From eed3e95a9af1f424560fed97f08bad0896f43df5 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 7 Jan 2019 13:51:14 +0100 Subject: [PATCH 1/5] MOBILE-2795 messages: Fix contact opened automatically when it shouldn't --- src/addon/messages/pages/contacts/contacts.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/addon/messages/pages/contacts/contacts.ts b/src/addon/messages/pages/contacts/contacts.ts index d27dc3662..047961507 100644 --- a/src/addon/messages/pages/contacts/contacts.ts +++ b/src/addon/messages/pages/contacts/contacts.ts @@ -73,6 +73,11 @@ export class AddonMessagesContactsPage implements OnDestroy { * User entered the page. */ ionViewDidEnter(): void { + if (!this.splitviewCtrl.isOn()) { + this.selectedUserId.contacts = null; + this.selectedUserId.requests = null; + } + this.tabsComponent && this.tabsComponent.ionViewDidEnter(); } From a709002f7e915c27f1ba0dc06dc258c69ed997a7 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Mon, 7 Jan 2019 16:11:08 +0100 Subject: [PATCH 2/5] MOBILE-2795 lesson: Fix password protected lessons --- src/addon/mod/lesson/components/index/index.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/addon/mod/lesson/components/index/index.ts b/src/addon/mod/lesson/components/index/index.ts index 015434ce0..ada4eded7 100644 --- a/src/addon/mod/lesson/components/index/index.ts +++ b/src/addon/mod/lesson/components/index/index.ts @@ -535,6 +535,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo const preventReason = this.lessonProvider.getPreventAccessReason(this.accessInfo, true); if (preventReason) { this.preventMessages = [preventReason]; + } else { + this.preventMessages = []; } // Log view now that we have the password. From b8526f585b3c47d026bfd739616331ddf96fd202 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 8 Jan 2019 08:20:10 +0100 Subject: [PATCH 3/5] MOBILE-2795 ws: Fix handle exception in ajax request --- src/providers/ws.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/ws.ts b/src/providers/ws.ts index 7372bbfff..de16e3103 100644 --- a/src/providers/ws.ts +++ b/src/providers/ws.ts @@ -261,7 +261,7 @@ export class CoreWSProvider { data = data[0]; if (data.error) { - return rejectWithError(data); + return rejectWithError(data.exception); } return data.data; From a2f14a200e7baff53c8ee91050fee9e7ba1ce94f Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 8 Jan 2019 09:29:11 +0100 Subject: [PATCH 4/5] MOBILE-2795 lesson: Fix ongoing score in offline --- src/addon/mod/lesson/providers/lesson.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/addon/mod/lesson/providers/lesson.ts b/src/addon/mod/lesson/providers/lesson.ts index dd15ed778..6af1f19d1 100644 --- a/src/addon/mod/lesson/providers/lesson.ts +++ b/src/addon/mod/lesson/providers/lesson.ts @@ -314,10 +314,10 @@ export class AddonModLessonProvider { * @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). * @param {any} [pageIndex] Object containing all the pages indexed by ID. If not defined, it will be calculated. * @param {string} [siteId] Site ID. If not defined, current site. - * @return {Promise<{reviewMode: boolean, progress: number, ongoingScore: string}>} Promise resolved with the data. + * @return {Promise<{reviewmode: boolean, progress: number, ongoingscore: string}>} Promise resolved with the data. */ protected calculateOfflineData(lesson: any, accessInfo?: any, password?: string, review?: boolean, pageIndex?: any, - siteId?: string): Promise<{reviewMode: boolean, progress: number, ongoingScore: string}> { + siteId?: string): Promise<{reviewmode: boolean, progress: number, ongoingscore: string}> { accessInfo = accessInfo || {}; @@ -342,9 +342,9 @@ export class AddonModLessonProvider { return Promise.all(promises).then(() => { return { - reviewMode: reviewMode, + reviewmode: reviewMode, progress: progress, - ongoingScore: ongoingMessage + ongoingscore: ongoingMessage }; }); } From a807e589209e2f22aed10a42ba58f16ec0b1b296 Mon Sep 17 00:00:00 2001 From: Dani Palou Date: Tue, 8 Jan 2019 11:57:20 +0100 Subject: [PATCH 5/5] MOBILE-2795 lesson: Fix Reports tab not displayed sometimes --- .../components/index/addon-mod-lesson-index.html | 2 +- src/addon/mod/lesson/providers/report-link-handler.ts | 2 +- src/components/tabs/tabs.ts | 11 +++++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html b/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html index e4e86a524..a394f589b 100644 --- a/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html +++ b/src/addon/mod/lesson/components/index/addon-mod-lesson-index.html @@ -13,7 +13,7 @@ - + diff --git a/src/addon/mod/lesson/providers/report-link-handler.ts b/src/addon/mod/lesson/providers/report-link-handler.ts index e07c9978c..76d8703ac 100644 --- a/src/addon/mod/lesson/providers/report-link-handler.ts +++ b/src/addon/mod/lesson/providers/report-link-handler.ts @@ -105,7 +105,7 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase module: module, courseId: Number(courseId), action: 'report', - group: groupId + group: isNaN(groupId) ? null : groupId }; this.linkHelper.goInSite(navCtrl, 'AddonModLessonIndexPage', pageParams, siteId); diff --git a/src/components/tabs/tabs.ts b/src/components/tabs/tabs.ts index 2dc4faf73..d17a5e39e 100644 --- a/src/components/tabs/tabs.ts +++ b/src/components/tabs/tabs.ts @@ -131,9 +131,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe ionViewDidEnter(): void { this.isCurrentView = true; - if (this.initialized) { - this.calculateSlides(); - } + this.calculateSlides(); this.registerBackButtonAction(); } @@ -188,6 +186,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe if (this.getIndex(tab) == -1) { this.tabs.push(tab); this.sortTabs(); + this.calculateSlides(); if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) { @@ -204,7 +203,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe * Calculate slides. */ calculateSlides(): void { - if (!this.isCurrentView || !this.tabsShown) { + if (!this.isCurrentView || !this.tabsShown || !this.initialized) { // Don't calculate if component isn't in current view, the calculations are wrong. return; } @@ -288,10 +287,10 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe } } + this.initialized = true; + // Check which arrows should be shown. this.calculateSlides(); - - this.initialized = true; } /**