From a7b8fd7fe9b45ce5f127b0765d50cb254591f5b5 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Tue, 28 Sep 2021 09:32:21 +0800 Subject: [PATCH] fix(mobile): today's journal not created automatically --- android/app/src/main/assets/capacitor.config.json | 4 ++-- src/main/frontend/components/repo.cljs | 6 ++++-- src/main/frontend/config.cljs | 5 +++-- src/main/frontend/fs/capacitor_fs.cljs | 2 +- src/main/frontend/handler/web/nfs.cljs | 2 +- 5 files changed, 11 insertions(+), 8 deletions(-) diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index 3beaf3a7f..94482261a 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -1,10 +1,10 @@ { "appId": "com.logseq.app", "appName": "Logseq", - "webDir": "public", "bundledWebRuntime": false, + "webDir": "public", "server": { - "url": "http://192.168.50.122:3001", + "url": "http://192.168.1.59:3001", "cleartext": true } } diff --git a/src/main/frontend/components/repo.cljs b/src/main/frontend/components/repo.cljs index cc3089bc3..fe8c6b55d 100644 --- a/src/main/frontend/components/repo.cljs +++ b/src/main/frontend/components/repo.cljs @@ -20,7 +20,8 @@ [frontend.util :as util] [frontend.version :as version] [reitit.frontend.easy :as rfe] - [rum.core :as rum])) + [rum.core :as rum] + [frontend.mobile.util :as mobile-util])) (rum/defc add-repo [args] @@ -189,7 +190,8 @@ [:a#repo-switch.fade-link.block.pr-2.whitespace-nowrap {:on-click toggle-fn} [:span (let [repo-name (get-repo-name current-repo) - repo-name (if (util/electron?) + repo-name (if (or (util/electron?) + (mobile-util/is-native-platform?)) (last (string/split repo-name #"/")) repo-name)] diff --git a/src/main/frontend/config.cljs b/src/main/frontend/config.cljs index ea6e92b00..aa2e47f21 100644 --- a/src/main/frontend/config.cljs +++ b/src/main/frontend/config.cljs @@ -348,7 +348,8 @@ (defn get-repo-path [repo-url path] - (if (and (util/electron?) (local-db? repo-url)) + (if (and (or (util/electron?) (mobile-util/is-native-platform?)) + (local-db? repo-url)) path (util/node-path.join (get-repo-dir repo-url) path))) @@ -356,7 +357,7 @@ [repo-url relative-path] (when (and repo-url relative-path) (cond - (and (util/electron?) (local-db? repo-url)) + (and (or (util/electron?) (mobile-util/is-native-platform?)) (local-db? repo-url)) (let [dir (get-repo-dir repo-url)] (if (string/starts-with? relative-path dir) relative-path diff --git a/src/main/frontend/fs/capacitor_fs.cljs b/src/main/frontend/fs/capacitor_fs.cljs index 681e86316..8ee0f1bc7 100644 --- a/src/main/frontend/fs/capacitor_fs.cljs +++ b/src/main/frontend/fs/capacitor_fs.cljs @@ -86,7 +86,7 @@ (js/console.log result) result)) (readdir [this dir] ; recursive - nil) + (readdir dir)) (unlink! [this repo path _opts] nil) (rmdir! [this dir] diff --git a/src/main/frontend/handler/web/nfs.cljs b/src/main/frontend/handler/web/nfs.cljs index c3c48db1f..ebbd704f3 100644 --- a/src/main/frontend/handler/web/nfs.cljs +++ b/src/main/frontend/handler/web/nfs.cljs @@ -48,7 +48,7 @@ (cond mobile-native? (map (fn [{:keys [uri content type size mtime]}] - {:file/path uri + {:file/path (string/replace uri "file://" "") :file/last-modified-at mtime :file/size size :file/content content})