make dapps great again
Signed-off-by: Andrey Shovkoplyas <motor4ik@gmail.com>
This commit is contained in:
parent
954efd9dd7
commit
31c905daa7
|
@ -14,14 +14,14 @@
|
|||
[status-im.ui.screens.add-new.styles :as add-new.styles]
|
||||
[status-im.ui.screens.add-new.open-dapp.styles :as styles]))
|
||||
|
||||
(defn- render-contact [contact]
|
||||
[contact-view/contact-view {:contact contact
|
||||
:on-press #(re-frame/dispatch [:navigate-to :dapp-description contact])
|
||||
(defn- render-dapp [dapp]
|
||||
[contact-view/contact-view {:contact dapp
|
||||
:on-press #(re-frame/dispatch [:navigate-to :dapp-description dapp])
|
||||
:show-forward? true
|
||||
:accessibility-label :dapp-item}])
|
||||
|
||||
(views/defview open-dapp []
|
||||
(views/letsubs [dapps [:all-dapp-with-url-contacts]
|
||||
(views/letsubs [dapps [:all-dapps]
|
||||
url-text (atom nil)]
|
||||
[react/keyboard-avoiding-view styles/main-container
|
||||
[status-bar/status-bar]
|
||||
|
@ -40,7 +40,7 @@
|
|||
:return-key-type :go}]]
|
||||
[list/section-list {:sections dapps
|
||||
:key-fn :dapp-url
|
||||
:render-fn render-contact
|
||||
:render-fn render-dapp
|
||||
:default-separator? true
|
||||
:enableEmptySections true
|
||||
:keyboardShouldPersistTaps :always}]]))
|
||||
|
|
|
@ -34,12 +34,11 @@
|
|||
(handlers/register-handler-fx
|
||||
:open-dapp-in-browser
|
||||
[re-frame/trim-v]
|
||||
(fn [cofx [{:keys [name dapp-url] :as contact}]]
|
||||
(let [browser {:browser-id (:whisper-identity contact)
|
||||
(fn [cofx [{:keys [name dapp-url]}]]
|
||||
(let [browser {:browser-id name
|
||||
:name name
|
||||
:dapp? true
|
||||
:url dapp-url
|
||||
:contact (:whisper-identity contact)}]
|
||||
:url dapp-url}]
|
||||
(merge (add-browser-fx cofx browser)
|
||||
{:dispatch [:navigate-to :browser {:browser/browser-id (:browser-id browser)}]}))))
|
||||
|
||||
|
|
|
@ -18,17 +18,17 @@
|
|||
[status-im.ui.components.toolbar.actions :as actions]
|
||||
[status-im.ui.components.tooltip.views :as tooltip]))
|
||||
|
||||
(views/defview toolbar-content-dapp [contact-identity]
|
||||
(views/letsubs [contact [:get-contact-by-identity contact-identity]]
|
||||
(views/defview toolbar-content-dapp [name]
|
||||
(views/letsubs [dapp [:get-dapp-by-name name]]
|
||||
[react/view
|
||||
[react/view styles/toolbar-content-dapp
|
||||
[chat-icon.screen/dapp-icon-browser contact 36]
|
||||
[chat-icon.screen/dapp-icon-browser dapp 36]
|
||||
[react/view styles/dapp-name
|
||||
[react/text {:style styles/dapp-name-text
|
||||
:number-of-lines 1
|
||||
:font :toolbar-title
|
||||
:accessibility-label :dapp-name-text}
|
||||
(:name contact)]
|
||||
name]
|
||||
[react/text {:style styles/dapp-text}
|
||||
(i18n/label :t/dapp)]]]]))
|
||||
|
||||
|
@ -76,7 +76,7 @@
|
|||
(views/defview browser []
|
||||
(views/letsubs [webview (atom nil)
|
||||
{:keys [address]} [:get-current-account]
|
||||
{:keys [dapp? contact url browser-id] :as browser} [:get-current-browser]
|
||||
{:keys [dapp? url browser-id name] :as browser} [:get-current-browser]
|
||||
{:keys [can-go-back? can-go-forward? error?]} [:get :browser/options]
|
||||
rpc-url [:get :rpc-url]
|
||||
network-id [:get-network-id]]
|
||||
|
@ -89,7 +89,7 @@
|
|||
(when error?
|
||||
(re-frame/dispatch [:remove-browser browser-id]))))]
|
||||
(if dapp?
|
||||
[toolbar-content-dapp contact]
|
||||
[toolbar-content-dapp name]
|
||||
[toolbar-content browser])]
|
||||
(if url
|
||||
[components.webview-bridge/webview-bridge
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
(defn- filter-dapps [v dev-mode?]
|
||||
(remove #(when-not dev-mode? (true? (:developer? %))) v))
|
||||
|
||||
(reg-sub :all-dapp-with-url-contacts
|
||||
(reg-sub :all-dapps
|
||||
:<- [:get-dapps]
|
||||
:<- [:get-current-account]
|
||||
(fn [[dapps {:keys [dev-mode?]}]]
|
||||
|
@ -66,6 +66,11 @@
|
|||
(fn [contacts [_ identity]]
|
||||
(get contacts identity)))
|
||||
|
||||
(reg-sub :get-dapp-by-name
|
||||
:<- [:get-dapps]
|
||||
(fn [dapps [_ name]]
|
||||
(first (filter #(= (:name %) name) (apply concat (map :data dapps))))))
|
||||
|
||||
(reg-sub :get-contact-name-by-identity
|
||||
:<- [:get-contacts]
|
||||
:<- [:get-current-account]
|
||||
|
|
|
@ -99,13 +99,13 @@
|
|||
[message-content-text last-message]
|
||||
[unviewed-indicator chat-id]]]]])))
|
||||
|
||||
(defview home-list-browser-item-inner-view [{:keys [browser-id name url dapp? contact] :as browser}]
|
||||
(letsubs [contact' [:get-contact-by-identity contact]]
|
||||
(defview home-list-browser-item-inner-view [{:keys [name url] :as browser}]
|
||||
(letsubs [dapp [:get-dapp-by-name name]]
|
||||
[react/touchable-highlight {:on-press #(re-frame/dispatch [:open-browser browser])}
|
||||
[react/view styles/chat-container
|
||||
[react/view styles/chat-icon-container
|
||||
(if contact'
|
||||
[chat-icon.screen/dapp-icon-browser contact' 36]
|
||||
(if dapp
|
||||
[chat-icon.screen/dapp-icon-browser dapp 36]
|
||||
[react/view styles/browser-icon-container
|
||||
[vector-icons/icon :icons/discover {:color component.styles/color-light-gray6}]])]
|
||||
[react/view styles/chat-info-container
|
||||
|
|
Loading…
Reference in New Issue