From 851421aaba2b04657d3a4bfaf26381c74d2b4ffc Mon Sep 17 00:00:00 2001 From: Jatin_Chugh Date: Tue, 28 Feb 2023 12:02:32 +0530 Subject: [PATCH] Download App functionality --- projects/aca-content/assets/i18n/en.json | 3 ++- .../components/open-in-app/open-in-app.component.html | 5 +++++ .../components/open-in-app/open-in-app.component.scss | 5 +++++ .../components/open-in-app/open-in-app.component.ts | 10 ++++++++++ .../lib/services/aca-mobile-app-switcher.service.ts | 9 ++++++--- projects/aca-shared/src/lib/shared.module.ts | 5 +++-- 6 files changed, 31 insertions(+), 6 deletions(-) diff --git a/projects/aca-content/assets/i18n/en.json b/projects/aca-content/assets/i18n/en.json index d9fedaece..d6058d051 100644 --- a/projects/aca-content/assets/i18n/en.json +++ b/projects/aca-content/assets/i18n/en.json @@ -271,7 +271,8 @@ "NO_LABEL": "Cancel" }, "MOBILE_APP": { - "MOBILE_APP_BUTTON_LABEL": "Open in App" + "MOBILE_APP_BUTTON_LABEL": "Open in App", + "DOWNLOAD_APP_BUTTON_LABEL": "Download App" } }, "DOCUMENT_LIST": { diff --git a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.html b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.html index 4433ab6b3..c567466ea 100644 --- a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.html +++ b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.html @@ -6,3 +6,8 @@ close +
+ +
diff --git a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.scss b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.scss index 115858f5e..0eed717c4 100644 --- a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.scss +++ b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.scss @@ -15,3 +15,8 @@ .open-in-app.mat-button { overflow-x: hidden; } + +.download-container.mat-button { + margin: auto; + margin-top: 5px; +} diff --git a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.ts b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.ts index b6f66824a..bc62f3713 100644 --- a/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.ts +++ b/projects/aca-shared/src/lib/components/open-in-app/open-in-app.component.ts @@ -28,6 +28,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; export interface OpenInAppDialogOptions { redirectUrl: string; + isIOS: boolean; + appleStoreUrl: string; } @Component({ selector: 'aca-open-in-app', @@ -38,6 +40,8 @@ export interface OpenInAppDialogOptions { export class OpenInAppComponent { private redirectUrl: string; public window: Window & typeof globalThis = window; + public isIOS = false; + public appleStoreUrl: string; constructor( @Inject(MAT_DIALOG_DATA) @@ -46,6 +50,8 @@ export class OpenInAppComponent { ) { if (data) { this.redirectUrl = data.redirectUrl; + this.isIOS = data.isIOS; + this.appleStoreUrl = data.appleStoreUrl; } } @@ -53,6 +59,10 @@ export class OpenInAppComponent { this.window.location.href = this.redirectUrl; } + downloadIosApp(): void { + this.window.location.href = this.appleStoreUrl; + } + onCloseDialog(): void { const time: number = new Date().getTime(); sessionStorage.setItem('mobile_notification_expires_in', time.toString()); diff --git a/projects/aca-shared/src/lib/services/aca-mobile-app-switcher.service.ts b/projects/aca-shared/src/lib/services/aca-mobile-app-switcher.service.ts index 0105f662d..d71b8f126 100644 --- a/projects/aca-shared/src/lib/services/aca-mobile-app-switcher.service.ts +++ b/projects/aca-shared/src/lib/services/aca-mobile-app-switcher.service.ts @@ -41,6 +41,7 @@ export interface MobileAppSwitchConfigurationOptions { export class AcaMobileAppSwitcherService { private mobileAppSwitchConfig: MobileAppSwitchConfigurationOptions; public redirectUrl: string; + public appleStoreUrl = 'https://apps.apple.com/us/app/alfresco-mobile-workspace/id1514434480'; constructor(private config: AppConfigService, private dialog: MatDialog) { this.mobileAppSwitchConfig = this.config.get('mobileAppSwitch'); @@ -90,14 +91,16 @@ export class AcaMobileAppSwitcherService { } if (this.redirectUrl !== undefined && this.redirectUrl !== null) { - this.openDialog(this.redirectUrl); + this.openDialog(this.redirectUrl, isIOS, this.appleStoreUrl); } } - openDialog(redirectUrl: string): void { + openDialog(redirectUrl: string, isIOS: boolean, appleStoreUrl: string): void { this.dialog.open(OpenInAppComponent, { data: { - redirectUrl + redirectUrl, + isIOS, + appleStoreUrl }, hasBackdrop: false, width: 'auto', diff --git a/projects/aca-shared/src/lib/shared.module.ts b/projects/aca-shared/src/lib/shared.module.ts index 1378be197..1d5da1e1a 100644 --- a/projects/aca-shared/src/lib/shared.module.ts +++ b/projects/aca-shared/src/lib/shared.module.ts @@ -33,10 +33,11 @@ import { MatButtonModule } from '@angular/material/button'; import { MatIconModule } from '@angular/material/icon'; import { MatDialogModule } from '@angular/material/dialog'; import { TranslateModule } from '@ngx-translate/core'; +import { CommonModule } from '@angular/common'; @NgModule({ - imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule], - exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule], + imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule, CommonModule], + exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule, CommonModule], declarations: [OpenInAppComponent] }) export class SharedModule {