[Fixes #7213] Properly handle universal links in status
Signed-off-by: Julien Eluard <julien.eluard@gmail.com>
This commit is contained in:
parent
40aff1da8d
commit
13b6295469
|
@ -198,6 +198,17 @@
|
|||
(when (and platform/android? (string/ends-with? url ".pdf"))
|
||||
{:browser/show-web-browser-selection url}))
|
||||
|
||||
(fx/defn handle-message-link
|
||||
[cofx link]
|
||||
(if (utils.universal-links/universal-link? link)
|
||||
(utils.universal-links/handle-url cofx link)
|
||||
{:browser/show-browser-selection link}))
|
||||
|
||||
(fx/defn handle-universal-link
|
||||
[cofx link]
|
||||
(when (utils.universal-links/universal-link? link)
|
||||
(utils.universal-links/handle-url cofx link)))
|
||||
|
||||
(fx/defn update-browser-on-nav-change
|
||||
[cofx url error?]
|
||||
(let [browser (get-current-browser (:db cofx))
|
||||
|
@ -209,6 +220,7 @@
|
|||
(fx/merge cofx
|
||||
(update-browser-history browser resolved-url)
|
||||
(handle-pdf url)
|
||||
(handle-universal-link url)
|
||||
(resolve-url {:error? error? :resolved-url (when resolved-ens url)}))))))
|
||||
|
||||
(fx/defn update-browser-name
|
||||
|
@ -335,12 +347,6 @@
|
|||
(= type constants/api-request)
|
||||
(browser.permissions/process-permission cofx dapp-name permission messageId params))))
|
||||
|
||||
(fx/defn handle-message-link
|
||||
[cofx link]
|
||||
(if (utils.universal-links/universal-link? link)
|
||||
(utils.universal-links/handle-url cofx link)
|
||||
{:browser/show-browser-selection link}))
|
||||
|
||||
(defn filter-letters-numbers-and-replace-dot-on-dash [value]
|
||||
(let [cc (.charCodeAt value 0)]
|
||||
(cond (or (and (> cc 96) (< cc 123))
|
||||
|
|
|
@ -691,15 +691,21 @@
|
|||
{:errors [{:type type :value value}]}))
|
||||
|
||||
(def uri-prefix "https://get.status.im/extension/")
|
||||
(def link-prefix "status-im://extension/")
|
||||
|
||||
(defn valid-uri? [s]
|
||||
(boolean
|
||||
(when s
|
||||
(re-matches (re-pattern (str "^" uri-prefix "\\w+@.+")) (string/trim s)))))
|
||||
(let [s' (string/trim s)]
|
||||
(or
|
||||
(re-matches (re-pattern (str "^" uri-prefix "\\w+@.+")) s')
|
||||
(re-matches (re-pattern (str "^" link-prefix "\\w+@.+")) s'))))))
|
||||
|
||||
(defn url->uri [s]
|
||||
(when s
|
||||
(string/replace s uri-prefix "")))
|
||||
(-> s
|
||||
(string/replace uri-prefix "")
|
||||
(string/replace link-prefix ""))))
|
||||
|
||||
(defn load-from [url f]
|
||||
(when-let [uri (url->uri url)]
|
||||
|
|
Loading…
Reference in New Issue