From f2fcff65c65d3c86a0965a927f6d85169fc0523c Mon Sep 17 00:00:00 2001 From: tamslo Date: Thu, 14 Nov 2024 12:56:09 +0100 Subject: [PATCH] feat(#661): get deep link (not handled correctly yet) --- app/android/app/src/main/AndroidManifest.xml | 12 ++++++++++++ app/lib/app.dart | 19 +++++++++++++++++-- app/lib/common/models/metadata.dart | 3 +++ app/lib/common/utilities/routing_utils.dart | 2 +- .../models/deep_link_share_flow_lab.dart | 19 +++++++++++++------ pharme.code-workspace | 1 + 6 files changed, 47 insertions(+), 9 deletions(-) diff --git a/app/android/app/src/main/AndroidManifest.xml b/app/android/app/src/main/AndroidManifest.xml index 90eaeddb..a4f22503 100644 --- a/app/android/app/src/main/AndroidManifest.xml +++ b/app/android/app/src/main/AndroidManifest.xml @@ -37,6 +37,18 @@ + + + + + + + + + + + + 'Please open the $shareAppName and share your data with PharMe'; + Future _waitForDeepLinkSharePublishUrl() async { + var waitingForDeepLinkSharePublishUrl = true; + while (waitingForDeepLinkSharePublishUrl) { + waitingForDeepLinkSharePublishUrl = + MetaData.instance.deepLinkSharePublishUrl == null; + await Future.delayed(Duration(seconds: 1)); + } + } + @override Future authenticate() async { - // THIS IS FOR TESTING, SHOULD WAIT UNTIL A DEEP LINK IS RECEIVED - // (if possible like this but could set metadata field when deep link - // caught and wait here until it was set) - await Future.delayed(Duration(seconds: 7)); + await _waitForDeepLinkSharePublishUrl(); } @override Future<(List, List)> loadData() async { - // THIS IS FOR TESTING, SHOULD GET FROM DWA publishUrl = Uri.parse( - 'https://hpi-datastore.duckdns.org/userdata?id=1e006a69-b693-43d2-a318-22904e305b5c', + MetaData.instance.deepLinkSharePublishUrl!, ); publishHeaders = null; return fetchData( diff --git a/pharme.code-workspace b/pharme.code-workspace index bfcd09fc..1d37b242 100644 --- a/pharme.code-workspace +++ b/pharme.code-workspace @@ -60,6 +60,7 @@ "drugclass", "drugid", "drugrecommendation", + "drugselection", "duckdns", "duloxetine", "endoxifen",