MOBILE-3205 forum: Save forum discussion sorting

main
Pau Ferrer Ocaña 2019-10-25 12:32:28 +02:00
parent 34ac2a93d8
commit e1e2b83933
1 changed files with 12 additions and 7 deletions

View File

@ -131,6 +131,9 @@ export class AddonModForumDiscussionPage implements OnDestroy {
* View loaded. * View loaded.
*/ */
ionViewDidLoad(): void { ionViewDidLoad(): void {
this.sitesProvider.getCurrentSite().getLocalSiteConfig('AddonModForumDiscussionSort', this.sort).then((value) => {
this.sort = value;
}).finally(() => {
this.fetchPosts(true, false, true).then(() => { this.fetchPosts(true, false, true).then(() => {
if (this.postId) { if (this.postId) {
// Scroll to the post. // Scroll to the post.
@ -139,6 +142,7 @@ export class AddonModForumDiscussionPage implements OnDestroy {
}); });
} }
}); });
});
} }
/** /**
@ -513,6 +517,7 @@ export class AddonModForumDiscussionPage implements OnDestroy {
changeSort(type: SortType): Promise<any> { changeSort(type: SortType): Promise<any> {
this.discussionLoaded = false; this.discussionLoaded = false;
this.sort = type; this.sort = type;
this.sitesProvider.getCurrentSite().setLocalSiteConfig('AddonModForumDiscussionSort', this.sort);
this.domUtils.scrollToTop(this.content); this.domUtils.scrollToTop(this.content);
return this.fetchPosts(); return this.fetchPosts();