summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWolfgang <github@linux-dude.de>2024-10-16 21:02:51 +0000
committerBenjamin Brahmer <info@b-brahmer.de>2024-10-19 11:15:39 +0200
commit40c99b1357afed906af794ca55dd20827ae408a9 (patch)
treea7b742beb0e316ead79f7ffca81740f7d6a9dcfc
parent9df78ecc8b8be9b398460b5d952b515e473a24a9 (diff)
fix: Navigating to the news app always opens /explore instead of remembering the last viewed feed
Signed-off-by: Wolfgang <github@linux-dude.de>
-rw-r--r--lib/Controller/PageController.php4
-rw-r--r--src/App.vue4
-rw-r--r--src/routes/index.ts28
-rw-r--r--src/store/app.ts10
4 files changed, 41 insertions, 5 deletions
diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php
index 9ec606565..4d223075c 100644
--- a/lib/Controller/PageController.php
+++ b/lib/Controller/PageController.php
@@ -80,7 +80,9 @@ class PageController extends Controller
'compactExpand',
'preventReadOnScroll',
'oldestFirst',
- 'showAll'
+ 'showAll',
+ 'lastViewedFeedId',
+ 'lastViewedFeedType'
];
foreach ($usersettings as $setting) {
diff --git a/src/App.vue b/src/App.vue
index 3aa79cfd2..9f01915ee 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -63,11 +63,11 @@ export default Vue.extend({
...mapState(['app']),
},
async created() {
+ // fetch starred to get starred count
+ await this.$store.dispatch(ACTIONS.FETCH_STARRED)
// fetch folders and feeds to build side bar
await this.$store.dispatch(ACTIONS.FETCH_FOLDERS)
await this.$store.dispatch(ACTIONS.FETCH_FEEDS)
- // fetch starred to get starred count
- await this.$store.dispatch(ACTIONS.FETCH_STARRED)
},
methods: {
stopPlaying() {
diff --git a/src/routes/index.ts b/src/routes/index.ts
index d623ff2c8..cffe56a71 100644
--- a/src/routes/index.ts
+++ b/src/routes/index.ts
@@ -7,6 +7,8 @@ import FeedPanel from '../components/routes/Feed.vue'
import FolderPanel from '../components/routes/Folder.vue'
import AllPanel from '../components/routes/All.vue'
+import store from './../store/app'
+
export const ROUTES = {
EXPLORE: 'explore',
STARRED: 'starred',
@@ -17,8 +19,30 @@ export const ROUTES = {
}
const getInitialRoute = function() {
- // TODO: Fetch Recent route from Browser Session?
- return ROUTES.UNREAD
+ const params: { feedId?: string; folderId?: string } = {}
+
+ switch (store.state.lastViewedFeedType) {
+ case '0':
+ params.feedId = store.state.lastViewedFeedId
+ return {
+ name: ROUTES.FEED,
+ params,
+ }
+ case '1':
+ params.folderId = store.state.lastViewedFeedId
+ return {
+ name: ROUTES.FOLDER,
+ params,
+ }
+ case '2':
+ return { name: ROUTES.STARRED }
+ case '3':
+ return { name: ROUTES.ALL }
+ case '5':
+ return { name: ROUTES.EXPLORE }
+ default:
+ return { name: ROUTES.UNREAD }
+ }
}
const routes = [
diff --git a/src/store/app.ts b/src/store/app.ts
index c394758bd..b56bf4365 100644
--- a/src/store/app.ts
+++ b/src/store/app.ts
@@ -12,6 +12,8 @@ export type AppInfoState = {
oldestFirst: boolean;
preventReadOnScroll: boolean;
showAll: boolean;
+ lastViewedFeedId: string;
+ lastViewedFeedType: string;
}
const state: AppInfoState = {
@@ -21,6 +23,8 @@ const state: AppInfoState = {
oldestFirst: loadState('news', 'oldestFirst', null) === '1',
preventReadOnScroll: loadState('news', 'preventReadOnScroll', null) === '1',
showAll: loadState('news', 'showAll', null) === '1',
+ lastViewedFeedId: loadState('news', 'lastViewedFeedId', '0'),
+ lastViewedFeedType: loadState('news', 'lastViewedFeedType', '6'),
}
const getters = {
@@ -42,6 +46,12 @@ const getters = {
showAll() {
return state.showAll
},
+ lastViewedFeedId() {
+ return state.lastViewedFeedId
+ },
+ lastViewedFeedType() {
+ return state.lastViewedFeedType
+ },
}
export const actions = {