rnn more issues

Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
andrey 2021-06-29 13:33:46 +02:00
parent 35845ae3d3
commit b280befe2d
No known key found for this signature in database
GPG Key ID: 89B67245FD2F0272
14 changed files with 174 additions and 158 deletions

View File

@ -26,7 +26,8 @@
;setting pin-retry-counter is a workaround for the way the PIN view decides if it should accept PUK or PIN ;setting pin-retry-counter is a workaround for the way the PIN view decides if it should accept PUK or PIN
(assoc-in [:keycard :application-info :pin-retry-counter] 3) (assoc-in [:keycard :application-info :pin-retry-counter] 3)
(assoc-in [:keycard :factory-reset-card?] true) (assoc-in [:keycard :factory-reset-card?] true)
(dissoc :popover/popover))} (dissoc :popover/popover))
:hide-popover nil}
(signing.core/discard) (signing.core/discard)
(if show-warning (if show-warning
(utils/show-confirmation {:title (i18n/label :t/keycard-recover-title) (utils/show-confirmation {:title (i18n/label :t/keycard-recover-title)

View File

@ -64,7 +64,8 @@
(update-in [:keycard :pin] assoc (update-in [:keycard :pin] assoc
:enter-step :reset :enter-step :reset
:error nil :error nil
:status nil))}) :status nil))
:hide-popover nil})
(when-not (:multiaccounts/login db) (when-not (:multiaccounts/login db)
(navigation/navigate-to-cofx :keycard-pin nil)))) (navigation/navigate-to-cofx :keycard-pin nil))))
@ -73,7 +74,8 @@
[{:keys [db]}] [{:keys [db]}]
{:db (-> db {:db (-> db
(dissoc :popover/popover) (dissoc :popover/popover)
(update :keycard dissoc :setup-step))}) (update :keycard dissoc :setup-step))
:hide-popover nil})
(fx/defn login-with-keycard (fx/defn login-with-keycard
{:events [:keycard/login-with-keycard]} {:events [:keycard/login-with-keycard]}

View File

@ -105,6 +105,13 @@
(when-let [handler (get-in views/screens [(keyword id) :right-handler])] (when-let [handler (get-in views/screens [(keyword id) :right-handler])]
(handler))))))) (handler)))))))
(defn set-view-id [view-id]
(when-let [{:keys [on-focus]} (get views/screens view-id)]
(re-frame/dispatch [:set :view-id view-id])
(re-frame/dispatch [:screens/on-will-focus view-id])
(when on-focus
(re-frame/dispatch on-focus))))
(defonce register-modal-reg (defonce register-modal-reg
(.registerModalDismissedListener (.registerModalDismissedListener
(.events Navigation) (.events Navigation)
@ -112,11 +119,11 @@
(if (> (count @modals) 1) (if (> (count @modals) 1)
(let [new-modals (butlast @modals)] (let [new-modals (butlast @modals)]
(reset! modals (vec new-modals)) (reset! modals (vec new-modals))
(re-frame/dispatch [:set :view-id (last new-modals)])) (set-view-id (last new-modals)))
(do (do
(reset! modals []) (reset! modals [])
(reset! curr-modal false) (reset! curr-modal false)
(re-frame/dispatch [:set :view-id @pushed-screen-id]))) (set-view-id @pushed-screen-id)))
(let [comp @dissmissing] (let [comp @dissmissing]
(reset! dissmissing false) (reset! dissmissing false)
@ -129,12 +136,9 @@
(.events Navigation) (.events Navigation)
(fn [^js evn] (fn [^js evn]
(let [view-id (keyword (.-componentName evn))] (let [view-id (keyword (.-componentName evn))]
(when-let [{:keys [on-focus]} (get views/screens view-id)] (when (get views/screens view-id)
(when (and (not= view-id :bottom-sheet) (not= view-id :popover)) (when (and (not= view-id :bottom-sheet) (not= view-id :popover))
(re-frame/dispatch [:set :view-id view-id]) (set-view-id view-id)
(re-frame/dispatch [:screens/on-will-focus view-id])
(when on-focus
(re-frame/dispatch on-focus))
(when-not @curr-modal (when-not @curr-modal
(reset! pushed-screen-id view-id)))))))) (reset! pushed-screen-id view-id))))))))

View File

@ -386,7 +386,8 @@
(fx/merge cofx (fx/merge cofx
{:db (-> db {:db (-> db
(assoc-in [:keycard :pin :status] nil) (assoc-in [:keycard :pin :status] nil)
(dissoc :signing/tx :signing/sign))} (dissoc :signing/tx :signing/sign))
:hide-signing-sheet nil}
(check-queue) (check-queue)
(keycard.common/hide-connection-sheet) (keycard.common/hide-connection-sheet)
(keycard.common/clear-pin) (keycard.common/clear-pin)

View File

@ -14,5 +14,5 @@
20)] 20)]
(reagent/as-element (reagent/as-element
(into [react/keyboard-avoiding-view (update props :keyboardVerticalOffset (into [react/keyboard-avoiding-view (update props :keyboardVerticalOffset
+ vertical-offset)] + vertical-offset (if (:ignore-offset props) 44 0))]
children))))])) children))))]))

View File

@ -325,7 +325,7 @@
on-close #(set-active-panel nil)] on-close #(set-active-panel nil)]
(reagent/create-class (reagent/create-class
{:component-will-unmount #(re-frame/dispatch-sync [:close-chat curr-chat-id]) {:component-will-unmount #(re-frame/dispatch-sync [:close-chat curr-chat-id])
:component-did-mount (fn [] (js/setTimeout #(re-frame/dispatch [:set :ignore-close-chat false]) 1000)) :component-did-mount (fn [] (js/setTimeout #(re-frame/dispatch [:set :ignore-close-chat false]) 500))
:reagent-render :reagent-render
(fn [] (fn []
(let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat} (let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat}

View File

@ -7,8 +7,9 @@
[status-im.communities.core :as communities])) [status-im.communities.core :as communities]))
(defn view [] (defn view []
(let [{:keys [chat-id]} (<sub [:get-screen-params]) (let [{:keys [chat-id]} (<sub [:get-screen-params])]
current-chat (<sub [:chat-by-id chat-id]) (fn []
(let [current-chat (<sub [:chat-by-id chat-id])
{:keys [chat-name color description community-id]} current-chat {:keys [chat-name color description community-id]} current-chat
{:keys [admin]} (<sub [:communities/community community-id])] {:keys [admin]} (<sub [:communities/community community-id])]
[:<> [:<>
@ -31,4 +32,4 @@
[:<> [:<>
[quo/list-footer {:color :main} [quo/list-footer {:color :main}
description] description]
[quo/separator {:style {:margin-vertical 8}}]])]])) [quo/separator {:style {:margin-vertical 8}}]])]]))))

View File

@ -128,6 +128,7 @@
;; unread indicator ;; unread indicator
(assoc home-item :public? true) (assoc home-item :public? true)
{:on-press (fn [] {:on-press (fn []
(re-frame/dispatch [:pop-to-root-tab :chat-stack])
(re-frame/dispatch [:dismiss-keyboard]) (re-frame/dispatch [:dismiss-keyboard])
(re-frame/dispatch [:chat.ui/navigate-to-chat chat-id]) (re-frame/dispatch [:chat.ui/navigate-to-chat chat-id])
(re-frame/dispatch [:search/home-filter-changed nil])) (re-frame/dispatch [:search/home-filter-changed nil]))

View File

@ -41,10 +41,10 @@
(defn invite [] (defn invite []
(let [user-pk (reagent/atom "") (let [user-pk (reagent/atom "")
contacts-selected (reagent/atom #{})] contacts-selected (reagent/atom #{})
{:keys [invite?]} (<sub [:get-screen-params])]
(fn [] (fn []
(let [contacts-data (<sub [:contacts/active]) (let [contacts-data (<sub [:contacts/active])
{:keys [invite?]} (<sub [:get-screen-params])
{:keys [permissions {:keys [permissions
can-manage-users?]} (<sub [:communities/edited-community]) can-manage-users?]} (<sub [:communities/edited-community])
selected @contacts-selected selected @contacts-selected

View File

@ -86,8 +86,9 @@
[quo/separator {:style {:margin-vertical 8}}]])) [quo/separator {:style {:margin-vertical 8}}]]))
(defn members [] (defn members []
(let [{:keys [community-id]} (<sub [:get-screen-params]) (let [{:keys [community-id]} (<sub [:get-screen-params])]
my-public-key (<sub [:multiaccount/public-key]) (fn []
(let [my-public-key (<sub [:multiaccount/public-key])
{:keys [members {:keys [members
permissions permissions
can-manage-users?]} (<sub [:communities/community community-id])] can-manage-users?]} (<sub [:communities/community community-id])]
@ -106,7 +107,7 @@
constants/community-no-membership-access)) constants/community-no-membership-access))
:can-manage-users? can-manage-users?} :can-manage-users? can-manage-users?}
:key-fn identity :key-fn identity
:render-fn render-member}]])) :render-fn render-member}]]))))
(defn members-container [] (defn members-container []
(reagent/create-class (reagent/create-class

View File

@ -15,8 +15,9 @@
[clojure.string :as string])) [clojure.string :as string]))
(defn management [] (defn management []
(let [{:keys [community-id]} (<sub [:get-screen-params]) (let [{:keys [community-id]} (<sub [:get-screen-params])]
requests-to-join (<sub [:communities/requests-to-join-for-community community-id]) (fn []
(let [requests-to-join (<sub [:communities/requests-to-join-for-community community-id])
community (<sub [:communities/community community-id]) community (<sub [:communities/community community-id])
{:keys [color members permissions description name admin]} community {:keys [color members permissions description name admin]} community
roles false roles false
@ -96,7 +97,7 @@
[quo/list-item {:theme :negative [quo/list-item {:theme :negative
:icon :main-icons/delete :icon :main-icons/delete
:title (i18n/label :t/delete) :title (i18n/label :t/delete)
:on-press #(>evt [::communities/delete-community community-id])}])]]])) :on-press #(>evt [::communities/delete-community community-id])}])]]]))))
(defn management-container [] (defn management-container []
(reagent/create-class (reagent/create-class

View File

@ -43,9 +43,9 @@
(multiaccounts/displayed-photo member)]}])) (multiaccounts/displayed-photo member)]}]))
(defn requests-to-join [] (defn requests-to-join []
(let [{:keys [community-id]} (<sub [:get-screen-params])]
(fn [] (fn []
(let [{:keys [community-id]} (<sub [:get-screen-params]) (let [requests (<sub [:communities/requests-to-join-for-community community-id])
requests (<sub [:communities/requests-to-join-for-community community-id])
{:keys [can-manage-users?]} (<sub [:communities/community community-id])] {:keys [can-manage-users?]} (<sub [:communities/community community-id])]
[:<> [:<>
[topbar/topbar {:title (i18n/label :t/community-requests-to-join-title) [topbar/topbar {:title (i18n/label :t/community-requests-to-join-title)
@ -54,7 +54,7 @@
:render-data {:community-id community-id :render-data {:community-id community-id
:can-manage-users? can-manage-users?} :can-manage-users? can-manage-users?}
:key-fn :id :key-fn :id
:render-fn render-request}]]))) :render-fn render-request}]]))))
(defn requests-to-join-container [] (defn requests-to-join-container []
(reagent/create-class (reagent/create-class

View File

@ -116,7 +116,8 @@
(defn nickname-view [public-key {:keys [nickname ens-name three-words-name]}] (defn nickname-view [public-key {:keys [nickname ens-name three-words-name]}]
(let [entered-nickname (reagent/atom nickname)] (let [entered-nickname (reagent/atom nickname)]
(fn [] (fn []
[kb-presentation/keyboard-avoiding-view {:style {:flex 1}} [kb-presentation/keyboard-avoiding-view {:style {:flex 1}
:ignore-offset true}
[topbar/topbar {:title (i18n/label :t/nickname) [topbar/topbar {:title (i18n/label :t/nickname)
:subtitle (or ens-name three-words-name) :subtitle (or ens-name three-words-name)
:modal? true}] :modal? true}]
@ -202,6 +203,7 @@
:ref #(reset! status.views/messages-list-ref %) :ref #(reset! status.views/messages-list-ref %)
:on-end-reached #(re-frame/dispatch [:chat.ui/load-more-messages current-chat-id]) :on-end-reached #(re-frame/dispatch [:chat.ui/load-more-messages current-chat-id])
:on-scroll-to-index-failed #() ;;don't remove this :on-scroll-to-index-failed #() ;;don't remove this
:render-data {:chat-id current-chat-id} :render-data {:chat-id current-chat-id
:profile true}
:render-fn status.views/render-message :render-fn status.views/render-message
:data messages}]]))) :data messages}]])))

View File

@ -98,7 +98,7 @@
:on-long-press #(on-long-press-fn on-long-press content true)} :on-long-press #(on-long-press-fn on-long-press content true)}
[message-content-image (:image content) false]]]))) [message-content-image (:image content) false]]])))
(defn message-item [account] (defn message-item [account profile]
(fn [{:keys [content-type content from timestamp outgoing] :as message} (fn [{:keys [content-type content from timestamp outgoing] :as message}
{:keys [modal on-long-press close-modal]}] {:keys [modal on-long-press close-modal]}]
[react/view (merge {:padding-vertical 8 [react/view (merge {:padding-vertical 8
@ -109,6 +109,7 @@
{:border-radius 16})) {:border-radius 16}))
[react/touchable-highlight [react/touchable-highlight
{:on-press #(do (when modal (close-modal)) {:on-press #(do (when modal (close-modal))
(when profile (re-frame/dispatch [:navigate-back]))
(re-frame/dispatch [:chat.ui/show-profile from]))} (re-frame/dispatch [:chat.ui/show-profile from]))}
[react/view {:padding-top 2 :padding-right 8} [react/view {:padding-top 2 :padding-right 8}
(if outgoing (if outgoing
@ -119,6 +120,7 @@
:justify-content :space-between} :justify-content :space-between}
[react/touchable-highlight [react/touchable-highlight
{:on-press #(do (when modal (close-modal)) {:on-press #(do (when modal (close-modal))
(when profile (re-frame/dispatch [:navigate-back]))
(re-frame/dispatch [:chat.ui/show-profile from]))} (re-frame/dispatch [:chat.ui/show-profile from]))}
(if outgoing (if outgoing
[message/message-my-name {:profile? true :you? false}] [message/message-my-name {:profile? true :you? false}]
@ -133,7 +135,7 @@
[message/render-parsed-text (assoc message :outgoing false) (:parsed-text content)]]) [message/render-parsed-text (assoc message :outgoing false) (:parsed-text content)]])
[link-preview/link-preview-wrapper (:links content) outgoing true]]]])) [link-preview/link-preview-wrapper (:links content) outgoing true]]]]))
(defn render-message [{:keys [type] :as message} idx _ {:keys [timeline account chat-id]}] (defn render-message [{:keys [type] :as message} idx _ {:keys [timeline account chat-id profile]}]
(if (= type :datemark) (if (= type :datemark)
nil nil
(if (= type :gap) (if (= type :gap)
@ -165,7 +167,7 @@
:chat-id chat-id :chat-id chat-id
:emoji-id emoji-id :emoji-id emoji-id
:emoji-reaction-id emoji-reaction-id}])) :emoji-reaction-id emoji-reaction-id}]))
:render (message-item account)}]])))) :render (message-item account profile)}]]))))
(def state (reagent/atom {:tab :timeline})) (def state (reagent/atom {:tab :timeline}))