commit
15d32b6577
|
@ -576,9 +576,13 @@ export class CoreSite {
|
|||
|
||||
// Call the WS.
|
||||
try {
|
||||
// Send the language to use. Do it after checking cache to prevent losing offline data when changing language.
|
||||
data.moodlewssettinglang = preSets.lang ?? await CoreLang.getCurrentLanguage();
|
||||
data.moodlewssettinglang = data.moodlewssettinglang.replace('-', '_'); // Moodle uses underscore instead of dash.
|
||||
if (method !== 'core_webservice_get_site_info') {
|
||||
// Send the language to use. Do it after checking cache to prevent losing offline data when changing language.
|
||||
// Don't send it to core_webservice_get_site_info, that WS is used to check if Moodle version is supported.
|
||||
data.moodlewssettinglang = preSets.lang ?? await CoreLang.getCurrentLanguage();
|
||||
// Moodle uses underscore instead of dash.
|
||||
data.moodlewssettinglang = data.moodlewssettinglang.replace('-', '_');
|
||||
}
|
||||
|
||||
const response = await this.callOrEnqueueRequest<T>(method, data, preSets, wsPreSets);
|
||||
|
||||
|
|
|
@ -121,11 +121,16 @@ export class CoreScreenService {
|
|||
*/
|
||||
watchOrientation(): void {
|
||||
// Listen media orientation CSS queries.
|
||||
window.matchMedia('(orientation: portrait)').addEventListener('change', (m) => {
|
||||
const changeListener = (m: MediaQueryListEvent) => {
|
||||
const orientation = m.matches ? CoreScreenOrientation.PORTRAIT : CoreScreenOrientation.LANDSCAPE;
|
||||
|
||||
CoreEvents.trigger(CoreEvents.ORIENTATION_CHANGE, { orientation });
|
||||
});
|
||||
};
|
||||
|
||||
const mql = window.matchMedia('(orientation: portrait)');
|
||||
mql.addEventListener ?
|
||||
mql.addEventListener('change', changeListener) :
|
||||
mql.addListener(changeListener);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -262,7 +262,7 @@ export class CoreSitesProvider {
|
|||
}
|
||||
|
||||
// Service supported but an error happened. Return error.
|
||||
if (error.errorcode == 'codingerror') {
|
||||
if (error.errorcode === 'codingerror') {
|
||||
// This could be caused by a redirect. Check if it's the case.
|
||||
const redirect = await CoreUtils.checkRedirect(siteUrl);
|
||||
|
||||
|
@ -272,6 +272,9 @@ export class CoreSitesProvider {
|
|||
// We can't be sure if there is a redirect or not. Display cannot connect error.
|
||||
error.message = Translate.instant('core.cannotconnecttrouble');
|
||||
}
|
||||
} else if (error.errorcode === 'invalidrecord') {
|
||||
// WebService not found, site not supported.
|
||||
error.message = Translate.instant('core.login.invalidmoodleversion', { $a: CoreSite.MINIMUM_MOODLE_VERSION });
|
||||
}
|
||||
|
||||
return new CoreSiteError({
|
||||
|
|
Loading…
Reference in New Issue