From ba150fb8b9330e166a4c44aab252c38a56e6c359 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 23 Nov 2022 09:45:53 +0100 Subject: [PATCH 1/4] MOBILE-4081 settings: Fix font size change click on other elements --- .../settings/pages/general/general.html | 18 +++---- .../settings/pages/general/general.ts | 52 ++++++++++++++++--- 2 files changed, 54 insertions(+), 16 deletions(-) diff --git a/src/core/features/settings/pages/general/general.html b/src/core/features/settings/pages/general/general.html index 3c463ffe7..c3de108b3 100644 --- a/src/core/features/settings/pages/general/general.html +++ b/src/core/features/settings/pages/general/general.html @@ -15,7 +15,7 @@

{{ 'core.settings.language' | translate }}

- {{ entry.name }} @@ -24,9 +24,9 @@

{{ 'core.settings.fontsize' | translate }}

- - + + {{ 'core.settings.fontsizecharacter' | translate }} @@ -40,7 +40,7 @@

{{ 'core.settings.colorscheme' | translate }}

{{ 'core.settings.forcedsetting' | translate }}

- {{ 'core.settings.colorscheme-' + scheme | translate }} @@ -56,13 +56,13 @@

{{ 'core.settings.enablerichtexteditor' | translate }}

{{ 'core.settings.enablerichtexteditordescription' | translate }}

- +

{{ 'core.settings.ioscookies' | translate }}

{{ 'core.settings.ioscookiesdescription' | translate }}

- + {{ 'core.opensettings' | translate }}
@@ -72,14 +72,14 @@

{{ 'core.settings.debugdisplay' | translate }}

{{ 'core.settings.debugdisplaydescription' | translate }}

- +

{{ 'core.settings.enablefirebaseanalytics' | translate }}

{{ 'core.settings.enablefirebaseanalyticsdescription' | translate }}

- +
diff --git a/src/core/features/settings/pages/general/general.ts b/src/core/features/settings/pages/general/general.ts index 31ecf47e6..04d0db1ce 100644 --- a/src/core/features/settings/pages/general/general.ts +++ b/src/core/features/settings/pages/general/general.ts @@ -111,8 +111,13 @@ export class CoreSettingsGeneralPage { /** * Called when a new language is selected. + * + * @param ev: Event */ - async languageChanged(): Promise { + async languageChanged(ev: Event): Promise { + ev.stopPropagation(); + ev.preventDefault(); + const previousLanguage = await CoreLang.getCurrentLanguage(); if (this.selectedLanguage === previousLanguage) { // Prevent opening again. @@ -177,8 +182,16 @@ export class CoreSettingsGeneralPage { /** * Called when a new zoom level is selected. + * + * @param ev: Event + * @param value: New value */ - zoomLevelChanged(): void { + zoomLevelChanged(ev: Event, value: CoreZoomLevel): void { + ev.stopPropagation(); + ev.preventDefault(); + + this.selectedZoomLevel = value; + this.zoomLevels = this.zoomLevels.map((fontSize) => { fontSize.selected = fontSize.value === this.selectedZoomLevel; @@ -191,31 +204,51 @@ export class CoreSettingsGeneralPage { /** * Called when a new color scheme is selected. + * + * @param ev: Event */ - colorSchemeChanged(): void { + colorSchemeChanged(ev: Event): void { + ev.stopPropagation(); + ev.preventDefault(); + CoreSettingsHelper.setColorScheme(this.selectedScheme); CoreConfig.set(CoreConstants.SETTINGS_COLOR_SCHEME, this.selectedScheme); } /** * Called when the rich text editor is enabled or disabled. + * + * @param ev: Event */ - richTextEditorChanged(): void { + richTextEditorChanged(ev: Event): void { + ev.stopPropagation(); + ev.preventDefault(); + CoreConfig.set(CoreConstants.SETTINGS_RICH_TEXT_EDITOR, this.richTextEditor ? 1 : 0); } /** * Called when the debug display setting is enabled or disabled. + * + * @param ev: Event */ - debugDisplayChanged(): void { + debugDisplayChanged(ev: Event): void { + ev.stopPropagation(); + ev.preventDefault(); + CoreConfig.set(CoreConstants.SETTINGS_DEBUG_DISPLAY, this.debugDisplay ? 1 : 0); CoreDomUtils.setDebugDisplay(this.debugDisplay); } /** * Called when the analytics setting is enabled or disabled. + * + * @param ev: Event */ - async analyticsEnabledChanged(): Promise { + async analyticsEnabledChanged(ev: Event): Promise { + ev.stopPropagation(); + ev.preventDefault(); + await CorePushNotifications.enableAnalytics(this.analyticsEnabled); CoreConfig.set(CoreConstants.SETTINGS_ANALYTICS_ENABLED, this.analyticsEnabled ? 1 : 0); @@ -223,8 +256,13 @@ export class CoreSettingsGeneralPage { /** * Open native settings. + * + * @param ev: Event */ - openNativeSettings(): void { + openNativeSettings(ev: Event): void { + ev.stopPropagation(); + ev.preventDefault(); + Diagnostic.switchToSettings(); } From 8c22f9a44d9186210d15b42af2ae63c2276d0ef0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 23 Nov 2022 09:46:08 +0100 Subject: [PATCH 2/4] MOBILE-4081 style: Fix outline clicked text color on iOS --- src/theme/theme.base.scss | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/theme/theme.base.scss b/src/theme/theme.base.scss index 59d08893e..f1206c51f 100644 --- a/src/theme/theme.base.scss +++ b/src/theme/theme.base.scss @@ -327,6 +327,9 @@ ion-button.button-outline { --background: var(--core-input-background); --color: var(--core-input-text); --ion-color-primary: var(--core-input-text); + &.ios { + --color-activated: var(--contrast-background); + } } ion-button.button-solid { From eac671c5b3ad47f41b849d9fdd0aa5968eb13aa9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 23 Nov 2022 11:07:07 +0100 Subject: [PATCH 3/4] MOBILE-4081 style: Improve style on message settings --- .../messages/pages/settings/settings.html | 80 +++++++++++-------- .../messages/pages/settings/settings.page.ts | 9 ++- 2 files changed, 51 insertions(+), 38 deletions(-) diff --git a/src/addons/messages/pages/settings/settings.html b/src/addons/messages/pages/settings/settings.html index ef1d86892..fe58ac796 100644 --- a/src/addons/messages/pages/settings/settings.html +++ b/src/addons/messages/pages/settings/settings.html @@ -13,31 +13,56 @@ + + + + + +

{{ 'core.settings.general' | translate }}

+
+
+ + +

{{ 'addon.messages.useentertosend' | translate }}

+
+ +
+
+
+ - {{ 'addon.messages.blocknoncontacts' | translate }} - + +

{{ 'addon.messages.blocknoncontacts' | translate }}

+
+
- +

{{ 'addon.messages.contactableprivacy' | translate }}

- - {{ 'addon.messages.contactableprivacy_onlycontacts' | translate }} + + +

{{ 'addon.messages.contactableprivacy_onlycontacts' | translate }}

+
- - {{ 'addon.messages.contactableprivacy_coursemember' | translate }} + + +

{{ 'addon.messages.contactableprivacy_coursemember' | translate }}

+
- - {{ 'addon.messages.contactableprivacy_site' | translate }} + + +

{{ 'addon.messages.contactableprivacy_site' | translate }}

+
@@ -53,23 +78,6 @@ - - - - - - -

{{ 'core.settings.general' | translate }}

-
-
- - -

{{ 'addon.messages.useentertosend' | translate }}

-
- -
-
-
@@ -94,18 +102,20 @@ - {{ 'core.settings.' + state | translate }} + +

{{ 'core.settings.' + state | translate }}

+
- + - + {{'core.settings.forced' | translate }} - + {{'core.settings.disallowed' | translate }} @@ -129,18 +139,20 @@ - {{ processor.displayname }} + +

{{ processor.displayname }}

+
- + - + {{ processor.lockedmessage }} - {{ 'core.settings.disabled' | translate }} + {{ 'core.settings.disabled' | translate }}
diff --git a/src/addons/messages/pages/settings/settings.page.ts b/src/addons/messages/pages/settings/settings.page.ts index c69841ece..05a8b61f1 100644 --- a/src/addons/messages/pages/settings/settings.page.ts +++ b/src/addons/messages/pages/settings/settings.page.ts @@ -70,9 +70,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy { } /** - * Runs when the page has loaded. This event only happens once per page being created. - * If a page leaves but is cached, then this event will not fire again on a subsequent viewing. - * Setup code for the page. + * @inheritdoc */ ngOnInit(): void { this.fetchPreferences(); @@ -261,6 +259,9 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy { }); } + /** + * Send on Enter toggle has changed. + */ sendOnEnterChanged(): void { // Save the value. CoreConfig.set(CoreConstants.SETTINGS_SEND_ON_ENTER, this.sendOnEnter ? 1 : 0); @@ -274,7 +275,7 @@ export class AddonMessagesSettingsPage implements OnInit, OnDestroy { } /** - * Page destroyed. + * @inheritdoc */ ngOnDestroy(): void { // If there is a pending action to update preferences, execute it right now. From 9b6a1e04fe357f43bfb075e26692eebabf5065f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pau=20Ferrer=20Oca=C3=B1a?= Date: Wed, 23 Nov 2022 11:49:09 +0100 Subject: [PATCH 4/4] MOBILE-4081 airnotifier: Improve devices list format --- .../airnotifier/pages/devices/devices.html | 44 ++++++++++------ .../airnotifier/pages/devices/devices.ts | 51 ++++++++++++------- 2 files changed, 62 insertions(+), 33 deletions(-) diff --git a/src/addons/messageoutput/airnotifier/pages/devices/devices.html b/src/addons/messageoutput/airnotifier/pages/devices/devices.html index 255e061b5..2a84773ea 100644 --- a/src/addons/messageoutput/airnotifier/pages/devices/devices.html +++ b/src/addons/messageoutput/airnotifier/pages/devices/devices.html @@ -9,24 +9,36 @@ - + - - - - -

- {{ device.name }} {{ device.model }} - ({{ 'core.currentdevice' | translate }}) -

-

{{ device.platform }} {{ device.version }}

+ + + + +

{{ platform.platform }}

- - - - -
-
+ + + + + +

+ {{ device.name }} {{ device.model }} ({{platform.platform}} {{ device.version }}) +

+

{{ 'core.currentdevice' | translate }}

+

+ {{ 'core.lastmodified' | translate }}: {{ device.timemodified * 1000 | + coreFormatDate:'strftimedatetimeshort' }} +

+
+ + + + +
+
+
+
diff --git a/src/addons/messageoutput/airnotifier/pages/devices/devices.ts b/src/addons/messageoutput/airnotifier/pages/devices/devices.ts index 6165791f2..9b431bd74 100644 --- a/src/addons/messageoutput/airnotifier/pages/devices/devices.ts +++ b/src/addons/messageoutput/airnotifier/pages/devices/devices.ts @@ -29,13 +29,13 @@ import { CoreUtils } from '@services/utils/utils'; }) export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestroy { - devices?: AddonMessageOutputAirnotifierDeviceFormatted[] = []; - devicesLoaded = false; + platformDevices: AddonMessageOutputAirnotifierPlatformDevices[] = []; + loaded = false; protected updateTimeout?: number; /** - * Component being initialized. + * @inheritdoc */ ngOnInit(): void { this.fetchDevices(); @@ -49,12 +49,11 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr protected async fetchDevices(): Promise { try { const devices = await AddonMessageOutputAirnotifier.getUserDevices(); - - this.devices = this.formatDevices(devices); + this.formatDevices(devices); } catch (error) { CoreDomUtils.showErrorModal(error); } finally { - this.devicesLoaded = true; + this.loaded = true; } } @@ -62,24 +61,37 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr * Add some calculated data for devices. * * @param devices Devices to format. - * @return Formatted devices. */ - protected formatDevices(devices: AddonMessageOutputAirnotifierDevice[]): AddonMessageOutputAirnotifierDeviceFormatted[] { - const formattedDevices: AddonMessageOutputAirnotifierDeviceFormatted[] = devices; + protected formatDevices(devices: AddonMessageOutputAirnotifierDevice[]): void { + this.platformDevices = []; + + const formattedDevices: Record = {}; const pushId = CorePushNotifications.getPushId(); // Convert enabled to boolean and search current device. - formattedDevices.forEach((device) => { + devices.forEach((device: AddonMessageOutputAirnotifierDeviceFormatted) => { + if (formattedDevices[device.platform] === undefined) { + formattedDevices[device.platform] = { + platform: device.platform, + devices: [], + }; + } + device.enable = !!device.enable; - device.current = !!(pushId && pushId == device.pushid); + device.current = pushId === device.pushid; + + formattedDevices[device.platform].devices.push(device); + }); - return formattedDevices.sort((a, b) => { - const compareA = a.name.toLowerCase(); - const compareB = b.name.toLowerCase(); + for (const platform in formattedDevices) { + const devices = formattedDevices[platform]; + devices.devices.sort((a, b) => b.timemodified - a.timemodified); - return compareA.localeCompare(compareB); - }); + devices.platform = devices.platform.replace('-fcm', ''); + + this.platformDevices.push(devices); + } } /** @@ -145,7 +157,7 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr } /** - * Page destroyed. + * @inheritdoc */ ngOnDestroy(): void { // If there is a pending action to update devices, execute it right now. @@ -157,6 +169,11 @@ export class AddonMessageOutputAirnotifierDevicesPage implements OnInit, OnDestr } +type AddonMessageOutputAirnotifierPlatformDevices = { + platform: string; + devices: AddonMessageOutputAirnotifierDeviceFormatted[]; +}; + /** * User device with some calculated data. */