mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-17 14:21:14 +00:00
Download App functionality
This commit is contained in:
@@ -271,7 +271,8 @@
|
|||||||
"NO_LABEL": "Cancel"
|
"NO_LABEL": "Cancel"
|
||||||
},
|
},
|
||||||
"MOBILE_APP": {
|
"MOBILE_APP": {
|
||||||
"MOBILE_APP_BUTTON_LABEL": "Open in App"
|
"MOBILE_APP_BUTTON_LABEL": "Open in App",
|
||||||
|
"DOWNLOAD_APP_BUTTON_LABEL": "Download App"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"DOCUMENT_LIST": {
|
"DOCUMENT_LIST": {
|
||||||
|
@@ -6,3 +6,8 @@
|
|||||||
<mat-icon>close</mat-icon>
|
<mat-icon>close</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
<div *ngIf="isIOS">
|
||||||
|
<button class="download-container" mat-button (click)="downloadIosApp()">
|
||||||
|
<span>{{ 'APP.DIALOGS.MOBILE_APP.DOWNLOAD_APP_BUTTON_LABEL' | translate }}</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
@@ -15,3 +15,8 @@
|
|||||||
.open-in-app.mat-button {
|
.open-in-app.mat-button {
|
||||||
overflow-x: hidden;
|
overflow-x: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.download-container.mat-button {
|
||||||
|
margin: auto;
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
@@ -28,6 +28,8 @@ import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
|
|||||||
|
|
||||||
export interface OpenInAppDialogOptions {
|
export interface OpenInAppDialogOptions {
|
||||||
redirectUrl: string;
|
redirectUrl: string;
|
||||||
|
isIOS: boolean;
|
||||||
|
appleStoreUrl: string;
|
||||||
}
|
}
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'aca-open-in-app',
|
selector: 'aca-open-in-app',
|
||||||
@@ -38,6 +40,8 @@ export interface OpenInAppDialogOptions {
|
|||||||
export class OpenInAppComponent {
|
export class OpenInAppComponent {
|
||||||
private redirectUrl: string;
|
private redirectUrl: string;
|
||||||
public window: Window & typeof globalThis = window;
|
public window: Window & typeof globalThis = window;
|
||||||
|
public isIOS = false;
|
||||||
|
public appleStoreUrl: string;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(MAT_DIALOG_DATA)
|
@Inject(MAT_DIALOG_DATA)
|
||||||
@@ -46,6 +50,8 @@ export class OpenInAppComponent {
|
|||||||
) {
|
) {
|
||||||
if (data) {
|
if (data) {
|
||||||
this.redirectUrl = data.redirectUrl;
|
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;
|
this.window.location.href = this.redirectUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
downloadIosApp(): void {
|
||||||
|
this.window.location.href = this.appleStoreUrl;
|
||||||
|
}
|
||||||
|
|
||||||
onCloseDialog(): void {
|
onCloseDialog(): void {
|
||||||
const time: number = new Date().getTime();
|
const time: number = new Date().getTime();
|
||||||
sessionStorage.setItem('mobile_notification_expires_in', time.toString());
|
sessionStorage.setItem('mobile_notification_expires_in', time.toString());
|
||||||
|
@@ -41,6 +41,7 @@ export interface MobileAppSwitchConfigurationOptions {
|
|||||||
export class AcaMobileAppSwitcherService {
|
export class AcaMobileAppSwitcherService {
|
||||||
private mobileAppSwitchConfig: MobileAppSwitchConfigurationOptions;
|
private mobileAppSwitchConfig: MobileAppSwitchConfigurationOptions;
|
||||||
public redirectUrl: string;
|
public redirectUrl: string;
|
||||||
|
public appleStoreUrl = 'https://apps.apple.com/us/app/alfresco-mobile-workspace/id1514434480';
|
||||||
|
|
||||||
constructor(private config: AppConfigService, private dialog: MatDialog) {
|
constructor(private config: AppConfigService, private dialog: MatDialog) {
|
||||||
this.mobileAppSwitchConfig = this.config.get<MobileAppSwitchConfigurationOptions>('mobileAppSwitch');
|
this.mobileAppSwitchConfig = this.config.get<MobileAppSwitchConfigurationOptions>('mobileAppSwitch');
|
||||||
@@ -90,14 +91,16 @@ export class AcaMobileAppSwitcherService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (this.redirectUrl !== undefined && this.redirectUrl !== null) {
|
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, {
|
this.dialog.open(OpenInAppComponent, {
|
||||||
data: {
|
data: {
|
||||||
redirectUrl
|
redirectUrl,
|
||||||
|
isIOS,
|
||||||
|
appleStoreUrl
|
||||||
},
|
},
|
||||||
hasBackdrop: false,
|
hasBackdrop: false,
|
||||||
width: 'auto',
|
width: 'auto',
|
||||||
|
@@ -33,10 +33,11 @@ import { MatButtonModule } from '@angular/material/button';
|
|||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatDialogModule } from '@angular/material/dialog';
|
import { MatDialogModule } from '@angular/material/dialog';
|
||||||
import { TranslateModule } from '@ngx-translate/core';
|
import { TranslateModule } from '@ngx-translate/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule],
|
imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule, CommonModule],
|
||||||
exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule],
|
exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, TranslateModule, CommonModule],
|
||||||
declarations: [OpenInAppComponent]
|
declarations: [OpenInAppComponent]
|
||||||
})
|
})
|
||||||
export class SharedModule {
|
export class SharedModule {
|
||||||
|
Reference in New Issue
Block a user