@alfresco/aca-shared 4.0.0-A.2-10162 → 4.0.0-A.2-10175

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -21,6 +21,7 @@ import * as i4 from '@angular/material/menu';
21
21
  import { MatMenuItem, MatMenu } from '@angular/material/menu';
22
22
  import * as i3$1 from '@angular/material/divider';
23
23
  import * as i2$1 from '@angular/material/button';
24
+ import { MatButtonModule } from '@angular/material/button';
24
25
  import * as i6$1 from '@angular/material/progress-bar';
25
26
  import { MatProgressBarModule } from '@angular/material/progress-bar';
26
27
  import * as i6$2 from '@alfresco/adf-content-services';
@@ -28,6 +29,8 @@ import { DocumentListComponent } from '@alfresco/adf-content-services';
28
29
  import * as i7 from '@angular/cdk/overlay';
29
30
  import * as i3$2 from '@angular/router';
30
31
  import { ActivationEnd, NavigationStart } from '@angular/router';
32
+ import * as i2$2 from '@angular/material/dialog';
33
+ import { MAT_DIALOG_DATA, MatDialogModule } from '@angular/material/dialog';
31
34
  import { NoopAnimationsModule } from '@angular/platform-browser/animations';
32
35
  import { HttpClientModule } from '@angular/common/http';
33
36
  import { RouterTestingModule } from '@angular/router/testing';
@@ -2280,6 +2283,137 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
2280
2283
  }]
2281
2284
  }], ctorParameters: function () { return [{ type: i3$2.Router }, { type: i3.ExtensionService }]; } });
2282
2285
 
2286
+ /*!
2287
+ * @license
2288
+ * Alfresco Example Content Application
2289
+ *
2290
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
2291
+ *
2292
+ * This file is part of the Alfresco Example Content Application.
2293
+ * If the software was purchased under a paid Alfresco license, the terms of
2294
+ * the paid license agreement will prevail. Otherwise, the software is
2295
+ * provided under the following open source license terms:
2296
+ *
2297
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
2298
+ * it under the terms of the GNU Lesser General Public License as published by
2299
+ * the Free Software Foundation, either version 3 of the License, or
2300
+ * (at your option) any later version.
2301
+ *
2302
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
2303
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2304
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2305
+ * GNU Lesser General Public License for more details.
2306
+ *
2307
+ * You should have received a copy of the GNU Lesser General Public License
2308
+ * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
2309
+ */
2310
+ class OpenInAppComponent {
2311
+ constructor(data) {
2312
+ this.data = data;
2313
+ this.window = window;
2314
+ if (data) {
2315
+ this.redirectUrl = data.redirectUrl;
2316
+ }
2317
+ }
2318
+ openInApp() {
2319
+ this.window.location.href = this.redirectUrl;
2320
+ }
2321
+ }
2322
+ OpenInAppComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: OpenInAppComponent, deps: [{ token: MAT_DIALOG_DATA }], target: i0.ɵɵFactoryTarget.Component });
2323
+ OpenInAppComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.1.2", type: OpenInAppComponent, selector: "aca-open-in-app", ngImport: i0, template: "<div class=\"container\">\n <button mat-button (click)=\"openInApp()\" data-automation-id=\"open-in-app-button\">\n <span>{{ 'APP.DIALOGS.MOBILE_APP.MOBILE_APP_BUTTON_LABEL' }}</span>\n </button>\n <button mat-button mat-dialog-close>\n <mat-icon>close</mat-icon>\n </button>\n</div>\n", styles: [".container{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.mat-dialog-container{padding:12px;border-radius:36px;background-color:var(--theme-blue-button-color);color:var(--theme-about-panel-background-color)}\n"], dependencies: [{ kind: "component", type: i2$1.MatButton, selector: "button[mat-button], button[mat-raised-button], button[mat-icon-button], button[mat-fab], button[mat-mini-fab], button[mat-stroked-button], button[mat-flat-button]", inputs: ["disabled", "disableRipple", "color"], exportAs: ["matButton"] }, { kind: "component", type: i1$1.MatIcon, selector: "mat-icon", inputs: ["color", "inline", "svgIcon", "fontSet", "fontIcon"], exportAs: ["matIcon"] }, { kind: "directive", type: i2$2.MatDialogClose, selector: "[mat-dialog-close], [matDialogClose]", inputs: ["aria-label", "type", "mat-dialog-close", "matDialogClose"], exportAs: ["matDialogClose"] }], encapsulation: i0.ViewEncapsulation.None });
2324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: OpenInAppComponent, decorators: [{
2325
+ type: Component,
2326
+ args: [{ selector: 'aca-open-in-app', encapsulation: ViewEncapsulation.None, template: "<div class=\"container\">\n <button mat-button (click)=\"openInApp()\" data-automation-id=\"open-in-app-button\">\n <span>{{ 'APP.DIALOGS.MOBILE_APP.MOBILE_APP_BUTTON_LABEL' }}</span>\n </button>\n <button mat-button mat-dialog-close>\n <mat-icon>close</mat-icon>\n </button>\n</div>\n", styles: [".container{display:flex;flex-direction:row;justify-content:space-between;align-items:center}.mat-dialog-container{padding:12px;border-radius:36px;background-color:var(--theme-blue-button-color);color:var(--theme-about-panel-background-color)}\n"] }]
2327
+ }], ctorParameters: function () { return [{ type: undefined, decorators: [{
2328
+ type: Inject,
2329
+ args: [MAT_DIALOG_DATA]
2330
+ }] }]; } });
2331
+
2332
+ /*!
2333
+ * @license
2334
+ * Alfresco Example Content Application
2335
+ *
2336
+ * Copyright (C) 2005 - 2020 Alfresco Software Limited
2337
+ *
2338
+ * This file is part of the Alfresco Example Content Application.
2339
+ * If the software was purchased under a paid Alfresco license, the terms of
2340
+ * the paid license agreement will prevail. Otherwise, the software is
2341
+ * provided under the following open source license terms:
2342
+ *
2343
+ * The Alfresco Example Content Application is free software: you can redistribute it and/or modify
2344
+ * it under the terms of the GNU Lesser General Public License as published by
2345
+ * the Free Software Foundation, either version 3 of the License, or
2346
+ * (at your option) any later version.
2347
+ *
2348
+ * The Alfresco Example Content Application is distributed in the hope that it will be useful,
2349
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2350
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2351
+ * GNU Lesser General Public License for more details.
2352
+ *
2353
+ * You should have received a copy of the GNU Lesser General Public License
2354
+ * along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
2355
+ */
2356
+ class AcaMobileAppSwitcherService {
2357
+ constructor(config, dialog) {
2358
+ this.config = config;
2359
+ this.dialog = dialog;
2360
+ this.mobileAppSwitchConfig = this.config.get('mobileAppSwitch');
2361
+ }
2362
+ checkForMobileApp() {
2363
+ const currentTime = new Date().getTime();
2364
+ const sessionTime = sessionStorage.getItem('mobile_notification_expires_in');
2365
+ if (sessionTime !== null) {
2366
+ const sessionConvertedTime = parseFloat(sessionTime);
2367
+ const timeDifference = (currentTime - sessionConvertedTime) / (1000 * 60 * 60);
2368
+ const sessionTimeForOpenAppDialogDisplay = parseFloat(this.mobileAppSwitchConfig.sessionTimeForOpenAppDialogDisplay);
2369
+ if (timeDifference > sessionTimeForOpenAppDialogDisplay) {
2370
+ this.showAppNotification();
2371
+ }
2372
+ }
2373
+ else {
2374
+ this.showAppNotification();
2375
+ }
2376
+ }
2377
+ showAppNotification() {
2378
+ const ua = navigator.userAgent.toLowerCase();
2379
+ const isAndroid = ua.indexOf('android') > -1;
2380
+ const isIOS = ua.indexOf('iphone') > -1 || ua.indexOf('ipad') > -1 || ua.indexOf('ipod') > -1;
2381
+ const currentUrl = window.location.href;
2382
+ const time = new Date().getTime();
2383
+ sessionStorage.setItem('mobile_notification_expires_in', time.toString());
2384
+ if (isIOS === true) {
2385
+ this.redirectUrl = this.mobileAppSwitchConfig.iphoneUrl + currentUrl;
2386
+ }
2387
+ else if (isAndroid === true) {
2388
+ this.redirectUrl = this.mobileAppSwitchConfig.androidUrlPart1 + currentUrl + this.mobileAppSwitchConfig.androidUrlPart2;
2389
+ }
2390
+ if (this.redirectUrl !== undefined && this.redirectUrl !== null) {
2391
+ this.openInApp(this.redirectUrl);
2392
+ }
2393
+ }
2394
+ openInApp(redirectUrl) {
2395
+ this.dialog.open(OpenInAppComponent, {
2396
+ data: {
2397
+ redirectUrl
2398
+ },
2399
+ width: '75%',
2400
+ role: 'dialog',
2401
+ position: { bottom: '50px' }
2402
+ });
2403
+ }
2404
+ reset() {
2405
+ sessionStorage.removeItem('mobile_notification_expires_in');
2406
+ }
2407
+ }
2408
+ AcaMobileAppSwitcherService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AcaMobileAppSwitcherService, deps: [{ token: i1$2.AppConfigService }, { token: i2$2.MatDialog }], target: i0.ɵɵFactoryTarget.Injectable });
2409
+ AcaMobileAppSwitcherService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AcaMobileAppSwitcherService, providedIn: 'root' });
2410
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AcaMobileAppSwitcherService, decorators: [{
2411
+ type: Injectable,
2412
+ args: [{
2413
+ providedIn: 'root'
2414
+ }]
2415
+ }], ctorParameters: function () { return [{ type: i1$2.AppConfigService }, { type: i2$2.MatDialog }]; } });
2416
+
2283
2417
  /*!
2284
2418
  * @license
2285
2419
  * Alfresco Example Content Application
@@ -2306,7 +2440,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
2306
2440
  */
2307
2441
  // After moving shell to ADF to core, AppService will implement ShellAppService
2308
2442
  class AppService {
2309
- constructor(preferencesService, authenticationService, store, router, activatedRoute, config, pageTitle, alfrescoApiService, uploadService, routerExtensionService, contentApi, sharedLinksApiService, groupService, overlayContainer, initialAppState, searchQueryBuilderService) {
2443
+ constructor(preferencesService, authenticationService, store, router, activatedRoute, config, pageTitle, alfrescoApiService, uploadService, routerExtensionService, contentApi, sharedLinksApiService, groupService, overlayContainer, initialAppState, searchQueryBuilderService, acaMobileAppSwitcherService) {
2310
2444
  this.preferencesService = preferencesService;
2311
2445
  this.authenticationService = authenticationService;
2312
2446
  this.store = store;
@@ -2322,6 +2456,7 @@ class AppService {
2322
2456
  this.groupService = groupService;
2323
2457
  this.overlayContainer = overlayContainer;
2324
2458
  this.initialAppState = initialAppState;
2459
+ this.acaMobileAppSwitcherService = acaMobileAppSwitcherService;
2325
2460
  this.hideSidenavConditions = ['/preview/'];
2326
2461
  this.minimizeSidenavConditions = ['search'];
2327
2462
  this.onDestroy$ = new Subject();
@@ -2387,6 +2522,13 @@ class AppService {
2387
2522
  }
2388
2523
  });
2389
2524
  this.overlayContainer.getContainerElement().setAttribute('role', 'region');
2525
+ const isMobileSwitchEnabled = this.config.get('mobileAppSwitch.enabled', false);
2526
+ if (isMobileSwitchEnabled) {
2527
+ this.acaMobileAppSwitcherService.checkForMobileApp();
2528
+ }
2529
+ else {
2530
+ this.acaMobileAppSwitcherService.reset();
2531
+ }
2390
2532
  }
2391
2533
  loadRepositoryStatus() {
2392
2534
  this.contentApi.getRepositoryInformation().subscribe((response) => {
@@ -2462,7 +2604,7 @@ class AppService {
2462
2604
  document.head.appendChild(cssLinkElement);
2463
2605
  }
2464
2606
  }
2465
- AppService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AppService, deps: [{ token: i1$2.UserPreferencesService }, { token: i1$2.AuthenticationService }, { token: i1$3.Store }, { token: i3$2.Router }, { token: i3$2.ActivatedRoute }, { token: i1$2.AppConfigService }, { token: i1$2.PageTitleService }, { token: i1$2.AlfrescoApiService }, { token: i1$2.UploadService }, { token: RouterExtensionService }, { token: ContentApiService }, { token: i6$2.SharedLinksApiService }, { token: i6$2.GroupService }, { token: i7.OverlayContainer }, { token: STORE_INITIAL_APP_DATA }, { token: i6$2.SearchQueryBuilderService }], target: i0.ɵɵFactoryTarget.Injectable });
2607
+ AppService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AppService, deps: [{ token: i1$2.UserPreferencesService }, { token: i1$2.AuthenticationService }, { token: i1$3.Store }, { token: i3$2.Router }, { token: i3$2.ActivatedRoute }, { token: i1$2.AppConfigService }, { token: i1$2.PageTitleService }, { token: i1$2.AlfrescoApiService }, { token: i1$2.UploadService }, { token: RouterExtensionService }, { token: ContentApiService }, { token: i6$2.SharedLinksApiService }, { token: i6$2.GroupService }, { token: i7.OverlayContainer }, { token: STORE_INITIAL_APP_DATA }, { token: i6$2.SearchQueryBuilderService }, { token: AcaMobileAppSwitcherService }], target: i0.ɵɵFactoryTarget.Injectable });
2466
2608
  AppService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AppService, providedIn: 'root' });
2467
2609
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: AppService, decorators: [{
2468
2610
  type: Injectable,
@@ -2472,7 +2614,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImpor
2472
2614
  }], ctorParameters: function () { return [{ type: i1$2.UserPreferencesService }, { type: i1$2.AuthenticationService }, { type: i1$3.Store }, { type: i3$2.Router }, { type: i3$2.ActivatedRoute }, { type: i1$2.AppConfigService }, { type: i1$2.PageTitleService }, { type: i1$2.AlfrescoApiService }, { type: i1$2.UploadService }, { type: RouterExtensionService }, { type: ContentApiService }, { type: i6$2.SharedLinksApiService }, { type: i6$2.GroupService }, { type: i7.OverlayContainer }, { type: undefined, decorators: [{
2473
2615
  type: Inject,
2474
2616
  args: [STORE_INITIAL_APP_DATA]
2475
- }] }, { type: i6$2.SearchQueryBuilderService }]; } });
2617
+ }] }, { type: i6$2.SearchQueryBuilderService }, { type: AcaMobileAppSwitcherService }]; } });
2476
2618
 
2477
2619
  /*!
2478
2620
  * @license
@@ -2651,13 +2793,14 @@ class SharedModule {
2651
2793
  }
2652
2794
  }
2653
2795
  SharedModule.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
2654
- SharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, imports: [ContextActionsModule], exports: [ContextActionsModule] });
2655
- SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, imports: [ContextActionsModule, ContextActionsModule] });
2796
+ SharedModule.ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, declarations: [OpenInAppComponent], imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule], exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule] });
2797
+ SharedModule.ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule, ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule] });
2656
2798
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.1.2", ngImport: i0, type: SharedModule, decorators: [{
2657
2799
  type: NgModule,
2658
2800
  args: [{
2659
- imports: [ContextActionsModule],
2660
- exports: [ContextActionsModule]
2801
+ imports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule],
2802
+ exports: [ContextActionsModule, MatButtonModule, MatIconModule, MatDialogModule],
2803
+ declarations: [OpenInAppComponent]
2661
2804
  }]
2662
2805
  }] });
2663
2806