Merge pull request #1711 from dpalou/MOBILE-2795

Mobile 2795
main
Juan Leyva 2019-01-08 12:45:46 +01:00 committed by GitHub
commit b55ca46c4c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 13 deletions

View File

@ -73,6 +73,11 @@ export class AddonMessagesContactsPage implements OnDestroy {
* User entered the page. * User entered the page.
*/ */
ionViewDidEnter(): void { ionViewDidEnter(): void {
if (!this.splitviewCtrl.isOn()) {
this.selectedUserId.contacts = null;
this.selectedUserId.requests = null;
}
this.tabsComponent && this.tabsComponent.ionViewDidEnter(); this.tabsComponent && this.tabsComponent.ionViewDidEnter();
} }

View File

@ -13,7 +13,7 @@
<!-- Content. --> <!-- Content. -->
<core-loading [hideUntil]="loaded" class="core-loading-center"> <core-loading [hideUntil]="loaded" class="core-loading-center">
<core-tabs [selectedIndex]="selectedTab"> <core-tabs [hideUntil]="loaded" [selectedIndex]="selectedTab">
<!-- Index/Preview tab. --> <!-- Index/Preview tab. -->
<core-tab [title]="'addon.mod_lesson.preview' | translate"> <core-tab [title]="'addon.mod_lesson.preview' | translate">
<ng-template> <ng-template>

View File

@ -535,6 +535,8 @@ export class AddonModLessonIndexComponent extends CoreCourseModuleMainActivityCo
const preventReason = this.lessonProvider.getPreventAccessReason(this.accessInfo, true); const preventReason = this.lessonProvider.getPreventAccessReason(this.accessInfo, true);
if (preventReason) { if (preventReason) {
this.preventMessages = [preventReason]; this.preventMessages = [preventReason];
} else {
this.preventMessages = [];
} }
// Log view now that we have the password. // Log view now that we have the password.

View File

@ -314,10 +314,10 @@ export class AddonModLessonProvider {
* @param {boolean} [review] If the user wants to review just after finishing (1 hour margin). * @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 {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. * @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, 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 || {}; accessInfo = accessInfo || {};
@ -342,9 +342,9 @@ export class AddonModLessonProvider {
return Promise.all(promises).then(() => { return Promise.all(promises).then(() => {
return { return {
reviewMode: reviewMode, reviewmode: reviewMode,
progress: progress, progress: progress,
ongoingScore: ongoingMessage ongoingscore: ongoingMessage
}; };
}); });
} }

View File

@ -105,7 +105,7 @@ export class AddonModLessonReportLinkHandler extends CoreContentLinksHandlerBase
module: module, module: module,
courseId: Number(courseId), courseId: Number(courseId),
action: 'report', action: 'report',
group: groupId group: isNaN(groupId) ? null : groupId
}; };
this.linkHelper.goInSite(navCtrl, 'AddonModLessonIndexPage', pageParams, siteId); this.linkHelper.goInSite(navCtrl, 'AddonModLessonIndexPage', pageParams, siteId);

View File

@ -144,9 +144,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
ionViewDidEnter(): void { ionViewDidEnter(): void {
this.isCurrentView = true; this.isCurrentView = true;
if (this.initialized) {
this.calculateSlides(); this.calculateSlides();
}
this.registerBackButtonAction(); this.registerBackButtonAction();
} }
@ -201,6 +199,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
if (this.getIndex(tab) == -1) { if (this.getIndex(tab) == -1) {
this.tabs.push(tab); this.tabs.push(tab);
this.sortTabs(); this.sortTabs();
this.calculateSlides(); this.calculateSlides();
if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) { if (this.initialized && this.tabs.length > 1 && this.tabBarHeight == 0) {
@ -217,7 +216,7 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
* Calculate slides. * Calculate slides.
*/ */
calculateSlides(): void { 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. // Don't calculate if component isn't in current view, the calculations are wrong.
return; return;
} }
@ -301,10 +300,10 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
} }
} }
this.initialized = true;
// Check which arrows should be shown. // Check which arrows should be shown.
this.calculateSlides(); this.calculateSlides();
this.initialized = true;
} }
/** /**

View File

@ -261,7 +261,7 @@ export class CoreWSProvider {
data = data[0]; data = data[0];
if (data.error) { if (data.error) {
return rejectWithError(data); return rejectWithError(data.exception);
} }
return data.data; return data.data;