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

This commit is contained in:
Andelf
2022-09-23 15:43:20 +08:00
parent dd91207d6f
commit d1c7328a93
4 changed files with 26 additions and 19 deletions

View File

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

View File

@@ -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",

View File

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

View File

@@ -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/capacitor-file-sync@0.0.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/capacitor-file-sync@0.0.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/react-tweet-embed@1.3.1-1":
version "1.3.1-1"