Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bookmarks not syncing #13727

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 6 additions & 13 deletions src/status_im/browser/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,7 @@
[{:keys [db]}
{:keys [url] :as bookmark}]
{:db (assoc-in db [:bookmarks/bookmarks url] bookmark)
::json-rpc/call [{:method "browsers_storeBookmark"
:params [bookmark]
:on-success #(re-frame/dispatch [:browser/sync-bookmark %1])}]})

(fx/defn sync-bookmark
{:events [:browser/sync-bookmark]}
[_ bookmark]
{::json-rpc/call [{:method "wakuext_syncBookmark"
::json-rpc/call [{:method "wakuext_addBookmark"
:params [bookmark]
:on-success #()}]})

Expand All @@ -123,9 +116,9 @@
(let [old-bookmark (get-in db [:bookmarks/bookmarks url])
new-bookmark (merge old-bookmark bookmark)]
(fx/merge cofx {:db (assoc-in db [:bookmarks/bookmarks url] new-bookmark)
::json-rpc/call [{:method "browsers_updateBookmark"
::json-rpc/call [{:method "wakuext_updateBookmark"
:params [url bookmark]
:on-success #(re-frame/dispatch [:browser/sync-bookmark new-bookmark])}]})))
:on-success #()}]})))

(fx/defn delete-bookmark
{:events [:browser/delete-bookmark]}
Expand All @@ -134,9 +127,9 @@
(let [old-bookmark (get-in db [:bookmarks/bookmarks url])
removed-bookmark (merge old-bookmark {:removed true})]
(fx/merge cofx {:db (update db :bookmarks/bookmarks dissoc url)
::json-rpc/call [{:method "browsers_removeBookmark"
::json-rpc/call [{:method "wakuext_removeBookmark"
:params [url]
:on-success #(re-frame/dispatch [:browser/sync-bookmark removed-bookmark])}]})))
:on-success #()}]})))

(defn can-go-back? [{:keys [history-index]}]
(pos? history-index))
Expand Down Expand Up @@ -560,4 +553,4 @@
{}
bookmarks)
stored-bookmarks (get-in db [:bookmarks/bookmarks])]
{:db (assoc-in db [:bookmarks/bookmarks] (merge stored-bookmarks changed-bookmarks))}))
{:db (assoc-in db [:bookmarks/bookmarks] (merge stored-bookmarks changed-bookmarks))}))