enhance(mobile): add a refresh button

This commit is contained in:
leizhe
2021-11-26 16:45:35 +08:00
parent ccd5b6e69a
commit dc9ca3462b
3 changed files with 28 additions and 8 deletions

View File

@@ -11,5 +11,9 @@
"splashImmersive": true, "splashImmersive": true,
"backgroundColor": "#002b36" "backgroundColor": "#002b36"
} }
},
"server": {
"url": "http://192.168.0.104:3001",
"cleartext": true
} }
} }

View File

@@ -16,10 +16,10 @@ const config: CapacitorConfig = {
} }
// do not commit this into source control // do not commit this into source control
// source: https://capacitorjs.com/docs/guides/live-reload // source: https://capacitorjs.com/docs/guides/live-reload
//, server: { , server: {
// url: process.env.LOGSEQ_APP_SERVER_URL, url: "http://192.168.0.104:3001" //process.env.LOGSEQ_APP_SERVER_URL,
// cleartext: true cleartext: true
//} }
}; };
export = config; export = config;

View File

@@ -24,7 +24,8 @@
[reitit.frontend.easy :as rfe] [reitit.frontend.easy :as rfe]
[rum.core :as rum] [rum.core :as rum]
[frontend.mobile.util :as mobile-util] [frontend.mobile.util :as mobile-util]
[frontend.components.widgets :as widgets])) [frontend.components.widgets :as widgets]
[frontend.handler.web.nfs :as nfs-handler]))
(rum/defc home-button [] (rum/defc home-button []
(ui/with-shortcut :go/home "left" (ui/with-shortcut :go/home "left"
@@ -205,9 +206,24 @@
(new-block-mode) (new-block-mode)
(when refreshing? (when (mobile-util/is-native-platform?)
[:div {:class "animate-spin-reverse"} [:a.text-sm.font-medium.button
svg/refresh]) {:on-click
(fn []
(state/pub-event!
[:modal/show
[:div {:style {:max-width 700}}
[:p "Refresh detects and processes files modified on your disk and diverged from the actual Logseq page content. Continue?"]
(ui/button
"Yes"
:on-click (fn []
(state/close-modal!)
(nfs-handler/refresh! (state/get-current-repo) repo/refresh-cb)))]]))}
(if refreshing?
[:div {:class "animate-spin-reverse"}
svg/refresh]
[:div.flex.flex-row.text-center.open-button__inner.items-center
(ui/icon "refresh" {:style {:fontSize ui/icon-size}})])])
(repo/sync-status current-repo) (repo/sync-status current-repo)