6177214e-ce7c-49e3-99de-ff9721b26f63 — Commit 4004da14

AuthorMikkel Thygesen<mth@dwarf.dk>
Date2025-02-05 10:35:36 +0100
455: reverted debug code

Changed files

comwell_key_app/lib/utils/seos_repository.dart | 25 +++++++++++++++----------
 1 file changed, 15 insertions(+), 10 deletions(-)

Diff

diff --git a/comwell_key_app/lib/utils/seos_repository.dart b/comwell_key_app/lib/utils/seos_repository.dart
index cb247b61..bd3dd61d 100644
--- a/comwell_key_app/lib/utils/seos_repository.dart
+++ b/comwell_key_app/lib/utils/seos_repository.dart
@@ -27,15 +27,17 @@ class SeosRepository {
await seosMobileKeysPlugin.startUp(mobileKeysOptions);
final isEndpointSetup = await seosMobileKeysPlugin.isEndpointSetup();
if (isEndpointSetup) {
- updateEndpoint();
- return true;
+ await seosMobileKeysPlugin.updateEndpoint();
} else {
- return false;
+ final invitationCode = await api.createEndpointRegistration();
+ print("qqq invCode=$invitationCode");
+ await seosMobileKeysPlugin.setupEndpoint(invitationCode);
+ await seosMobileKeysPlugin.updateEndpoint();
}
} on PlatformException catch (e) {
throw Exception('Failed to init MobileKeysManager - ${e.toString()}');
- } catch (_) {
- throw Exception('Failed to init start');
+ } catch (e) {
+ throw Exception('Failed to init start: $e');
}
}
@@ -56,7 +58,7 @@ class SeosRepository {
if (hasKey != null) {
final DateTime hasKeyDate = DateTime.parse(hasKey);
if (DateTime.now().difference(hasKeyDate).inDays < 1) {
- // return;
+ return;
}
}
@@ -77,14 +79,17 @@ class SeosRepository {
}
}
- Future<void> setupEndpoint(String invitationCode) async {
- await seosMobileKeysPlugin.setupEndpoint(invitationCode);
+ Future<void> setupEndpoint() async {
+ //final invitationCode = await api.createEndpointRegistration();
+ //print("qqq invCode=$invitationCode");
+ await seosMobileKeysPlugin.setupEndpoint("BC63-2BXN-MRPD-XZHR");
}
Future<List<MobileKeysKey>> refreshKeys() async {
try {
- final List<MobileKeysKey> listOfKeys = await seosMobileKeysPlugin.listMobileKeys();
- //await secureStorage.write(constants.hasKey, DateTime.now().toString());
+ final List<MobileKeysKey> listOfKeys =
+ await seosMobileKeysPlugin.listMobileKeys();
+ await secureStorage.write(constants.hasKey, DateTime.now().toString());
return listOfKeys;
} catch (e) {
throw Exception('Failed to list keys - ${e.toString()}');