fix deep links to user profiles don't do anything on tap (#15089)

This commit is contained in:
Parvesh Monu 2023-02-15 23:27:34 +05:30 committed by GitHub
parent ab750c1829
commit 5cea66647e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 9 deletions

View File

@ -8,6 +8,8 @@
[status-im.ethereum.core :as ethereum]
[status-im.ethereum.eip681 :as eip681]
[status-im.ethereum.ens :as ens]
[status-im.utils.types :as types]
[status-im.native-module.core :as status]
[status-im.ethereum.stateofus :as stateofus]
[status-im2.utils.validators :as validators]
[status-im.utils.http :as http]
@ -71,15 +73,27 @@
(defn match-contact-async
[chain {:keys [user-id ens-name]} callback]
(let [valid-key (and (validators/valid-public-key? user-id)
(not= user-id ens/default-key))]
(let [valid-public-key? (and (validators/valid-public-key? user-id)
(not= user-id ens/default-key))
valid-compressed-key? (validators/valid-compressed-key? user-id)]
(cond
valid-key
valid-public-key?
(callback {:type :contact
:public-key user-id
:ens-name ens-name})
(and (not valid-key)
valid-compressed-key?
(status/compressed-key->public-key
user-id
(fn [response]
(let [{:keys [error]} (types/json->clj response)]
(when-not error
(match-contact-async
chain
{:user-id (str "0x" (subs response 5)) :ens-name ens-name}
callback)))))
(and (not valid-public-key?)
(string? user-id)
(not (string/blank? user-id))
(not= user-id "0x"))

View File

@ -113,11 +113,7 @@
:pop-to-root-tab-fx :profile-stack}
public-key
(navigation/navigate-to-cofx (-> cofx
(assoc-in [:db :contacts/identity] public-key)
(assoc-in [:db :contacts/ens-name] ens-name))
:profile
{})))
{:dispatch [:chat.ui/show-profile public-key ens-name]}))
(rf/defn handle-eip681
[cofx data]