From ba2acedb949769824fc487a541e620cd6da7cc64 Mon Sep 17 00:00:00 2001 From: Tzahi12345 Date: Mon, 24 Aug 2020 05:13:01 -0400 Subject: [PATCH] Files are now reloaded when you navigate back home --- .../components/recent-videos/recent-videos.component.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/app/components/recent-videos/recent-videos.component.ts b/src/app/components/recent-videos/recent-videos.component.ts index 40dd773..64c4962 100644 --- a/src/app/components/recent-videos/recent-videos.component.ts +++ b/src/app/components/recent-videos/recent-videos.component.ts @@ -55,17 +55,21 @@ export class RecentVideosComponent implements OnInit { if (localStorage.getItem('cached_file_count')) { this.cached_file_count = +localStorage.getItem('cached_file_count'); this.loading_files = Array(this.cached_file_count).fill(0); - console.log(this.loading_files); } } ngOnInit(): void { + if (this.postsService.initialized) { + this.getAllFiles(); + } + this.postsService.service_initialized.subscribe(init => { if (init) { this.getAllFiles(); } }); + // set filter property to cached const cached_filter_property = localStorage.getItem('filter_property'); if (cached_filter_property && this.filterProperties[cached_filter_property]) { @@ -145,7 +149,7 @@ export class RecentVideosComponent implements OnInit { navigateToFile(file) { localStorage.setItem('player_navigator', this.router.url); if (file.sub_id) { - const sub = this.postsService.getSubscriptionByID(file.sub_id) + const sub = this.postsService.getSubscriptionByID(file.sub_id); if (sub.streamingOnly) { this.router.navigate(['/player', {name: file.id, url: file.requested_formats ? file.requested_formats[0].url : file.url}]); @@ -177,7 +181,6 @@ export class RecentVideosComponent implements OnInit { const type = file.isAudio ? 'audio' : 'video'; const ext = type === 'audio' ? '.mp3' : '.mp4' const sub = this.postsService.getSubscriptionByID(file.sub_id); - console.log(sub.isPlaylist) this.postsService.downloadFileFromServer(file.id, type, null, null, sub.name, sub.isPlaylist, this.postsService.user ? this.postsService.user.uid : null, null).subscribe(res => { const blob: Blob = res;