Skip to content

[codex] Support signed-out account preferences#3316

Open
MichaelSpece wants to merge 1 commit into
lichess-org:mainfrom
MichaelSpece:codex/signed-out-account-preferences
Open

[codex] Support signed-out account preferences#3316
MichaelSpece wants to merge 1 commit into
lichess-org:mainfrom
MichaelSpece:codex/signed-out-account-preferences

Conversation

@MichaelSpece

@MichaelSpece MichaelSpece commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • move account-style display, game behavior, and clock controls into Board settings so they are reachable while signed out
  • add local storage and effective account preference providers, while keeping server preferences authoritative for signed-in users
  • apply local preference fallbacks to game setup, zen toggling, and clock tenths consumers

Validation

  • dart run build_runner build
  • dart format lib/src/model/account/account_preferences.dart lib/src/model/game/game_controller.dart lib/src/model/settings/preferences_storage.dart lib/src/view/game/game_body.dart lib/src/view/over_the_board/over_the_board_screen.dart lib/src/view/settings/account_preferences_screen.dart lib/src/view/settings/board_settings_screen.dart lib/src/view/watch/tv_screen.dart test/model/account/account_repository_test.dart
  • flutter analyze lib/src/model/account/account_preferences.dart lib/src/model/game/game_controller.dart lib/src/model/settings/preferences_storage.dart lib/src/view/game/game_body.dart lib/src/view/over_the_board/over_the_board_screen.dart lib/src/view/settings/account_preferences_screen.dart lib/src/view/settings/board_settings_screen.dart lib/src/view/watch/tv_screen.dart test/model/account/account_repository_test.dart
  • flutter test test/model/account/account_repository_test.dart
  • GitHub Actions build workflow on fork: https://github.com/MichaelSpece/mobile/actions/runs/27378113214 (flutter build ios --no-codesign, flutter build appbundle --debug)

Closes #3273

@MichaelSpece MichaelSpece marked this pull request as ready for review June 12, 2026 12:57
@MichaelSpece

Copy link
Copy Markdown
Contributor Author

Validation update:

  • Fork build with the PR head plus the artifact-only workflow commit succeeded: https://github.com/MichaelSpece/mobile/actions/runs/27566049170
  • The run produced a debug APK artifact from Build apk --debug; Build appbundle --debug and Build ios --no-codesign also passed.
  • I installed the debug APK on a fresh Android emulator as org.lichess.mobileV2.debug.
  • Signed-out smoke test passed: More > Settings > Board settings is reachable without logging in; migrated account-preference rows are interactive; Zen mode persisted after force-stop/relaunch; Promote to Queen automatically updated immediately.
  • Play > Over the board opened successfully and the board rendered.
  • A final fatal-only logcat scan had no app crash matches.

This should be ready for maintainer review. I kept the installable-artifact workflow out of this feature PR; that is tracked separately in #3337.

@veloce veloce left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for this contribution!

I'd like to see another approach for this feature, as explained in one comment.

This is a significant change, and I have not reviewed the PR thoroughly yet (will do after the change). Hope I have not missed something that would prevent doing it, but I don't think so.

build:
name: Build ${{ matrix.target }}
runs-on: macos-latest
runs-on: macos-26

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We've never had issues before, not sure this is a relevant change (not relevant in this PR actually).

runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "if [[ \"$PLATFORM_NAME\" == *simulator* ]]; then\n echo \"Skipping Crashlytics upload for simulator build\"\n exit 0\nfi\n\"$PODS_ROOT/FirebaseCrashlytics/upload-symbols\" --flutter-project \"$PROJECT_DIR/firebase_app_id_file.json\" ";
shellScript = "if [[ \"$PLATFORM_NAME\" == *simulator* ]]; then\n echo \"Skipping Crashlytics upload for simulator build\"\n exit 0\nfi\nUPLOAD_SYMBOLS=\"$PODS_ROOT/FirebaseCrashlytics/upload-symbols\"\nif [[ ! -x \"$UPLOAD_SYMBOLS\" ]]; then\n echo \"Skipping Crashlytics upload; upload-symbols not found at $UPLOAD_SYMBOLS\"\n exit 0\nfi\n\"$UPLOAD_SYMBOLS\" --flutter-project \"$PROJECT_DIR/firebase_app_id_file.json\" ";

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have you run that to ensure the iOS build still works?

);

/// Account-style preferences with server values taking precedence when signed in.
final effectiveAccountPreferencesProvider = FutureProvider<AccountPrefState>((Ref ref) async {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Instead of having 3 separate account prefs providers (local, server, effective), which adds extra complexity and code duplication. I'd rather have a single one (the existing AccountPreferences notifier for that matter) that handles the local logic and decides itself which pref to return.

@MichaelSpece MichaelSpece force-pushed the codex/signed-out-account-preferences branch 3 times, most recently from 480778f to 7807aa1 Compare June 19, 2026 20:36
@MichaelSpece

Copy link
Copy Markdown
Contributor Author

Thanks for the review, @veloce. I updated the PR to use the existing AccountPreferences notifier as the single source for account preferences: it now handles signed-in server preferences and signed-out local storage itself, so the extra local/effective providers are gone.

I also removed the temporary workflow and iOS project changes from the final diff; those review threads are now outdated. The PR is rebased on current origin/main as a single feature commit, and Tests / Unit tests on ubuntu-latest is green on the latest head: https://github.com/lichess-org/mobile/actions/runs/27847312464

@MichaelSpece

MichaelSpece commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Hi @veloce, gentle follow-up now that the PR has been updated to the AccountPreferences-based approach you suggested. The final diff is still limited to the feature implementation, the temporary workflow/iOS-project changes were removed, and the latest unit test check is green. Happy to make any further changes you think are needed for review.

@MichaelSpece MichaelSpece force-pushed the codex/signed-out-account-preferences branch from 7807aa1 to d65ba3b Compare June 27, 2026 23:36
@MichaelSpece MichaelSpece force-pushed the codex/signed-out-account-preferences branch from d65ba3b to 8fabb93 Compare July 2, 2026 20:17
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.

Support account-style preferences for signed-out users

2 participants