Skip to content

Commit 3a27eda

Browse files
authored
Merge pull request #2562 from dpalou/MOBILE-3523
Mobile 3523
2 parents a948e4b + 0124b4d commit 3a27eda

File tree

20 files changed

+154
-128
lines changed

20 files changed

+154
-128
lines changed

package.json

Lines changed: 76 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -47,96 +47,96 @@
4747
"windows.store": "npx electron-windows-store --input-directory .\\desktop\\dist\\win-unpacked --output-directory .\\desktop\\store -a .\\resources\\desktop -m .\\desktop\\assets\\windows\\AppXManifest.xml --package-version 0.0.0.0 --package-name MoodleDesktop"
4848
},
4949
"dependencies": {
50-
"@angular/animations": "^5.2.11",
51-
"@angular/common": "^5.2.11",
52-
"@angular/compiler": "^5.2.11",
53-
"@angular/compiler-cli": "^5.2.11",
54-
"@angular/core": "^5.2.11",
55-
"@angular/forms": "^5.2.11",
56-
"@angular/platform-browser": "^5.2.11",
57-
"@angular/platform-browser-dynamic": "^5.2.11",
58-
"@ionic-native/badge": "^4.20.0",
59-
"@ionic-native/camera": "^4.20.0",
60-
"@ionic-native/chooser": "^4.20.0",
61-
"@ionic-native/clipboard": "^4.20.0",
62-
"@ionic-native/core": "^4.20.0",
63-
"@ionic-native/device": "^4.20.0",
64-
"@ionic-native/diagnostic": "^4.2.0",
65-
"@ionic-native/file": "^4.20.0",
66-
"@ionic-native/file-opener": "^4.20.0",
67-
"@ionic-native/file-transfer": "^4.20.0",
68-
"@ionic-native/geolocation": "^4.20.0",
69-
"@ionic-native/globalization": "^4.20.0",
70-
"@ionic-native/http": "^4.20.0",
71-
"@ionic-native/in-app-browser": "^4.20.0",
72-
"@ionic-native/keyboard": "^4.20.0",
73-
"@ionic-native/local-notifications": "^4.20.0",
74-
"@ionic-native/media": "^4.20.0",
75-
"@ionic-native/media-capture": "^4.20.0",
76-
"@ionic-native/network": "^4.20.0",
77-
"@ionic-native/push": "^4.20.0",
78-
"@ionic-native/qr-scanner": "^4.20.0",
79-
"@ionic-native/screen-orientation": "^4.20.0",
80-
"@ionic-native/splash-screen": "^4.20.0",
81-
"@ionic-native/sqlite": "^4.20.0",
82-
"@ionic-native/status-bar": "^4.20.0",
83-
"@ionic-native/web-intent": "^4.20.0",
84-
"@ionic-native/zip": "^4.20.0",
85-
"@ngx-translate/core": "^8.0.0",
86-
"@ngx-translate/http-loader": "^2.0.1",
87-
"ajv": "^6.11.0",
88-
"chart.js": "^2.9.3",
89-
"com-darryncampbell-cordova-plugin-intent": "^1.3.0",
90-
"cordova": "^10.0.0",
91-
"cordova-android": "^8.1.0",
92-
"cordova-android-support-gradle-release": "^3.0.1",
93-
"cordova-clipboard": "^1.3.0",
94-
"cordova-ios": "^5.1.1",
95-
"cordova-plugin-advanced-http": "^2.4.1",
96-
"cordova-plugin-badge": "^0.8.8",
97-
"cordova-plugin-camera": "^4.1.0",
98-
"cordova-plugin-chooser": "^1.3.2",
99-
"cordova-plugin-customurlscheme": "^5.0.1",
100-
"cordova-plugin-device": "^2.0.3",
101-
"cordova-plugin-file": "^6.0.2",
102-
"cordova-plugin-file-opener2": "^3.0.4",
103-
"cordova-plugin-file-transfer": "^1.7.1",
50+
"@angular/animations": "5.2.11",
51+
"@angular/common": "5.2.11",
52+
"@angular/compiler": "5.2.11",
53+
"@angular/compiler-cli": "5.2.11",
54+
"@angular/core": "5.2.11",
55+
"@angular/forms": "5.2.11",
56+
"@angular/platform-browser": "5.2.11",
57+
"@angular/platform-browser-dynamic": "5.2.11",
58+
"@ionic-native/badge": "4.20.0",
59+
"@ionic-native/camera": "4.20.0",
60+
"@ionic-native/chooser": "4.20.0",
61+
"@ionic-native/clipboard": "4.20.0",
62+
"@ionic-native/core": "4.20.0",
63+
"@ionic-native/device": "4.20.0",
64+
"@ionic-native/diagnostic": "4.2.0",
65+
"@ionic-native/file": "4.20.0",
66+
"@ionic-native/file-opener": "4.20.0",
67+
"@ionic-native/file-transfer": "4.20.0",
68+
"@ionic-native/geolocation": "4.20.0",
69+
"@ionic-native/globalization": "4.20.0",
70+
"@ionic-native/http": "4.20.0",
71+
"@ionic-native/in-app-browser": "4.20.0",
72+
"@ionic-native/keyboard": "4.20.0",
73+
"@ionic-native/local-notifications": "4.20.0",
74+
"@ionic-native/media": "4.20.0",
75+
"@ionic-native/media-capture": "4.20.0",
76+
"@ionic-native/network": "4.20.0",
77+
"@ionic-native/push": "4.20.0",
78+
"@ionic-native/qr-scanner": "4.20.0",
79+
"@ionic-native/screen-orientation": "4.20.0",
80+
"@ionic-native/splash-screen": "4.20.0",
81+
"@ionic-native/sqlite": "4.20.0",
82+
"@ionic-native/status-bar": "4.20.0",
83+
"@ionic-native/web-intent": "4.20.0",
84+
"@ionic-native/zip": "4.20.0",
85+
"@ngx-translate/core": "8.0.0",
86+
"@ngx-translate/http-loader": "2.0.1",
87+
"ajv": "6.11.0",
88+
"chart.js": "2.9.3",
89+
"com-darryncampbell-cordova-plugin-intent": "1.3.0",
90+
"cordova": "10.0.0",
91+
"cordova-android": "8.1.0",
92+
"cordova-android-support-gradle-release": "3.0.1",
93+
"cordova-clipboard": "1.3.0",
94+
"cordova-ios": "5.1.1",
95+
"cordova-plugin-advanced-http": "2.4.1",
96+
"cordova-plugin-badge": "0.8.8",
97+
"cordova-plugin-camera": "4.1.0",
98+
"cordova-plugin-chooser": "1.3.2",
99+
"cordova-plugin-customurlscheme": "5.0.1",
100+
"cordova-plugin-device": "2.0.3",
101+
"cordova-plugin-file": "6.0.2",
102+
"cordova-plugin-file-opener2": "3.0.4",
103+
"cordova-plugin-file-transfer": "1.7.1",
104104
"cordova-plugin-geolocation": "git+https://github.com/apache/cordova-plugin-geolocation.git#89cf51d222e8f225bdfb661965b3007d669c40ff",
105-
"cordova-plugin-globalization": "^1.11.0",
105+
"cordova-plugin-globalization": "1.11.0",
106106
"cordova-plugin-inappbrowser": "git+https://github.com/moodlemobile/cordova-plugin-inappbrowser.git#moodle",
107107
"cordova-plugin-ionic-keyboard": "2.1.3",
108108
"cordova-plugin-ionic-webview": "git+https://github.com/moodlemobile/cordova-plugin-ionic-webview.git#500-moodle",
109109
"cordova-plugin-local-notification": "git+https://github.com/moodlemobile/cordova-plugin-local-notification.git#moodle",
110-
"cordova-plugin-media": "^5.0.3",
111-
"cordova-plugin-media-capture": "^3.0.3",
112-
"cordova-plugin-network-information": "^2.0.2",
110+
"cordova-plugin-media": "5.0.3",
111+
"cordova-plugin-media-capture": "3.0.3",
112+
"cordova-plugin-network-information": "2.0.2",
113113
"cordova-plugin-qrscanner": "git+https://github.com/moodlemobile/cordova-plugin-qrscanner.git#dist",
114-
"cordova-plugin-screen-orientation": "^3.0.2",
115-
"cordova-plugin-splashscreen": "^6.0.0",
116-
"cordova-plugin-statusbar": "^2.4.3",
117-
"cordova-plugin-whitelist": "^1.3.4",
114+
"cordova-plugin-screen-orientation": "3.0.2",
115+
"cordova-plugin-splashscreen": "6.0.0",
116+
"cordova-plugin-statusbar": "2.4.3",
117+
"cordova-plugin-whitelist": "1.3.4",
118118
"cordova-plugin-wkuserscript": "git+https://github.com/moodlemobile/cordova-plugin-wkuserscript.git",
119119
"cordova-plugin-wkwebview-cookies": "git+https://github.com/moodlemobile/cordova-plugin-wkwebview-cookies.git",
120-
"cordova-plugin-zip": "^3.1.0",
121-
"cordova-sqlite-storage": "^4.0.0",
122-
"cordova-support-google-services": "^1.3.2",
123-
"es6-promise-plugin": "^4.2.2",
124-
"font-awesome": "^4.7.0",
120+
"cordova-plugin-zip": "3.1.0",
121+
"cordova-sqlite-storage": "4.0.0",
122+
"cordova-support-google-services": "1.3.2",
123+
"es6-promise-plugin": "4.2.2",
124+
"font-awesome": "4.7.0",
125125
"inquirer": "^7.3.2",
126126
"ionic-angular": "3.9.9",
127127
"ionicons": "3.0.0",
128-
"jszip": "^3.1.5",
128+
"jszip": "3.1.5",
129129
"mathjax": "2.7.7",
130-
"moment": "^2.24.0",
131-
"nl.kingsquare.cordova.background-audio": "^1.0.1",
132-
"phonegap-plugin-multidex": "^1.0.0",
130+
"moment": "2.24.0",
131+
"nl.kingsquare.cordova.background-audio": "1.0.1",
132+
"phonegap-plugin-multidex": "1.0.0",
133133
"phonegap-plugin-push": "git+https://github.com/moodlemobile/phonegap-plugin-push.git#moodle-v3",
134134
"promise.prototype.finally": "3.1.0",
135-
"rxjs": "^5.5.12",
136-
"sw-toolbox": "^3.6.0",
137-
"ts-md5": "^1.2.7",
138-
"web-animations-js": "^2.3.2",
139-
"zone.js": "^0.8.29"
135+
"rxjs": "5.5.12",
136+
"sw-toolbox": "3.6.0",
137+
"ts-md5": "1.2.7",
138+
"web-animations-js": "2.3.2",
139+
"zone.js": "0.8.29"
140140
},
141141
"devDependencies": {
142142
"@ionic/app-scripts": "3.2.3",

src/components/iframe/iframe.ts

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import { CoreUrlUtilsProvider } from '@providers/utils/url';
2424
import { CoreIframeUtilsProvider } from '@providers/utils/iframe';
2525
import { CoreUtilsProvider } from '@providers/utils/utils';
2626
import { CoreSplitViewComponent } from '@components/split-view/split-view';
27-
import { CoreUrl } from '@singletons/url';
28-
import { CoreApp } from '@providers/app';
29-
import { WKWebViewCookiesWindow } from 'cordova-plugin-wkwebview-cookies';
3027

3128
@Component({
3229
selector: 'core-iframe',
@@ -107,24 +104,7 @@ export class CoreIframeComponent implements OnChanges {
107104
if (changes.src) {
108105
const url = this.urlUtils.getYoutubeEmbedUrl(changes.src.currentValue) || changes.src.currentValue;
109106

110-
if (CoreApp.instance.isIOS() && url && !this.urlUtils.isLocalFileUrl(url)) {
111-
// Save a "fake" cookie for the iframe's domain to fix a bug in WKWebView.
112-
try {
113-
const win = <WKWebViewCookiesWindow> window;
114-
const urlParts = CoreUrl.parse(url);
115-
116-
if (urlParts.domain) {
117-
await win.WKWebViewCookies.setCookie({
118-
name: 'MoodleAppCookieForWKWebView',
119-
value: '1',
120-
domain: urlParts.domain,
121-
});
122-
}
123-
} catch (err) {
124-
// Ignore errors.
125-
this.logger.error('Error setting cookie', err);
126-
}
127-
}
107+
await this.iframeUtils.fixIframeCookies(url);
128108

129109
this.safeUrl = this.sanitizer.bypassSecurityTrustResourceUrl(CoreFile.instance.convertFileSrc(url));
130110

src/core/contentlinks/providers/delegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ export class CoreContentLinksDelegate {
191191

192192
// Add them to the list.
193193
linkActions.push({
194-
priority: handler.priority,
194+
priority: handler.priority || 0,
195195
actions: actions
196196
});
197197
}

src/core/course/providers/options-delegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export class CoreCourseOptionsDelegate extends CoreDelegate {
405405
promises.push(Promise.resolve(getFunction.call(handler, injector, course)).then((data) => {
406406
handlersToDisplay.push({
407407
data: data,
408-
priority: handler.priority,
408+
priority: handler.priority || 0,
409409
prefetch: handler.prefetch && handler.prefetch.bind(handler),
410410
name: handler.name
411411
});

src/core/editor/components/rich-text-editor/rich-text-editor.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import { Component, Input, Output, EventEmitter, ViewChild, ElementRef, AfterContentInit, OnDestroy, Optional }
1616
from '@angular/core';
1717
import { TextInput, Content, Platform, Slides } from 'ionic-angular';
18+
import { Device } from '@ionic-native/device';
1819
import { CoreApp } from '@providers/app';
1920
import { CoreSitesProvider } from '@providers/sites';
2021
import { CoreFilepoolProvider } from '@providers/filepool';
@@ -118,7 +119,8 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
118119
protected events: CoreEventsProvider,
119120
protected utils: CoreUtilsProvider,
120121
protected platform: Platform,
121-
protected editorOffline: CoreEditorOfflineProvider) {
122+
protected editorOffline: CoreEditorOfflineProvider,
123+
protected device: Device) {
122124
this.contentChanged = new EventEmitter<string>();
123125
this.element = elementRef.nativeElement as HTMLDivElement;
124126
this.pageInstance = 'app_' + Date.now(); // Generate a "unique" ID based on timestamp.
@@ -236,7 +238,7 @@ export class CoreEditorRichTextEditorComponent implements AfterContentInit, OnDe
236238
if (CoreApp.instance.isAndroid()) {
237239
// In Android we ignore the keyboard height because it is not part of the web view.
238240
height = this.domUtils.getContentHeight(this.content) - this.getSurroundingHeight(this.element);
239-
} else if (CoreApp.instance.isIOS() && this.kbHeight > 0 && this.platform.version().major < 12) {
241+
} else if (CoreApp.instance.isIOS() && this.kbHeight > 0 && Number(this.device.version.split('.')[0]) < 12) {
240242
// Keyboard open in iOS 11 or previous. The window height changes when the keyboard is open.
241243
height = window.innerHeight - this.getSurroundingHeight(this.element);
242244

src/core/fileuploader/providers/delegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export class CoreFileUploaderDelegate extends CoreDelegate {
177177
}
178178

179179
const data: CoreFileUploaderHandlerDataToReturn = handler.getData();
180-
data.priority = handler.priority;
180+
data.priority = handler.priority || 0;
181181
data.mimetypes = supportedMimetypes;
182182
handlers.push(data);
183183
}

src/core/fileuploader/providers/file-handler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@ export class CoreFileUploaderFileHandler implements CoreFileUploaderHandler {
4444
* @return True or promise resolved with true if enabled.
4545
*/
4646
isEnabled(): boolean | Promise<boolean> {
47-
return CoreApp.instance.isAndroid() || !CoreApp.instance.isMobile() ||
48-
(CoreApp.instance.isIOS() && this.platform.version().major >= 9);
47+
return true;
4948
}
5049

5150
/**

src/core/mainmenu/pages/menu/menu.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class CoreMainMenuPage implements OnDestroy {
4646
protected urlToOpen: string;
4747
protected mainMenuId: number;
4848
protected keyboardObserver: any;
49+
protected resizeFunction;
4950

5051
@ViewChild('mainTabs') mainTabs: CoreIonTabsComponent;
5152

@@ -115,7 +116,8 @@ export class CoreMainMenuPage implements OnDestroy {
115116
}
116117
});
117118

118-
window.addEventListener('resize', this.initHandlers.bind(this));
119+
this.resizeFunction = this.initHandlers.bind(this);
120+
window.addEventListener('resize', this.resizeFunction);
119121

120122
if (CoreApp.instance.isIOS()) {
121123
// In iOS, the resize event is triggered before the keyboard is opened/closed and not triggered again once done.
@@ -241,7 +243,7 @@ export class CoreMainMenuPage implements OnDestroy {
241243
ngOnDestroy(): void {
242244
this.subscription && this.subscription.unsubscribe();
243245
this.redirectObs && this.redirectObs.off();
244-
window.removeEventListener('resize', this.initHandlers.bind(this));
246+
window.removeEventListener('resize', this.resizeFunction);
245247
CoreApp.instance.setMainMenuOpen(this.mainMenuId, false);
246248
this.keyboardObserver && this.keyboardObserver.off();
247249
}

src/core/mainmenu/providers/delegate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class CoreMainMenuDelegate extends CoreDelegate {
162162
handlersData.push({
163163
name: name,
164164
data: data,
165-
priority: handler.priority
165+
priority: handler.priority || 0,
166166
});
167167
}
168168

src/core/pushnotifications/providers/delegate.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export class CorePushNotificationsDelegate {
177177

178178
this.logger.log(`Registered addon '${handler.name}'`);
179179
this.clickHandlers[handler.name] = handler;
180+
handler.priority = handler.priority || 0;
180181

181182
return true;
182183
}

0 commit comments

Comments
 (0)