Merge pull request #4078 from dpalou/MOBILE-4470

MOBILE-4470 remotethemes: Fix styles not loaded in reconnect in offline
main
Pau Ferrer Ocaña 2024-05-31 15:57:02 +02:00 committed by GitHub
commit aa08f5a3b0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View File

@ -144,6 +144,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
{
config: this.siteConfig,
loginSuccessful: this.loginSuccessful,
siteId: this.siteId,
},
this.siteId,
);
@ -180,7 +181,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
if (!this.eventThrown && !this.viewLeft) {
this.eventThrown = true;
CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig });
CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig, siteId: this.siteId });
}
this.isBrowserSSO = CoreLoginHelper.isSSOLoginNeeded(this.siteConfig.typeoflogin);

View File

@ -148,8 +148,15 @@ export class CoreStylesService {
this.removeSite(site.getId());
});
// Load temporary styles when site config is checked in login.
// Load temporary styles when site config is checked in login/reconnect.
CoreEvents.on(CoreEvents.LOGIN_SITE_CHECKED, (data) => {
if (data.siteId) {
// Reconnecting to a site, enable the site styles.
this.enableSiteStyles(data.siteId);
return;
}
this.loadTmpStyles(data.config).catch((error) => {
this.logger.error('Error loading tmp styles', error);
});
@ -163,8 +170,9 @@ export class CoreStylesService {
return;
}
// The tmp styles are from a site that wasn't added in the end. Just remove them.
// User didn't access the site, unload tmp styles and site styles if any.
this.unloadTmpStyles();
this.clear();
});
}

View File

@ -428,6 +428,7 @@ export type CoreEventActivityDataSentData = {
*/
export type CoreEventLoginSiteCheckedData = {
config: CoreSitePublicConfigResponse;
siteId?: string;
};
/**
@ -436,6 +437,7 @@ export type CoreEventLoginSiteCheckedData = {
export type CoreEventLoginSiteUncheckedData = {
config?: CoreSitePublicConfigResponse;
loginSuccessful: boolean;
siteId?: string;
};
/**