migrate mobileAppSwitch and aosPlugin

This commit is contained in:
Denys Vuika
2023-05-18 20:06:48 +01:00
parent fbe3a7917a
commit b8ec2b88a4
5 changed files with 13 additions and 15 deletions

View File

@@ -7,14 +7,14 @@
"authType": "${APP_CONFIG_AUTH_TYPE}",
"loginRoute": "login",
"mobileAppSwitch": {
"enabled" : ${APP_CONFIG_ENABLE_MOBILE_APP_SWITCH},
"enabled" : "${APP_CONFIG_ENABLE_MOBILE_APP_SWITCH}",
"iphoneUrl": "iosamw://",
"androidUrlPart1": "intent:///",
"androidUrlPart2": "#Intent;scheme=androidamw;package=com.alfresco.content.app;end",
"sessionTimeForOpenAppDialogDisplay": "${APP_CONFIG_SESSION_TIME_FOR_OPEN_APP_DIALOG_DISPLAY_IN_HOURS}"
},
"plugins": {
"aosPlugin": ${APP_CONFIG_PLUGIN_AOS},
"aosPlugin": "${APP_CONFIG_PLUGIN_AOS}",
"contentService": ${APP_CONFIG_PLUGIN_CONTENT_SERVICE},
"folderRules": ${APP_CONFIG_PLUGIN_FOLDER_RULES}
},

View File

@@ -45,7 +45,7 @@ describe('AcaMobileAppSwitcherService', () => {
});
appConfig = TestBed.inject(AppConfigService);
appConfig.config.mobileAppSwitch = {
enabled: true,
enabled: 'true',
iphoneUrl: 'iosamw://',
androidUrlPart1: 'intent:///',
androidUrlPart2: '#Intent;scheme=androidamw;package=com.alfresco.content.app;end',

View File

@@ -54,7 +54,7 @@ describe('AlfrescoOfficeExtensionService', () => {
appConfig = TestBed.inject(AppConfigService);
appConfig.onLoad = onLoad$;
appConfig.config.aosPlugin = true;
appConfig.config.aosPlugin = 'true';
service = TestBed.inject(AlfrescoOfficeExtensionService);
@@ -67,7 +67,7 @@ describe('AlfrescoOfficeExtensionService', () => {
onLoad$.next({
plugins: {
aosPlugin: true
aosPlugin: 'true'
}
});
@@ -80,7 +80,7 @@ describe('AlfrescoOfficeExtensionService', () => {
onLoad$.next({
plugins: {
aosPlugin: false
aosPlugin: 'false'
}
});

View File

@@ -34,10 +34,10 @@ export class AlfrescoOfficeExtensionService {
this.appConfigService.onLoad
.pipe(
take(1),
map((appConfig) => appConfig.plugins && appConfig.plugins.aosPlugin)
map((appConfig) => appConfig.plugins?.aosPlugin)
)
.subscribe((aosPlugin) => {
if (aosPlugin) {
if (aosPlugin === 'true') {
this.enablePlugin();
} else {
this.disablePlugin();
@@ -55,7 +55,7 @@ export class AlfrescoOfficeExtensionService {
localStorage.removeItem('aosPlugin');
}
isAosPluginEnabled() {
isAosPluginEnabled(): boolean {
return localStorage && localStorage.getItem('aosPlugin') === 'true';
}
}

View File

@@ -142,11 +142,9 @@ export class AppService implements OnDestroy {
const { router } = this;
this.router.events
.pipe(filter((event) => event instanceof ActivationEnd && event.snapshot.children.length === 0))
.subscribe((_event: ActivationEnd) => {
this.store.dispatch(new SetCurrentUrlAction(router.url));
});
this.router.events.pipe(filter((event) => event instanceof ActivationEnd && event.snapshot.children.length === 0)).subscribe(() => {
this.store.dispatch(new SetCurrentUrlAction(router.url));
});
this.router.events.pipe(filter((event) => event instanceof NavigationStart)).subscribe(() => {
this.store.dispatch(new ResetSelectionAction());
@@ -171,7 +169,7 @@ export class AppService implements OnDestroy {
this.overlayContainer.getContainerElement().setAttribute('role', 'region');
const isMobileSwitchEnabled: boolean = this.config.get<boolean>('mobileAppSwitch.enabled', false);
const isMobileSwitchEnabled = this.config.get<string>('mobileAppSwitch.enabled', 'false') === 'true';
if (isMobileSwitchEnabled) {
this.acaMobileAppSwitcherService.resolveExistenceOfDialog();
} else {