diff --git a/android/app/src/main/assets/capacitor.config.json b/android/app/src/main/assets/capacitor.config.json index 1c34a08de3..ff2de7ba55 100644 --- a/android/app/src/main/assets/capacitor.config.json +++ b/android/app/src/main/assets/capacitor.config.json @@ -11,9 +11,5 @@ "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 5848a8239b..43a87e49c5 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: process.env.LOGSEQ_APP_SERVER_URL, + // cleartext: true + // } }; export = config; diff --git a/package.json b/package.json index 0d042c391a..99b229a073 100644 --- a/package.json +++ b/package.json @@ -53,7 +53,7 @@ "cljs:electron-watch": "PATCH_PARSER_WORKER=$(cat \"./templates/patch.parser.worker.js\" | sed -e \"s#PWD_ROOT#`pwd`#g\") clojure -M:cljs watch parser-worker app electron", "cljs:release": "clojure -M:cljs release parser-worker app publishing electron", "cljs:release-electron": "clojure -M:cljs release parser-worker app publishing electron --debug", - "cljs:release-app": "clojure -M:cljs release parser-worker app", + "cljs:release-app": "clojure -M:cljs release parser-worker app --debug", "cljs:test": "clojure -M:test compile test", "cljs:run-test": "node static/tests.js", "cljs:dev-release-app": "clojure -M:cljs release app --config-merge '{:closure-defines {frontend.config/DEV-RELEASE true}}'", diff --git a/src/main/frontend/components/sidebar.cljs b/src/main/frontend/components/sidebar.cljs index 134d790c64..0fbcc3cfa9 100644 --- a/src/main/frontend/components/sidebar.cljs +++ b/src/main/frontend/components/sidebar.cljs @@ -441,7 +441,10 @@ (seq latest-journals) (journal/journals latest-journals) - (and logged? (empty? (:repos me))) + (or + (and (mobile-util/is-native-platform?) + (nil? (state/get-current-repo))) + (and logged? (empty? (:repos me)))) (widgets/add-graph) ;; FIXME: why will this happen? diff --git a/src/main/frontend/fs/capacitor_fs.cljs b/src/main/frontend/fs/capacitor_fs.cljs index 9333e6dc3b..e659c8662c 100644 --- a/src/main/frontend/fs/capacitor_fs.cljs +++ b/src/main/frontend/fs/capacitor_fs.cljs @@ -36,6 +36,8 @@ (remove (fn [file] (string/starts-with? file ".")))) files (->> files (map (fn [file] (futil/node-path.join d file)))) + _ (prn "files: ") + _ (js/console.dir files) files-with-stats (p/all (mapv (fn [file] @@ -148,9 +150,8 @@ (.pickFolder util/folder-picker) #(js->clj % :keywordize-keys true) :path) - files (readdir path)] - (js/console.log path) - (js/console.log files) + files (readdir path) + files (js->clj files :keywordize-keys true)] (into [] (concat [{:path path}] files)))) (get-files [this path-or-handle _ok-handler] (readdir path-or-handle)) diff --git a/src/main/frontend/handler.cljs b/src/main/frontend/handler.cljs index eed44d8a8f..8ff04a3eeb 100644 --- a/src/main/frontend/handler.cljs +++ b/src/main/frontend/handler.cljs @@ -111,7 +111,8 @@ (and (not logged?) (not (seq (db/get-files config/local-repo))) ;; Not native local directory - (not (some config/local-db? (map :url repos)))) + (not (some config/local-db? (map :url repos))) + (not (mobile-util/is-native-platform?))) (repo-handler/setup-local-repo-if-not-exists!) :else diff --git a/src/main/frontend/handler/page.cljs b/src/main/frontend/handler/page.cljs index 043f782045..22c14116d9 100644 --- a/src/main/frontend/handler/page.cljs +++ b/src/main/frontend/handler/page.cljs @@ -33,7 +33,8 @@ [frontend.util.page-property :as page-property] [goog.object :as gobj] [lambdaisland.glogi :as log] - [promesa.core :as p])) + [promesa.core :as p] + [frontend.mobile.util :as mobile])) (defn- get-directory [journal?] @@ -700,8 +701,8 @@ (not (:repo/loading-files? @state/state))) (state/set-today! (date/today)) (when (or (db/cloned? repo) - (or (config/local-db? repo) - (= "local" repo))) + (config/local-db? repo) + (and (= "local" repo) (not (mobile/is-native-platform?)))) (let [title (date/today) today-page (string/lower-case title) template (state/get-default-journal-template) diff --git a/src/main/frontend/handler/repo.cljs b/src/main/frontend/handler/repo.cljs index e2e00d6e5b..79d7bb8f8b 100644 --- a/src/main/frontend/handler/repo.cljs +++ b/src/main/frontend/handler/repo.cljs @@ -555,26 +555,25 @@ (defn setup-local-repo-if-not-exists! [] - (when-not (mobile/is-native-platform?) - (if js/window.pfs - (let [repo config/local-repo] - (p/do! (fs/mkdir-if-not-exists (str "/" repo)) - (state/set-current-repo! repo) - (db/start-db-conn! nil repo) - (when-not config/publishing? - (let [dummy-notes (get-in dicts/dicts [:en :tutorial/dummy-notes])] - (create-dummy-notes-page repo dummy-notes))) - (when-not config/publishing? - (let [tutorial (get-in dicts/dicts [:en :tutorial/text]) - tutorial (string/replace-first tutorial "$today" (date/today))] - (create-today-journal-if-not-exists repo {:content tutorial}))) - (create-config-file-if-not-exists repo) - (create-contents-file repo) - (create-favorites-file repo) - (create-custom-theme repo) - (state/set-db-restoring! false) - (ui-handler/re-render-root!))) - (js/setTimeout setup-local-repo-if-not-exists! 100)))) + (if js/window.pfs + (let [repo config/local-repo] + (p/do! (fs/mkdir-if-not-exists (str "/" repo)) + (state/set-current-repo! repo) + (db/start-db-conn! nil repo) + (when-not config/publishing? + (let [dummy-notes (get-in dicts/dicts [:en :tutorial/dummy-notes])] + (create-dummy-notes-page repo dummy-notes))) + (when-not config/publishing? + (let [tutorial (get-in dicts/dicts [:en :tutorial/text]) + tutorial (string/replace-first tutorial "$today" (date/today))] + (create-today-journal-if-not-exists repo {:content tutorial}))) + (create-config-file-if-not-exists repo) + (create-contents-file repo) + (create-favorites-file repo) + (create-custom-theme repo) + (state/set-db-restoring! false) + (ui-handler/re-render-root!))) + (js/setTimeout setup-local-repo-if-not-exists! 100))) (defn periodically-pull-current-repo [] diff --git a/src/main/frontend/handler/web/nfs.cljs b/src/main/frontend/handler/web/nfs.cljs index ee076e99d5..592cdbcd93 100644 --- a/src/main/frontend/handler/web/nfs.cljs +++ b/src/main/frontend/handler/web/nfs.cljs @@ -184,10 +184,11 @@ (log/error :nfs/load-files-error repo) (log/error :exception error))))))) (p/catch (fn [error] + (log/error :exception error) (if (contains? #{"AbortError" "Error"} (gobj/get error "name")) (state/set-loading-files! false) ;; (log/error :nfs/open-dir-error error) - (log/error :exception error))))))) + )))))) (defn- compute-diffs [old-files new-files] diff --git a/src/main/frontend/state.cljs b/src/main/frontend/state.cljs index a7ada30c62..9098e64115 100644 --- a/src/main/frontend/state.cljs +++ b/src/main/frontend/state.cljs @@ -14,7 +14,8 @@ [lambdaisland.glogi :as log] [medley.core :as medley] [promesa.core :as p] - [rum.core :as rum])) + [rum.core :as rum] + [frontend.mobile.util :as mobile])) (defonce state (let [document-mode? (or (storage/get :document/mode?) false) @@ -231,7 +232,9 @@ (defn get-current-repo [] - (or (:git/current-repo @state) "local")) + (or (:git/current-repo @state) + (when-not (mobile/is-native-platform?) + "local"))) (defn get-config ([]