Skip to content

Commit

Permalink
Router fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
alwx committed Jan 30, 2024
1 parent 5b36a6d commit c0746a5
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
27 changes: 18 additions & 9 deletions src/status_im/common/router.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,17 @@

(def web2-domain "status.app")

(def user-path "u#")
(def user-with-data-path "u/")
(def community-path "c#")
(def community-with-data-path "c/")
(def channel-path "cc/")

(def web-urls (map #(str % web2-domain "/") web-prefixes))

(defn path-urls [path]
(map #(str % "/" path) web-urls))

(def handled-schemes (set (into uri-schemes web-urls)))

(def group-chat-extractor
Expand All @@ -41,15 +50,15 @@

(def routes
[""
{handled-schemes {["c/" :community-data] :community
["cc/" :community-data] :community-chat
["p/" :chat-id] :private-chat
["cr/" :community-id] :community-requests
"g/" group-chat-extractor
["wallet/" :account] :wallet-account
["u/" :user-data] :user
"c" :community
"u" :user}
{handled-schemes {[community-with-data-path :community-data] :community
[channel-path :community-data] :community-chat
["p/" :chat-id] :private-chat
["cr/" :community-id] :community-requests
"g/" group-chat-extractor
["wallet/" :account] :wallet-account
[user-with-data-path :user-data] :user
"c" :community
"u" :user}
ethereum-scheme eip-extractor}])

(defn parse-query-params
Expand Down
7 changes: 5 additions & 2 deletions src/status_im/contexts/shell/qr_reader/view.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@
[re-frame.core :as rf]
[react-native.core :as rn]
[react-native.hooks :as hooks]
[status-im.common.router :as router]
[status-im.common.scan-qr-code.view :as scan-qr-code]
[status-im.contexts.wallet.common.validation :as wallet-validation]
[status-im.navigation.events :as navigation]
[utils.i18n :as i18n]))

(defn community-qr-code?
[scanned-text]
false)
(string/starts-with? scanned-text "https://status.app/c/"))

;;(some string/starts-with? (router/path-urls router/user-with-data-path))

(defn channel-qr-code?
[scanned-text]
false)
(string/starts-with? scanned-text "https://status.app/cc/"))

(defn profile-qr-code?
[scanned-text]
Expand Down

0 comments on commit c0746a5

Please sign in to comment.