Skip to content

Conversation

@lk340
Copy link
Collaborator

@lk340 lk340 commented Aug 4, 2025

Designs


@jrswanson this PR serves as the response to this comment in the first logged out mode PR:

What if I don't want to use local models and I don't want to login, but I haven't set my provider tokens yet?

* Add `AddModelAlert` view to `ContentView` that appears when the user is logged out and has no access to both remote and local models.
* Update `SubscriptionAlert` view in accordance to design updates.
* Update `AuthFlow` and `ModelSelectionView` with new CTA UI.
* Bring back redirect CTA to `AuthFlow` now that we have proper CTAs in place for when the user is accessing Onit while logged out.
* Remove old CTA logic from `AuthFlow` and `PromptCore`.
@lk340 lk340 requested a review from jrswanson August 4, 2025 17:27
@lk340 lk340 self-assigned this Aug 4, 2025
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR implements updated logged-out call-to-action (CTA) components to address a specific user experience gap: users who don't want to use local models, don't want to login, but haven't set up their provider API tokens yet. The changes introduce a new AddModelAlert system that provides clear pathways for users in this state.

The core implementation centers around a new AddModelAlert component that leverages the existing SubscriptionAlert infrastructure to present two action options: opening Settings to manually add API keys, or signing up for access to cloud models. This alert is triggered when users have neither remote API tokens nor local models available.

Key architectural changes include:

  • New Alert System: Added showAddModelAlert state property to AppState and integrated it into the alert display logic in ContentView
  • Refactored Authentication Flow: Simplified AuthFlow by removing complex local model detection logic and replacing it with a cleaner value proposition subtitle
  • Enhanced Model Selection: Updated ModelSelectionView to show contextual CTAs for different user states, including a "Sign up for access" button for logged-out users
  • Improved Button Styling: Modified SetUpButtonStyle with visual refinements (corner radius 8→6, background color .gray700→.gray500)
  • Generic Alert Component: Made SubscriptionAlert more flexible by adding generic type parameters and configuration options

The solution creates a progressive disclosure pattern where users encounter helpful guidance before being pushed toward account creation. Two new icon assets (plus-thin and user) support the updated visual design. The changes maintain existing analytics tracking while providing a more intuitive user flow that addresses the specific edge case identified in the previous PR discussion.

Confidence score: 4/5

  • This PR addresses a specific UX gap with a well-structured solution that maintains code consistency
  • Score reflects solid implementation with good separation of concerns, though complexity of state management across multiple components requires attention
  • Pay close attention to ContentView.swift and AddModelAlert.swift for proper alert triggering logic and state management

10 files reviewed, 2 comments

Edit Code Review Bot Settings | Greptile

@lk340 lk340 changed the title Add updated logged out CTAs: Logged Out Mode: Updated CTAs Aug 5, 2025
Copy link
Contributor

@jrswanson jrswanson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ✅

@lk340 lk340 merged commit 27d535f into refactor/auth-manager Aug 14, 2025
8 checks passed
lk340 added a commit that referenced this pull request Aug 14, 2025
[ AUTH MANAGER UPDATES ]

* Add `AuthManager`, central source of truth for auth-related operations:

* Move auth-based logic from various parts of the codebase into `AuthManager.swift`.
* Remove defunct auth window from `App.swift`. Remove `WindowConstants.swift` in conjunction with this update.

* Fix post-rebase bugs.

* Fix bug in `AuthManager.logInWithGoogle()` where it didn't properly capture error messages on time.

* Refactor `logInWithApple()`.

* Update provider variables and handlers to add UI reactivity:

* Move provider logic from `AIModel` to `ModelProvidersManager` to (1) create reactive, computed variables and (2) to keep all custom provider-related logic in a single place.
* Update `ModelProvidersManager` to properly account for custom provider states.
* Fix bug where the UI was not properly reacting in real time to updated custom provider states.
* Fix wrong boolean for `authManager.userLoggedIn` state in `RemoteModelSection`.

* Fix `OnboardingSkipAccesssibility` forcing `AuthFlow` sign up state, even when logged in.

* Move subscription updates on account change into cancellable sink to reduce complexity.

* Remove auto-switching to remote mode when remote models become available

* Refactor `ModelProvidersManager`:

* Remove `false` fallbacks for .custom provider cases and, instead, automatically handle custom provider cases within `ModelProvidersManager` itself to reduce code complexity.
* Add `getCanAccessStandardRemoteProvider()` to `ModelProvidersManager` class to more cleanly handle checks for available remote providers in `AppState`.
* Refactor manual "cannotAccess" variables in `AppState` with new `ModelProvidersManager.getCanAccessStandardRemoteProvider()` method.

---

[ UPDATED LOGGED OUT CTA UI UPDATES ]

* Add updated logged out CTAs: (#373)

* Add `AddModelAlert` view to `ContentView` that appears when the user is logged out and has no access to both remote and local models.
* Update `SubscriptionAlert` view in accordance to design updates.
* Update `AuthFlow` and `ModelSelectionView` with new CTA UI.
* Bring back redirect CTA to `AuthFlow` now that we have proper CTAs in place for when the user is accessing Onit while logged out.
* Remove old CTA logic from `AuthFlow` and `PromptCore`.
lk340 added a commit that referenced this pull request Aug 14, 2025
[ AUTH MANAGER UPDATES ]

* Add `AuthManager`, central source of truth for auth-related operations:

* Move auth-based logic from various parts of the codebase into `AuthManager.swift`.
* Remove defunct auth window from `App.swift`. Remove `WindowConstants.swift` in conjunction with this update.

* Fix post-rebase bugs.

* Fix bug in `AuthManager.logInWithGoogle()` where it didn't properly capture error messages on time.

* Refactor `logInWithApple()`.

* Update provider variables and handlers to add UI reactivity:

* Move provider logic from `AIModel` to `ModelProvidersManager` to (1) create reactive, computed variables and (2) to keep all custom provider-related logic in a single place.
* Update `ModelProvidersManager` to properly account for custom provider states.
* Fix bug where the UI was not properly reacting in real time to updated custom provider states.
* Fix wrong boolean for `authManager.userLoggedIn` state in `RemoteModelSection`.

* Fix `OnboardingSkipAccesssibility` forcing `AuthFlow` sign up state, even when logged in.

* Move subscription updates on account change into cancellable sink to reduce complexity.

* Remove auto-switching to remote mode when remote models become available

* Refactor `ModelProvidersManager`:

* Remove `false` fallbacks for .custom provider cases and, instead, automatically handle custom provider cases within `ModelProvidersManager` itself to reduce code complexity.
* Add `getCanAccessStandardRemoteProvider()` to `ModelProvidersManager` class to more cleanly handle checks for available remote providers in `AppState`.
* Refactor manual "cannotAccess" variables in `AppState` with new `ModelProvidersManager.getCanAccessStandardRemoteProvider()` method.

---

[ UPDATED LOGGED OUT CTA UI UPDATES ]

* Add updated logged out CTAs: (#373)

* Add `AddModelAlert` view to `ContentView` that appears when the user is logged out and has no access to both remote and local models.
* Update `SubscriptionAlert` view in accordance to design updates.
* Update `AuthFlow` and `ModelSelectionView` with new CTA UI.
* Bring back redirect CTA to `AuthFlow` now that we have proper CTAs in place for when the user is accessing Onit while logged out.
* Remove old CTA logic from `AuthFlow` and `PromptCore`.
lk340 added a commit that referenced this pull request Aug 15, 2025
[ AUTH MANAGER UPDATES ]

* Add `AuthManager`, central source of truth for auth-related operations:

* Move auth-based logic from various parts of the codebase into `AuthManager.swift`.
* Remove defunct auth window from `App.swift`. Remove `WindowConstants.swift` in conjunction with this update.

* Fix post-rebase bugs.

* Fix bug in `AuthManager.logInWithGoogle()` where it didn't properly capture error messages on time.

* Refactor `logInWithApple()`.

* Update provider variables and handlers to add UI reactivity:

* Move provider logic from `AIModel` to `ModelProvidersManager` to (1) create reactive, computed variables and (2) to keep all custom provider-related logic in a single place.
* Update `ModelProvidersManager` to properly account for custom provider states.
* Fix bug where the UI was not properly reacting in real time to updated custom provider states.
* Fix wrong boolean for `authManager.userLoggedIn` state in `RemoteModelSection`.

* Fix `OnboardingSkipAccesssibility` forcing `AuthFlow` sign up state, even when logged in.

* Move subscription updates on account change into cancellable sink to reduce complexity.

* Remove auto-switching to remote mode when remote models become available

* Refactor `ModelProvidersManager`:

* Remove `false` fallbacks for .custom provider cases and, instead, automatically handle custom provider cases within `ModelProvidersManager` itself to reduce code complexity.
* Add `getCanAccessStandardRemoteProvider()` to `ModelProvidersManager` class to more cleanly handle checks for available remote providers in `AppState`.
* Refactor manual "cannotAccess" variables in `AppState` with new `ModelProvidersManager.getCanAccessStandardRemoteProvider()` method.

---

[ UPDATED LOGGED OUT CTA UI UPDATES ]

* Add updated logged out CTAs: (#373)

* Add `AddModelAlert` view to `ContentView` that appears when the user is logged out and has no access to both remote and local models.
* Update `SubscriptionAlert` view in accordance to design updates.
* Update `AuthFlow` and `ModelSelectionView` with new CTA UI.
* Bring back redirect CTA to `AuthFlow` now that we have proper CTAs in place for when the user is accessing Onit while logged out.
* Remove old CTA logic from `AuthFlow` and `PromptCore`.
lk340 added a commit that referenced this pull request Aug 15, 2025
* Implement logged-out mode:
* Add app-wide listener for user login status.
* Separate listener for remote model access: logged in vs. logged out.
* Update `appState.listedModels` to account for access to remote models when logged out.
* App now sets the proper LLM mode based on login state and model availability.
* Models that shouldn't be selectable (providers toggled off, specific models checked off) are now removed from the UI.
* Lock app to local mode when no remote models are available.
* Fix token validation to properly persist validated and invalidated tokens.
* Update AuthFlow to now be close-able when logged out user provided a useable remote OR local model.
* Fix ToolbarRight and ModelSelectionButton mode-based UI reactivity bugs.
* Add "sign in" CTAs above prompt text input & in model selection view.
* Remote automatic local mode toggle in RemoteModelSection, as a more advanced handling of this logic now lives in ContentView.

---

* Address Greptile review.

Fix PromptCore sign in CTA hover.

Add "Setup remote models" CTA to empty remote models view.

* Add token validation background checks to ContentView (throttled to once every 24 hours).

Fix TokenValidationManager not properly setting tokens as invalid.

Add "not logged in" CTAs to AuthFlow.

* Fix mode toggle disabling when listed models is empty.

---

* Address PR feedback:

* Move provider logic into `AIModel.ModelProvider`.
* Add descriptive comments to `TokenValidationManager`.
* Refactor logged-out mode states and listeners.

---

* Finish polishing codebase based on PR feedback:

* Add `ModelProvidersManager` to localize provider-based reactive logic into a single source of truth. Refactor `AppState` and `ContentView` in accordance with this update.
* Update comments on `TokenValidationManager.validateToken()` to be more descriptive.
* Update `AIModel.ModelProvider.hasValidRemoteToken` from a variable to a function for better reusability.
* Update `RemoteModelButton` to use `AIModel.ModelProvider` to check for valid remote token to reduce duplicated code logic.

* Remove auto-switching to remote mode when remote models become available.

---

* Logged Out Mode: Auth Manager (#364)

[ AUTH MANAGER UPDATES ]

* Add `AuthManager`, central source of truth for auth-related operations:

* Move auth-based logic from various parts of the codebase into `AuthManager.swift`.
* Remove defunct auth window from `App.swift`. Remove `WindowConstants.swift` in conjunction with this update.

* Fix post-rebase bugs.

* Fix bug in `AuthManager.logInWithGoogle()` where it didn't properly capture error messages on time.

* Refactor `logInWithApple()`.

* Update provider variables and handlers to add UI reactivity:

* Move provider logic from `AIModel` to `ModelProvidersManager` to (1) create reactive, computed variables and (2) to keep all custom provider-related logic in a single place.
* Update `ModelProvidersManager` to properly account for custom provider states.
* Fix bug where the UI was not properly reacting in real time to updated custom provider states.
* Fix wrong boolean for `authManager.userLoggedIn` state in `RemoteModelSection`.

* Fix `OnboardingSkipAccesssibility` forcing `AuthFlow` sign up state, even when logged in.

* Move subscription updates on account change into cancellable sink to reduce complexity.

* Remove auto-switching to remote mode when remote models become available

* Refactor `ModelProvidersManager`:

* Remove `false` fallbacks for .custom provider cases and, instead, automatically handle custom provider cases within `ModelProvidersManager` itself to reduce code complexity.
* Add `getCanAccessStandardRemoteProvider()` to `ModelProvidersManager` class to more cleanly handle checks for available remote providers in `AppState`.
* Refactor manual "cannotAccess" variables in `AppState` with new `ModelProvidersManager.getCanAccessStandardRemoteProvider()` method.

---

[ UPDATED LOGGED OUT CTA UI UPDATES ]

* Add updated logged out CTAs: (#373)

* Add `AddModelAlert` view to `ContentView` that appears when the user is logged out and has no access to both remote and local models.
* Update `SubscriptionAlert` view in accordance to design updates.
* Update `AuthFlow` and `ModelSelectionView` with new CTA UI.
* Bring back redirect CTA to `AuthFlow` now that we have proper CTAs in place for when the user is accessing Onit while logged out.
* Remove old CTA logic from `AuthFlow` and `PromptCore`.

---

* Fix bugs post-rebase with `main`:

* Fix `RemoteModelButton` showing as being "selected" when still in local mode.
* Remove vestigial code in `AppState.swift` that is no longer required for implementing model checks, as they're now handled by `ModelProvidersManager`.
* Update `QuickEditView` to use `authManager` for grabbing user's account ID.
* Update `RemoteModelSection` to use `authManager` for confirming user logged in state. Also bring back `noAvailableRemoteModels` check that was lost in the rebase.
* Update `SettingsAuthCTA` to use `authManager` for confirming user logged in state.
* Update `signInButton` in `GeneralTabAccount.swift` to be a static component again (this was lost in the rebase).
* Remove unused `remoteModel` variable in `ContentView.swift`.
* Auth flow caption text weight.

* Fix `ModelSelectionView` sign in CTA.

* Fix post-rebase with `main`:

* Update colors.
* Remove vestigial code that didn't get properly removed during the rebase.
* Add `Color.` prefix for codebase consistency.
* Perform final test before merge.
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