rnn more issues
Signed-off-by: andrey <motor4ik@gmail.com>
This commit is contained in:
parent
35845ae3d3
commit
b280befe2d
|
@ -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
|
||||
(assoc-in [:keycard :application-info :pin-retry-counter] 3)
|
||||
(assoc-in [:keycard :factory-reset-card?] true)
|
||||
(dissoc :popover/popover))}
|
||||
(dissoc :popover/popover))
|
||||
:hide-popover nil}
|
||||
(signing.core/discard)
|
||||
(if show-warning
|
||||
(utils/show-confirmation {:title (i18n/label :t/keycard-recover-title)
|
||||
|
|
|
@ -64,7 +64,8 @@
|
|||
(update-in [:keycard :pin] assoc
|
||||
:enter-step :reset
|
||||
:error nil
|
||||
:status nil))})
|
||||
:status nil))
|
||||
:hide-popover nil})
|
||||
(when-not (:multiaccounts/login db)
|
||||
(navigation/navigate-to-cofx :keycard-pin nil))))
|
||||
|
||||
|
@ -73,7 +74,8 @@
|
|||
[{:keys [db]}]
|
||||
{:db (-> db
|
||||
(dissoc :popover/popover)
|
||||
(update :keycard dissoc :setup-step))})
|
||||
(update :keycard dissoc :setup-step))
|
||||
:hide-popover nil})
|
||||
|
||||
(fx/defn login-with-keycard
|
||||
{:events [:keycard/login-with-keycard]}
|
||||
|
|
|
@ -105,6 +105,13 @@
|
|||
(when-let [handler (get-in views/screens [(keyword id) :right-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
|
||||
(.registerModalDismissedListener
|
||||
(.events Navigation)
|
||||
|
@ -112,11 +119,11 @@
|
|||
(if (> (count @modals) 1)
|
||||
(let [new-modals (butlast @modals)]
|
||||
(reset! modals (vec new-modals))
|
||||
(re-frame/dispatch [:set :view-id (last new-modals)]))
|
||||
(set-view-id (last new-modals)))
|
||||
(do
|
||||
(reset! modals [])
|
||||
(reset! curr-modal false)
|
||||
(re-frame/dispatch [:set :view-id @pushed-screen-id])))
|
||||
(set-view-id @pushed-screen-id)))
|
||||
|
||||
(let [comp @dissmissing]
|
||||
(reset! dissmissing false)
|
||||
|
@ -129,12 +136,9 @@
|
|||
(.events Navigation)
|
||||
(fn [^js 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))
|
||||
(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))
|
||||
(set-view-id view-id)
|
||||
(when-not @curr-modal
|
||||
(reset! pushed-screen-id view-id))))))))
|
||||
|
||||
|
|
|
@ -386,7 +386,8 @@
|
|||
(fx/merge cofx
|
||||
{:db (-> db
|
||||
(assoc-in [:keycard :pin :status] nil)
|
||||
(dissoc :signing/tx :signing/sign))}
|
||||
(dissoc :signing/tx :signing/sign))
|
||||
:hide-signing-sheet nil}
|
||||
(check-queue)
|
||||
(keycard.common/hide-connection-sheet)
|
||||
(keycard.common/clear-pin)
|
||||
|
|
|
@ -14,5 +14,5 @@
|
|||
20)]
|
||||
(reagent/as-element
|
||||
(into [react/keyboard-avoiding-view (update props :keyboardVerticalOffset
|
||||
+ vertical-offset)]
|
||||
+ vertical-offset (if (:ignore-offset props) 44 0))]
|
||||
children))))]))
|
||||
|
|
|
@ -325,7 +325,7 @@
|
|||
on-close #(set-active-panel nil)]
|
||||
(reagent/create-class
|
||||
{: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
|
||||
(fn []
|
||||
(let [{:keys [chat-id show-input? group-chat admins invitation-admin] :as chat}
|
||||
|
|
|
@ -7,28 +7,29 @@
|
|||
[status-im.communities.core :as communities]))
|
||||
|
||||
(defn view []
|
||||
(let [{:keys [chat-id]} (<sub [:get-screen-params])
|
||||
current-chat (<sub [:chat-by-id chat-id])
|
||||
{:keys [chat-name color description community-id]} current-chat
|
||||
{:keys [admin]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[quo/animated-header {:left-accessories [{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:on-press #(>evt [:navigate-back])}]
|
||||
:right-accessories (when admin [{:icon :edit
|
||||
:accessibility-label :invite-button
|
||||
:on-press #(>evt [::communities/edit-channel-pressed
|
||||
community-id
|
||||
chat-name
|
||||
description
|
||||
color])}])
|
||||
:extended-header (profile-header/extended-header
|
||||
{:title chat-name
|
||||
:color color
|
||||
:subtitle (i18n/label :t/public-channel)})
|
||||
:use-insets true}
|
||||
(when-not (string/blank? description)
|
||||
(let [{:keys [chat-id]} (<sub [:get-screen-params])]
|
||||
(fn []
|
||||
(let [current-chat (<sub [:chat-by-id chat-id])
|
||||
{:keys [chat-name color description community-id]} current-chat
|
||||
{:keys [admin]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[quo/list-footer {:color :main}
|
||||
description]
|
||||
[quo/separator {:style {:margin-vertical 8}}]])]]))
|
||||
[quo/animated-header {:left-accessories [{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:on-press #(>evt [:navigate-back])}]
|
||||
:right-accessories (when admin [{:icon :edit
|
||||
:accessibility-label :invite-button
|
||||
:on-press #(>evt [::communities/edit-channel-pressed
|
||||
community-id
|
||||
chat-name
|
||||
description
|
||||
color])}])
|
||||
:extended-header (profile-header/extended-header
|
||||
{:title chat-name
|
||||
:color color
|
||||
:subtitle (i18n/label :t/public-channel)})
|
||||
:use-insets true}
|
||||
(when-not (string/blank? description)
|
||||
[:<>
|
||||
[quo/list-footer {:color :main}
|
||||
description]
|
||||
[quo/separator {:style {:margin-vertical 8}}]])]]))))
|
|
@ -128,6 +128,7 @@
|
|||
;; unread indicator
|
||||
(assoc home-item :public? true)
|
||||
{:on-press (fn []
|
||||
(re-frame/dispatch [:pop-to-root-tab :chat-stack])
|
||||
(re-frame/dispatch [:dismiss-keyboard])
|
||||
(re-frame/dispatch [:chat.ui/navigate-to-chat chat-id])
|
||||
(re-frame/dispatch [:search/home-filter-changed nil]))
|
||||
|
|
|
@ -41,10 +41,10 @@
|
|||
|
||||
(defn invite []
|
||||
(let [user-pk (reagent/atom "")
|
||||
contacts-selected (reagent/atom #{})]
|
||||
contacts-selected (reagent/atom #{})
|
||||
{:keys [invite?]} (<sub [:get-screen-params])]
|
||||
(fn []
|
||||
(let [contacts-data (<sub [:contacts/active])
|
||||
{:keys [invite?]} (<sub [:get-screen-params])
|
||||
{:keys [permissions
|
||||
can-manage-users?]} (<sub [:communities/edited-community])
|
||||
selected @contacts-selected
|
||||
|
|
|
@ -86,27 +86,28 @@
|
|||
[quo/separator {:style {:margin-vertical 8}}]]))
|
||||
|
||||
(defn members []
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])
|
||||
my-public-key (<sub [:multiaccount/public-key])
|
||||
{:keys [members
|
||||
permissions
|
||||
can-manage-users?]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[topbar/topbar {:title (i18n/label :t/community-members-title)
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])]
|
||||
(fn []
|
||||
(let [my-public-key (<sub [:multiaccount/public-key])
|
||||
{:keys [members
|
||||
permissions
|
||||
can-manage-users?]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[topbar/topbar {:title (i18n/label :t/community-members-title)
|
||||
|
||||
:subtitle (str (count members))}]
|
||||
[header community-id]
|
||||
(when (and can-manage-users? (= constants/community-on-request-access (:access permissions)))
|
||||
[requests-to-join community-id])
|
||||
[rn/flat-list {:data (keys members)
|
||||
:render-data {:community-id community-id
|
||||
:my-public-key my-public-key
|
||||
:can-kick-users? (and can-manage-users?
|
||||
(not= (:access permissions)
|
||||
constants/community-no-membership-access))
|
||||
:can-manage-users? can-manage-users?}
|
||||
:key-fn identity
|
||||
:render-fn render-member}]]))
|
||||
:subtitle (str (count members))}]
|
||||
[header community-id]
|
||||
(when (and can-manage-users? (= constants/community-on-request-access (:access permissions)))
|
||||
[requests-to-join community-id])
|
||||
[rn/flat-list {:data (keys members)
|
||||
:render-data {:community-id community-id
|
||||
:my-public-key my-public-key
|
||||
:can-kick-users? (and can-manage-users?
|
||||
(not= (:access permissions)
|
||||
constants/community-no-membership-access))
|
||||
:can-manage-users? can-manage-users?}
|
||||
:key-fn identity
|
||||
:render-fn render-member}]]))))
|
||||
|
||||
(defn members-container []
|
||||
(reagent/create-class
|
||||
|
|
|
@ -15,88 +15,89 @@
|
|||
[clojure.string :as string]))
|
||||
|
||||
(defn management []
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])
|
||||
requests-to-join (<sub [:communities/requests-to-join-for-community community-id])
|
||||
community (<sub [:communities/community community-id])
|
||||
{:keys [color members permissions description name admin]} community
|
||||
roles false
|
||||
notifications false
|
||||
show-members-count? (not= (:access permissions) constants/community-no-membership-access)
|
||||
members-count (count members)]
|
||||
[:<>
|
||||
[quo/animated-header {:left-accessories [{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:on-press #(>evt [:navigate-back])}]
|
||||
:right-accessories [{:icon :main-icons/share
|
||||
:accessibility-label :invite-button
|
||||
:on-press #(>evt [::communities/share-community-pressed community-id])}]
|
||||
:extended-header (profile-header/extended-header
|
||||
{:title name
|
||||
:color (or color (rand-nth colors/chat-colors))
|
||||
:photo (if (= community-id constants/status-community-id)
|
||||
(:uri
|
||||
(rn/resolve-asset-source
|
||||
(resources/get-image :status-logo)))
|
||||
(get-in community [:images :large :uri]))
|
||||
:subtitle (if show-members-count?
|
||||
(i18n/label-pluralize members-count :t/community-members {:count members-count})
|
||||
(i18n/label :t/open-membership))})
|
||||
:use-insets true}
|
||||
[:<>
|
||||
(when-not (string/blank? description)
|
||||
[:<>
|
||||
[quo/list-footer {:color :main}
|
||||
description]
|
||||
[quo/separator {:style {:margin-vertical 8}}]])
|
||||
[:<>
|
||||
(let [link (communities/universal-link community-id)]
|
||||
[react/view {:padding-vertical 10
|
||||
:padding-horizontal 16}
|
||||
[react/view {:margin-bottom 20}
|
||||
[quo/text {:color :secondary} (i18n/label :t/community-link)]]
|
||||
[copyable-text/copyable-text-view
|
||||
{:copied-text link}
|
||||
[react/view {:border-radius 16
|
||||
:padding-horizontal 16
|
||||
:padding-vertical 11
|
||||
:background-color colors/blue-light}
|
||||
[quo/text {:color :link} (subs link 8)]]]])
|
||||
[quo/separator {:style {:margin-vertical 8}}]]
|
||||
(when show-members-count?
|
||||
[quo/list-item {:chevron true
|
||||
:accessory
|
||||
[react/view {:flex-direction :row}
|
||||
(when (pos? members-count)
|
||||
[quo/text {:color :secondary} (str members-count)])
|
||||
[unviewed-indicator/unviewed-indicator (count requests-to-join)]]
|
||||
:on-press #(>evt [:navigate-to :community-members {:community-id community-id}])
|
||||
:title (i18n/label :t/members-label)
|
||||
:icon :main-icons/group-chat}])
|
||||
(when (and admin roles)
|
||||
[quo/list-item {:chevron true
|
||||
:title (i18n/label :t/commonuity-role)
|
||||
:icon :main-icons/objects}])
|
||||
(when notifications
|
||||
[quo/list-item {:chevron true
|
||||
:title (i18n/label :t/chat-notification-preferences)
|
||||
:icon :main-icons/notification}])
|
||||
(when (or show-members-count? notifications (and admin roles))
|
||||
[quo/separator {:style {:margin-vertical 8}}])
|
||||
(when admin
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/edit
|
||||
:title (i18n/label :t/edit-community)
|
||||
:on-press #(>evt [::communities/open-edit-community community-id])}])
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/arrow-left
|
||||
:title (i18n/label :t/leave-community)
|
||||
:on-press #(>evt [::communities/leave community-id])}]
|
||||
;; Disable as not implemented yet
|
||||
(when false
|
||||
[quo/list-item {:theme :negative
|
||||
:icon :main-icons/delete
|
||||
:title (i18n/label :t/delete)
|
||||
:on-press #(>evt [::communities/delete-community community-id])}])]]]))
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])]
|
||||
(fn []
|
||||
(let [requests-to-join (<sub [:communities/requests-to-join-for-community community-id])
|
||||
community (<sub [:communities/community community-id])
|
||||
{:keys [color members permissions description name admin]} community
|
||||
roles false
|
||||
notifications false
|
||||
show-members-count? (not= (:access permissions) constants/community-no-membership-access)
|
||||
members-count (count members)]
|
||||
[:<>
|
||||
[quo/animated-header {:left-accessories [{:icon :main-icons/arrow-left
|
||||
:accessibility-label :back-button
|
||||
:on-press #(>evt [:navigate-back])}]
|
||||
:right-accessories [{:icon :main-icons/share
|
||||
:accessibility-label :invite-button
|
||||
:on-press #(>evt [::communities/share-community-pressed community-id])}]
|
||||
:extended-header (profile-header/extended-header
|
||||
{:title name
|
||||
:color (or color (rand-nth colors/chat-colors))
|
||||
:photo (if (= community-id constants/status-community-id)
|
||||
(:uri
|
||||
(rn/resolve-asset-source
|
||||
(resources/get-image :status-logo)))
|
||||
(get-in community [:images :large :uri]))
|
||||
:subtitle (if show-members-count?
|
||||
(i18n/label-pluralize members-count :t/community-members {:count members-count})
|
||||
(i18n/label :t/open-membership))})
|
||||
:use-insets true}
|
||||
[:<>
|
||||
(when-not (string/blank? description)
|
||||
[:<>
|
||||
[quo/list-footer {:color :main}
|
||||
description]
|
||||
[quo/separator {:style {:margin-vertical 8}}]])
|
||||
[:<>
|
||||
(let [link (communities/universal-link community-id)]
|
||||
[react/view {:padding-vertical 10
|
||||
:padding-horizontal 16}
|
||||
[react/view {:margin-bottom 20}
|
||||
[quo/text {:color :secondary} (i18n/label :t/community-link)]]
|
||||
[copyable-text/copyable-text-view
|
||||
{:copied-text link}
|
||||
[react/view {:border-radius 16
|
||||
:padding-horizontal 16
|
||||
:padding-vertical 11
|
||||
:background-color colors/blue-light}
|
||||
[quo/text {:color :link} (subs link 8)]]]])
|
||||
[quo/separator {:style {:margin-vertical 8}}]]
|
||||
(when show-members-count?
|
||||
[quo/list-item {:chevron true
|
||||
:accessory
|
||||
[react/view {:flex-direction :row}
|
||||
(when (pos? members-count)
|
||||
[quo/text {:color :secondary} (str members-count)])
|
||||
[unviewed-indicator/unviewed-indicator (count requests-to-join)]]
|
||||
:on-press #(>evt [:navigate-to :community-members {:community-id community-id}])
|
||||
:title (i18n/label :t/members-label)
|
||||
:icon :main-icons/group-chat}])
|
||||
(when (and admin roles)
|
||||
[quo/list-item {:chevron true
|
||||
:title (i18n/label :t/commonuity-role)
|
||||
:icon :main-icons/objects}])
|
||||
(when notifications
|
||||
[quo/list-item {:chevron true
|
||||
:title (i18n/label :t/chat-notification-preferences)
|
||||
:icon :main-icons/notification}])
|
||||
(when (or show-members-count? notifications (and admin roles))
|
||||
[quo/separator {:style {:margin-vertical 8}}])
|
||||
(when admin
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/edit
|
||||
:title (i18n/label :t/edit-community)
|
||||
:on-press #(>evt [::communities/open-edit-community community-id])}])
|
||||
[quo/list-item {:theme :accent
|
||||
:icon :main-icons/arrow-left
|
||||
:title (i18n/label :t/leave-community)
|
||||
:on-press #(>evt [::communities/leave community-id])}]
|
||||
;; Disable as not implemented yet
|
||||
(when false
|
||||
[quo/list-item {:theme :negative
|
||||
:icon :main-icons/delete
|
||||
:title (i18n/label :t/delete)
|
||||
:on-press #(>evt [::communities/delete-community community-id])}])]]]))))
|
||||
|
||||
(defn management-container []
|
||||
(reagent/create-class
|
||||
|
|
|
@ -43,18 +43,18 @@
|
|||
(multiaccounts/displayed-photo member)]}]))
|
||||
|
||||
(defn requests-to-join []
|
||||
(fn []
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])
|
||||
requests (<sub [:communities/requests-to-join-for-community community-id])
|
||||
{:keys [can-manage-users?]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[topbar/topbar {:title (i18n/label :t/community-requests-to-join-title)
|
||||
:subtitle (str (count requests))}]
|
||||
[rn/flat-list {:data requests
|
||||
:render-data {:community-id community-id
|
||||
:can-manage-users? can-manage-users?}
|
||||
:key-fn :id
|
||||
:render-fn render-request}]])))
|
||||
(let [{:keys [community-id]} (<sub [:get-screen-params])]
|
||||
(fn []
|
||||
(let [requests (<sub [:communities/requests-to-join-for-community community-id])
|
||||
{:keys [can-manage-users?]} (<sub [:communities/community community-id])]
|
||||
[:<>
|
||||
[topbar/topbar {:title (i18n/label :t/community-requests-to-join-title)
|
||||
:subtitle (str (count requests))}]
|
||||
[rn/flat-list {:data requests
|
||||
:render-data {:community-id community-id
|
||||
:can-manage-users? can-manage-users?}
|
||||
:key-fn :id
|
||||
:render-fn render-request}]]))))
|
||||
|
||||
(defn requests-to-join-container []
|
||||
(reagent/create-class
|
||||
|
|
|
@ -116,7 +116,8 @@
|
|||
(defn nickname-view [public-key {:keys [nickname ens-name three-words-name]}]
|
||||
(let [entered-nickname (reagent/atom nickname)]
|
||||
(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)
|
||||
:subtitle (or ens-name three-words-name)
|
||||
:modal? true}]
|
||||
|
@ -202,6 +203,7 @@
|
|||
:ref #(reset! status.views/messages-list-ref %)
|
||||
:on-end-reached #(re-frame/dispatch [:chat.ui/load-more-messages current-chat-id])
|
||||
: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
|
||||
:data messages}]])))
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
:on-long-press #(on-long-press-fn on-long-press content true)}
|
||||
[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}
|
||||
{:keys [modal on-long-press close-modal]}]
|
||||
[react/view (merge {:padding-vertical 8
|
||||
|
@ -109,6 +109,7 @@
|
|||
{:border-radius 16}))
|
||||
[react/touchable-highlight
|
||||
{:on-press #(do (when modal (close-modal))
|
||||
(when profile (re-frame/dispatch [:navigate-back]))
|
||||
(re-frame/dispatch [:chat.ui/show-profile from]))}
|
||||
[react/view {:padding-top 2 :padding-right 8}
|
||||
(if outgoing
|
||||
|
@ -119,6 +120,7 @@
|
|||
:justify-content :space-between}
|
||||
[react/touchable-highlight
|
||||
{:on-press #(do (when modal (close-modal))
|
||||
(when profile (re-frame/dispatch [:navigate-back]))
|
||||
(re-frame/dispatch [:chat.ui/show-profile from]))}
|
||||
(if outgoing
|
||||
[message/message-my-name {:profile? true :you? false}]
|
||||
|
@ -133,7 +135,7 @@
|
|||
[message/render-parsed-text (assoc message :outgoing false) (:parsed-text content)]])
|
||||
[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)
|
||||
nil
|
||||
(if (= type :gap)
|
||||
|
@ -165,7 +167,7 @@
|
|||
:chat-id chat-id
|
||||
:emoji-id emoji-id
|
||||
:emoji-reaction-id emoji-reaction-id}]))
|
||||
:render (message-item account)}]]))))
|
||||
:render (message-item account profile)}]]))))
|
||||
|
||||
(def state (reagent/atom {:tab :timeline}))
|
||||
|
||||
|
|
Loading…
Reference in New Issue