Skip to content

Commit

Permalink
fix: add ulink support for p chat and com request back
Browse files Browse the repository at this point in the history
blocking e2e test

Signed-off-by: yqrashawn <namy.19@gmail.com>
  • Loading branch information
yqrashawn committed Oct 23, 2023
1 parent 04a7f76 commit 1ebc19a
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
1 change: 1 addition & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="status-app" />
<data android:scheme="status-im" />
<data android:scheme="ethereum" />
</intent-filter>
</activity>
Expand Down
1 change: 1 addition & 0 deletions ios/StatusIm/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<key>CFBundleURLSchemes</key>
<array>
<string>status-app</string>
<string>status-im</string>
</array>
</dict>
<dict>
Expand Down
1 change: 1 addition & 0 deletions ios/StatusImPR/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<key>CFBundleURLSchemes</key>
<array>
<string>status-app</string>
<string>status-im</string>
</array>
</dict>
<dict>
Expand Down
16 changes: 9 additions & 7 deletions src/status_im/router/core.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

(def ethereum-scheme "ethereum:")

(def uri-schemes ["status-app://"])
(def uri-schemes ["status-app://" "status-im://" "status-im:"])

(def web-prefixes ["https://" "http://" "https://www." "http://www."])

Expand All @@ -40,6 +40,8 @@
(def routes
[""
{handled-schemes {["c/" :community-data] :community
["p/" :chat-id] :private-chat
["cr/" :community-id] :community-requests
["cc/" :chat-data] :community-chat
["u/" :user-data] :user}
ethereum-scheme eip-extractor}])
Expand Down Expand Up @@ -253,9 +255,9 @@
(and (= handler :user) (:user-id route-params))
(match-contact-async chain route-params cb)

;; ;; NOTE: removed in `match-uri`, might need this in the future
;; (= handler :private-chat)
;; (match-private-chat-async chain route-params cb)
;; NOTE: removed in `match-uri`, might need this in the future
(= handler :private-chat)
(match-private-chat-async chain route-params cb)

;; ;; NOTE: removed in `match-uri`, might need this in the future
;; (= handler :group-chat)
Expand All @@ -264,9 +266,9 @@
(validators/valid-public-key? uri)
(match-contact-async chain {:user-id uri} cb)

;; ;; NOTE: removed in `match-uri`, might need this in the future
;; (= handler :community-requests)
;; (cb {:type handler :community-id (:community-id route-params)})
;; NOTE: removed in `match-uri`, might need this in the future
(= handler :community-requests)
(cb {:type handler :community-id (:community-id route-params)})

(and (= handler :community) (:community-id route-params))
(cb {:type (community-route-type route-params)
Expand Down
6 changes: 4 additions & 2 deletions src/status_im/utils/universal_links/utils.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
(defn universal-link?
[url]
(boolean
(re-matches constants/regx-universal-link url)))
(or (re-matches constants/regx-universal-link url)
(re-matches constants/regx-universal-link-deprecated url))))

(defn deep-link?
[url]
(boolean
(re-matches constants/regx-deep-link url)))
(or (re-matches constants/regx-deep-link url)
(re-matches constants/regx-deep-link-deprecated url))))

(defn generate-link
[link-type domain-type param]
Expand Down
2 changes: 2 additions & 0 deletions src/status_im2/constants.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,10 @@
(def regx-italic #"~[^~]+~")
(def regx-backquote #"`[^`]+`")
(def regx-universal-link #"((^https?://status.app/)|(^status-app://))[\x00-\x7F]+$")
(def regx-universal-link-deprecated #"((^https?://status.app/)|(^status-im://))[\x00-\x7F]+$")
(def regx-community-universal-link #"((^https?://status.app/)|(^status-app://))c/([\x00-\x7F]+)$")
(def regx-deep-link #"((^ethereum:.*)|(^status-app://[\x00-\x7F]+$))")
(def regx-deep-link-deprecated #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))")
(def regx-ens #"^(?=.{5,255}$)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$")
(def regx-address #"^0x[a-fA-F0-9]{40}$")
(def regx-address-contains #"(?i)0x[a-fA-F0-9]{40}")
Expand Down

0 comments on commit 1ebc19a

Please sign in to comment.