Skip to content

Commit 9efe39b

Browse files
committed
MOBILE-3523 login: Check application everywhere
1 parent dbe0b86 commit 9efe39b

File tree

4 files changed

+10
-12
lines changed

4 files changed

+10
-12
lines changed

src/core/login/pages/site/site.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ export class CoreLoginSitePage {
526526
// Check if site uses SSO.
527527
const response = await this.sitesProvider.checkSite(siteUrl);
528528

529-
await this.sitesProvider.checkRequiredMinimumVersion(response.config);
529+
await this.sitesProvider.checkApplication(response.config);
530530

531531
if (!this.loginHelper.isSSOLoginNeeded(response.code)) {
532532
// No SSO, go to credentials page.

src/core/login/providers/cron-handler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export class CoreLoginCronHandler implements CoreCronHandler {
4444
return site.getPublicConfig().catch(() => {
4545
return {};
4646
}).then((config) => {
47-
this.sitesProvider.checkRequiredMinimumVersion(config).catch(() => {
47+
this.sitesProvider.checkApplication(config).catch(() => {
4848
// Ignore errors.
4949

5050
});

src/providers/sites.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,20 +1039,19 @@ export class CoreSitesProvider {
10391039
/**
10401040
* Check the app for a site and show a download dialogs if necessary.
10411041
*
1042-
* @param response Data obtained during site check.
1042+
* @param config Config object of the site.
10431043
*/
1044-
async checkApplication(response: CoreSiteCheckResponse): Promise<void> {
1045-
await this.checkRequiredMinimumVersion(response.config);
1044+
async checkApplication(config: any): Promise<void> {
1045+
await this.checkRequiredMinimumVersion(config);
10461046
}
10471047

10481048
/**
10491049
* Check the required minimum version of the app for a site and shows a download dialog.
10501050
*
1051-
* @param config Config object of the site.
1052-
* @param siteId ID of the site to check. Current site id will be used otherwise.
1051+
* @param config Config object of the site.
10531052
* @return Resolved with if meets the requirements, rejected otherwise.
10541053
*/
1055-
checkRequiredMinimumVersion(config: any, siteId?: string): Promise<void> {
1054+
protected checkRequiredMinimumVersion(config: any): Promise<void> {
10561055
if (config && config.tool_mobile_minimumversion) {
10571056
const requiredVersion = this.convertVersionName(config.tool_mobile_minimumversion),
10581057
appVersion = this.convertVersionName(CoreConfigConstants.versionname);
@@ -1067,8 +1066,7 @@ export class CoreSitesProvider {
10671066
};
10681067

10691068
const downloadUrl = this.appProvider.getAppStoreUrl(storesConfig);
1070-
1071-
siteId = siteId || this.getCurrentSiteId();
1069+
const siteId = this.getCurrentSiteId();
10721070

10731071
// Do not block interface.
10741072
this.domUtils.showConfirm(
@@ -1159,7 +1157,7 @@ export class CoreSitesProvider {
11591157
return site.getPublicConfig().catch(() => {
11601158
return {};
11611159
}).then((config) => {
1162-
return this.checkRequiredMinimumVersion(config).then(() => {
1160+
return this.checkApplication(config).then(() => {
11631161
this.login(siteId);
11641162

11651163
// Update site info. We don't block the UI.

src/providers/urlschemes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export class CoreCustomURLSchemesProvider {
102102

103103
data.siteUrl = result.siteUrl;
104104

105-
await this.sitesProvider.checkRequiredMinimumVersion(result.config);
105+
await this.sitesProvider.checkApplication(result.config);
106106
}
107107

108108
return this.sitesProvider.newSite(data.siteUrl, data.token, data.privateToken, !!data.isSSOToken,

0 commit comments

Comments
 (0)