MOBILE-4239 core: Remove cannotconnect version

main
Noel De Martin 2023-01-17 17:14:49 +01:00
parent 5ecea64d70
commit 250c6c1db8
6 changed files with 9 additions and 14 deletions

View File

@ -15,7 +15,6 @@
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { CoreError } from '@classes/errors/error'; import { CoreError } from '@classes/errors/error';
import { CoreSite } from '@classes/site';
import { CoreCourseActivitySyncBaseProvider } from '@features/course/classes/activity-sync'; import { CoreCourseActivitySyncBaseProvider } from '@features/course/classes/activity-sync';
import { CoreCourse, CoreCourseModuleBasicInfo } from '@features/course/services/course'; import { CoreCourse, CoreCourseModuleBasicInfo } from '@features/course/services/course';
import { CoreCourseLogHelper } from '@features/course/services/log-helper'; import { CoreCourseLogHelper } from '@features/course/services/log-helper';
@ -314,7 +313,7 @@ export class AddonModQuizSyncProvider extends CoreCourseActivitySyncBaseProvider
if (!CoreNetwork.isOnline()) { if (!CoreNetwork.isOnline()) {
// Cannot sync in offline. // Cannot sync in offline.
throw new CoreError(Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION })); throw new CoreError(Translate.instant('core.cannotconnect'));
} }
const offlineAttempt = offlineAttempts.pop()!; const offlineAttempt = offlineAttempts.pop()!;

View File

@ -806,7 +806,7 @@ export class CoreSite {
): Promise<T> { ): Promise<T> {
if (preSets.forceOffline) { if (preSets.forceOffline) {
// Don't call the WS, just fail. // Don't call the WS, just fail.
throw new CoreError(Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION })); throw new CoreError(Translate.instant('core.cannotconnect'));
} }
try { try {
@ -1694,7 +1694,7 @@ export class CoreSite {
.catch(async () => { .catch(async () => {
if (cachePreSets.forceOffline) { if (cachePreSets.forceOffline) {
// Don't call the WS, just fail. // Don't call the WS, just fail.
throw new CoreError(Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION })); throw new CoreError(Translate.instant('core.cannotconnect'));
} }
// Call the WS. // Call the WS.

View File

@ -45,7 +45,6 @@ import { CoreErrorInfoComponent } from '@components/error-info/error-info';
import { CoreUserSupportConfig } from '@features/user/classes/support/support-config'; import { CoreUserSupportConfig } from '@features/user/classes/support/support-config';
import { CoreUserGuestSupportConfig } from '@features/user/classes/support/guest-support-config'; import { CoreUserGuestSupportConfig } from '@features/user/classes/support/guest-support-config';
import { CoreLoginError } from '@classes/errors/loginerror'; import { CoreLoginError } from '@classes/errors/loginerror';
import { CoreSite } from '@classes/site';
/** /**
* Site (url) chooser when adding a new site. * Site (url) chooser when adding a new site.
@ -420,7 +419,7 @@ export class CoreLoginSitePage implements OnInit {
text: Translate.instant('core.contactsupport'), text: Translate.instant('core.contactsupport'),
handler: () => CoreUserSupport.contact({ handler: () => CoreUserSupport.contact({
supportConfig: alertSupportConfig, supportConfig: alertSupportConfig,
subject: Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION }), subject: Translate.instant('core.cannotconnect'),
message: `Error: ${errorCode}\n\n${errorDetails}`, message: `Error: ${errorCode}\n\n${errorDetails}`,
}), }),
} }
@ -435,11 +434,10 @@ export class CoreLoginSitePage implements OnInit {
), ),
].filter(button => !!button); ].filter(button => !!button);
// @todo Remove CoreSite.MINIMUM_MOODLE_VERSION, not used on translations since 3.9.0.
const alertElement = await CoreDomUtils.showAlertWithOptions({ const alertElement = await CoreDomUtils.showAlertWithOptions({
header: errorTitle ?? ( header: errorTitle ?? (
siteExists siteExists
? Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION }) ? Translate.instant('core.cannotconnect')
: Translate.instant('core.sitenotfound') : Translate.instant('core.sitenotfound')
), ),
message: errorMessage ?? Translate.instant('core.sitenotfoundhelp'), message: errorMessage ?? Translate.instant('core.sitenotfoundhelp'),

View File

@ -55,7 +55,6 @@ import { lazyMap, LazyMap } from '../utils/lazy-map';
import { asyncInstance, AsyncInstance } from '../utils/async-instance'; import { asyncInstance, AsyncInstance } from '../utils/async-instance';
import { CorePath } from '@singletons/path'; import { CorePath } from '@singletons/path';
import { CorePromisedValue } from '@classes/promised-value'; import { CorePromisedValue } from '@classes/promised-value';
import { CoreSite } from '@classes/site';
/* /*
* Factory for handling downloading files and retrieve downloaded files. * Factory for handling downloading files and retrieve downloaded files.
@ -510,7 +509,7 @@ export class CoreFilepoolProvider {
} else { } else {
if (!CoreNetwork.isOnline()) { if (!CoreNetwork.isOnline()) {
// Cannot check size in offline, stop. // Cannot check size in offline, stop.
throw new CoreError(Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION })); throw new CoreError(Translate.instant('core.cannotconnect'));
} }
size = await CoreWS.getRemoteFileSize(fileUrl); size = await CoreWS.getRemoteFileSize(fileUrl);

View File

@ -363,7 +363,7 @@ export class CoreSitesProvider {
if (error instanceof CoreAjaxError || !('errorcode' in error)) { if (error instanceof CoreAjaxError || !('errorcode' in error)) {
// The WS didn't return data, probably cannot connect. // The WS didn't return data, probably cannot connect.
return new CoreLoginError({ return new CoreLoginError({
title: Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION }), title: Translate.instant('core.cannotconnect'),
message: Translate.instant('core.siteunavailablehelp', { site: siteUrl }), message: Translate.instant('core.siteunavailablehelp', { site: siteUrl }),
errorcode: 'publicconfigfailed', errorcode: 'publicconfigfailed',
errorDetails: error.message || '', errorDetails: error.message || '',
@ -374,7 +374,7 @@ export class CoreSitesProvider {
// Service supported but an error happened. Return error. // Service supported but an error happened. Return error.
const options: CoreLoginErrorOptions = { const options: CoreLoginErrorOptions = {
critical: true, critical: true,
title: Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION }), title: Translate.instant('core.cannotconnect'),
message: Translate.instant('core.siteunavailablehelp', { site: siteUrl }), message: Translate.instant('core.siteunavailablehelp', { site: siteUrl }),
errorcode: error.errorcode, errorcode: error.errorcode,
supportConfig: error.supportConfig, supportConfig: error.supportConfig,

View File

@ -57,7 +57,6 @@ import { CoreNetwork } from '@services/network';
import { CoreSiteError } from '@classes/errors/siteerror'; import { CoreSiteError } from '@classes/errors/siteerror';
import { CoreUserSupport } from '@features/user/services/support'; import { CoreUserSupport } from '@features/user/services/support';
import { CoreErrorInfoComponent } from '@components/error-info/error-info'; import { CoreErrorInfoComponent } from '@components/error-info/error-info';
import { CoreSite } from '@classes/site';
/* /*
* "Utils" service with helper functions for UI, DOM elements and HTML code. * "Utils" service with helper functions for UI, DOM elements and HTML code.
@ -1373,7 +1372,7 @@ export class CoreDomUtilsProvider {
} else if (this.isSiteUnavailableError(message)) { } else if (this.isSiteUnavailableError(message)) {
alertOptions.header = CoreSites.isLoggedIn() alertOptions.header = CoreSites.isLoggedIn()
? Translate.instant('core.connectionlost') ? Translate.instant('core.connectionlost')
: Translate.instant('core.cannotconnect', { $a: CoreSite.MINIMUM_MOODLE_VERSION }); : Translate.instant('core.cannotconnect');
} else { } else {
alertOptions.header = Translate.instant('core.error'); alertOptions.header = Translate.instant('core.error');
} }