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

View File

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

View File

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

View File

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

View File

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