about summary refs log tree commit diff
path: root/src/state/models/feeds
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-05-18 14:39:04 -0500
committerPaul Frazee <pfrazee@gmail.com>2023-05-18 14:39:04 -0500
commit5537d19e555c39f5f9a0ec16735ea4c3860357c4 (patch)
tree35b22f36a6703caefef3c63ca82678ee1d53c2d4 /src/state/models/feeds
parentacea0e074d75ac549abb01dc4ac16573a43ad7fa (diff)
downloadvoidsky-5537d19e555c39f5f9a0ec16735ea4c3860357c4.tar.zst
Update saved feeds to use preferences
Diffstat (limited to 'src/state/models/feeds')
-rw-r--r--src/state/models/feeds/custom-feed.ts20
1 files changed, 4 insertions, 16 deletions
diff --git a/src/state/models/feeds/custom-feed.ts b/src/state/models/feeds/custom-feed.ts
index 5e550ec69..e457d2d1e 100644
--- a/src/state/models/feeds/custom-feed.ts
+++ b/src/state/models/feeds/custom-feed.ts
@@ -38,7 +38,7 @@ export class CustomFeedModel {
   }
 
   get isSaved() {
-    return this.data.viewer?.saved
+    return this.rootStore.preferences.savedFeeds.includes(this.uri)
   }
 
   get isLiked() {
@@ -49,23 +49,11 @@ export class CustomFeedModel {
   // =
 
   async save() {
-    await this.rootStore.agent.app.bsky.feed.saveFeed({
-      feed: this.uri,
-    })
-    runInAction(() => {
-      this.data.viewer = this.data.viewer || {}
-      this.data.viewer.saved = true
-    })
+    await this.rootStore.preferences.addSavedFeed(this.uri)
   }
 
   async unsave() {
-    await this.rootStore.agent.app.bsky.feed.unsaveFeed({
-      feed: this.uri,
-    })
-    runInAction(() => {
-      this.data.viewer = this.data.viewer || {}
-      this.data.viewer.saved = false
-    })
+    await this.rootStore.preferences.removeSavedFeed(this.uri)
   }
 
   async like() {
@@ -82,7 +70,7 @@ export class CustomFeedModel {
   }
 
   async unlike() {
-    if (!this.data.viewer.like) {
+    if (!this.data.viewer?.like) {
       return
     }
     try {