MOBILE-2795 login: Trigger login event on reconnect
parent
51b2c94cde
commit
43d727a526
|
@ -97,14 +97,13 @@ export class CoreSitePluginsHelperProvider {
|
||||||
this.logger = logger.getInstance('CoreSitePluginsHelperProvider');
|
this.logger = logger.getInstance('CoreSitePluginsHelperProvider');
|
||||||
|
|
||||||
// Fetch the plugins on login.
|
// Fetch the plugins on login.
|
||||||
eventsProvider.on(CoreEventsProvider.LOGIN, () => {
|
eventsProvider.on(CoreEventsProvider.LOGIN, (data) => {
|
||||||
const siteId = this.sitesProvider.getCurrentSiteId();
|
this.fetchSitePlugins(data.siteId).then((plugins) => {
|
||||||
this.fetchSitePlugins(siteId).then((plugins) => {
|
|
||||||
// Plugins fetched, check that site hasn't changed.
|
// Plugins fetched, check that site hasn't changed.
|
||||||
if (siteId == this.sitesProvider.getCurrentSiteId() && plugins.length) {
|
if (data.siteId == this.sitesProvider.getCurrentSiteId() && plugins.length) {
|
||||||
// Site is still the same. Load the plugins and trigger the event.
|
// Site is still the same. Load the plugins and trigger the event.
|
||||||
this.loadSitePlugins(plugins).then(() => {
|
this.loadSitePlugins(plugins).then(() => {
|
||||||
eventsProvider.trigger(CoreEventsProvider.SITE_PLUGINS_LOADED, {}, siteId);
|
eventsProvider.trigger(CoreEventsProvider.SITE_PLUGINS_LOADED, {}, data.siteId);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1062,7 +1062,9 @@ export class CoreSitesProvider {
|
||||||
updateSiteToken(siteUrl: string, username: string, token: string, privateToken: string = ''): Promise<any> {
|
updateSiteToken(siteUrl: string, username: string, token: string, privateToken: string = ''): Promise<any> {
|
||||||
const siteId = this.createSiteID(siteUrl, username);
|
const siteId = this.createSiteID(siteUrl, username);
|
||||||
|
|
||||||
return this.updateSiteTokenBySiteId(siteId, token, privateToken);
|
return this.updateSiteTokenBySiteId(siteId, token, privateToken).then(() => {
|
||||||
|
return this.login(siteId);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue