fix: cloud icon is not shown when restarting the app

pull/6555/head
Tienson Qin 2022-09-01 18:59:06 +08:00
parent 4c84589da4
commit e008a38540
9 changed files with 25 additions and 27 deletions

View File

@ -32,7 +32,6 @@
:warnings {:fn-deprecated false
:redef false}}
:closure-defines {goog.debug.LOGGING_ENABLED true
frontend.config/ENABLE-FILE-SYNC #shadow/env ["ENABLE_FILE_SYNC" :as :bool :default false]
frontend.config/ENABLE-PLUGINS #shadow/env ["ENABLE_PLUGINS" :as :bool :default true]
frontend.config/ENABLE-FILE-SYNC-PRODUCTION #shadow/env ["ENABLE_FILE_SYNC_PRODUCTION" :as :bool :default false]}

View File

@ -5,6 +5,7 @@
[frontend.handler.route :as route-handler]
[frontend.handler.editor :as editor-handler]
[frontend.handler.ui :as ui-handler]
[frontend.handler.file-sync :as file-sync-handler]
[frontend.config :as config]
[clojure.string :as string]
[cljs-bean.core :as bean]
@ -45,7 +46,7 @@
(fn [data]
(let [{:keys [type payload]} (bean/->clj data)]
(watcher-handler/handle-changed! type payload)
(when config/enable-file-sync?
(when (file-sync-handler/enable-sync?)
(sync/file-watch-handler type payload)))))
(js/window.apis.on "notification"

View File

@ -230,7 +230,6 @@
[:div.cp__file-sync-indicator
(when (and (not config/publishing?)
(user-handler/logged-in?))
(ui/dropdown-with-links
(fn [{:keys [toggle-fn]}]
(if (not off?)

View File

@ -34,10 +34,12 @@
(rum/defc login < rum/reactive
[]
(let [_ (state/sub :auth/id-token)
loading? (state/sub [:ui/loading? :login])]
loading? (state/sub [:ui/loading? :login])
sync-enabled? (file-sync-handler/enable-sync?)
logged? (user-handler/logged-in?)]
(when-not (or config/publishing?
(user-handler/logged-in?)
(not (state/enable-sync?)))
logged?
(not sync-enabled?))
[:a.button.text-sm.font-medium.block {:on-click #(js/window.open config/LOGIN-URL)}
[:span (t :login)]
(when loading?
@ -155,7 +157,8 @@
(state/set-left-sidebar-open!
(not (:ui/left-sidebar-open? @state/state))))})
custom-home-page? (and (state/custom-home-page?)
(= (state/sub-default-home-page) (state/get-current-page)))]
(= (state/sub-default-home-page) (state/get-current-page)))
sync-enabled? (file-sync-handler/enable-sync?)]
[:div.cp__header#head
{:class (util/classnames [{:electron-mac electron-mac?
:native-ios (mobile-util/native-ios?)
@ -187,17 +190,18 @@
(ui/icon "chevron-left" {:style {:fontSize 25}})])))]
[:div.r.flex
(when (and (not file-sync-handler/hiding-login&file-sync)
current-repo
(not (config/demo-graph? current-repo))
(user-handler/alpha-user?))
(fs-sync/indicator))
(do
(when (and sync-enabled?
current-repo
(not (config/demo-graph? current-repo))
(user-handler/alpha-user?))
(fs-sync/indicator)))
(when (and (not= (state/get-current-route) :home)
(not custom-home-page?))
(home-button))
(when-not file-sync-handler/hiding-login&file-sync
(when sync-enabled?
(login))
(when plugin-handler/lsp-enabled?

View File

@ -74,7 +74,7 @@
file-path (when (util/electron?) (page-handler/get-page-file-path))
_ (state/sub :auth/id-token)
file-sync-graph-uuid (and (user-handler/logged-in?)
(not file-sync-handler/hiding-login&file-sync)
(file-sync-handler/enable-sync?)
(file-sync-handler/get-current-graph-uuid))]
(when (and page (not block?))
(->>

View File

@ -21,13 +21,6 @@
(goog-define ENABLE-FILE-SYNC-PRODUCTION false)
;; prod env
;; (goog-define FILE-SYNC-PROD? true)
;; (goog-define LOGIN-URL
;; "https://logseq-prod.auth.us-east-1.amazoncognito.com/login?client_id=3c7np6bjtb4r1k1bi9i049ops5&response_type=code&scope=email+openid+phone&redirect_uri=logseq%3A%2F%2Fauth-callback")
;; (goog-define API-DOMAIN "api-prod.logseq.com")
;; (goog-define WS-URL "wss://b2rp13onu2.execute-api.us-east-1.amazonaws.com/production?graphuuid=%s")
(if ENABLE-FILE-SYNC-PRODUCTION
(do (def FILE-SYNC-PROD? true)
(def LOGIN-URL
@ -42,8 +35,6 @@
(def WS-URL "wss://ws-dev.logseq.com/file-sync?graphuuid=%s")))
;; feature flags
(goog-define ENABLE-FILE-SYNC false)
(defonce enable-file-sync? (or ENABLE-FILE-SYNC dev?)) ;; always enable file-sync when dev
(goog-define ENABLE-PLUGINS true)
(defonce enable-plugins? ENABLE-PLUGINS)

View File

@ -515,7 +515,7 @@
payload (-> event
(js->clj :keywordize-keys true))]
(fs-watcher/handle-changed! type payload)
(when config/enable-file-sync?
(when (file-sync-handler/enable-sync?)
(sync/file-watch-handler type payload))))
(defmethod handle :rebuild-slash-commands-list [[_]]

View File

@ -14,9 +14,13 @@
(def *beta-unavailable? (volatile! false))
(def hiding-login&file-sync (not config/enable-file-sync?))
(def refresh-file-sync-component (atom false))
(defn enable-sync?
[]
(or (state/enable-sync?)
config/dev?))
(defn current-graph-sync-on?
[]
(when-let [sync-state (state/sub [:file-sync/sync-state (state/get-current-repo)])]

View File

@ -402,7 +402,7 @@
(defn user-groups
[]
(set (get-in @state [:user/info :UserGroups])))
(set (sub [:user/info :UserGroups])))
(defn enable-sync?
[]