MOBILE-3320 login: Check application everywhere
parent
a16c3d3ce6
commit
ca8b223e78
|
@ -112,7 +112,7 @@ export class CoreLoginReconnectPage implements OnInit, OnDestroy {
|
|||
|
||||
this.siteConfig = config;
|
||||
|
||||
await CoreSites.checkRequiredMinimumVersion(config);
|
||||
await CoreSites.checkApplication(config);
|
||||
|
||||
// Check logoURL if user avatar is not set.
|
||||
if (this.userAvatar.startsWith(this.siteUrl + '/theme/image.php')) {
|
||||
|
|
|
@ -349,7 +349,7 @@ export class CoreLoginSitePage implements OnInit {
|
|||
*/
|
||||
protected async login(response: CoreSiteCheckResponse, foundSite?: CoreLoginSiteInfoExtended): Promise<void> {
|
||||
try {
|
||||
await CoreSites.checkApplication(response);
|
||||
await CoreSites.checkApplication(response.config);
|
||||
|
||||
CoreForms.triggerFormSubmittedEvent(this.formElement, true);
|
||||
|
||||
|
@ -545,7 +545,7 @@ export class CoreLoginSitePage implements OnInit {
|
|||
// Check if site uses SSO.
|
||||
const response = await CoreSites.checkSite(siteUrl);
|
||||
|
||||
await CoreSites.checkApplication(response);
|
||||
await CoreSites.checkApplication(response.config);
|
||||
|
||||
if (!CoreLoginHelper.isSSOLoginNeeded(response.code)) {
|
||||
// No SSO, go to credentials page.
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
// limitations under the License.
|
||||
|
||||
import { Injectable } from '@angular/core';
|
||||
import { CoreSitePublicConfigResponse } from '@classes/site';
|
||||
import { CoreCronHandler } from '@services/cron';
|
||||
import { CoreSites } from '@services/sites';
|
||||
import { CoreUtils } from '@services/utils/utils';
|
||||
|
@ -40,9 +39,9 @@ export class CoreLoginCronHandlerService implements CoreCronHandler {
|
|||
// Do not check twice in the same 10 minutes.
|
||||
const site = await CoreSites.getSite(siteId);
|
||||
|
||||
const config = await CoreUtils.ignoreErrors(site.getPublicConfig(), <Partial<CoreSitePublicConfigResponse>> {});
|
||||
const config = await CoreUtils.ignoreErrors(site.getPublicConfig());
|
||||
|
||||
CoreUtils.ignoreErrors(CoreSites.checkApplication(<any> config));
|
||||
CoreUtils.ignoreErrors(CoreSites.checkApplication(config));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -707,20 +707,19 @@ export class CoreSitesProvider {
|
|||
/**
|
||||
* 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> {
|
||||
await this.checkRequiredMinimumVersion(response.config);
|
||||
async checkApplication(config?: CoreSitePublicConfigResponse): Promise<void> {
|
||||
await this.checkRequiredMinimumVersion(config);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the required minimum version of the app for a site and shows a download dialog.
|
||||
*
|
||||
* @param config Config object of the site.
|
||||
* @param siteId ID of the site to check. Current site id will be used otherwise.
|
||||
* @param config Config object of the site.
|
||||
* @return Resolved with if meets the requirements, rejected otherwise.
|
||||
*/
|
||||
async checkRequiredMinimumVersion(config?: CoreSitePublicConfigResponse, siteId?: string): Promise<void> {
|
||||
protected async checkRequiredMinimumVersion(config?: CoreSitePublicConfigResponse): Promise<void> {
|
||||
if (!config || !config.tool_mobile_minimumversion) {
|
||||
return;
|
||||
}
|
||||
|
@ -736,7 +735,7 @@ export class CoreSitesProvider {
|
|||
default: config.tool_mobile_setuplink,
|
||||
};
|
||||
|
||||
siteId = siteId || this.getCurrentSiteId();
|
||||
const siteId = this.getCurrentSiteId();
|
||||
|
||||
const downloadUrl = CoreApp.getAppStoreUrl(storesConfig);
|
||||
|
||||
|
@ -838,7 +837,7 @@ export class CoreSitesProvider {
|
|||
}
|
||||
|
||||
try {
|
||||
await this.checkRequiredMinimumVersion(config);
|
||||
await this.checkApplication(config);
|
||||
|
||||
this.login(siteId);
|
||||
// Update site info. We don't block the UI.
|
||||
|
@ -1301,7 +1300,7 @@ export class CoreSitesProvider {
|
|||
* @param siteid Site's ID.
|
||||
* @return A promise resolved when the site is updated.
|
||||
*/
|
||||
async updateSiteInfo(siteId: string): Promise<void> {
|
||||
async updateSiteInfo(siteId?: string): Promise<void> {
|
||||
const site = await this.getSite(siteId);
|
||||
|
||||
try {
|
||||
|
|
|
@ -66,7 +66,7 @@ export class CoreCustomURLSchemesProvider {
|
|||
|
||||
data.siteUrl = result.siteUrl;
|
||||
|
||||
await CoreSites.checkApplication(result);
|
||||
await CoreSites.checkApplication(result.config);
|
||||
}
|
||||
|
||||
return CoreSites.newSite(
|
||||
|
|
Loading…
Reference in New Issue