MOBILE-3039 core: Fix getStoredConfig error in synchronize

main
Dani Palou 2019-05-30 10:12:37 +02:00
parent 136869cc04
commit 3eb0c81c46
2 changed files with 7 additions and 1 deletions

View File

@ -72,6 +72,8 @@ export class CoreMainMenuMorePage implements OnDestroy {
*/ */
ngOnDestroy(): void { ngOnDestroy(): void {
window.removeEventListener('resize', this.initHandlers.bind(this)); window.removeEventListener('resize', this.initHandlers.bind(this));
this.langObserver && this.langObserver.off();
this.updateSiteObserver && this.updateSiteObserver.off();
if (this.subscription) { if (this.subscription) {
this.subscription.unsubscribe(); this.subscription.unsubscribe();

View File

@ -27,6 +27,7 @@ import { CoreConfigConstants } from '../configconstants';
import { CoreSite } from '@classes/site'; import { CoreSite } from '@classes/site';
import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb'; import { SQLiteDB, SQLiteDBTableSchema } from '@classes/sqlitedb';
import { Md5 } from 'ts-md5/dist/md5'; import { Md5 } from 'ts-md5/dist/md5';
import { Location } from '@angular/common';
/** /**
* Response of checking if a site exists and its configuration. * Response of checking if a site exists and its configuration.
@ -320,7 +321,7 @@ export class CoreSitesProvider {
constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider, constructor(logger: CoreLoggerProvider, private http: HttpClient, private sitesFactory: CoreSitesFactoryProvider,
private appProvider: CoreAppProvider, private translate: TranslateService, private urlUtils: CoreUrlUtilsProvider, private appProvider: CoreAppProvider, private translate: TranslateService, private urlUtils: CoreUrlUtilsProvider,
private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider, private eventsProvider: CoreEventsProvider, private textUtils: CoreTextUtilsProvider, private location: Location,
private utils: CoreUtilsProvider) { private utils: CoreUtilsProvider) {
this.logger = logger.getInstance('CoreSitesProvider'); this.logger = logger.getInstance('CoreSitesProvider');
@ -1161,6 +1162,9 @@ export class CoreSitesProvider {
promises.push(this.appDB.deleteRecords(this.CURRENT_SITE_TABLE, { id: 1 })); promises.push(this.appDB.deleteRecords(this.CURRENT_SITE_TABLE, { id: 1 }));
return Promise.all(promises).finally(() => { return Promise.all(promises).finally(() => {
// Due to DeepLinker, we need to remove the path from the URL, otherwise some pages are re-created when they shouldn't.
this.location.replaceState('');
this.eventsProvider.trigger(CoreEventsProvider.LOGOUT, {}, siteId); this.eventsProvider.trigger(CoreEventsProvider.LOGOUT, {}, siteId);
}); });
} }