From a6c84b25f200e3246d218f06c90ebfc260006bef Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Thu, 24 Jan 2019 14:36:08 +0100 Subject: [PATCH 1/6] MOBILE-2829 mac: Fix single instance in Mac apps --- desktop/assets/mac/parent.plist | 2 ++ 1 file changed, 2 insertions(+) diff --git a/desktop/assets/mac/parent.plist b/desktop/assets/mac/parent.plist index 9e39db337..0941fd051 100644 --- a/desktop/assets/mac/parent.plist +++ b/desktop/assets/mac/parent.plist @@ -16,5 +16,7 @@ com.apple.security.device.audio-input + LSMultipleInstancesProhibited + \ No newline at end of file From 336b50cc9281f1a827b9b4360ad26a5fb9acca9e Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 25 Jan 2019 11:30:46 +0100 Subject: [PATCH 2/6] MOBILE-2829 mac: Use inappbrowser for SSO in Mac --- desktop/assets/mac/parent.plist | 2 -- src/core/login/providers/helper.ts | 4 ++-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/desktop/assets/mac/parent.plist b/desktop/assets/mac/parent.plist index 0941fd051..9e39db337 100644 --- a/desktop/assets/mac/parent.plist +++ b/desktop/assets/mac/parent.plist @@ -16,7 +16,5 @@ com.apple.security.device.audio-input - LSMultipleInstancesProhibited - \ No newline at end of file diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 9cebad238..5c51f6aae 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -561,8 +561,8 @@ export class CoreLoginHelperProvider { * @return {boolean} True if embedded browser, false othwerise. */ isSSOEmbeddedBrowser(code: number): boolean { - if (this.appProvider.isLinux()) { - // In Linux desktop apps, always use embedded browser. + if (this.appProvider.isLinux() || this.appProvider.isMac()) { + // In Linux and Mac desktop apps, always use embedded browser. return true; } From 05c552c3439e0d73ff5fcf0f1c992a7d76089048 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Fri, 25 Jan 2019 11:51:20 +0100 Subject: [PATCH 3/6] MOBILE-2844 mac: Use inappbrowser for oauth in Mac --- src/core/login/providers/helper.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index 5c51f6aae..ff9d6c58d 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -647,8 +647,8 @@ export class CoreLoginHelperProvider { loginUrl += '&oauthsso=' + params.id; - if (this.appProvider.isLinux()) { - // In Linux desktop apps, always use embedded browser. + if (this.appProvider.isLinux() || this.appProvider.isMac()) { + // In Linux and Mac desktop apps, always use embedded browser. this.utils.openInApp(loginUrl); } else { // Always open it in browser because the user might have the session stored in there. From edcc26f2c523ecd1d7d21dffad4003ebfc3806c9 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 28 Jan 2019 09:55:32 +0100 Subject: [PATCH 4/6] MOBILE-2844 desktop: Display download button in SSO legacy site --- src/core/login/providers/helper.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/core/login/providers/helper.ts b/src/core/login/providers/helper.ts index ff9d6c58d..77d06b08c 100644 --- a/src/core/login/providers/helper.ts +++ b/src/core/login/providers/helper.ts @@ -179,10 +179,10 @@ export class CoreLoginHelperProvider { } else { this.goToSiteInitialPage(); } - }).catch((errorMessage) => { - if (errorMessage) { + }).catch((error) => { + if (error) { // An error occurred, display the error and logout the user. - this.domUtils.showErrorModal(errorMessage); + this.treatUserTokenError(siteData.siteUrl, error); this.sitesProvider.logout(); } }).finally(() => { From bf786ba596c1d79ea90fd137371a295c071ad98b Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 28 Jan 2019 10:26:30 +0100 Subject: [PATCH 5/6] MOBILE-2844 course: Display size instead of are you sure in prefetch --- src/providers/utils/dom.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/providers/utils/dom.ts b/src/providers/utils/dom.ts index 05f86a032..d026def15 100644 --- a/src/providers/utils/dom.ts +++ b/src/providers/utils/dom.ts @@ -140,13 +140,12 @@ export class CoreDomUtilsProvider { const readableSize = this.textUtils.bytesToSize(size.size, 2); return this.showConfirm(this.translate.instant('core.course.confirmpartialdownloadsize', { size: readableSize })); - } else if (size.size >= wifiThreshold || (this.appProvider.isNetworkAccessLimited() && size.size >= limitedThreshold)) { + } else if (alwaysConfirm || size.size >= wifiThreshold || + (this.appProvider.isNetworkAccessLimited() && size.size >= limitedThreshold)) { message = message || 'core.course.confirmdownload'; const readableSize = this.textUtils.bytesToSize(size.size, 2); return this.showConfirm(this.translate.instant(message, { size: readableSize })); - } else if (alwaysConfirm) { - return this.showConfirm(this.translate.instant('core.areyousure')); } return Promise.resolve(); From 97d4f6d4edfde231fe2e2c5cc2a0297b29d2ebb6 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 29 Jan 2019 13:03:31 +0100 Subject: [PATCH 6/6] MOBILE-2844 assign: Fix prefetch error if grader was -1 --- src/addon/mod/assign/providers/prefetch-handler.ts | 2 +- src/core/user/providers/user.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/addon/mod/assign/providers/prefetch-handler.ts b/src/addon/mod/assign/providers/prefetch-handler.ts index d7a86836a..93ecb3f68 100644 --- a/src/addon/mod/assign/providers/prefetch-handler.ts +++ b/src/addon/mod/assign/providers/prefetch-handler.ts @@ -392,7 +392,7 @@ export class AddonModAssignPrefetchHandler extends CoreCourseActivityPrefetchHan // Prefetch feedback. if (submission.feedback) { // Get profile and image of the grader. - if (submission.feedback.grade && submission.feedback.grade.grader) { + if (submission.feedback.grade && submission.feedback.grade.grader && submission.feedback.grade.grader != -1) { userIds.push(submission.feedback.grade.grader); } diff --git a/src/core/user/providers/user.ts b/src/core/user/providers/user.ts index 2a4d83d47..242c586d6 100644 --- a/src/core/user/providers/user.ts +++ b/src/core/user/providers/user.ts @@ -397,7 +397,7 @@ export class CoreUserProvider { userId = Number(userId); // Make sure it's a number. // Prevent repeats and errors. - if (!isNaN(userId) && !treated[userId]) { + if (!isNaN(userId) && !treated[userId] && userId > 0) { treated[userId] = true; promises.push(this.getProfile(userId, courseId, false, siteId).then((profile) => {