Skip to content

Commit d74f564

Browse files
committed
fix: add ulink support for p chat and com request back
blocking e2e test Signed-off-by: yqrashawn <[email protected]>
1 parent 221c501 commit d74f564

File tree

6 files changed

+18
-9
lines changed

6 files changed

+18
-9
lines changed

android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070
<category android:name="android.intent.category.DEFAULT" />
7171
<category android:name="android.intent.category.BROWSABLE" />
7272
<data android:scheme="status-app" />
73+
<data android:scheme="status-im" />
7374
<data android:scheme="ethereum" />
7475
</intent-filter>
7576
</activity>

ios/StatusIm/Info.plist

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
<key>CFBundleURLSchemes</key>
3535
<array>
3636
<string>status-app</string>
37+
<string>status-im</string>
3738
</array>
3839
</dict>
3940
<dict>

ios/StatusImPR/Info.plist

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<key>CFBundleURLSchemes</key>
3131
<array>
3232
<string>status-app</string>
33+
<string>status-im</string>
3334
</array>
3435
</dict>
3536
<dict>

src/status_im/router/core.cljs

+9-7
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
(def ethereum-scheme "ethereum:")
2222

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

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

@@ -40,6 +40,8 @@
4040
(def routes
4141
[""
4242
{handled-schemes {["c/" :community-data] :community
43+
["p/" :chat-id] :private-chat
44+
["cr/" :community-id] :community-requests
4345
["cc/" :chat-data] :community-chat
4446
["u/" :user-data] :user}
4547
ethereum-scheme eip-extractor}])
@@ -253,9 +255,9 @@
253255
(and (= handler :user) (:user-id route-params))
254256
(match-contact-async chain route-params cb)
255257

256-
;; ;; NOTE: removed in `match-uri`, might need this in the future
257-
;; (= handler :private-chat)
258-
;; (match-private-chat-async chain route-params cb)
258+
;; NOTE: removed in `match-uri`, might need this in the future
259+
(= handler :private-chat)
260+
(match-private-chat-async chain route-params cb)
259261

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

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

271273
(and (= handler :community) (:community-id route-params))
272274
(cb {:type (community-route-type route-params)

src/status_im/utils/universal_links/utils.cljs

+4-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
(defn universal-link?
1717
[url]
1818
(boolean
19-
(re-matches constants/regx-universal-link url)))
19+
(or (re-matches constants/regx-universal-link url)
20+
(re-matches constants/regx-universal-link-deprecated url))))
2021

2122
(defn deep-link?
2223
[url]
2324
(boolean
24-
(re-matches constants/regx-deep-link url)))
25+
(or (re-matches constants/regx-deep-link url)
26+
(re-matches constants/regx-deep-link-deprecated url))))
2527

2628
(defn generate-link
2729
[link-type domain-type param]

src/status_im2/constants.cljs

+2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,10 @@
179179
(def regx-italic #"~[^~]+~")
180180
(def regx-backquote #"`[^`]+`")
181181
(def regx-universal-link #"((^https?://status.app/)|(^status-app://))[\x00-\x7F]+$")
182+
(def regx-universal-link-deprecated #"((^https?://status.app/)|(^status-im://))[\x00-\x7F]+$")
182183
(def regx-community-universal-link #"((^https?://status.app/)|(^status-app://))c/([\x00-\x7F]+)$")
183184
(def regx-deep-link #"((^ethereum:.*)|(^status-app://[\x00-\x7F]+$))")
185+
(def regx-deep-link-deprecated #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))")
184186
(def regx-ens #"^(?=.{5,255}$)([a-zA-Z0-9-]+\.)*[a-zA-Z0-9-]+\.[a-zA-Z]{2,}$")
185187
(def regx-address #"^0x[a-fA-F0-9]{40}$")
186188
(def regx-address-contains #"(?i)0x[a-fA-F0-9]{40}")

0 commit comments

Comments
 (0)