mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-09-10 14:11:17 +00:00
Dialog for private files visibility after login implementation and implementation for dialog appearance changed to after login now
This commit is contained in:
@@ -31,7 +31,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { of } from 'rxjs';
|
||||
import { NO_ERRORS_SCHEMA } from '@angular/core';
|
||||
import { SetSelectedNodesAction } from '@alfresco/aca-shared/store';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService, AppService } from '@alfresco/aca-shared';
|
||||
|
||||
describe('SharedLinkViewComponent', () => {
|
||||
let component: SharedLinkViewComponent;
|
||||
@@ -56,7 +56,8 @@ describe('SharedLinkViewComponent', () => {
|
||||
snapshot: { data: { preferencePrefix: 'prefix' } },
|
||||
params: of({ id: '123' })
|
||||
}
|
||||
}
|
||||
},
|
||||
AppService
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
});
|
||||
|
@@ -32,7 +32,7 @@ import { ActivatedRoute } from '@angular/router';
|
||||
import { Store } from '@ngrx/store';
|
||||
import { forkJoin, from, of, Subject } from 'rxjs';
|
||||
import { catchError, mergeMap, takeUntil } from 'rxjs/operators';
|
||||
import { AppExtensionService } from '@alfresco/aca-shared';
|
||||
import { AppExtensionService, AppService } from '@alfresco/aca-shared';
|
||||
|
||||
@Component({
|
||||
selector: 'app-shared-link-view',
|
||||
@@ -51,7 +51,8 @@ export class SharedLinkViewComponent implements OnInit, OnDestroy {
|
||||
private route: ActivatedRoute,
|
||||
private store: Store<AppStore>,
|
||||
private extensions: AppExtensionService,
|
||||
private alfrescoApiService: AlfrescoApiService
|
||||
private alfrescoApiService: AlfrescoApiService,
|
||||
private appService: AppService
|
||||
) {
|
||||
this.sharedLinksApi = new SharedlinksApi(this.alfrescoApiService.getInstance());
|
||||
}
|
||||
@@ -76,6 +77,8 @@ export class SharedLinkViewComponent implements OnInit, OnDestroy {
|
||||
.subscribe((actions) => {
|
||||
this.viewerToolbarActions = actions;
|
||||
});
|
||||
|
||||
this.appService.mobileApp();
|
||||
}
|
||||
|
||||
ngOnDestroy() {
|
||||
|
@@ -25,7 +25,7 @@
|
||||
|
||||
import { AppConfigService } from '@alfresco/adf-core';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { MatDialog } from '@angular/material/dialog';
|
||||
import { MatDialog, MatDialogRef } from '@angular/material/dialog';
|
||||
import { OpenInAppComponent } from '../components/open-in-app/open-in-app.component';
|
||||
|
||||
export interface MobileAppSwitchConfigurationOptions {
|
||||
@@ -41,6 +41,7 @@ export interface MobileAppSwitchConfigurationOptions {
|
||||
export class AcaMobileAppSwitcherService {
|
||||
private mobileAppSwitchConfig: MobileAppSwitchConfigurationOptions;
|
||||
public redirectUrl: string;
|
||||
public dialogRef: MatDialogRef<OpenInAppComponent, any>;
|
||||
|
||||
constructor(private config: AppConfigService, private dialog: MatDialog) {
|
||||
this.mobileAppSwitchConfig = this.config.get<MobileAppSwitchConfigurationOptions>('mobileAppSwitch');
|
||||
@@ -95,15 +96,17 @@ export class AcaMobileAppSwitcherService {
|
||||
}
|
||||
|
||||
openDialog(redirectUrl: string): void {
|
||||
this.dialog.open(OpenInAppComponent, {
|
||||
data: {
|
||||
redirectUrl
|
||||
},
|
||||
hasBackdrop: false,
|
||||
width: 'auto',
|
||||
role: 'dialog',
|
||||
position: { bottom: '20px' }
|
||||
});
|
||||
if (this.dialogRef !== null || this.dialog !== undefined) {
|
||||
this.dialogRef = this.dialog.open(OpenInAppComponent, {
|
||||
data: {
|
||||
redirectUrl
|
||||
},
|
||||
hasBackdrop: false,
|
||||
width: 'auto',
|
||||
role: 'dialog',
|
||||
position: { bottom: '20px' }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
clearSessionExpireTime(): void {
|
||||
|
@@ -102,13 +102,14 @@ export class AppService implements OnDestroy {
|
||||
) {
|
||||
this.ready = new BehaviorSubject(this.authenticationService.isLoggedIn() || this.withCredentials);
|
||||
this.ready$ = this.ready.asObservable();
|
||||
|
||||
this.authenticationService.onLogin.subscribe(() => {
|
||||
this.ready.next(true);
|
||||
});
|
||||
|
||||
this.authenticationService.onLogout.subscribe(() => {
|
||||
searchQueryBuilderService.resetToDefaults();
|
||||
this.acaMobileAppSwitcherService.dialogRef.close(true);
|
||||
this.acaMobileAppSwitcherService.dialogRef = undefined;
|
||||
});
|
||||
|
||||
this.pageHeading$ = this.router.events.pipe(
|
||||
@@ -175,17 +176,11 @@ export class AppService implements OnDestroy {
|
||||
if (isReady) {
|
||||
this.loadRepositoryStatus();
|
||||
this.loadUserProfile();
|
||||
this.mobileApp();
|
||||
}
|
||||
});
|
||||
|
||||
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
|
||||
|
||||
const isMobileSwitchEnabled: boolean = this.config.get<boolean>('mobileAppSwitch.enabled', false);
|
||||
if (isMobileSwitchEnabled) {
|
||||
this.acaMobileAppSwitcherService.resolveExistenceOfDialog();
|
||||
} else {
|
||||
this.acaMobileAppSwitcherService.clearSessionExpireTime();
|
||||
}
|
||||
}
|
||||
|
||||
private loadRepositoryStatus() {
|
||||
@@ -278,4 +273,15 @@ export class AppService implements OnDestroy {
|
||||
cssLinkElement.setAttribute('href', url);
|
||||
document.head.appendChild(cssLinkElement);
|
||||
}
|
||||
|
||||
public mobileApp(): void {
|
||||
if (!this.acaMobileAppSwitcherService.dialogRef) {
|
||||
const isMobileSwitchEnabled: boolean = this.config.get<boolean>('mobileAppSwitch.enabled', false);
|
||||
if (isMobileSwitchEnabled) {
|
||||
this.acaMobileAppSwitcherService.resolveExistenceOfDialog();
|
||||
} else {
|
||||
this.acaMobileAppSwitcherService.clearSessionExpireTime();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user