Bladeren bron

fix(android): use graph-uuid in call, update capacitor-file-sync

Andelf 3 jaren geleden
bovenliggende
commit
d1c7328a93
4 gewijzigde bestanden met toevoegingen van 26 en 19 verwijderingen
  1. 1 1
      android/app/src/main/assets/capacitor.plugins.json
  2. 1 1
      package.json
  3. 20 13
      src/main/frontend/fs/sync.cljs
  4. 4 4
      yarn.lock

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

@@ -37,7 +37,7 @@
 	},
 	{
 		"pkg": "@logseq/capacitor-file-sync",
-		"classpath": "com.logseq.app.FileSyncPlugin"
+		"classpath": "com.logseq.app.filesync.FileSyncPlugin"
 	},
 	{
 		"pkg": "capacitor-voice-recorder",

+ 1 - 1
package.json

@@ -83,7 +83,7 @@
         "@capacitor/status-bar": "^4.0.0",
         "@excalidraw/excalidraw": "0.10.0",
         "@kanru/rage-wasm": "0.2.1",
-        "@logseq/capacitor-file-sync": "0.0.6",
+        "@logseq/capacitor-file-sync": "0.0.10",
         "@logseq/react-tweet-embed": "1.3.1-1",
         "@sentry/react": "^6.18.2",
         "@sentry/tracing": "^6.18.2",

+ 20 - 13
src/main/frontend/fs/sync.cljs

@@ -820,13 +820,15 @@
     (set! graph-uuid' graph-uuid)
     (set! private-key secret-key)
     (set! public-key' public-key)
-    (p->c (.setEnv mobile-util/file-sync (clj->js {:env (if prod? "prod" "dev")
+    (p->c (.setEnv mobile-util/file-sync (clj->js {:graphUUID graph-uuid
+                                                   :env (if prod? "prod" "dev")
                                                    :secretKey secret-key
                                                    :publicKey public-key}))))
 
-  (<get-local-all-files-meta [_ _graph-uuid base-path]
+  (<get-local-all-files-meta [_ graph-uuid base-path]
     (go
-      (let [r (<! (p->c (.getLocalAllFilesMeta mobile-util/file-sync (clj->js {:basePath base-path}))))]
+      (let [r (<! (p->c (.getLocalAllFilesMeta mobile-util/file-sync (clj->js {:graphUUID graph-uuid
+                                                                               :basePath base-path}))))]
         (if (instance? ExceptionInfo r)
           r
           (->> (.-result r)
@@ -836,10 +838,11 @@
                                       (get metadata "encryptedFname") (get metadata "mtime") false nil)))
                set)))))
 
-  (<get-local-files-meta [_ _graph-uuid base-path filepaths]
+  (<get-local-files-meta [_ graph-uuid base-path filepaths]
     (go
       (let [r (<! (p->c (.getLocalFilesMeta mobile-util/file-sync
-                                            (clj->js {:basePath base-path
+                                            (clj->js {:graphUUID graph-uuid
+                                                      :basePath base-path
                                                       :filePaths filepaths}))))]
         (assert (not (instance? ExceptionInfo r)) "get-local-files-meta shouldn't return exception")
         (->> (.-result r)
@@ -849,9 +852,10 @@
                                     (get metadata "encryptedFname") (get metadata "mtime") false nil)))
              set))))
 
-  (<rename-local-file [_ _graph-uuid base-path from to]
+  (<rename-local-file [_ graph-uuid base-path from to]
     (p->c (.renameLocalFile mobile-util/file-sync
-                            (clj->js {:basePath base-path
+                            (clj->js {:graphUUID graph-uuid
+                                      :basePath base-path
                                       :from from
                                       :to to}))))
 
@@ -874,10 +878,11 @@
                                                                           :token token})))))]
         r)))
 
-  (<delete-local-files [_ _graph-uuid base-path filepaths]
+  (<delete-local-files [_ graph-uuid base-path filepaths]
     (go
       (let [r (<! (<retry-rsapi #(p->c (.deleteLocalFiles mobile-util/file-sync
-                                                          (clj->js {:basePath base-path
+                                                          (clj->js {:graphUUID graph-uuid
+                                                                    :basePath base-path
                                                                     :filePaths filepaths})))))]
         r)))
 
@@ -907,16 +912,18 @@
          r
          (get (js->clj r) "txid")))))
 
-  (<encrypt-fnames [_ _graph-uuid fnames]
+  (<encrypt-fnames [_ graph-uuid fnames]
     (go
       (let [r (<! (p->c (.encryptFnames mobile-util/file-sync
-                                        (clj->js {:filePaths fnames}))))]
+                                        (clj->js {:graphUUID graph-uuid
+                                                  :filePaths fnames}))))]
         (if (instance? ExceptionInfo r)
           (.-cause r)
           (get (js->clj r) "value")))))
-  (<decrypt-fnames [_ _graph-uuid fnames]
+  (<decrypt-fnames [_ graph-uuid fnames]
     (go (let [r (<! (p->c (.decryptFnames mobile-util/file-sync
-                                          (clj->js {:filePaths fnames}))))]
+                                          (clj->js {:graphUUID graph-uuid
+                                                    :filePaths fnames}))))]
           (if (instance? ExceptionInfo r)
             (ex-info "decrypt-failed" {:fnames fnames} (ex-cause r))
             (get (js->clj r) "value"))))))

+ 4 - 4
yarn.lock

@@ -480,10 +480,10 @@
   resolved "https://registry.yarnpkg.com/@kanru/rage-wasm/-/rage-wasm-0.2.1.tgz#dd8fdd3133992c42bf68c0086d8cad40a13bc329"
   integrity sha512-sYi4F2mL6Mpcz7zbS4myasw11xLBEbgZkDMRVg9jNxTKt6Ct/LT7/vCHDmEzAFcPcPqixD5De6Ql3bJijAX0/w==
 
-"@logseq/[email protected].6":
-  version "0.0.6"
-  resolved "https://registry.yarnpkg.com/@logseq/capacitor-file-sync/-/capacitor-file-sync-0.0.6.tgz#e738ec08c1249ad96560c5f5090a60f4f49d679a"
-  integrity sha512-gnSAm2x9jNAtlQP4r8S5P2a7vRYZkGDIh6wX1/UgldDHPaY//+SWYvtFQQeDEJ1rLU/S+UYnPndlQdMDpu6mqA==
+"@logseq/[email protected].10":
+  version "0.0.10"
+  resolved "https://registry.yarnpkg.com/@logseq/capacitor-file-sync/-/capacitor-file-sync-0.0.10.tgz#36575b369a4fff83e71b282c19cc948d60309809"
+  integrity sha512-O4bCHLym7+DnqCoO57D1Ii6ec6tcZBjp8SzFEYCKE9mvHsX5aFmCA61XUHgNEFovocQ3gBMJvi6GKSJBcGwT3Q==
 
 "@logseq/[email protected]":
   version "1.3.1-1"