MOBILE-3523 login: Check application everywhere

main
Noel De Martin 2020-11-11 14:01:12 +01:00
parent dbe0b86821
commit 9efe39b711
4 changed files with 10 additions and 12 deletions

View File

@ -526,7 +526,7 @@ export class CoreLoginSitePage {
// Check if site uses SSO. // Check if site uses SSO.
const response = await this.sitesProvider.checkSite(siteUrl); const response = await this.sitesProvider.checkSite(siteUrl);
await this.sitesProvider.checkRequiredMinimumVersion(response.config); await this.sitesProvider.checkApplication(response.config);
if (!this.loginHelper.isSSOLoginNeeded(response.code)) { if (!this.loginHelper.isSSOLoginNeeded(response.code)) {
// No SSO, go to credentials page. // No SSO, go to credentials page.

View File

@ -44,7 +44,7 @@ export class CoreLoginCronHandler implements CoreCronHandler {
return site.getPublicConfig().catch(() => { return site.getPublicConfig().catch(() => {
return {}; return {};
}).then((config) => { }).then((config) => {
this.sitesProvider.checkRequiredMinimumVersion(config).catch(() => { this.sitesProvider.checkApplication(config).catch(() => {
// Ignore errors. // Ignore errors.
}); });

View File

@ -1039,20 +1039,19 @@ export class CoreSitesProvider {
/** /**
* Check the app for a site and show a download dialogs if necessary. * Check the app for a site and show a download dialogs if necessary.
* *
* @param response Data obtained during site check. * @param config Config object of the site.
*/ */
async checkApplication(response: CoreSiteCheckResponse): Promise<void> { async checkApplication(config: any): Promise<void> {
await this.checkRequiredMinimumVersion(response.config); await this.checkRequiredMinimumVersion(config);
} }
/** /**
* Check the required minimum version of the app for a site and shows a download dialog. * Check the required minimum version of the app for a site and shows a download dialog.
* *
* @param config Config object of the site. * @param config Config object of the site.
* @param siteId ID of the site to check. Current site id will be used otherwise.
* @return Resolved with if meets the requirements, rejected otherwise. * @return Resolved with if meets the requirements, rejected otherwise.
*/ */
checkRequiredMinimumVersion(config: any, siteId?: string): Promise<void> { protected checkRequiredMinimumVersion(config: any): Promise<void> {
if (config && config.tool_mobile_minimumversion) { if (config && config.tool_mobile_minimumversion) {
const requiredVersion = this.convertVersionName(config.tool_mobile_minimumversion), const requiredVersion = this.convertVersionName(config.tool_mobile_minimumversion),
appVersion = this.convertVersionName(CoreConfigConstants.versionname); appVersion = this.convertVersionName(CoreConfigConstants.versionname);
@ -1067,8 +1066,7 @@ export class CoreSitesProvider {
}; };
const downloadUrl = this.appProvider.getAppStoreUrl(storesConfig); const downloadUrl = this.appProvider.getAppStoreUrl(storesConfig);
const siteId = this.getCurrentSiteId();
siteId = siteId || this.getCurrentSiteId();
// Do not block interface. // Do not block interface.
this.domUtils.showConfirm( this.domUtils.showConfirm(
@ -1159,7 +1157,7 @@ export class CoreSitesProvider {
return site.getPublicConfig().catch(() => { return site.getPublicConfig().catch(() => {
return {}; return {};
}).then((config) => { }).then((config) => {
return this.checkRequiredMinimumVersion(config).then(() => { return this.checkApplication(config).then(() => {
this.login(siteId); this.login(siteId);
// Update site info. We don't block the UI. // Update site info. We don't block the UI.

View File

@ -102,7 +102,7 @@ export class CoreCustomURLSchemesProvider {
data.siteUrl = result.siteUrl; data.siteUrl = result.siteUrl;
await this.sitesProvider.checkRequiredMinimumVersion(result.config); await this.sitesProvider.checkApplication(result.config);
} }
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken, !!data.isSSOToken, return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken, !!data.isSSOToken,