diff --git a/android/app/build.gradle b/android/app/build.gradle index 15301c58c..65abb2a8c 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -54,7 +54,7 @@ android { defaultConfig { applicationId "tv.brunstad.app" - minSdkVersion 21 + minSdkVersion 23 targetSdkVersion flutter.targetSdkVersion versionCode flutterVersionCode.toInteger() versionName flutterVersionName diff --git a/lib/providers/auth_state/implementations/auth_state_notifier_mobile.dart b/lib/providers/auth_state/implementations/auth_state_notifier_mobile.dart index b96fa1787..7a62a063e 100644 --- a/lib/providers/auth_state/implementations/auth_state_notifier_mobile.dart +++ b/lib/providers/auth_state/implementations/auth_state_notifier_mobile.dart @@ -24,14 +24,21 @@ import '../../../models/auth0/auth0_id_token.dart'; import '../../../models/auth_state.dart'; import '../auth_state.dart'; -// Careful. This line is very important, +// Careful. The function naming here is very important, // but because it's conditionally imported (see auth_state_notifier_interface.dart) -// IDEs don't show any errors when you remove it.. -AuthStateNotifier getPlatformSpecificAuthStateNotifier(Ref ref) => AuthStateNotifierMobile( - appAuth: const FlutterAppAuth(), - secureStorage: const FlutterSecureStorage(), - settingsService: ref.watch(settingsProvider.notifier), - ); +// IDEs don't show any errors when you remove/change it.. +AuthStateNotifier getPlatformSpecificAuthStateNotifier(Ref ref) { + return AuthStateNotifierMobile( + appAuth: const FlutterAppAuth(), + secureStorage: const FlutterSecureStorage( + aOptions: AndroidOptions( + encryptedSharedPreferences: true, // https://github.com/mogol/flutter_secure_storage/issues/354 + sharedPreferencesName: 'auth', + ), + ), + settingsService: ref.watch(settingsProvider.notifier), + ); +} const kMinimumCredentialsTTL = Duration(hours: 1); diff --git a/lib/screens/auto_login.dart b/lib/screens/auto_login.dart index e3421a938..7c30814a9 100644 --- a/lib/screens/auto_login.dart +++ b/lib/screens/auto_login.dart @@ -40,7 +40,9 @@ class _AutoLoginScreeenState extends ConsumerState { void load() async { final deepLinkUri = await AppLinks().getInitialAppLink(); - authFuture = ref.read(authStateProvider.notifier).load(); + setState(() { + authFuture = ref.read(authStateProvider.notifier).load(); + }); authFuture!.then((_) { debugPrint('navigate(deepLinkUri: $deepLinkUri)'); navigate(deepLinkUri: deepLinkUri);