Просмотр исходного кода

fix: don't show file graphs on both web and mobile

Tienson Qin 3 месяцев назад
Родитель
Сommit
cfbb563bc5

+ 2 - 1
src/main/frontend/db/persist.cljs

@@ -11,7 +11,8 @@
 
 (defn get-all-graphs
   []
-  (p/let [idb-repos (idb/get-nfs-dbs)
+  (p/let [idb-repos (when-not (or (util/web-platform?) (util/mobile?))
+                      (idb/get-nfs-dbs))
           repos (persist-db/<list-db)
           repos' (map
                   (fn [{:keys [name] :as repo}]

+ 1 - 1
src/main/frontend/fs/sync.cljs

@@ -3213,7 +3213,7 @@
 (defn <sync-start
   []
   (go
-    (when-not @*sync-starting
+    (when-not (or @*sync-starting (util/mobile?) (util/web-platform?))
       (reset! *sync-starting true)
       (if-not (and (<! (<should-start-sync?))
                    (<! (<connectivity-testing)))

+ 12 - 8
src/main/frontend/handler/events/ui.cljs

@@ -317,7 +317,8 @@
 (defmethod events/handle :user/fetch-info-and-graphs [[_]]
   (state/set-state! [:ui/loading? :login] false)
   (async/go
-    (let [result (async/<! (sync/<user-info sync/remoteapi))]
+    (let [result (async/<! (sync/<user-info sync/remoteapi))
+          mobile-or-web? (or (util/mobile?) (util/web-platform?))]
       (cond
         (instance? ExceptionInfo result)
         nil
@@ -330,15 +331,18 @@
             (when (and (= status :welcome) (user-handler/logged-in?))
               (enable-beta-features!)
               (async/<! (p->c (rtc-handler/<get-remote-graphs)))
-              (async/<! (file-sync-handler/load-session-graphs))
+              (when-not mobile-or-web?
+                (async/<! (file-sync-handler/load-session-graphs)))
               (p/let [repos (repo-handler/refresh-repos!)]
                 (when-let [repo (state/get-current-repo)]
-                  (when (some #(and (= (:url %) repo)
-                                    (vector? (:sync-meta %))
-                                    (util/uuid-string? (first (:sync-meta %)))
-                                    (util/uuid-string? (second (:sync-meta %)))) repos)
-                    (sync/<sync-start)))))
-            (file-sync/maybe-onboarding-show status)))))))
+                  (when-not mobile-or-web?
+                    (when (some #(and (= (:url %) repo)
+                                      (vector? (:sync-meta %))
+                                      (util/uuid-string? (first (:sync-meta %)))
+                                      (util/uuid-string? (second (:sync-meta %)))) repos)
+                      (sync/<sync-start))))))
+            (when-not mobile-or-web?
+              (file-sync/maybe-onboarding-show status))))))))
 
 (defmethod events/handle :file-sync/onboarding-tip [[_ type opts]]
   (let [type (keyword type)]

+ 1 - 1
src/main/frontend/handler/file_sync.cljs

@@ -101,7 +101,7 @@
   []
   (when-not (state/sub [:file-sync/remote-graphs :loading])
     (go
-      (when-not util/web-platform?
+      (when-not (or (util/web-platform?) (util/mobile?))
         (state/set-state! [:file-sync/remote-graphs :loading] true)
         (let [graphs-or-exp (<! (<list-graphs))]
           (when-not (instance? ExceptionInfo graphs-or-exp)

+ 2 - 1
src/main/frontend/handler/repo.cljs

@@ -172,7 +172,8 @@
                   repos
                   (concat
                    (state/get-rtc-graphs)
-                   (state/get-remote-file-graphs)))]
+                   (when-not (or (util/mobile?) (util/web-platform?))
+                     (state/get-remote-file-graphs))))]
     (state/set-repos! repos')
     repos'))