mirror of
https://github.com/status-im/status-react.git
synced 2025-01-10 19:16:59 +00:00
fix #9903 hide buttons of actions that are not yet implemented
fix ens release button which showed a hardcoded date link to release instructions on hackmd Signed-off-by: yenda <eric@status.im>
This commit is contained in:
parent
b41df2f2fc
commit
cc3ae6c693
@ -3,6 +3,7 @@
|
|||||||
[re-frame.core :as re-frame]
|
[re-frame.core :as re-frame]
|
||||||
[status-im.ens.db :as ens.db]
|
[status-im.ens.db :as ens.db]
|
||||||
[taoensso.timbre :as log]
|
[taoensso.timbre :as log]
|
||||||
|
[status-im.utils.datetime :as datetime]
|
||||||
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
[status-im.multiaccounts.update.core :as multiaccounts.update]
|
||||||
[status-im.multiaccounts.model :as multiaccounts.model]
|
[status-im.multiaccounts.model :as multiaccounts.model]
|
||||||
[status-im.ethereum.abi-spec :as abi-spec]
|
[status-im.ethereum.abi-spec :as abi-spec]
|
||||||
@ -42,6 +43,11 @@
|
|||||||
(fn [[registry name cb]]
|
(fn [[registry name cb]]
|
||||||
(resolver/pubkey registry name cb)))
|
(resolver/pubkey registry name cb)))
|
||||||
|
|
||||||
|
(re-frame/reg-fx
|
||||||
|
::get-expiration-time
|
||||||
|
(fn [[registrar label-hash cb]]
|
||||||
|
(stateofus/get-expiration-time registrar label-hash cb)))
|
||||||
|
|
||||||
(fx/defn set-state
|
(fx/defn set-state
|
||||||
{:events [::name-resolved]}
|
{:events [::name-resolved]}
|
||||||
[{:keys [db]} username state]
|
[{:keys [db]} username state]
|
||||||
@ -249,14 +255,32 @@
|
|||||||
[{:keys [db]} username public-key]
|
[{:keys [db]} username public-key]
|
||||||
{:db (assoc-in db [:ens/names username :public-key] public-key)})
|
{:db (assoc-in db [:ens/names username :public-key] public-key)})
|
||||||
|
|
||||||
|
(fx/defn store-expiration-date
|
||||||
|
{:events [::get-expiration-time-success]}
|
||||||
|
[{:keys [now db]} username timestamp]
|
||||||
|
{:db (-> db
|
||||||
|
(assoc-in [:ens/names username :expiration-date]
|
||||||
|
(datetime/timestamp->year-month-day-date timestamp))
|
||||||
|
(assoc-in [:ens/names username :releasable?] (<= timestamp now)))})
|
||||||
|
|
||||||
(fx/defn navigate-to-name
|
(fx/defn navigate-to-name
|
||||||
{:events [::navigate-to-name]}
|
{:events [::navigate-to-name]}
|
||||||
[{:keys [db] :as cofx} username]
|
[{:keys [db] :as cofx} username]
|
||||||
(let [registry (get ens/ens-registries (ethereum/chain-keyword db))]
|
(let [chain (ethereum/chain-keyword db)
|
||||||
|
registry (get ens/ens-registries chain)
|
||||||
|
registrar (get stateofus/registrars chain)]
|
||||||
(fx/merge cofx
|
(fx/merge cofx
|
||||||
{::resolve-address [registry username
|
{::get-expiration-time
|
||||||
|
[registrar
|
||||||
|
(-> username
|
||||||
|
stateofus/username
|
||||||
|
ethereum/sha3)
|
||||||
|
#(re-frame/dispatch [::get-expiration-time-success username %])]
|
||||||
|
::resolve-address
|
||||||
|
[registry username
|
||||||
#(re-frame/dispatch [::address-resolved username %])]
|
#(re-frame/dispatch [::address-resolved username %])]
|
||||||
::resolve-pubkey [registry username
|
::resolve-pubkey
|
||||||
|
[registry username
|
||||||
#(re-frame/dispatch [::public-key-resolved username %])]}
|
#(re-frame/dispatch [::public-key-resolved username %])]}
|
||||||
(navigation/navigate-to-cofx :ens-name-details username))))
|
(navigation/navigate-to-cofx :ens-name-details username))))
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
(ns status-im.ethereum.stateofus
|
(ns status-im.ethereum.stateofus
|
||||||
(:require [clojure.string :as string]))
|
(:require [clojure.string :as string]
|
||||||
|
[status-im.ethereum.json-rpc :as json-rpc]))
|
||||||
|
|
||||||
(def domain "stateofus.eth")
|
(def domain "stateofus.eth")
|
||||||
|
|
||||||
@ -24,3 +25,15 @@
|
|||||||
(boolean
|
(boolean
|
||||||
(and (lower-case? username)
|
(and (lower-case? username)
|
||||||
(re-find #"^[a-z0-9]+$" username))))
|
(re-find #"^[a-z0-9]+$" username))))
|
||||||
|
|
||||||
|
(defn get-expiration-time
|
||||||
|
[registrar label-hash cb]
|
||||||
|
(json-rpc/eth-call
|
||||||
|
{:contract registrar
|
||||||
|
:method "getExpirationTime(bytes32)"
|
||||||
|
:params [label-hash]
|
||||||
|
:outputs ["uint256"]
|
||||||
|
:on-success
|
||||||
|
(fn [[release-time]]
|
||||||
|
;;NOTE: returns a timestamp in s and we want ms
|
||||||
|
(cb (* release-time 1000)))}))
|
||||||
|
@ -2007,7 +2007,7 @@
|
|||||||
:<- [:get-screen-params :ens-name-details]
|
:<- [:get-screen-params :ens-name-details]
|
||||||
:<- [:ens/names]
|
:<- [:ens/names]
|
||||||
(fn [[name ens]]
|
(fn [[name ens]]
|
||||||
(let [{:keys [address public-key]} (get ens name)
|
(let [{:keys [address public-key expiration-date releasable?]} (get ens name)
|
||||||
pending? (nil? address)]
|
pending? (nil? address)]
|
||||||
(cond-> {:name name
|
(cond-> {:name name
|
||||||
:custom-domain? (not (string/ends-with? name ".stateofus.eth"))}
|
:custom-domain? (not (string/ends-with? name ".stateofus.eth"))}
|
||||||
@ -2015,7 +2015,9 @@
|
|||||||
(assoc :pending? true)
|
(assoc :pending? true)
|
||||||
(not pending?)
|
(not pending?)
|
||||||
(assoc :address address
|
(assoc :address address
|
||||||
:public-key public-key)))))
|
:public-key public-key
|
||||||
|
:releasable? releasable?
|
||||||
|
:expiration-date expiration-date)))))
|
||||||
|
|
||||||
(re-frame/reg-sub
|
(re-frame/reg-sub
|
||||||
:ens.main/screen
|
:ens.main/screen
|
||||||
|
@ -476,8 +476,14 @@
|
|||||||
;;; NAME DETAILS SCREEN
|
;;; NAME DETAILS SCREEN
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(def ^:const release-instructions-link "https://our.status.im/managing-your-ens-name-in-v1/")
|
||||||
|
|
||||||
|
(defn open-release-instructions-link! []
|
||||||
|
(.openURL react/linking release-instructions-link))
|
||||||
|
|
||||||
(views/defview name-details []
|
(views/defview name-details []
|
||||||
(views/letsubs [{:keys [name address custom-domain? public-key pending?]}
|
(views/letsubs [{:keys [name address custom-domain? public-key
|
||||||
|
expiration-date releasable? pending?]}
|
||||||
[:ens.name/screen]]
|
[:ens.name/screen]]
|
||||||
[react/view {:style {:flex 1}}
|
[react/view {:style {:flex 1}}
|
||||||
[topbar/topbar {:title name}]
|
[topbar/topbar {:title name}]
|
||||||
@ -502,7 +508,8 @@
|
|||||||
[section {:title (i18n/label :t/key)
|
[section {:title (i18n/label :t/key)
|
||||||
:content public-key}]])
|
:content public-key}]])
|
||||||
[react/view {:style {:margin-top 16 :margin-bottom 32}}
|
[react/view {:style {:margin-top 16 :margin-bottom 32}}
|
||||||
[list/big-list-item {:text (i18n/label :t/ens-remove-username)
|
;;TODO: re-enable once feature is developped
|
||||||
|
#_[list/big-list-item {:text (i18n/label :t/ens-remove-username)
|
||||||
:subtext (i18n/label :t/ens-remove-hints)
|
:subtext (i18n/label :t/ens-remove-hints)
|
||||||
:text-color colors/gray
|
:text-color colors/gray
|
||||||
:text-style {:font-weight "500"}
|
:text-style {:font-weight "500"}
|
||||||
@ -512,13 +519,21 @@
|
|||||||
(when-not custom-domain?
|
(when-not custom-domain?
|
||||||
[react/view {:style {:margin-top 18}}
|
[react/view {:style {:margin-top 18}}
|
||||||
[list/big-list-item {:text (i18n/label :t/ens-release-username)
|
[list/big-list-item {:text (i18n/label :t/ens-release-username)
|
||||||
:text-color colors/gray
|
:text-color (if releasable?
|
||||||
|
colors/blue
|
||||||
|
colors/gray)
|
||||||
:text-style {:font-weight "500"}
|
:text-style {:font-weight "500"}
|
||||||
:subtext (i18n/label :t/ens-locked)
|
:subtext (when (and expiration-date
|
||||||
|
(not releasable?))
|
||||||
|
(i18n/label :t/ens-locked
|
||||||
|
{:date expiration-date}))
|
||||||
:icon :main-icons/delete
|
:icon :main-icons/delete
|
||||||
:icon-color colors/gray
|
:icon-color (if releasable?
|
||||||
:active? false
|
colors/blue
|
||||||
:hide-chevron? true}]])]]]]))
|
colors/gray)
|
||||||
|
:active? releasable?
|
||||||
|
:hide-chevron? true
|
||||||
|
:action-fn #(open-release-instructions-link!)}]])]]]]))
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
;;; WELCOME SCREEN
|
;;; WELCOME SCREEN
|
||||||
|
@ -33,18 +33,19 @@
|
|||||||
:icon :main-icons/add
|
:icon :main-icons/add
|
||||||
:accessories [:chevron]
|
:accessories [:chevron]
|
||||||
:on-press #(re-frame/dispatch [:wallet.accounts/start-adding-new-account {:type :generate}])}]
|
:on-press #(re-frame/dispatch [:wallet.accounts/start-adding-new-account {:type :generate}])}]
|
||||||
[list-item/list-item
|
;;TODO: implement adding account by seedphrase and private key
|
||||||
|
#_[list-item/list-item
|
||||||
{:type :section-header
|
{:type :section-header
|
||||||
:container-margin-top 24
|
:container-margin-top 24
|
||||||
:title (i18n/label :t/advanced)}]
|
:title (i18n/label :t/advanced)}]
|
||||||
[list-item/list-item
|
#_[list-item/list-item
|
||||||
{:title (i18n/label :t/enter-a-seed-phrase)
|
{:title (i18n/label :t/enter-a-seed-phrase)
|
||||||
:theme :action
|
:theme :action
|
||||||
:icon :main-icons/add
|
:icon :main-icons/add
|
||||||
:accessories [:chevron]
|
:accessories [:chevron]
|
||||||
:disabled? true
|
:disabled? true
|
||||||
:on-press #(re-frame/dispatch [:wallet.accounts/start-adding-new-account {:type :seed}])}]
|
:on-press #(re-frame/dispatch [:wallet.accounts/start-adding-new-account {:type :seed}])}]
|
||||||
[list-item/list-item
|
#_[list-item/list-item
|
||||||
{:title (i18n/label :t/enter-a-private-key)
|
{:title (i18n/label :t/enter-a-private-key)
|
||||||
:theme :action
|
:theme :action
|
||||||
:icon :main-icons/add
|
:icon :main-icons/add
|
||||||
|
@ -404,7 +404,7 @@
|
|||||||
"ens-displayed-with": "يتم عرض الرسائل الخاصة بك للآخرين مع",
|
"ens-displayed-with": "يتم عرض الرسائل الخاصة بك للآخرين مع",
|
||||||
"ens-get-name": "الحصول علي اسم مستخدم عالمي",
|
"ens-get-name": "الحصول علي اسم مستخدم عالمي",
|
||||||
"ens-got-it": "حسنا، تابع",
|
"ens-got-it": "حسنا، تابع",
|
||||||
"ens-locked": "اسم المستخدم مقفل. لن تكون قادرا علي اصداره حتى 25.05.2020",
|
"ens-locked": "{{date}} اسم المستخدم مقفل. لن تكون قادرا علي اصداره حتى",
|
||||||
"ens-name-content": "اسم مستعار مخصص لمفتاح الدردشة الذي يمكنك تسجيله باستخدام خدمة Ethereum Name Service. أسماء ENS هي أسماء مستخدمين لا مركزية.",
|
"ens-name-content": "اسم مستعار مخصص لمفتاح الدردشة الذي يمكنك تسجيله باستخدام خدمة Ethereum Name Service. أسماء ENS هي أسماء مستخدمين لا مركزية.",
|
||||||
"ens-name-title": "اسم ENS",
|
"ens-name-title": "اسم ENS",
|
||||||
"ens-network-restriction": "متوفر فقط على Mainnet",
|
"ens-network-restriction": "متوفر فقط على Mainnet",
|
||||||
|
@ -365,7 +365,7 @@
|
|||||||
"ens-displayed-with": "Your messages are displayed to others with",
|
"ens-displayed-with": "Your messages are displayed to others with",
|
||||||
"ens-get-name": "Get a universal username",
|
"ens-get-name": "Get a universal username",
|
||||||
"ens-got-it": "Ok, got it",
|
"ens-got-it": "Ok, got it",
|
||||||
"ens-locked": "Username locked. You won’t be able to release it until 25.05.2020",
|
"ens-locked": "Username locked. You won’t be able to release it until {{date}}",
|
||||||
"ens-network-restriction": "Only available on Mainnet",
|
"ens-network-restriction": "Only available on Mainnet",
|
||||||
"ens-no-usernames": "You don't have any username connected",
|
"ens-no-usernames": "You don't have any username connected",
|
||||||
"ens-powered-by": "Powered by Ethereum Name Services",
|
"ens-powered-by": "Powered by Ethereum Name Services",
|
||||||
|
@ -367,7 +367,7 @@
|
|||||||
"ens-displayed-with": "Vos messages sont affichés aux autres avec",
|
"ens-displayed-with": "Vos messages sont affichés aux autres avec",
|
||||||
"ens-get-name": "Obtenir un nom d'utilisateur universel",
|
"ens-get-name": "Obtenir un nom d'utilisateur universel",
|
||||||
"ens-got-it": "Ok, j'ai compris",
|
"ens-got-it": "Ok, j'ai compris",
|
||||||
"ens-locked": "Nom d'utilisateur verrouillé. Vous ne pourrez pas le déverrouiller avant le 25.05.2020",
|
"ens-locked": "Nom d'utilisateur verrouillé. Vous ne pourrez pas le déverrouiller avant le {{date}}",
|
||||||
"ens-network-restriction": "Disponible uniquement sur Mainnet",
|
"ens-network-restriction": "Disponible uniquement sur Mainnet",
|
||||||
"ens-no-usernames": "Vous n'avez aucun nom d'utilisateur connecté",
|
"ens-no-usernames": "Vous n'avez aucun nom d'utilisateur connecté",
|
||||||
"ens-powered-by": "Propulsé par Ethereum Name Services",
|
"ens-powered-by": "Propulsé par Ethereum Name Services",
|
||||||
|
@ -379,7 +379,7 @@
|
|||||||
"ens-displayed-with": "I tuoi messaggi vengono visualizzati agli altri con",
|
"ens-displayed-with": "I tuoi messaggi vengono visualizzati agli altri con",
|
||||||
"ens-get-name": "Ottieni un nome utente universale",
|
"ens-get-name": "Ottieni un nome utente universale",
|
||||||
"ens-got-it": "Ok capito",
|
"ens-got-it": "Ok capito",
|
||||||
"ens-locked": "Nome utente bloccato. Non sarà possibile rilasciarlo fino al 25.05.2020",
|
"ens-locked": "Nome utente bloccato. Non sarà possibile rilasciarlo fino al {{date}}",
|
||||||
"ens-name-content": "Alias personalizzato per la tua chiave di chat che puoi registrare usando Ethereum Name Service. I nomi ENS sono nomi utente decentralizzati.",
|
"ens-name-content": "Alias personalizzato per la tua chiave di chat che puoi registrare usando Ethereum Name Service. I nomi ENS sono nomi utente decentralizzati.",
|
||||||
"ens-name-title": "Nome ENS",
|
"ens-name-title": "Nome ENS",
|
||||||
"ens-network-restriction": "Disponibile solo su Mainnet",
|
"ens-network-restriction": "Disponibile solo su Mainnet",
|
||||||
|
@ -339,7 +339,7 @@
|
|||||||
"ens-displayed-with": "あなたのメッセージは他の人に表示されます",
|
"ens-displayed-with": "あなたのメッセージは他の人に表示されます",
|
||||||
"ens-get-name": "ユニバーサルユーザー名を取得",
|
"ens-get-name": "ユニバーサルユーザー名を取得",
|
||||||
"ens-got-it": "わかりました",
|
"ens-got-it": "わかりました",
|
||||||
"ens-locked": "ユーザー名がロックされています。あなたは25.05.2020まで手放すことはできません",
|
"ens-locked": "ユーザー名がロックされています。あなたは{{date}}まで手放すことはできません",
|
||||||
"ens-network-restriction": "Mainnetまたはropstenでのみ利用可能",
|
"ens-network-restriction": "Mainnetまたはropstenでのみ利用可能",
|
||||||
"ens-no-usernames": "接続しているユーザー名がありません",
|
"ens-no-usernames": "接続しているユーザー名がありません",
|
||||||
"ens-powered-by": "Ethereum Name Servicesを利用しています",
|
"ens-powered-by": "Ethereum Name Servicesを利用しています",
|
||||||
|
@ -372,7 +372,7 @@
|
|||||||
"ens-displayed-with": "귀하의 메시지가 다른 사용자에게 다음과 같이 표시됩니다",
|
"ens-displayed-with": "귀하의 메시지가 다른 사용자에게 다음과 같이 표시됩니다",
|
||||||
"ens-get-name": "사용자 이름 등록",
|
"ens-get-name": "사용자 이름 등록",
|
||||||
"ens-got-it": "알겠습니다",
|
"ens-got-it": "알겠습니다",
|
||||||
"ens-locked": "사용자 이름이 등록되었습니다. 2020.05.25까지 해지 할 수 없습니다.",
|
"ens-locked": "사용자 이름이 등록되었습니다. {{date}}까지 해지 할 수 없습니다.",
|
||||||
"ens-name-content": "이더리움 네임 서비스(Ethereum Name Service)로 채팅키와 연결되는 커스텀 닉네임. ENS 이름은 탈중앙화된 사용자 명입니다.",
|
"ens-name-content": "이더리움 네임 서비스(Ethereum Name Service)로 채팅키와 연결되는 커스텀 닉네임. ENS 이름은 탈중앙화된 사용자 명입니다.",
|
||||||
"ens-name-title": "ENS 이름",
|
"ens-name-title": "ENS 이름",
|
||||||
"ens-network-restriction": "Mainnet에서만 사용 가능",
|
"ens-network-restriction": "Mainnet에서만 사용 가능",
|
||||||
|
@ -382,7 +382,7 @@
|
|||||||
"ens-displayed-with": "Ваши сообщения остальным пользователям показываются с ",
|
"ens-displayed-with": "Ваши сообщения остальным пользователям показываются с ",
|
||||||
"ens-get-name": "Получить универсальное имя пользователя",
|
"ens-get-name": "Получить универсальное имя пользователя",
|
||||||
"ens-got-it": "Ок, понятно",
|
"ens-got-it": "Ок, понятно",
|
||||||
"ens-locked": "Имя пользователя зарезервировано. Вы не сможете освободить его до 25.05.2020",
|
"ens-locked": "Имя пользователя зарезервировано. Вы не сможете освободить его до {{date}} ",
|
||||||
"ens-network-restriction": "Доступно только на Mainnet или Ropsten",
|
"ens-network-restriction": "Доступно только на Mainnet или Ropsten",
|
||||||
"ens-no-usernames": "Нет присоединенного имени пользователя",
|
"ens-no-usernames": "Нет присоединенного имени пользователя",
|
||||||
"ens-powered-by": "При поддержке Ethereum Name Services",
|
"ens-powered-by": "При поддержке Ethereum Name Services",
|
||||||
|
@ -373,7 +373,7 @@
|
|||||||
"ens-displayed-with": "您的消息会显示给其他人",
|
"ens-displayed-with": "您的消息会显示给其他人",
|
||||||
"ens-get-name": "获取用户名",
|
"ens-get-name": "获取用户名",
|
||||||
"ens-got-it": "好的, 知道了",
|
"ens-got-it": "好的, 知道了",
|
||||||
"ens-locked": "用户名已锁定。您将无法在25.05.2020之前释放它",
|
"ens-locked": "用户名已锁定。您将无法在{{date}}之前释放它",
|
||||||
"ens-name-content": "您可以为您的聊天码使用以太坊名称服务(ENS)注册的自定义昵称。 ENS名称是去中心化的用户名。",
|
"ens-name-content": "您可以为您的聊天码使用以太坊名称服务(ENS)注册的自定义昵称。 ENS名称是去中心化的用户名。",
|
||||||
"ens-name-title": "ENS名称",
|
"ens-name-title": "ENS名称",
|
||||||
"ens-network-restriction": "仅适用于主网",
|
"ens-network-restriction": "仅适用于主网",
|
||||||
|
@ -349,7 +349,7 @@
|
|||||||
"ens-displayed-with": "您的消息会显示给其他人",
|
"ens-displayed-with": "您的消息会显示给其他人",
|
||||||
"ens-get-name": "获取通用用户名",
|
"ens-get-name": "获取通用用户名",
|
||||||
"ens-got-it": "好的, 明白了",
|
"ens-got-it": "好的, 明白了",
|
||||||
"ens-locked": "用户名已锁定。您将无法在25.05.2020之前释放它",
|
"ens-locked": "用户名已锁定。您将无法在{{date}}之前释放它",
|
||||||
"ens-network-restriction": "仅适用于主网或ropsten",
|
"ens-network-restriction": "仅适用于主网或ropsten",
|
||||||
"ens-no-usernames": "您没有关联任何用户名",
|
"ens-no-usernames": "您没有关联任何用户名",
|
||||||
"ens-powered-by": "由以太坊名称服务提供支持",
|
"ens-powered-by": "由以太坊名称服务提供支持",
|
||||||
|
@ -323,7 +323,7 @@
|
|||||||
"ens-displayed-with": "您的消息会显示给其他人",
|
"ens-displayed-with": "您的消息会显示给其他人",
|
||||||
"ens-get-name": "获取通用用户名",
|
"ens-get-name": "获取通用用户名",
|
||||||
"ens-got-it": "好的, 明白了",
|
"ens-got-it": "好的, 明白了",
|
||||||
"ens-locked": "用户名已锁定。您将无法在25.05.2020之前释放它",
|
"ens-locked": "用户名已锁定。您将无法在{{date}}之前释放它",
|
||||||
"ens-network-restriction": "仅适用于主网或ropsten",
|
"ens-network-restriction": "仅适用于主网或ropsten",
|
||||||
"ens-no-usernames": "您没有关联任何用户名",
|
"ens-no-usernames": "您没有关联任何用户名",
|
||||||
"ens-powered-by": "由以太坊名称服务提供支持",
|
"ens-powered-by": "由以太坊名称服务提供支持",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user