Tienson Qin 4 лет назад
Родитель
Сommit
e2894ee189

+ 1 - 1
android/app/src/main/assets/capacitor.config.json

@@ -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
 	}
 }

+ 2 - 2
src/main/frontend/components/editor.cljs

@@ -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 "/" {})

+ 1 - 1
src/main/frontend/components/editor.css

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

+ 16 - 11
src/main/frontend/fs.cljs

@@ -114,17 +114,21 @@
   [dir path]
   (protocol/stat (get-fs dir) dir path))
 
-(defn open-dir
-  [ok-handler]
-  (let [record (cond
-                 (util/electron?)
-                 node-record
+(defn- get-record
+  []
+  (cond
+    (util/electron?)
+    node-record
 
-                 (mobile-util/is-native-platform?)
-                 mobile-record
+    (mobile-util/is-native-platform?)
+    mobile-record
 
-                 :else
-                 nfs-record)]
+    :else
+    nfs-record))
+
+(defn open-dir
+  [ok-handler]
+  (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))))

+ 2 - 2
src/main/frontend/fs/capacitor_fs.cljs

@@ -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))
 

+ 1 - 1
src/main/frontend/handler.cljs

@@ -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)))

+ 4 - 2
src/main/frontend/handler/web/nfs.cljs

@@ -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))