Merge pull request #2062 from crazyserver/MOBILE-3068

Mobile 3068
main
Juan Leyva 2019-08-21 10:19:50 +01:00 committed by GitHub
commit ee4d1ad4f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 13 deletions

View File

@ -31,7 +31,8 @@
<ion-icon name="information-circle"></ion-icon> {{ availabilityMessage }} <ion-icon name="information-circle"></ion-icon> {{ availabilityMessage }}
</ion-card> </ion-card>
<core-empty-box *ngIf="forum && discussions.length == 0 && offlineDiscussions.length == 0" icon="chatbubbles" [message]="'addon.mod_forum.forumnodiscussionsyet' | translate"> <ng-container *ngIf="forum">
<core-empty-box *ngIf="discussions.length == 0 && offlineDiscussions.length == 0" icon="chatbubbles" [message]="'addon.mod_forum.forumnodiscussionsyet' | translate">
</core-empty-box> </core-empty-box>
<div text-wrap *ngIf="sortingAvailable && selectedSortOrder" ion-row padding-horizontal padding-top margin-bottom> <div text-wrap *ngIf="sortingAvailable && selectedSortOrder" ion-row padding-horizontal padding-top margin-bottom>
@ -41,7 +42,6 @@
</button> </button>
</div> </div>
<ng-container *ngIf="forum">
<ion-card *ngFor="let discussion of offlineDiscussions" (click)="openNewDiscussion(discussion.timecreated)" [class.addon-forum-discussion-selected]="discussion.timecreated == -selectedDiscussion"> <ion-card *ngFor="let discussion of offlineDiscussions" (click)="openNewDiscussion(discussion.timecreated)" [class.addon-forum-discussion-selected]="discussion.timecreated == -selectedDiscussion">
<ion-item text-wrap> <ion-item text-wrap>
<ion-avatar core-user-avatar [user]="discussion" item-start [courseId]="courseId"></ion-avatar> <ion-avatar core-user-avatar [user]="discussion" item-start [courseId]="courseId"></ion-avatar>
@ -95,9 +95,9 @@
</ion-col> </ion-col>
</ion-row> </ion-row>
</ion-card> </ion-card>
</ng-container>
<core-infinite-loading [enabled]="canLoadMore" (action)="fetchMoreDiscussions($event)" [error]="loadMoreError"></core-infinite-loading> <core-infinite-loading [enabled]="canLoadMore" (action)="fetchMoreDiscussions($event)" [error]="loadMoreError"></core-infinite-loading>
</ng-container>
</core-loading> </core-loading>
<ion-fab core-fab bottom end *ngIf="forum && canAddDiscussion"> <ion-fab core-fab bottom end *ngIf="forum && canAddDiscussion">

View File

@ -128,6 +128,8 @@ export class CoreTabComponent implements OnInit, OnDestroy {
}); });
this.tabs.showHideTabs(scroll); this.tabs.showHideTabs(scroll);
}).catch(() => {
// Ignore errors.
}); });
} }

View File

@ -417,6 +417,13 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
const scroll = parseInt(scrollElement.scrollTop, 10); const scroll = parseInt(scrollElement.scrollTop, 10);
if (scroll == this.lastScroll) { if (scroll == this.lastScroll) {
if (scroll == 0) {
// Ensure tabbar is shown.
this.topTabsElement.style.transform = '';
this.originalTabsContainer.style.transform = '';
this.originalTabsContainer.style.paddingBottom = this.tabBarHeight + 'px';
}
// Ensure scroll has been modified to avoid flicks. // Ensure scroll has been modified to avoid flicks.
return; return;
} }
@ -438,7 +445,8 @@ export class CoreTabsComponent implements OnInit, AfterViewInit, OnChanges, OnDe
this.originalTabsContainer.style.transform = 'translateY(-' + scroll + 'px)'; this.originalTabsContainer.style.transform = 'translateY(-' + scroll + 'px)';
this.originalTabsContainer.style.paddingBottom = this.tabBarHeight - scroll + 'px'; this.originalTabsContainer.style.paddingBottom = this.tabBarHeight - scroll + 'px';
} }
this.lastScroll = scroll; // Use lastScroll after moving the tabs to avoid flickering.
this.lastScroll = parseInt(scrollElement.scrollTop, 10);
} }
/** /**

View File

@ -67,6 +67,10 @@ export class CoreBlockCourseBlocksComponent implements OnInit, OnDestroy {
* Setup scrolling. * Setup scrolling.
*/ */
protected initScroll(): void { protected initScroll(): void {
if (this.blocks.length <= 0) {
return;
}
const scroll: HTMLElement = this.content && this.content.getScrollElement(); const scroll: HTMLElement = this.content && this.content.getScrollElement();
this.domUtils.waitElementToExist(() => scroll && scroll.querySelector('.core-course-blocks-side')).then((sideElement) => { this.domUtils.waitElementToExist(() => scroll && scroll.querySelector('.core-course-blocks-side')).then((sideElement) => {
@ -89,6 +93,8 @@ export class CoreBlockCourseBlocksComponent implements OnInit, OnDestroy {
this.sideScroll.classList.remove('core-course-blocks-fixed-bottom'); this.sideScroll.classList.remove('core-course-blocks-fixed-bottom');
this.scrollWorking = false; this.scrollWorking = false;
} }
}).catch(() => {
// Ignore errors.
}); });
} }