Skip to content

Conversation

@kkostov
Copy link
Collaborator

@kkostov kkostov commented Oct 10, 2025

In this PR, several changes are made to the preferences system & login procedure:

Configuration

  1. Local AppConfig has been migrated from Java Preferences to KMP's DataStore

With this change, the mechanism of storing and reading settings is common to all KMP platforms.
It also allows us to move to Flow-based state in Views and ViewModels (which currently rely on imperative "reload" logic).

  1. Configuration migration has been introduced to carry out migration of settings from an existing installation (e.g. pretixSCAN Desktop v1).

  2. To facilitate troubleshooting of the migration process, structured file logging has been added. Logs are written in the user logs folder in a platform-specific location.

The Settings screen now has a Diagnostics section with a button to easily open the data or logs folder on each platform
Screenshot 2025-10-20 at 12 23 57

Login

When pretixSCAN Desktop 2 is started, it will show the policy screen as usual. When users confirm and are taken to the login screen, the app will initiate the migration procedure (if possible) and automatically sign the user-in.

Workflow

  • (Optional) Uninstall pretixSCAN Desktop v1 if it's present on the system
  • Install pretixSCAN Desktop v2
  • When v2 is launched for the first time:
    • It checks if pretixSCAN Desktop v1 settings are present.
    • If v1 settings are found, they will be loaded and applied to v2.
    • Finally, v2 will clear most v1 settings (e.g. api key, and even selection).
    • This process does not require user interaction and replaces the login screen.
  • Once v2 has been migrated, it will not try to perform the migration on subsequent launches (we keep a flag in v2 settings for that).

Troubleshooting

  • If the migration fails, or v2 is unable to renew the api key, sync errors may be visible. In this case, it's best to reset the application and initialise it with a fresh token.

@kkostov kkostov requested a review from raphaelm October 10, 2025 14:32
- Changed from "key" to "api_token" to match API specification
- /device/roll returns same response structure as /initialize
- Field name verified in libpretixsync SetupManager implementation
- Removed migration logic from Navigation component
- Migration now runs automatically when SetupScreen loads
- Reuses existing SetupUiState (Loading/Success/Error) instead of custom dialogs
- Deleted MigrationProgressDialog - uses existing CircularProgressIndicator
- User experience: migration is functionally equivalent to device login
- No new UI elements - cleaner, simpler flow

Changes:
- SetupViewModel: added checkAndExecuteMigration() function
- SetupScreen: added LaunchedEffect to trigger migration on load
- Navigation.kt: removed all migration-specific code and dialogs
- SetupModule.kt: injected MigrationCoordinator dependency
- Deleted MigrationProgressDialog.kt
…etup screen inputs should match the rest of the app, add some missing translation keys
@kkostov kkostov marked this pull request as ready for review October 20, 2025 10:42
@kkostov kkostov merged commit 5aedbbf into vnext-kmp Oct 25, 2025
7 of 9 checks passed
@kkostov kkostov deleted the feat/vnext-kmp/config-migration branch October 25, 2025 11:53
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