Преглед изворни кода

fix(sync): synced pictures not reload on mobile

charlie пре 3 година
родитељ
комит
627bfcec9e
1 измењених фајлова са 9 додато и 4 уклоњено
  1. 9 4
      deps/graph-parser/src/logseq/graph_parser/config.cljs

+ 9 - 4
deps/graph-parser/src/logseq/graph_parser/config.cljs

@@ -1,7 +1,8 @@
 (ns logseq.graph-parser.config
   "App config that is shared between graph-parser and rest of app"
   (:require [clojure.set :as set]
-            [clojure.string :as string]))
+            [clojure.string :as string]
+            [goog.object :as gobj]))
 
 (def app-name
   "Copy of frontend.config/app-name. Too small to couple to main app"
@@ -9,7 +10,9 @@
 
 (defonce asset-protocol "assets://")
 (defonce capacitor-protocol "capacitor://")
-(defonce capacitor-protocol-with-prefix (str capacitor-protocol "localhost/_capacitor_file_"))
+(defonce capacitor-prefix "_capacitor_file_")
+(defonce capacitor-protocol-with-prefix (str capacitor-protocol "localhost/" capacitor-prefix))
+(defonce capacitor-x-protocol-with-prefix (str (gobj/getValueByKeys js/globalThis "location" "href") capacitor-prefix))
 
 (defonce local-assets-dir "assets")
 
@@ -22,14 +25,16 @@
   [s]
   (when (string? s)
     (or (string/starts-with? s asset-protocol)
-        (string/starts-with? s capacitor-protocol))))
+        (string/starts-with? s capacitor-protocol)
+        (string/starts-with? s capacitor-x-protocol-with-prefix))))
 
 (defn remove-asset-protocol
   [s]
   (if (local-protocol-asset? s)
     (-> s
         (string/replace-first asset-protocol "")
-        (string/replace-first capacitor-protocol-with-prefix "file://"))
+        (string/replace-first capacitor-protocol-with-prefix "file://")
+        (string/replace-first capacitor-x-protocol-with-prefix "file://"))
     s))
 
 (defonce default-draw-directory "draws")