Conversation
Introduces internal mode toggling in settings, with tap gestures to enable/disable and persistent storage via SharedPreferences. Integrates internal mode state with analytics (PostHog) and updates user metadata in Supabase. Also adds loading indicators to settings actions and refactors analytics registration and user metadata update logic.
…2 onboarding files)
There was a problem hiding this comment.
💡 Codex Review
The success branch of signInWithAppleCode populates local state and returns AppleLoginState.Success but never calls updateAnalyticsAndSupabase(session). All other sign‑in paths introduced in this commit perform that call to identify the user in PostHog and push the is_internal flag to Supabase. As a result, users authenticating through the authorization-code flow will never have their analytics identity or metadata updated, so internal-mode tracking remains stale for them.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
@Gaurav-eightinity01 , look into this |
justanotheratom
left a comment
There was a problem hiding this comment.
address the one comment by codex.
And confirm whether is_internal is getting populated in backend.
Apple authorization-code login now calls updateAnalyticsAndSupabase(session) on success. This aligns the Apple code flow with other sign-in paths (Google, Apple ID token). Result: PostHog identify + super property registration happens, and Supabase is_internal metadata is synced based on the stored flag.
Replaces the call to repository.updateUserMetadata with a direct call to repository.supabaseClient.auth.updateUser, updating the 'is_internal' field. Adds error handling to catch exceptions during the update.
|
|
||
| private val httpClient: OkHttpClient = OkHttpClient() | ||
|
|
||
| suspend fun updateUserMetadata(metadata: Map<String, Any>): Result<Unit> = withContext(Dispatchers.IO) { |
There was a problem hiding this comment.
remove this method if it is not called from anywhere anymore
Deleted the updateUserMetadata suspend function and related OkHttp imports from LoginAuthRepository as they are no longer used. This cleans up the repository and removes unnecessary dependencies.
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bug: Google Login: Incomplete User Data Sync
The signInWithGoogleIdToken method is missing the updateAnalyticsAndSupabase(session) call in its success handler. All other login methods (Apple ID token, Apple code, anonymous, and token imports) were updated in this commit to call updateAnalyticsAndSupabase after successful authentication, but Google login was overlooked. This causes Google users' internal mode status and analytics data not to sync with Supabase and PostHog upon login.
app/src/main/java/lc/fungee/IngrediCheck/viewmodel/LoginAuthViewModel.kt#L249-L277
There was a problem hiding this comment.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bug: Incomplete Google Sign-In Flow
The signInWithGoogleIdToken method doesn't call updateAnalyticsAndSupabase(session) after successful login, unlike all other sign-in methods (signInWithAppleIdToken, signInWithAppleCode, signInAnonymously, and completeWithSupabaseTokens). This means Google users won't have their analytics identified or their internal mode flag synced to Supabase, breaking parity with other authentication flows.
app/src/main/java/lc/fungee/IngrediCheck/viewmodel/LoginAuthViewModel.kt#L249-L268
| ) { | ||
| if (!isSignOutLoading) { | ||
| isSignOutLoading = true | ||
| clearAllSession() |
There was a problem hiding this comment.
Bug: Permanent Loading Blocks User Interaction
The loading states isSignOutLoading, isDeleteAccountLoading, and isResetLoading are set to true but never reset to false. If onRequireReauth() navigation fails or any operation errors occur before reaching it, the UI remains permanently stuck with a spinner and disabled buttons, preventing users from retrying the action.
Note
Adds an internal mode toggle that registers with PostHog and syncs to Supabase user metadata, plus settings UI loading states for sign-out/reset.
AppConstants.Prefs.INTERNAL_FLAGSand helpersisInternalEnabled(...)/setInternalEnabled(...).IngrediCheckApp), register PostHog super propertyis_internal.Analyticshelpers:identifyAndRegister(...),registerInternal(...),resetAndRegister(...).AppleAuthViewModel:updateAnalyticsAndSupabase(...)toidentifyuser in PostHog andupdateUser { data { put("is_internal", ...) } }in Supabase.enableInternalMode(...)/disableInternalMode(...)to toggle flag and update analytics/user metadata.is_internal.SettingScreen):IconRowtrailingLoading.IconRowupdated to show a trailing spinner and disable clicks when loading.Build APK.Written by Cursor Bugbot for commit a318fd1. This will update automatically on new commits. Configure here.