From 9a06a9af75f932952d658b041bb85144a467a25a Mon Sep 17 00:00:00 2001 From: mpgxvii Date: Fri, 4 Nov 2022 10:23:46 +0000 Subject: [PATCH 1/5] chore: bump versions --- config.xml | 2 +- src/assets/data/defaultConfig.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config.xml b/config.xml index f783b068f..ed5414b61 100755 --- a/config.xml +++ b/config.xml @@ -1,5 +1,5 @@ - + RADAR Questionnaire An application that collects active data for research. RADAR-Base diff --git a/src/assets/data/defaultConfig.ts b/src/assets/data/defaultConfig.ts index 7f3e0e992..2ffb21383 100755 --- a/src/assets/data/defaultConfig.ts +++ b/src/assets/data/defaultConfig.ts @@ -16,7 +16,7 @@ import { Localisations } from './localisations' export const DefaultPlatformInstance = 'RADAR-CNS' // *Default app version -export const DefaultAppVersion = '2.6.1-alpha' +export const DefaultAppVersion = '2.6.3-alpha' // *Default Android package name export const DefaultPackageName = 'org.phidatalab.radar_armt' From 927ad6884bc09f67e2b1f0828c22fe6f132319f0 Mon Sep 17 00:00:00 2001 From: Peyman Mohtashami Date: Thu, 24 Nov 2022 14:34:31 +0100 Subject: [PATCH 2/5] Check if the external app is installed and supported --- .../finish-and-launch.component.ts | 29 ++++++++++++------- .../containers/questions-page.component.ts | 11 +++++-- .../services/app-launcher.service.ts | 17 +++++++++++ 3 files changed, 44 insertions(+), 13 deletions(-) diff --git a/src/app/pages/questions/components/finish-and-launch/finish-and-launch.component.ts b/src/app/pages/questions/components/finish-and-launch/finish-and-launch.component.ts index 634fac035..f67554091 100755 --- a/src/app/pages/questions/components/finish-and-launch/finish-and-launch.component.ts +++ b/src/app/pages/questions/components/finish-and-launch/finish-and-launch.component.ts @@ -42,7 +42,7 @@ export class FinishAndLaunchComponent implements OnInit, OnChanges { displayNextTaskReminder = true completedInClinic = false - canLaunch = true + canLaunch = false externalAppLaunchDescription = '' constructor( @@ -52,7 +52,13 @@ export class FinishAndLaunchComponent implements OnInit, OnChanges { ) {} ngOnInit() { - this.getExternalAppLaunchDescription() + this.appLauncher.isExternalAppCanLaunch(this.externalApp, this.task).then(canLaunch=>{ + this.canLaunch = canLaunch + this.externalAppLaunchDescription = this.getExternalAppLaunchDescription(this.canLaunch) + }).catch(err=>{ + console.log(err) + this.externalAppLaunchDescription = this.getExternalAppLaunchDescription(false) + }) } ngOnChanges() { @@ -68,18 +74,19 @@ export class FinishAndLaunchComponent implements OnInit, OnChanges { this.exit.emit(this.completedInClinic) } - getExternalAppLaunchDescription() { + getExternalAppLaunchDescription(canLaunch: boolean) { const options = this.appLauncher.getAppLauncherOptions( this.externalApp, this.task ) - this.externalAppLaunchDescription = - this.externalApp.field_label && this.externalApp.field_label.length - ? this.externalApp.field_label - : this.localization.translateKey(LocKeys.EXTERNAL_APP_LAUNCH_DESC) + - ' ' + - (this.externalApp.external_app_name - ? this.externalApp.external_app_name - : options.uri.toString()) + if(canLaunch){ + return this.externalApp.field_label && this.externalApp.field_label.length ? + (this.externalApp.field_label) : (this.localization.translateKey(LocKeys.EXTERNAL_APP_LAUNCH_DESC) + ' ' + + (this.externalApp.external_app_name? this.externalApp.external_app_name : options.uri.toString())) + }else{ + return (this.externalApp.external_app_name? + this.externalApp.external_app_name : options.uri.toString()) + + ' ' + this.localization.translateKey(LocKeys.EXTERNAL_APP_FAILURE_ON_VALIDATING) + } } } diff --git a/src/app/pages/questions/containers/questions-page.component.ts b/src/app/pages/questions/containers/questions-page.component.ts index b622a6166..14cc97e19 100644 --- a/src/app/pages/questions/containers/questions-page.component.ts +++ b/src/app/pages/questions/containers/questions-page.component.ts @@ -321,8 +321,15 @@ export class QuestionsPageComponent implements OnInit { this.externalApp && this.appLauncher.isExternalAppUriValidForThePlatform(this.externalApp) ) { - this.showFinishAndLaunchScreen = true - this.externalAppCanLaunch = true + this.appLauncher.isExternalAppCanLaunch(this.externalApp, this.task) + .then(canLaunch => { + this.showFinishAndLaunchScreen = true + this.externalAppCanLaunch = canLaunch + }) + .catch(err => { + this.showFinishAndLaunchScreen = false + console.log(err) + }) } } } diff --git a/src/app/pages/questions/services/app-launcher.service.ts b/src/app/pages/questions/services/app-launcher.service.ts index b49db69a8..257521bfd 100644 --- a/src/app/pages/questions/services/app-launcher.service.ts +++ b/src/app/pages/questions/services/app-launcher.service.ts @@ -52,6 +52,23 @@ export class AppLauncherService { return true } + isExternalAppCanLaunch(externalApp: Question, task: Task) { + if(!this.isExternalAppUriValidForThePlatform(externalApp)){ + return Promise.reject() + } + + const options: AppLauncherOptions = this.getAppLauncherOptions(externalApp, task) + + return this.appLauncher.canLaunch(options) + .then((canLaunch: boolean) => { + return canLaunch; + }) + .catch(err => { + this.logger.error("External App is not installed or doesn't support deeplink.", err) + return false + }) + } + getAppLauncherOptions(externalApp: ExternalApp, task: Task) { const options: AppLauncherOptions = {} From c20f95796e116b06954a9bf3268c3580e84cc457 Mon Sep 17 00:00:00 2001 From: Pauline Conde Date: Tue, 3 Jan 2023 17:07:24 +0000 Subject: [PATCH 3/5] Update config.xml with AndroidManifest configs - For notification icon and permissions --- config.xml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/config.xml b/config.xml index ed5414b61..f64e80ee2 100755 --- a/config.xml +++ b/config.xml @@ -48,9 +48,12 @@ - + - + + + + From ac4fc6dbc9b8b41dc567d0a5f604e7e272b2bf3c Mon Sep 17 00:00:00 2001 From: Pauline Conde Date: Tue, 3 Jan 2023 17:31:03 +0000 Subject: [PATCH 4/5] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index be4c9d431..61ac16f9e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: uses: android-actions/setup-android@v2 - name: Fix Android directories - run: rm -R /usr/local/lib/android/sdk/build-tools/31.0.0/ && rm -R /usr/local/lib/android/sdk/build-tools/32.0.0/ && rm -R /usr/local/lib/android/sdk/build-tools/33.0.0/ + run: rm -R /usr/local/lib/android/sdk/build-tools/ - name: Setup Node uses: actions/setup-node@v2 From 1bceadc00d743bdbe7ef1f572a7d5fb147a05baf Mon Sep 17 00:00:00 2001 From: Pauline Conde Date: Tue, 3 Jan 2023 18:04:13 +0000 Subject: [PATCH 5/5] Update main.yml --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 61ac16f9e..900c412ef 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -45,7 +45,7 @@ jobs: uses: android-actions/setup-android@v2 - name: Fix Android directories - run: rm -R /usr/local/lib/android/sdk/build-tools/ + run: rm -R /usr/local/lib/android/sdk/build-tools/31.0.0/ && rm -R /usr/local/lib/android/sdk/build-tools/32.0.0/ && rm -R /usr/local/lib/android/sdk/build-tools/33.0.0/ && rm -R /usr/local/lib/android/sdk/build-tools/33.0.1/ - name: Setup Node uses: actions/setup-node@v2