fix(mobile): re-index

This commit is contained in:
Tienson Qin
2021-09-29 13:18:02 +08:00
parent 31cbdcad2e
commit e2894ee189
7 changed files with 27 additions and 20 deletions

View File

@@ -4,7 +4,7 @@
"bundledWebRuntime": false,
"webDir": "public",
"server": {
"url": "http://192.168.147.189:3001",
"url": "http://192.168.1.59:3001",
"cleartext": true
}
}

View File

@@ -235,7 +235,7 @@
(commands/handle-step [:editor/search-page]))})
(when-let [input (gdom/getElement parent-id)]
(.focus input)))}
"[[]]"]
"[["]
[:button.bottom-action.text-sm
{:on-click #(do
(commands/simple-insert!
@@ -246,7 +246,7 @@
(commands/handle-step [:editor/search-block]))})
(when-let [input (gdom/getElement parent-id)]
(.focus input)))}
"(())"]
"(("]
[:button.bottom-action.text-sm
{:on-click #(do
(commands/simple-insert! parent-id "/" {})

View File

@@ -12,7 +12,7 @@
transition: top 0.3s;
> button {
padding: 12px;
padding: 10px;
}
}

View File

@@ -114,17 +114,21 @@
[dir path]
(protocol/stat (get-fs dir) dir path))
(defn- get-record
[]
(cond
(util/electron?)
node-record
(mobile-util/is-native-platform?)
mobile-record
:else
nfs-record))
(defn open-dir
[ok-handler]
(let [record (cond
(util/electron?)
node-record
(mobile-util/is-native-platform?)
mobile-record
:else
nfs-record)]
(let [record (get-record)]
(->
(p/let [result (protocol/open-dir record ok-handler)]
(if (or (util/electron?)
@@ -137,9 +141,10 @@
(defn get-files
[path-or-handle ok-handler]
(let [record (if (util/electron?) node-record nfs-record)]
(let [record (get-record)]
(p/let [result (protocol/get-files record path-or-handle ok-handler)]
(if (util/electron?)
(if (or (util/electron?)
(mobile-util/is-native-platform?))
(let [result (bean/->clj result)]
(rest result))
result))))

View File

@@ -145,8 +145,8 @@
(js/console.log path)
(js/console.log files)
(into [] (concat [{:path path}] files)))))
(get-files [this path-or-handle ok-handler]
nil)
(get-files [this path-or-handle _ok-handler]
(readdir path-or-handle))
(watch-dir! [this dir]
nil))

View File

@@ -235,4 +235,4 @@
(p/let [_ (el/persist-dbs!)
_ (reset! triggered? true)
_ (ipc/invoke "set-quit-dirty-state" false)]
(ipc/ipc :quitAndInstall)))
(ipc/ipc :quitAndInstall)))

View File

@@ -279,8 +279,10 @@
(when re-index?
(state/set-graph-syncing? true))
(->
(p/let [handle (idb/get-item handle-path)]
(when (or handle electron?) ; electron doesn't store the file handle
(p/let [handle (-> (idb/get-item handle-path)
(p/catch (fn [_error]
nil)))]
(when (or handle electron? mobile-native?) ; electron doesn't store the file handle
(p/let [_ (when handle (nfs/verify-permission repo handle true))
files-result (fs/get-files (if nfs? handle
(config/get-local-dir repo))