From 04a7f76271ad4bf6f1397f161b83cadc514f3350 Mon Sep 17 00:00:00 2001 From: yqrashawn Date: Sun, 22 Oct 2023 08:50:48 +0700 Subject: [PATCH] feat: support new universal/deep link format (#17480) --- android/app/src/main/AndroidManifest.xml | 6 +- ios/StatusIm/Info.plist | 2 +- ios/StatusIm/StatusIm.entitlements | 2 +- ios/StatusImPR/Info.plist | 2 +- ios/StatusImPR/StatusImPR.entitlements | 2 +- src/status_im/router/core.cljs | 116 ++++++++++++------ src/status_im/router/core_test.cljs | 52 ++++---- .../screens/browser/site_blocked/views.cljs | 3 +- src/status_im/utils/universal_links/core.cljs | 16 +-- .../utils/universal_links/core_test.cljs | 4 +- .../utils/universal_links/utils.cljs | 4 +- .../utils/universal_links/utils_test.cljs | 24 ++-- src/status_im2/constants.cljs | 6 +- .../contexts/add_new_contact/events.cljs | 2 +- .../contexts/add_new_contact/events_test.cljs | 4 +- .../chat/messages/link_preview/events.cljs | 2 +- src/utils/address.cljs | 4 +- src/utils/address_test.cljs | 14 +-- src/utils/image_server.cljs | 4 +- 19 files changed, 159 insertions(+), 110 deletions(-) diff --git a/android/app/src/main/AndroidManifest.xml b/android/app/src/main/AndroidManifest.xml index df182dccb0..58dbd759ed 100644 --- a/android/app/src/main/AndroidManifest.xml +++ b/android/app/src/main/AndroidManifest.xml @@ -62,14 +62,14 @@ - - + + - + diff --git a/ios/StatusIm/Info.plist b/ios/StatusIm/Info.plist index 85e79925af..ad0ac04376 100644 --- a/ios/StatusIm/Info.plist +++ b/ios/StatusIm/Info.plist @@ -33,7 +33,7 @@ im.status.ethereum.applink CFBundleURLSchemes - status-im + status-app diff --git a/ios/StatusIm/StatusIm.entitlements b/ios/StatusIm/StatusIm.entitlements index 00074aa872..b4932cf5be 100644 --- a/ios/StatusIm/StatusIm.entitlements +++ b/ios/StatusIm/StatusIm.entitlements @@ -11,7 +11,7 @@ development com.apple.developer.associated-domains - applinks:join.status.im + applinks:status.app keychain-access-groups diff --git a/ios/StatusImPR/Info.plist b/ios/StatusImPR/Info.plist index 65485c6174..1e0693833c 100644 --- a/ios/StatusImPR/Info.plist +++ b/ios/StatusImPR/Info.plist @@ -29,7 +29,7 @@ im.status.ethereum.applink CFBundleURLSchemes - status-im + status-app diff --git a/ios/StatusImPR/StatusImPR.entitlements b/ios/StatusImPR/StatusImPR.entitlements index cc0f12eac4..e568b09f0e 100644 --- a/ios/StatusImPR/StatusImPR.entitlements +++ b/ios/StatusImPR/StatusImPR.entitlements @@ -11,7 +11,7 @@ development com.apple.developer.associated-domains - applinks:join.status.im + applinks:status.app keychain-access-groups diff --git a/src/status_im/router/core.cljs b/src/status_im/router/core.cljs index 4efee2fda3..ab55ac3986 100644 --- a/src/status_im/router/core.cljs +++ b/src/status_im/router/core.cljs @@ -7,7 +7,6 @@ [status-im.ethereum.eip681 :as eip681] [status-im.ethereum.ens :as ens] [status-im.ethereum.stateofus :as stateofus] - [status-im.utils.deprecated-types :as types] [status-im.utils.wallet-connect :as wallet-connect] [status-im2.constants :as constants] [status-im2.contexts.chat.events :as chat.events] @@ -15,29 +14,22 @@ [utils.address :as address] [utils.ethereum.chain :as chain] [utils.security.core :as security] + [utils.transforms :as transforms] [utils.url :as url] [utils.validators :as validators])) (def ethereum-scheme "ethereum:") -(def uri-schemes ["status-im://" "status-im:"]) +(def uri-schemes ["status-app://"]) (def web-prefixes ["https://" "http://" "https://www." "http://www."]) -(def web2-domain "join.status.im") +(def web2-domain "status.app") (def web-urls (map #(str % web2-domain "/") web-prefixes)) (def handled-schemes (set (into uri-schemes web-urls))) -(def browser-extractor - {[#"(.*)" :domain] {"" :browser - "/" :browser}}) - -(def group-chat-extractor - {[#"(.*)" :params] {"" :group-chat - "/" :group-chat}}) - (def eip-extractor {#{[:prefix "-" :address] [:address]} @@ -47,16 +39,9 @@ (def routes ["" - {handled-schemes {"b/" browser-extractor - "browser/" browser-extractor - ["p/" :chat-id] :private-chat - ["cr/" :community-id] :community-requests - ["c/" :community-id] :community - ["cc/" :chat-id] :community-chat - "g/" group-chat-extractor - ["wallet/" :account] :wallet-account - ["u/" :user-id] :user - ["user/" :user-id] :user} + {handled-schemes {["c/" :community-data] :community + ["cc/" :chat-data] :community-chat + ["u/" :user-data] :user} ethereum-scheme eip-extractor}]) (defn parse-query-params @@ -64,9 +49,52 @@ (let [url (goog.Uri. url)] (url/query->map (.getQuery url)))) +(defn parse-fragment + [url] + (let [url (goog.Uri. url) + fragment (.getFragment url)] + (when-not (string/blank? fragment) + fragment))) + (defn match-uri [uri] - (assoc (bidi/match-route routes uri) :uri uri :query-params (parse-query-params uri))) + ;; + (let [;; bidi has trouble parse path with `=` in it extract `=` here and add back to parsed + ;; base64url regex based on https://datatracker.ietf.org/doc/html/rfc4648#section-5 may + ;; include invalid base64 (invalid length, length of any base64 encoded string must be a + ;; multiple of 4) + ;; equal-end-of-base64url can be `=`, `==`, `nil` + equal-end-of-base64url + (last (re-find #"^(https|status-app)://(status\.app/)?(c|cc|u)/([a-zA-Z0-9_-]+)(={0,2})#" uri)) + + uri-without-equal-in-path + (if equal-end-of-base64url (string/replace-first uri equal-end-of-base64url "") uri) + + fragment (parse-fragment uri) + ens? (ens/is-valid-eth-name? fragment) + + {:keys [handler route-params] :as parsed} + (assoc (bidi/match-route routes uri-without-equal-in-path) + :uri uri + :query-params (parse-query-params uri))] + (cond-> parsed + ens? + (assoc-in [:route-params :ens-name] fragment) + + (and (or (= handler :community) (= handler :community-chat)) fragment) + (assoc-in [:route-params :community-id] fragment) + + (and equal-end-of-base64url (= handler :community) (:community-data route-params)) + (update-in [:route-params :community-data] #(str % equal-end-of-base64url)) + + (and equal-end-of-base64url (= handler :community-chat) (:chat-data route-params)) + (update-in [:route-params :chat-data] #(str % equal-end-of-base64url)) + + (and equal-end-of-base64url (= handler :user) (:user-data route-params)) + (update-in [:route-params :user-data] #(str % equal-end-of-base64url)) + + (and (= handler :user) fragment) + (assoc-in [:route-params :user-id] fragment)))) (defn match-contact-async [chain {:keys [user-id ens-name]} callback] @@ -84,7 +112,7 @@ user-id constants/deserialization-key (fn [response] - (let [{:keys [error]} (types/json->clj response)] + (let [{:keys [error]} (transforms/json->clj response)] (when-not error (match-contact-async chain @@ -210,41 +238,51 @@ :community)) (defn handle-uri - [chain chats uri cb] - (let [{:keys [handler route-params query-params]} (match-uri uri)] + [chain _chats uri cb] + (let [{:keys [handler route-params]} (match-uri uri)] (log/info "[router] uri " uri " matched " handler " with " route-params) (cond - (= handler :browser) - (cb (match-browser uri route-params)) + ;; ;; NOTE: removed in `match-uri`, might need this in the future + ;; (= handler :browser) + ;; (cb (match-browser uri route-params)) (= handler :ethereum) (cb (match-eip681 uri)) - (= handler :user) + (and (= handler :user) (:user-id route-params)) (match-contact-async chain route-params cb) - (= 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) - (= handler :group-chat) - (cb (match-group-chat chats query-params)) + ;; ;; NOTE: removed in `match-uri`, might need this in the future + ;; (= handler :group-chat) + ;; (cb (match-group-chat chats query-params)) (validators/valid-public-key? uri) (match-contact-async chain {:user-id uri} cb) - (= 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)}) - (= handler :community) + (and (= handler :community) (:community-id route-params)) (cb {:type (community-route-type route-params) :community-id (:community-id route-params)}) - (= handler :community-chat) - (cb {:type handler :chat-id (:chat-id route-params)}) + ;; ;; TODO: jump to community overview for now, should jump to community channel + ;; (and (= handler :community-chat) (:chat-id route-params)) + ;; (cb {:type handler :chat-id (:chat-id route-params)}) - (= handler :wallet-account) - (cb (match-wallet-account route-params)) + (and (= handler :community-chat) (:community-id route-params)) + (cb {:type (community-route-type route-params) + :community-id (:community-id route-params)}) + + ;; ;; NOTE: removed in `match-uri`, might need this in the future + ;; (= handler :wallet-account) + ;; (cb (match-wallet-account route-params)) (address/address? uri) (cb (address->eip681 uri)) diff --git a/src/status_im/router/core_test.cljs b/src/status_im/router/core_test.cljs index d74a30743e..882a55e3b3 100644 --- a/src/status_im/router/core_test.cljs +++ b/src/status_im/router/core_test.cljs @@ -19,33 +19,41 @@ :query-params (when (= 3 (count expected)) (last expected)) :uri uri}) - "status-im://u/statuse2e" - [:user {:user-id "statuse2e"}] + "https://status.app/u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj" + [:user + {:user-data + "G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y" + :user-id "zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj"}] - (str "status-im://user/" public-key) - [:user {:user-id public-key}] + "status-app://u/G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y#zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj" + [:user + {:user-data + "G10A4B0JdgwyRww90WXtnP1oNH1ZLQNM0yX0Ja9YyAMjrqSZIYINOHCbFhrnKRAcPGStPxCMJDSZlGCKzmZrJcimHY8BbcXlORrElv_BbQEegnMDPx1g9C5VVNl0fE4y" + :user-id "zQ3shwQPhRuDJSjVGVBnTjCdgXy5i9WQaeVPdGJD6yTarJQSj"}] - "status-im://b/www.cryptokitties.co" - [:browser {:domain "www.cryptokitties.c"}] + "https://status.app/cc/G54AAKwObLdpiGjXnckYzRcOSq0QQAS_CURGfqVU42ceGHCObstUIknTTZDOKF3E8y2MSicncpO7fTskXnoACiPKeejvjtLTGWNxUhlT7fyQS7Jrr33UVHluxv_PLjV2ePGw5GQ33innzeK34pInIgUGs5RjdQifMVmURalxxQKwiuoY5zwIjixWWRHqjHM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" + [:community-chat + {:chat-data + "G54AAKwObLdpiGjXnckYzRcOSq0QQAS_CURGfqVU42ceGHCObstUIknTTZDOKF3E8y2MSicncpO7fTskXnoACiPKeejvjtLTGWNxUhlT7fyQS7Jrr33UVHluxv_PLjV2ePGw5GQ33innzeK34pInIgUGs5RjdQifMVmURalxxQKwiuoY5zwIjixWWRHqjHM=" + :community-id "zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"}] - (str "status-im://g/args?a=" public-key "&a1=" chat-name-url "&a2=" chat-id) - [:group-chat {:params "arg"} {"a" public-key "a1" chat-name "a2" chat-id}] + "status-app://cc/G54AAKwObLdpiGjXnckYzRcOSq0QQAS_CURGfqVU42ceGHCObstUIknTTZDOKF3E8y2MSicncpO7fTskXnoACiPKeejvjtLTGWNxUhlT7fyQS7Jrr33UVHluxv_PLjV2ePGw5GQ33innzeK34pInIgUGs5RjdQifMVmURalxxQKwiuoY5zwIjixWWRHqjHM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" + [:community-chat + {:chat-data + "G54AAKwObLdpiGjXnckYzRcOSq0QQAS_CURGfqVU42ceGHCObstUIknTTZDOKF3E8y2MSicncpO7fTskXnoACiPKeejvjtLTGWNxUhlT7fyQS7Jrr33UVHluxv_PLjV2ePGw5GQ33innzeK34pInIgUGs5RjdQifMVmURalxxQKwiuoY5zwIjixWWRHqjHM=" + :community-id "zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"}] - (str "https://join.status.im/g/args?a=" public-key "&a1=" chat-name-url "&a2=" chat-id) - [:group-chat {:params "arg"} {"a" public-key "a1" chat-name "a2" chat-id}] + "https://status.app/c/iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" + [:community + {:community-data + "iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM=" + :community-id "zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"}] - "https://join.status.im/u/statuse2e" - [:user {:user-id "statuse2e"}] - - (str "https://join.status.im/user/" public-key) - [:user {:user-id public-key}] - - ;; Last char removed by: https://github.com/juxt/bidi/issues/104 - "https://join.status.im/b/www.cryptokitties.co" - [:browser {:domain "www.cryptokitties.c"}] - - "https://join.status.im/b/https://www.google.com/" - [:browser {:domain "https://www.google.co"}] + "status-app://c/iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM=#zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11" + [:community + {:community-data + "iyKACkQKB0Rvb2RsZXMSJ0NvbG9yaW5nIHRoZSB3b3JsZCB3aXRoIGpveSDigKIg4bSXIOKAohiYohsiByMxMzFEMkYqAwEhMwM=" + :community-id "zQ3shYSHp7GoiXaauJMnDcjwU2yNjdzpXLosAWapPS4CFxc11"}] "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" [:ethereum {:address "0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7"}] diff --git a/src/status_im/ui/screens/browser/site_blocked/views.cljs b/src/status_im/ui/screens/browser/site_blocked/views.cljs index 41ab459f7b..5175ab78f6 100644 --- a/src/status_im/ui/screens/browser/site_blocked/views.cljs +++ b/src/status_im/ui/screens/browser/site_blocked/views.cljs @@ -21,7 +21,8 @@ (i18n/label :t/browsing-site-blocked-title)] [react/nested-text {:style styles/description-text} (i18n/label :t/browsing-site-blocked-description1) - [{:on-press #(.openURL ^js react/linking "status-im://chat/public/status") + ;; NOTE: this link is broken + [{:on-press #(.openURL ^js react/linking "status-app://chat/public/status") :style styles/chat-link-text} "#status"] (i18n/label :t/browsing-site-blocked-description2)] diff --git a/src/status_im/utils/universal_links/core.cljs b/src/status_im/utils/universal_links/core.cljs index 9d52eb9cd4..d9858372e8 100644 --- a/src/status_im/utils/universal_links/core.cljs +++ b/src/status_im/utils/universal_links/core.cljs @@ -21,8 +21,8 @@ ;; domains should be without the trailing slash (def domains - {:external "https://join.status.im" - :internal "status-im:/"}) + {:external "https://status.app" + :internal "status-app:/"}) (def links {:private-chat "%s/p/%s" @@ -81,17 +81,20 @@ (log/info "universal-links: handling community" community-id) (navigation/navigate-to cofx :community {:community-id community-id})) - (rf/defn handle-navigation-to-desktop-community-from-mobile {:events [:handle-navigation-to-desktop-community-from-mobile]} [cofx deserialized-key] - (navigation/navigate-to cofx :community-overview deserialized-key)) + (rf/merge + cofx + {:dispatch [:navigate-to :community-overview deserialized-key]} + (navigation/pop-to-root :shell-stack))) (rf/defn handle-desktop-community [cofx {:keys [community-id]}] (native-module/deserialize-and-compress-key community-id (fn [deserialized-key] + (rf/dispatch [:chat.ui/resolve-community-info (str deserialized-key)]) (rf/dispatch [:handle-navigation-to-desktop-community-from-mobile (str deserialized-key)])))) (rf/defn handle-community-chat @@ -212,9 +215,8 @@ (.then dispatch-url)) 200) (.addEventListener ^js react/linking "url" url-event-listener) - ;;StartSearchForLocalPairingPeers() shouldn't be called ATM from the UI - ;;It can be called after the error "route ip+net: netlinkrib: permission denied" is fixed on status-go - ;;side + ;;StartSearchForLocalPairingPeers() shouldn't be called ATM from the UI It can be called after the + ;;error "route ip+net: netlinkrib: permission denied" is fixed on status-go side #_(native-module/start-searching-for-local-pairing-peers #(log/info "[local-pairing] errors from local-pairing-preflight-outbound-check ->" %))) diff --git a/src/status_im/utils/universal_links/core_test.cljs b/src/status_im/utils/universal_links/core_test.cljs index 25c4bbd711..c3ecd8d43f 100644 --- a/src/status_im/utils/universal_links/core_test.cljs +++ b/src/status_im/utils/universal_links/core_test.cljs @@ -20,9 +20,9 @@ (is (nil? (get-in (links/handle-url {:db db} "some-url") [:db :universal-links/url])))) (testing "Handle a custom string" - (is (= (get-in (links/handle-url {:db db} "https://join.status.im/u/statuse2e") + (is (= (get-in (links/handle-url {:db db} "https://status.app/u/statuse2e") [::router/handle-uri :uri]) - "https://join.status.im/u/statuse2e"))))))) + "https://status.app/u/statuse2e"))))))) (deftest url-event-listener (testing "the url is not nil" diff --git a/src/status_im/utils/universal_links/utils.cljs b/src/status_im/utils/universal_links/utils.cljs index f66449196c..f754389306 100644 --- a/src/status_im/utils/universal_links/utils.cljs +++ b/src/status_im/utils/universal_links/utils.cljs @@ -5,8 +5,8 @@ ;; domains should be without the trailing slash (def domains - {:external "https://join.status.im" - :internal "status-im:/"}) + {:external "https://status.app" + :internal "status-app:/"}) (def links {:private-chat "%s/p/%s" diff --git a/src/status_im/utils/universal_links/utils_test.cljs b/src/status_im/utils/universal_links/utils_test.cljs index bb0992d990..b58dfc2ad2 100644 --- a/src/status_im/utils/universal_links/utils_test.cljs +++ b/src/status_im/utils/universal_links/utils_test.cljs @@ -4,25 +4,25 @@ [status-im.utils.universal-links.utils :as links])) (deftest universal-link-test - (testing "status-im://blah" + (testing "status-app://blah" (testing "it returns true" - (is (links/universal-link? "status-im://blah")))) - (testing "status-im://blah" + (is (links/universal-link? "status-app://blah")))) + (testing "status-app://blah" (testing "it returns true" - (is (links/deep-link? "status-im://blah")))) + (is (links/deep-link? "status-app://blah")))) (testing "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7" (testing "it returns true" (is (links/deep-link? "ethereum:0x89205a3a3b2a69de6dbf7f01ed13b2108b2c43e7")))) - (testing "http://join.status.im/blah" + (testing "http://status.app/blah" (testing "it returns true" - (is (links/universal-link? "http://join.status.im/blah")))) - (testing "https://join.status.im/blah" + (is (links/universal-link? "http://status.app/blah")))) + (testing "https://status.app/blah" (testing "it returns true" - (is (links/universal-link? "https://join.status.im/blah")))) + (is (links/universal-link? "https://status.app/blah")))) (testing "unicode characters" (testing "it returns false" - (is (not (links/universal-link? "https://join.status.im/browse/www.аррӏе.com"))))) - (testing "not-status-im://blah" + (is (not (links/universal-link? "https://status.app/browse/www.аррӏе.com"))))) + (testing "not-status-app://blah" (testing "it returns false" (is (not (links/universal-link? "https://not.status.im/blah"))))) (testing "http://not.status.im/blah" @@ -31,6 +31,6 @@ (testing "https://not.status.im/blah" (testing "it returns false" (is (not (links/universal-link? "https://not.status.im/blah"))))) - (testing "http://join.status.im/blah" + (testing "http://status.app/blah" (testing "it returns false" - (is (not (links/deep-link? "http://join.status.im/blah")))))) + (is (not (links/deep-link? "http://status.app/blah")))))) diff --git a/src/status_im2/constants.cljs b/src/status_im2/constants.cljs index 0dc08edf16..7f3f57f78b 100644 --- a/src/status_im2/constants.cljs +++ b/src/status_im2/constants.cljs @@ -178,9 +178,9 @@ (def regx-bold #"\*[^*]+\*") (def regx-italic #"~[^~]+~") (def regx-backquote #"`[^`]+`") -(def regx-universal-link #"((^https?://join.status.im/)|(^status-im://))[\x00-\x7F]+$") -(def regx-community-universal-link #"((^https?://join.status.im/)|(^status-im://))c/([\x00-\x7F]+)$") -(def regx-deep-link #"((^ethereum:.*)|(^status-im://[\x00-\x7F]+$))") +(def regx-universal-link #"((^https?://status.app/)|(^status-app://))[\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-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}") diff --git a/src/status_im2/contexts/add_new_contact/events.cljs b/src/status_im2/contexts/add_new_contact/events.cljs index c49f346ba0..8e392e91b7 100644 --- a/src/status_im2/contexts/add_new_contact/events.cljs +++ b/src/status_im2/contexts/add_new_contact/events.cljs @@ -34,7 +34,7 @@ (zipmap (repeat nil)))) ([kv] (-> (init-contact) (merge kv)))) -(def url-regex #"^https?://join.status.im/u/(.+)") +(def url-regex #"^https?://status.app/u/(.+)") (defn ->id [{:keys [input] :as contact}] diff --git a/src/status_im2/contexts/add_new_contact/events_test.cljs b/src/status_im2/contexts/add_new_contact/events_test.cljs index e449915f75..7d57156372 100644 --- a/src/status_im2/contexts/add_new_contact/events_test.cljs +++ b/src/status_im2/contexts/add_new_contact/events_test.cljs @@ -11,8 +11,8 @@ (def ckey "zQ3shWj4WaBdf2zYKCkXe6PHxDxNTzZyid1i75879Ue9cX9gA") (def ens "esep") (def ens-stateofus-eth (str ens ".stateofus.eth")) -(def link-ckey (str "https://join.status.im/u/" ckey)) -(def link-ens (str "https://join.status.im/u/" ens)) +(def link-ckey (str "https://status.app/u/" ckey)) +(def link-ens (str "https://status.app/u/" ens)) ;;; unit tests (no app-db involved) diff --git a/src/status_im2/contexts/chat/messages/link_preview/events.cljs b/src/status_im2/contexts/chat/messages/link_preview/events.cljs index 448c6fab89..d156eb460d 100644 --- a/src/status_im2/contexts/chat/messages/link_preview/events.cljs +++ b/src/status_im2/contexts/chat/messages/link_preview/events.cljs @@ -9,7 +9,7 @@ (defn community-link [id] - (str "https://join.status.im/c/" id)) + (str "https://status.app/c/" id)) (rf/defn cache-link-preview-data {:events [:chat.ui/cache-link-preview-data]} diff --git a/src/utils/address.cljs b/src/utils/address.cljs index 04b271450b..7da405b793 100644 --- a/src/utils/address.cljs +++ b/src/utils/address.cljs @@ -43,11 +43,11 @@ (defn get-abbreviated-profile-url "The goal here is to generate a string that begins with - join.status.im/u/ joined with the 1st 5 characters + status.app/u/ joined with the 1st 5 characters of the compressed public key followed by an ellipsis followed by the last 10 characters of the compressed public key" [base-url public-key] - (if (and public-key base-url (> (count public-key) 17) (= "join.status.im/u/" base-url)) + (if (and public-key base-url (> (count public-key) 17) (= "status.app/u/" base-url)) (let [first-part-of-public-pk (subs public-key 0 5) ellipsis "..." public-key-size (count public-key) diff --git a/src/utils/address_test.cljs b/src/utils/address_test.cljs index 8c76bb79ea..3560aa31bb 100644 --- a/src/utils/address_test.cljs +++ b/src/utils/address_test.cljs @@ -22,22 +22,22 @@ (deftest test-get-abbreviated-profile-url (testing "Ensure the function correctly generates an abbreviated profile URL for a valid public key" - (is (= "join.status.im/u/zQ3sh...mrdYpzeFUa" + (is (= "status.app/u/zQ3sh...mrdYpzeFUa" (utils.address/get-abbreviated-profile-url - "join.status.im/u/" + "status.app/u/" "zQ3shPrnUhhR42JJn3QdhodGest8w8MjiH8hPaimrdYpzeFUa")))) (testing "Ensure the function returns nil when given an empty public key" - (is (nil? (utils.address/get-abbreviated-profile-url "join.status.im/u/" "")))) + (is (nil? (utils.address/get-abbreviated-profile-url "status.app/u/" "")))) (testing "Ensure the function returns nil when given a nil public key" - (is (nil? (utils.address/get-abbreviated-profile-url "join.status.im/u/" nil)))) + (is (nil? (utils.address/get-abbreviated-profile-url "status.app/u/" nil)))) (testing "Ensure the function returns nil when given an incorrect base URL" (is (nil? (utils.address/get-abbreviated-profile-url - "join.status.im/uwu/" + "status.app/uwu/" "zQ3shPrnUhhR42JJn3QdhodGest8w8MjiH8hPaimrdYpzeFUa")))) (testing "Ensure the function returns nil when given a public key shorter than 17 characters" - (is (nil? (utils.address/get-abbreviated-profile-url "join.status.im/u/" "abc"))) - (is (nil? (utils.address/get-abbreviated-profile-url "join.status.im/u/" "1234"))))) + (is (nil? (utils.address/get-abbreviated-profile-url "status.app/u/" "abc"))) + (is (nil? (utils.address/get-abbreviated-profile-url "status.app/u/" "1234"))))) diff --git a/src/utils/image_server.cljs b/src/utils/image_server.cljs index 5681219754..65ed6acf9b 100644 --- a/src/utils/image_server.cljs +++ b/src/utils/image_server.cljs @@ -11,8 +11,8 @@ (def ^:const account-initials-action "/accountInitials") (def ^:const contact-images-action "/contactImages") (def ^:const generate-qr-action "/GenerateQRCode") -(def ^:const status-profile-base-url "https://join.status.im/u/") -(def ^:const status-profile-base-url-without-https "join.status.im/u/") +(def ^:const status-profile-base-url "https://status.app/u/") +(def ^:const status-profile-base-url-without-https "status.app/u/") (defn get-font-file-ready "setup font file and get the absolute path to it