6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 67e8db52

AuthorEdmir Suljic<esu@dwarf.dk>
Date2025-05-15 09:45:13 +0200
Mid commit

Changed files

.../lib/authentication/authentication_repository.dart        |  1 +
 comwell_key_app/lib/utils/secure_storage.dart                | 12 ++++++++++++
 comwell_key_app/pubspec.yaml                                 |  1 +
 3 files changed, 14 insertions(+)

Diff

diff --git a/comwell_key_app/lib/authentication/authentication_repository.dart b/comwell_key_app/lib/authentication/authentication_repository.dart
index c5ab35d8..c9b2dda8 100644
--- a/comwell_key_app/lib/authentication/authentication_repository.dart
+++ b/comwell_key_app/lib/authentication/authentication_repository.dart
@@ -24,6 +24,7 @@ class AuthenticationRepository {
AuthenticationRepository() {
broadcast.listen((status) {
statusBuffer = status;
+ secureStorage.clearKeychainValues();
});
_controller.sink.add(AuthenticationStatus.unknown);
diff --git a/comwell_key_app/lib/utils/secure_storage.dart b/comwell_key_app/lib/utils/secure_storage.dart
index 2091d759..66a475c0 100644
--- a/comwell_key_app/lib/utils/secure_storage.dart
+++ b/comwell_key_app/lib/utils/secure_storage.dart
@@ -1,4 +1,5 @@
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
+import 'package:shared_preferences/shared_preferences.dart';
class SecureStorage {
final FlutterSecureStorage _storage = const FlutterSecureStorage();
@@ -15,6 +16,17 @@ class SecureStorage {
await _storage.delete(key: key);
}
+ Future<void> clearKeychainValues() async {
+ final prefs = await SharedPreferences.getInstance();
+ print("prefs: $prefs");
+
+ if (prefs.getBool('is_first_app_launch') ?? true) {
+ await _storage.deleteAll();
+
+ await prefs.setBool('is_first_app_launch', false);
+ }
+ }
+
Future<void> deleteAll() async {
await _storage.deleteAll();
}
diff --git a/comwell_key_app/pubspec.yaml b/comwell_key_app/pubspec.yaml
index 71246a0e..826ec57c 100644
--- a/comwell_key_app/pubspec.yaml
+++ b/comwell_key_app/pubspec.yaml
@@ -54,6 +54,7 @@ dependencies:
package_info_plus: ^8.3.0
sentry_flutter: ^8.13.0
share_plus: ^10.1.4
+ shared_preferences: ^2.5.3
dependency_overrides:
#Remove override when slider button updates