mirror of
https://github.com/FoggedLens/deflock-app.git
synced 2026-07-09 14:17:55 +02:00
Force simulate mode when OSM OAuth secrets are missing
Preview/PR builds don't have access to GitHub Secrets, so the OAuth client IDs are empty. Previously this caused a runtime crash from keys.dart throwing on empty values. Now we detect missing secrets and force simulate mode, which already fully supports fake auth and uploads. Also fixes a latent bug where forceLogin() would crash with LateInitializationError in simulate mode since _helper is never initialized when OAuth setup is skipped. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -36,6 +36,7 @@ class AuthService {
|
||||
|
||||
void setUploadMode(UploadMode mode) {
|
||||
_mode = mode;
|
||||
if (mode == UploadMode.simulate || !kHasOsmSecrets) return;
|
||||
final isSandbox = (mode == UploadMode.sandbox);
|
||||
final authBase = isSandbox
|
||||
? 'https://master.apis.dev.openstreetmap.org'
|
||||
@@ -150,7 +151,9 @@ class AuthService {
|
||||
|
||||
// Force a fresh login by clearing stored tokens
|
||||
Future<String?> forceLogin() async {
|
||||
await _helper.removeAllTokens();
|
||||
if (_mode != UploadMode.simulate) {
|
||||
await _helper.removeAllTokens();
|
||||
}
|
||||
_displayName = null;
|
||||
return await login();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user