mirror of
https://github.com/logseq/logseq.git
synced 2026-05-04 02:46:45 +00:00
fix: prompt to create a Logseq sync graph or normal graph on iOS
Previously, users can create a graph everywhere including the iCloud folder, which is both confusing and can cause unexpected data conflicts. Another enhancement: After the user confirms the "Use Logseq Sync for this new graph?" prompt, a remote graph will be created and start to sync automatically. https://www.loom.com/share/69059969747c4b798a4c712c45e442d7
This commit is contained in:
@@ -572,6 +572,24 @@
|
||||
(state/close-modal!)
|
||||
(nfs-handler/refresh! (state/get-current-repo) refresh-cb)))]]))
|
||||
|
||||
(defmethod handle :sync/create-remote-graph [[_ current-repo]]
|
||||
(let [graph-name (js/decodeURI (util/node-path.basename current-repo))]
|
||||
(async/go
|
||||
(async/<! (sync/<sync-stop))
|
||||
(state/set-state! [:ui/loading? :graph/create-remote?] true)
|
||||
(when-let [GraphUUID (get (async/<! (file-sync-handler/create-graph graph-name)) 2)]
|
||||
(async/<! (sync/sync-start))
|
||||
(state/set-state! [:ui/loading? :graph/create-remote?] false)
|
||||
;; update existing repo
|
||||
(state/set-repos! (map (fn [r]
|
||||
(if (= (:url r) current-repo)
|
||||
(assoc r
|
||||
:GraphUUID GraphUUID
|
||||
:GraphName graph-name
|
||||
:remote? true)
|
||||
r))
|
||||
(state/get-repos)))))))
|
||||
|
||||
(defmethod handle :graph/re-index [[_]]
|
||||
;; Ensure the graph only has ONE window instance
|
||||
(repo-handler/re-index!
|
||||
|
||||
Reference in New Issue
Block a user