MOBILE-4074 configs: Add default zoom level
parent
a8220cb894
commit
a7f2016f9f
|
@ -76,9 +76,10 @@
|
||||||
"password": "moodle"
|
"password": "moodle"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"defaultZoomLevel": "none",
|
||||||
"zoomlevels": {
|
"zoomlevels": {
|
||||||
"normal": 100,
|
"none": 100,
|
||||||
"low": 110,
|
"medium": 110,
|
||||||
"high": 120
|
"high": 120
|
||||||
},
|
},
|
||||||
"customurlscheme": "moodlemobile",
|
"customurlscheme": "moodlemobile",
|
||||||
|
|
|
@ -41,7 +41,7 @@ export class CoreSettingsGeneralPage {
|
||||||
languages: { code: string; name: string }[] = [];
|
languages: { code: string; name: string }[] = [];
|
||||||
selectedLanguage = '';
|
selectedLanguage = '';
|
||||||
zoomLevels: { value: CoreZoomLevel; style: number; selected: boolean }[] = [];
|
zoomLevels: { value: CoreZoomLevel; style: number; selected: boolean }[] = [];
|
||||||
selectedZoomLevel = CoreZoomLevel.NORMAL;
|
selectedZoomLevel = CoreZoomLevel.NONE;
|
||||||
richTextEditor = true;
|
richTextEditor = true;
|
||||||
debugDisplay = false;
|
debugDisplay = false;
|
||||||
analyticsSupported = false;
|
analyticsSupported = false;
|
||||||
|
|
|
@ -50,8 +50,8 @@ export const enum CoreColorScheme {
|
||||||
* Constants to define zoom levels.
|
* Constants to define zoom levels.
|
||||||
*/
|
*/
|
||||||
export const enum CoreZoomLevel {
|
export const enum CoreZoomLevel {
|
||||||
NORMAL = 'normal',
|
NONE = 'none',
|
||||||
LOW = 'low',
|
MEDIUM = 'medium',
|
||||||
HIGH = 'high',
|
HIGH = 'high',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,13 +303,13 @@ export class CoreSettingsHelperProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset the value to solve edge cases.
|
// Reset the value to solve edge cases.
|
||||||
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.NORMAL);
|
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.NONE);
|
||||||
|
|
||||||
if (fontSize < 100) {
|
if (fontSize < 100) {
|
||||||
if (fontSize > 90) {
|
if (fontSize > 90) {
|
||||||
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.HIGH);
|
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.HIGH);
|
||||||
} else if (fontSize > 70) {
|
} else if (fontSize > 70) {
|
||||||
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.LOW);
|
CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.MEDIUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ export class CoreSettingsHelperProvider {
|
||||||
* @return The saved zoom Level option.
|
* @return The saved zoom Level option.
|
||||||
*/
|
*/
|
||||||
async getZoomLevel(): Promise<CoreZoomLevel> {
|
async getZoomLevel(): Promise<CoreZoomLevel> {
|
||||||
return CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.NORMAL);
|
return CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreConstants.CONFIG.defaultZoomLevel);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -23,6 +23,7 @@ import { CoreLoginHelper } from '@features/login/services/login-helper';
|
||||||
import { CoreSites } from './sites';
|
import { CoreSites } from './sites';
|
||||||
import { CoreUtils, PromiseDefer } from './utils/utils';
|
import { CoreUtils, PromiseDefer } from './utils/utils';
|
||||||
import { CoreApp } from './app';
|
import { CoreApp } from './app';
|
||||||
|
import { CoreZoomLevel } from '@features/settings/services/settings-helper';
|
||||||
|
|
||||||
const VERSION_APPLIED = 'version_applied';
|
const VERSION_APPLIED = 'version_applied';
|
||||||
|
|
||||||
|
@ -71,6 +72,10 @@ export class CoreUpdateManagerProvider {
|
||||||
promises.push(CoreH5P.h5pPlayer.deleteAllContentIndexes());
|
promises.push(CoreH5P.h5pPlayer.deleteAllContentIndexes());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (versionCode >= 41000 && versionApplied < 41000 && versionApplied > 0) {
|
||||||
|
promises.push(this.upgradeFontSizeNames());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await Promise.all(promises);
|
await Promise.all(promises);
|
||||||
|
|
||||||
|
@ -121,6 +126,19 @@ export class CoreUpdateManagerProvider {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async upgradeFontSizeNames(): Promise<void> {
|
||||||
|
const storedFontSizeName = await CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL);
|
||||||
|
switch (storedFontSizeName) {
|
||||||
|
case 'low':
|
||||||
|
await CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.NONE);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'normal':
|
||||||
|
await CoreConfig.set(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.MEDIUM);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const CoreUpdateManager = makeSingleton(CoreUpdateManagerProvider);
|
export const CoreUpdateManager = makeSingleton(CoreUpdateManagerProvider);
|
||||||
|
|
|
@ -1792,12 +1792,12 @@ export class CoreDomUtilsProvider {
|
||||||
|
|
||||||
const { waitForDismissCompleted, ...popoverOptions } = options;
|
const { waitForDismissCompleted, ...popoverOptions } = options;
|
||||||
const popover = await PopoverController.create(popoverOptions);
|
const popover = await PopoverController.create(popoverOptions);
|
||||||
const zoomLevel = await CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreZoomLevel.NORMAL);
|
const zoomLevel = await CoreConfig.get(CoreConstants.SETTINGS_ZOOM_LEVEL, CoreConstants.CONFIG.defaultZoomLevel);
|
||||||
|
|
||||||
await popover.present();
|
await popover.present();
|
||||||
|
|
||||||
// Fix popover position if zoom is applied.
|
// Fix popover position if zoom is applied.
|
||||||
if (zoomLevel !== CoreZoomLevel.NORMAL) {
|
if (zoomLevel !== CoreZoomLevel.NONE) {
|
||||||
switch (getMode()) {
|
switch (getMode()) {
|
||||||
case 'ios':
|
case 'ios':
|
||||||
fixIOSPopoverPosition(popover, options.event);
|
fixIOSPopoverPosition(popover, options.event);
|
||||||
|
|
|
@ -39,6 +39,7 @@ export interface EnvironmentConfig {
|
||||||
wsservice: string;
|
wsservice: string;
|
||||||
demo_sites: Record<string, CoreSitesDemoSiteData>;
|
demo_sites: Record<string, CoreSitesDemoSiteData>;
|
||||||
zoomlevels: Record<CoreZoomLevel, number>;
|
zoomlevels: Record<CoreZoomLevel, number>;
|
||||||
|
defaultZoomLevel?: CoreZoomLevel; // Set the default zoom level of the app.
|
||||||
customurlscheme: string;
|
customurlscheme: string;
|
||||||
siteurl: string;
|
siteurl: string;
|
||||||
sitename: string;
|
sitename: string;
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
This files describes API changes in the Moodle Mobile app,
|
This files describes API changes in the Moodle Mobile app,
|
||||||
information provided here is intended especially for developers.
|
information provided here is intended especially for developers.
|
||||||
|
|
||||||
|
=== 4.0.1 ===
|
||||||
|
|
||||||
|
- Zoom levels changed from "normal / low / high" to " none / medium / high".
|
||||||
|
|
||||||
=== 4.0.0 ===
|
=== 4.0.0 ===
|
||||||
|
|
||||||
- The versioncode in moodle.config.json has changed from 4 digits to 5 digits to match the actual value for the stores: the 4.0.0 version's versioncode is now 40000 instead of 4000. If you maintain a Moodle plugin with mobile support and you use the versioncode that is sent in every request, you might need to check if this change will affect your code.
|
- The versioncode in moodle.config.json has changed from 4 digits to 5 digits to match the actual value for the stores: the 4.0.0 version's versioncode is now 40000 instead of 4000. If you maintain a Moodle plugin with mobile support and you use the versioncode that is sent in every request, you might need to check if this change will affect your code.
|
||||||
|
|
Loading…
Reference in New Issue