From dc9ca3462bb6fa5e30de827aefaa64fe09dc29f2 Mon Sep 17 00:00:00 2001 From: leizhe Date: Fri, 26 Nov 2021 16:45:35 +0800 Subject: [PATCH] enhance(mobile): add a refresh button --- .../app/src/main/assets/capacitor.config.json | 4 ++++ capacitor.config.ts | 8 +++---- src/main/frontend/components/header.cljs | 24 +++++++++++++++---- 3 files changed, 28 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index ff2de7ba5..1c34a08de 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -11,5 +11,9 @@ "splashImmersive": true, "backgroundColor": "#002b36" } + }, + "server": { + "url": "http://192.168.0.104:3001", + "cleartext": true } } diff --git a/capacitor.config.ts b/capacitor.config.ts index db5c9f982..cd8163fc4 100644 --- a/capacitor.config.ts +++ b/capacitor.config.ts @@ -16,10 +16,10 @@ const config: CapacitorConfig = { } // do not commit this into source control // source: https://capacitorjs.com/docs/guides/live-reload - //, server: { - // url: process.env.LOGSEQ_APP_SERVER_URL, - // cleartext: true - //} + , server: { + url: "http://192.168.0.104:3001" //process.env.LOGSEQ_APP_SERVER_URL, + cleartext: true + } }; export = config; diff --git a/src/main/frontend/components/header.cljs b/src/main/frontend/components/header.cljs index a18e9a17c..019977e70 100644 --- a/src/main/frontend/components/header.cljs +++ b/src/main/frontend/components/header.cljs @@ -24,7 +24,8 @@ [reitit.frontend.easy :as rfe] [rum.core :as rum] [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 [] (ui/with-shortcut :go/home "left" @@ -205,9 +206,24 @@ (new-block-mode) - (when refreshing? - [:div {:class "animate-spin-reverse"} - svg/refresh]) + (when (mobile-util/is-native-platform?) + [:a.text-sm.font-medium.button + {: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)