From 6e565d66b7241df70b3bdd2077d81245ea0f6388 Mon Sep 17 00:00:00 2001 From: Alex Date: Fri, 1 Apr 2022 14:02:08 +1300 Subject: [PATCH] feat: pagination, url handling, tracking --- .../slimVideoDescriptionRenderer.vue | 2 -- NUXT/components/observer.vue | 25 +++++++++++++++ NUXT/components/topNavigation.vue | 16 +++++----- NUXT/components/vidLoadRenderer.vue | 11 ++++--- NUXT/layouts/default.vue | 9 ++++++ NUXT/pages/home.vue | 31 ++++++++++++++++--- NUXT/plugins/innertube.js | 18 ++++++----- NUXT/plugins/youtube.js | 25 +++++++-------- android/app/src/main/AndroidManifest.xml | 16 +++++++++- 9 files changed, 113 insertions(+), 40 deletions(-) create mode 100644 NUXT/components/observer.vue diff --git a/NUXT/components/UtilRenderers/slimVideoDescriptionRenderer.vue b/NUXT/components/UtilRenderers/slimVideoDescriptionRenderer.vue index a93e708..47e2417 100644 --- a/NUXT/components/UtilRenderers/slimVideoDescriptionRenderer.vue +++ b/NUXT/components/UtilRenderers/slimVideoDescriptionRenderer.vue @@ -9,7 +9,6 @@ {{ text.text }} @@ -17,7 +16,6 @@ {{ text.text }} diff --git a/NUXT/components/observer.vue b/NUXT/components/observer.vue new file mode 100644 index 0000000..6d752a0 --- /dev/null +++ b/NUXT/components/observer.vue @@ -0,0 +1,25 @@ + + + diff --git a/NUXT/components/topNavigation.vue b/NUXT/components/topNavigation.vue index 5a63ff3..cf14454 100644 --- a/NUXT/components/topNavigation.vue +++ b/NUXT/components/topNavigation.vue @@ -77,18 +77,20 @@ export default { methods: { refreshRecommendations() { this.$emit("scroll-to-top"); - const continuations = this.$store.state.recommendedVideos.continuations; + const continuations = + this.$store.state.recommendedVideos[ + this.$store.state.recommendedVideos.length - 1 + ].continuations; this.$store.commit("updateRecommendedVideos", []); this.$youtube - .continuation( - continuations[1].reloadContinuationData.continuation, + .recommendContinuation( + continuations.find((element) => element.reloadContinuationData) + .reloadContinuationData.continuation, "browse" ) .then((result) => { - if (result) - this.$youtube.recommend(result).then((result) => { - if (result) this.$store.commit("updateRecommendedVideos", result); - }); + console.log(result); + if (result) this.$store.commit("updateRecommendedVideos", [result]); }) .catch((error) => this.$logger("Home Page (Nav Refresh)", error, true)); }, diff --git a/NUXT/components/vidLoadRenderer.vue b/NUXT/components/vidLoadRenderer.vue index ec85465..bc23104 100644 --- a/NUXT/components/vidLoadRenderer.vue +++ b/NUXT/components/vidLoadRenderer.vue @@ -1,7 +1,10 @@ // this is an loading animation for videos diff --git a/NUXT/layouts/default.vue b/NUXT/layouts/default.vue index 14293fc..8328efd 100644 --- a/NUXT/layouts/default.vue +++ b/NUXT/layouts/default.vue @@ -124,6 +124,15 @@ export default { window.history.back(); } }); + + CapacitorApp.addListener("appUrlOpen", (event) => { + const slug = new URL(event.url); + // We only push to the route if there is a slug present + if (slug) { + console.log(slug.pathname + slug.search); + this.$router.push(slug.pathname + slug.search); + } + }); }, methods: { diff --git a/NUXT/pages/home.vue b/NUXT/pages/home.vue index 27860e9..7f55d00 100644 --- a/NUXT/pages/home.vue +++ b/NUXT/pages/home.vue @@ -7,16 +7,20 @@
- - + +
+ +
+