Skip to content

Commit 3d393e7

Browse files
committed
MOBILE-4606 remotethemes: Fix styles not loaded in reconnect in offline
1 parent 3fdc860 commit 3d393e7

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

src/core/features/login/pages/reconnect/reconnect.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
151151
{
152152
config: this.siteConfig,
153153
loginSuccessful: this.loginSuccessful,
154+
siteId: this.siteId,
154155
},
155156
this.siteId,
156157
);
@@ -190,7 +191,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
190191

191192
if (!this.eventThrown && !this.viewLeft) {
192193
this.eventThrown = true;
193-
CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig });
194+
CoreEvents.trigger(CoreEvents.LOGIN_SITE_CHECKED, { config: this.siteConfig, siteId: this.siteId });
194195
}
195196

196197
this.isBrowserSSO = CoreLoginHelper.isSSOLoginNeeded(this.siteConfig.typeoflogin);

src/core/features/styles/services/styles.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,15 @@ export class CoreStylesService {
148148
this.removeSite(site.getId());
149149
});
150150

151-
// Load temporary styles when site config is checked in login.
151+
// Load temporary styles when site config is checked in login/reconnect.
152152
CoreEvents.on(CoreEvents.LOGIN_SITE_CHECKED, (data) => {
153+
if (data.siteId) {
154+
// Reconnecting to a site, enable the site styles.
155+
this.enableSiteStyles(data.siteId);
156+
157+
return;
158+
}
159+
153160
this.loadTmpStyles(data.config).catch((error) => {
154161
this.logger.error('Error loading tmp styles', error);
155162
});
@@ -163,8 +170,9 @@ export class CoreStylesService {
163170
return;
164171
}
165172

166-
// The tmp styles are from a site that wasn't added in the end. Just remove them.
173+
// User didn't access the site, unload tmp styles and site styles if any.
167174
this.unloadTmpStyles();
175+
this.clear();
168176
});
169177
}
170178

src/core/singletons/events.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,7 @@ export type CoreEventActivityDataSentData = {
428428
*/
429429
export type CoreEventLoginSiteCheckedData = {
430430
config: CoreSitePublicConfigResponse;
431+
siteId?: string;
431432
};
432433

433434
/**
@@ -436,6 +437,7 @@ export type CoreEventLoginSiteCheckedData = {
436437
export type CoreEventLoginSiteUncheckedData = {
437438
config?: CoreSitePublicConfigResponse;
438439
loginSuccessful: boolean;
440+
siteId?: string;
439441
};
440442

441443
/**

0 commit comments

Comments
 (0)