Skip to content

Conversation

@justanotheratom
Copy link
Contributor

This PR implements device registration and internal mode management for Android, replicating the iOS functionality.

Changes

  • Added device ID management using ANDROID_ID (persists across app reinstalls)
  • Created DeviceRepository for device registration and internal mode API calls
  • Integrated device registration after login flows
  • Implemented reactive internal mode UI using StateFlow
  • Added automatic internal mode for debug builds and emulators
  • Throttled device registration to prevent duplicate calls
  • Added Internal Mode Enabled indicator in Settings screen

Key Features

  • Device ID is derived from ANDROID_ID as a deterministic RFC-4122 UUID
  • Internal mode is automatically enabled for debug builds and emulators
  • Internal mode state is managed server-side and synced reactively
  • Device registration happens once per session on authentication

- Throttle registerDevice calls to prevent duplicate registrations
- Make effectiveInternalMode observable via StateFlow for reactive UI updates
- Add missing Internal Mode Enabled row in Settings screen
- Fix device registration to only trigger on Authenticated session status
- Remove debug logging
@cursor
Copy link

cursor bot commented Nov 22, 2025

You have run out of free Bugbot PR reviews for this billing cycle. This will reset on December 16.

To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

justanotheratom and others added 6 commits November 22, 2025 11:55
- Centralize device registration in session status observer
- Remove redundant registerDeviceAfterLogin calls from login methods
- Remove lastSessionStatusAuthenticated flag (use deviceRegistrationCompleted instead)
- Remove verbose debug logs that were spamming logcat

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Remove premature PostHog registration on app startup
- Parse is_internal from registerDevice response instead of making
  a separate API call
- PostHog now receives server-authoritative internal status

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Remove unnecessary dependency on PreferenceRepository - DeviceRepository
only needed it for auth token, which can be obtained directly from
SupabaseClient.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
For authenticated Supabase requests, the Bearer token is sufficient.
The apikey header is only needed for unauthenticated requests.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
Server now manages is_internal status via device registration API.
No need to duplicate in user metadata.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Replace confusing identifyAndRegister/registerInternal/resetAndRegister
  with clear single-purpose methods: identify, setInternal, reset
- Remove redundant updateAnalytics calls from all login methods
- Call Analytics.identify once on authentication
- Call Analytics.setInternal only after server response
- Call Analytics.reset on logout without is_internal parameter

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
@iAmVishal16 iAmVishal16 merged commit 654ee8d into main Nov 24, 2025
1 check passed
@justanotheratom justanotheratom deleted the feature/device-registration-internal-mode branch November 24, 2025 05:40
@justanotheratom justanotheratom restored the feature/device-registration-internal-mode branch November 25, 2025 15:47
@justanotheratom justanotheratom deleted the feature/device-registration-internal-mode branch November 25, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants