File tree 14 files changed +44
-45
lines changed
chat/messages/link_preview
14 files changed +44
-45
lines changed Original file line number Diff line number Diff line change 24
24
(defn universal-link
25
25
[community-id]
26
26
(str (:external universal-links/domains)
27
- " /c/ "
27
+ " /c# "
28
28
community-id))
29
29
30
30
(defn <-request-to-join-community-rpc
Original file line number Diff line number Diff line change 49
49
[" cr/" :community-id ] :community-requests
50
50
" g/" group-chat-extractor
51
51
[" wallet/" :account ] :wallet-account
52
- [" u/" :user-data ] :user }
52
+ [" u/" :user-data ] :user
53
+ " c" :community
54
+ " u" :user }
53
55
ethereum-scheme eip-extractor}])
54
56
55
57
(defn parse-query-params
Original file line number Diff line number Diff line change 19
19
:query-params (when (= 3 (count expected)) (last expected))
20
20
:uri uri})
21
21
22
+ " https://status.app/u#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj"
23
+ [:user
24
+ {:user-id " zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj" }]
22
25
" https://status.app/u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj"
23
26
[:user
24
27
{:user-data
31
34
" G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y"
32
35
:user-id " zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj" }]
33
36
37
+ " status-app://u#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj"
38
+ [:user
39
+ {:user-id " zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj" }]
40
+
34
41
" https://status.app/cc/G54AAKwObLdpiGjXnckYzRcOSq0QQAS_CURGfqVU42ceGHCObstUIknTTZDOKF3E8y2MSicncpO7fTskXnoACiPKeejvjtLTGWNxUhlT7fyQS7Jrr33UVHluxv_PLjV2ePGw5GQ33innzeK34pInIgUGs5RjdQifMVmURalxxQKwiuoY5zwIjixWWRHqjHM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"
35
42
[:community-chat
36
43
{:chat-data
48
55
{:community-data
49
56
" iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM="
50
57
:community-id " zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" }]
58
+ " https://status.app/c#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"
59
+ [:community
60
+ {:community-id " zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" }]
51
61
52
62
" status-app://c/iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"
53
63
[:community
54
64
{:community-data
55
65
" iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM="
56
66
:community-id " zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" }]
57
67
68
+ " status-app://c#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"
69
+ [:community
70
+ {:community-id " zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" }]
71
+
58
72
" ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"
59
73
[:ethereum {:address " 0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" }]
60
74
Original file line number Diff line number Diff line change 8
8
[status-im.multiaccounts.model :as multiaccounts.model]
9
9
[status-im.router.core :as router]
10
10
[status-im.ui.components.react :as react]
11
+ [status-im.utils.universal-links.utils :as universal-links.utils]
11
12
[status-im.wallet.choose-recipient.core :as choose-recipient]
12
13
[status-im2.constants :as constants]
13
14
[status-im2.navigation.events :as navigation]
27
28
(def links
28
29
{:private-chat " %s/p/%s"
29
30
:community-requests " %s/cr/%s"
30
- :community " %s/c/ %s"
31
+ :community " %s/c# %s"
31
32
:group-chat " %s/g/%s"
32
- :user " %s/u/ %s"
33
+ :user " %s/u# %s"
33
34
:browse " %s/b/%s" })
34
35
35
- (defn generate-link
36
- [link-type domain-type param]
37
- (gstring/format (get links link-type)
38
- (get domains domain-type)
39
- param))
40
-
41
- (defn universal-link?
42
- [url]
43
- (boolean
44
- (re-matches constants/regx-universal-link url)))
45
-
46
- (defn deep-link?
47
- [url]
48
- (boolean
49
- (re-matches constants/regx-deep-link url)))
50
-
51
36
(rf/defn handle-browse
52
37
[cofx {:keys [url]}]
53
38
(log/info " universal-links: handling browse" url)
220
205
#_ (native-module/start-searching-for-local-pairing-peers
221
206
#(log/info " [local-pairing] errors from local-pairing-preflight-outbound-check ->" %)))
222
207
223
-
224
208
(defn finalize
225
209
" Remove event listener for url"
226
210
[]
Original file line number Diff line number Diff line change 20
20
(is (nil? (get-in (links/handle-url {:db db} " some-url" )
21
21
[:db :universal-links/url ]))))
22
22
(testing " Handle a custom string"
23
- (is (= (get-in (links/handle-url {:db db} " https://status.app/u/ statuse2e" )
23
+ (is (= (get-in (links/handle-url {:db db} " https://status.app/u# statuse2e" )
24
24
[::router/handle-uri :uri ])
25
- " https://status.app/u/ statuse2e" )))))))
25
+ " https://status.app/u# statuse2e" )))))))
26
26
27
27
(deftest url-event-listener
28
28
(testing " the url is not nil"
Original file line number Diff line number Diff line change 10
10
11
11
(def links
12
12
{:private-chat " %s/p/%s"
13
- :user " %s/u/ %s"
13
+ :user " %s/u# %s"
14
14
:browse " %s/b/%s" })
15
15
16
16
(defn universal-link?
Original file line number Diff line number Diff line change 34
34
(zipmap (repeat nil ))))
35
35
([kv] (-> (init-contact ) (merge kv))))
36
36
37
- (def url-regex #"^https?://status.app/u/ (.+)" )
37
+ (def url-regex #"^https?://status.app/u# (.+)" )
38
38
39
39
(defn ->id
40
40
[{:keys [input] :as contact}]
Original file line number Diff line number Diff line change 11
11
(def ckey " zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA" )
12
12
(def ens " esep" )
13
13
(def ens-stateofus-eth (str ens " .stateofus.eth" ))
14
- (def link-ckey (str " https://status.app/u/ " ckey))
15
- (def link-ens (str " https://status.app/u/ " ens))
14
+ (def link-ckey (str " https://status.app/u# " ckey))
15
+ (def link-ens (str " https://status.app/u# " ens))
16
16
17
17
; ;; unit tests (no app-db involved)
18
18
Original file line number Diff line number Diff line change 80
80
:button (when empty-input?
81
81
{:on-press paste-on-input
82
82
:text (i18n/label :t/paste )})
83
- ; ; NOTE: `scanned` has priority over `@input-value`, we clean it when the input
84
- ; ; is updated so that it's `nil` and `@input-value` is shown.
85
- ; ; To fastly clean it, we use `dispatch-sync`.
86
- ; ; This call could be avoided if `::qr-scanner/scan-code` were able to receive a
87
- ; ; callback function, not only a re-frame event as callback.
83
+ ; ; NOTE: `scanned` has priority over `@input-value`, we clean it when the input is updated
84
+ ; ; so that it's `nil` and `@input-value` is shown. To fastly clean it, we use
85
+ ; ; `dispatch-sync`. This call could be avoided if `::qr-scanner/scan-code` were able to
86
+ ; ; receive a callback function, not only a re-frame event as callback.
88
87
:value (or scanned @input-value)
89
88
:on-change-text (fn [new-text]
90
89
(reset! input-value new-text)
Original file line number Diff line number Diff line change 9
9
10
10
(defn community-link
11
11
[id]
12
- (str " https://status.app/c/ " id))
12
+ (str " https://status.app/c# " id))
13
13
14
14
(rf/defn cache-link-preview-data
15
15
{:events [:chat.ui/cache-link-preview-data ]}
Original file line number Diff line number Diff line change 14
14
[]
15
15
(let [state (reagent/atom {:info-button? true
16
16
:link-title " Link to profile"
17
- :url " status.app/u/ zQ34e1zlOdas0pKnvrweeedsasas12adjie8" })]
17
+ :url " status.app/u# zQ34e1zlOdas0pKnvrweeedsasas12adjie8" })]
18
18
(fn []
19
19
(let [qr-media-server-uri (image-server/get-qr-image-uri-for-any-url
20
20
{:url (:url @state)
Original file line number Diff line number Diff line change 43
43
44
44
(defn get-abbreviated-profile-url
45
45
" The goal here is to generate a string that begins with
46
- status.app/u/ joined with the 1st 5 characters
46
+ status.app/u# joined with the 1st 5 characters
47
47
of the compressed public key followed by an ellipsis followed by
48
48
the last 10 characters of the compressed public key"
49
49
[base-url public-key]
50
- (if (and public-key base-url (> (count public-key) 17 ) (= " status.app/u/ " base-url))
50
+ (if (and public-key base-url (> (count public-key) 17 ) (= " status.app/u# " base-url))
51
51
(let [first-part-of-public-pk (subs public-key 0 5 )
52
52
ellipsis " ..."
53
53
public-key-size (count public-key)
Original file line number Diff line number Diff line change 22
22
23
23
(deftest test-get-abbreviated-profile-url
24
24
(testing " Ensure the function correctly generates an abbreviated profile URL for a valid public key"
25
- (is (= " status.app/u/ zQ3sh...mrdYpzeFUa"
25
+ (is (= " status.app/u# zQ3sh...mrdYpzeFUa"
26
26
(utils.address/get-abbreviated-profile-url
27
- " status.app/u/ "
27
+ " status.app/u# "
28
28
" zQ3shPrnUhhR42JJn3QdhodGest8w8MjiH8hPaimrdYpzeFUa" ))))
29
29
30
30
(testing " Ensure the function returns nil when given an empty public key"
31
- (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u/ " " " ))))
31
+ (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u# " " " ))))
32
32
33
33
(testing " Ensure the function returns nil when given a nil public key"
34
- (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u/ " nil ))))
34
+ (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u# " nil ))))
35
35
36
36
(testing " Ensure the function returns nil when given an incorrect base URL"
37
37
(is (nil? (utils.address/get-abbreviated-profile-url
38
- " status.app/uwu/ "
38
+ " status.app/uwu# "
39
39
" zQ3shPrnUhhR42JJn3QdhodGest8w8MjiH8hPaimrdYpzeFUa" ))))
40
40
41
41
(testing " Ensure the function returns nil when given a public key shorter than 17 characters"
42
- (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u/ " " abc" )))
43
- (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u/ " " 1234" )))))
42
+ (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u# " " abc" )))
43
+ (is (nil? (utils.address/get-abbreviated-profile-url " status.app/u# " " 1234" )))))
Original file line number Diff line number Diff line change 11
11
(def ^:const account-initials-action " /accountInitials" )
12
12
(def ^:const contact-images-action " /contactImages" )
13
13
(def ^:const generate-qr-action " /GenerateQRCode" )
14
- (def ^:const status-profile-base-url " https://status.app/u/ " )
15
- (def ^:const status-profile-base-url-without-https " status.app/u/ " )
14
+ (def ^:const status-profile-base-url " https://status.app/u# " )
15
+ (def ^:const status-profile-base-url-without-https " status.app/u# " )
16
16
17
17
(defn get-font-file-ready
18
18
" setup font file and get the absolute path to it
You can’t perform that action at this time.
0 commit comments