Merge pull request #3240 from crazyserver/MOBILE-3833

Mobile 3833
main
Dani Palou 2022-04-07 15:17:47 +02:00 committed by GitHub
commit 1173e55644
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 41 additions and 18 deletions

20
package-lock.json generated
View File

@ -117,6 +117,7 @@
"@typescript-eslint/parser": "4.22.0",
"check-es-compat": "1.1.1",
"cordova-plugin-androidx-adapter": "1.1.3",
"cordova-plugin-screen-orientation": "^3.0.2",
"cross-env": "7.0.3",
"eslint": "7.25.0",
"eslint-config-prettier": "8.3.0",
@ -11141,6 +11142,19 @@
}
}
},
"node_modules/cordova-plugin-screen-orientation": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg==",
"dev": true,
"engines": {
"cordovaDependencies": {
"4.0.0": {
"cordova": ">100"
}
}
}
},
"node_modules/cordova-plugin-splashscreen": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-6.0.0.tgz",
@ -39599,6 +39613,12 @@
"resolved": "https://registry.npmjs.org/cordova-plugin-prevent-override/-/cordova-plugin-prevent-override-1.0.1.tgz",
"integrity": "sha512-yy1JZ+lXTR33Ai1yloT6wdXJXe0a3LrfgnKORuPZv/QkbiqfIQKjy0R4zRP8qljaJSelF/xv5CgrVt8iS0SkBg=="
},
"cordova-plugin-screen-orientation": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/cordova-plugin-screen-orientation/-/cordova-plugin-screen-orientation-3.0.2.tgz",
"integrity": "sha512-2w6CMC+HGvbhogJetalwGurL2Fx8DQCCPy3wlSZHN1/W7WoQ5n9ujVozcoKrY4VaagK6bxrPFih+ElkO8Uqfzg==",
"dev": true
},
"cordova-plugin-splashscreen": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cordova-plugin-splashscreen/-/cordova-plugin-splashscreen-6.0.0.tgz",

View File

@ -146,6 +146,7 @@
"@typescript-eslint/parser": "4.22.0",
"check-es-compat": "1.1.1",
"cordova-plugin-androidx-adapter": "1.1.3",
"cordova-plugin-screen-orientation": "^3.0.2",
"cross-env": "7.0.3",
"eslint": "7.25.0",
"eslint-config-prettier": "8.3.0",
@ -237,7 +238,8 @@
},
"@moodlehq/cordova-plugin-file-transfer": {},
"cordova-plugin-prevent-override": {},
"cordova-plugin-androidx-adapter": {}
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-screen-orientation": {}
}
},
"optionalDependencies": {

View File

@ -69,7 +69,8 @@
[message]="'addon.mod_glossary.noentriesfound' | translate">
</core-empty-box>
<core-infinite-loading [enabled]="entries && !entries.completed" [error]="loadMoreError" (action)="loadMoreEntries($event)">
<core-infinite-loading [enabled]="entries && !entries.completed && (!isSearch || hasSearched)" [error]="loadMoreError"
(action)="loadMoreEntries($event)">
</core-infinite-loading>
</core-loading>

View File

@ -95,3 +95,10 @@
flex-direction: column;
min-height: 100%;
}
// There is a bug on iOs that displays inside elements in wrong order.
// This bug seems not to affect other elements like format-text
:host-context(.ios) {
--contents-display: flex;
flex-direction: column;
}

View File

@ -16,7 +16,7 @@ import { Injectable } from '@angular/core';
import { BehaviorSubject, Observable } from 'rxjs';
import { distinctUntilChanged, map } from 'rxjs/operators';
import { makeSingleton } from '@singletons';
import { makeSingleton, Platform } from '@singletons';
import { CoreEvents } from '@singletons/events';
/**
@ -103,9 +103,9 @@ export class CoreScreenService {
}
get orientation(): CoreScreenOrientation {
const mql = window.matchMedia('(orientation: portrait)');
return mql.matches ? CoreScreenOrientation.PORTRAIT : CoreScreenOrientation.LANDSCAPE;
return screen.orientation.type.startsWith(CoreScreenOrientation.LANDSCAPE)
? CoreScreenOrientation.LANDSCAPE
: CoreScreenOrientation.PORTRAIT;
}
get isPortrait(): boolean {
@ -119,18 +119,12 @@ export class CoreScreenService {
/**
* Watch orientation changes.
*/
watchOrientation(): void {
// Listen media orientation CSS queries.
const changeListener = (m: MediaQueryListEvent) => {
const orientation = m.matches ? CoreScreenOrientation.PORTRAIT : CoreScreenOrientation.LANDSCAPE;
async watchOrientation(): Promise<void> {
await Platform.ready();
CoreEvents.trigger(CoreEvents.ORIENTATION_CHANGE, { orientation });
};
const mql = window.matchMedia('(orientation: portrait)');
mql.addEventListener ?
mql.addEventListener('change', changeListener) :
mql.addListener(changeListener);
screen.orientation.addEventListener('change', () => {
CoreEvents.trigger(CoreEvents.ORIENTATION_CHANGE, { orientation: this.orientation });
});
}
/**

View File

@ -120,7 +120,6 @@ export function setCreateSingletonMethodProxy(method: typeof createSingletonMeth
*
* @param injectionToken Injection token used to resolve the service. This is usually the service class if the provider was
* defined using a class or the string used in the `provide` key if it was defined using an object.
* @param getters Getter names to proxy.
* @return Singleton proxy.
*/
export function makeSingleton<Service extends object = object>( // eslint-disable-line @typescript-eslint/ban-types