Change all components to use the set function
This commit is contained in:
parent
350136987d
commit
a64aebd06f
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.contexts.shell.activity-center.notification.admin.view
|
(ns status-im.contexts.shell.activity-center.notification.admin.view
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
|
[react-native.core :as rn]
|
||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
||||||
|
@ -23,30 +24,42 @@
|
||||||
:text (i18n/label :t/decline)}])
|
:text (i18n/label :t/decline)}])
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable notification extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable notification extra-fn]} child]
|
||||||
(let [{:keys [community-id id membership-status]} notification]
|
(let [{:keys [community-id id
|
||||||
|
membership-status]} notification
|
||||||
|
accept (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:communities/accept-request-to-join-pressed
|
||||||
|
community-id id]))
|
||||||
|
[community-id id])
|
||||||
|
decline (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:communities/decline-request-to-join-pressed
|
||||||
|
community-id id]))
|
||||||
|
[community-id id])]
|
||||||
(cond
|
(cond
|
||||||
(#{constants/activity-center-membership-status-accepted
|
(#{constants/activity-center-membership-status-accepted
|
||||||
constants/activity-center-membership-status-declined}
|
constants/activity-center-membership-status-declined}
|
||||||
membership-status)
|
membership-status)
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
(= membership-status constants/activity-center-membership-status-pending)
|
(= membership-status constants/activity-center-membership-status-pending)
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button swipe-button-accept
|
{:left-button swipe-button-accept
|
||||||
:left-on-press #(rf/dispatch [:communities/accept-request-to-join-pressed community-id id])
|
:left-on-press accept
|
||||||
:right-button swipe-button-decline
|
:right-button swipe-button-decline
|
||||||
:right-on-press #(rf/dispatch [:communities/decline-request-to-join-pressed community-id
|
:right-on-press decline
|
||||||
id])
|
:active-swipeable active-swipeable
|
||||||
:active-swipeable active-swipeable
|
:set-active-swipeable set-active-swipeable
|
||||||
:extra-fn extra-fn}
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
:else
|
:else
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.contexts.shell.activity-center.notification.community-kicked.view
|
(ns status-im.contexts.shell.activity-center.notification.community-kicked.view
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
|
[react-native.core :as rn]
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
||||||
|
@ -9,28 +10,31 @@
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable extra-fn]} child]
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child])
|
child])
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
||||||
(let [{:keys [community-id read
|
(let [{:keys [id community-id read
|
||||||
timestamp]} notification
|
timestamp]} notification
|
||||||
community (rf/sub [:communities/community community-id])
|
community (rf/sub [:communities/community community-id])
|
||||||
community-name (:name community)
|
community-name (:name community)
|
||||||
community-image (get-in community [:images :thumbnail :uri])]
|
community-image (get-in community [:images :thumbnail :uri])
|
||||||
|
on-press (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:navigate-back])
|
||||||
|
(rf/dispatch [:activity-center.notifications/mark-as-read id]))
|
||||||
|
[id])]
|
||||||
[swipeable props
|
[swipeable props
|
||||||
[gesture/touchable-without-feedback
|
[gesture/touchable-without-feedback {:on-press on-press}
|
||||||
{:on-press (fn []
|
|
||||||
(rf/dispatch [:navigate-back])
|
|
||||||
(rf/dispatch [:activity-center.notifications/mark-as-read (:id notification)]))}
|
|
||||||
[quo/activity-log
|
[quo/activity-log
|
||||||
{:title (i18n/label :t/community-kicked-heading)
|
{:title (i18n/label :t/community-kicked-heading)
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.contexts.shell.activity-center.notification.community-request.view
|
(ns status-im.contexts.shell.activity-center.notification.community-request.view
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
|
[react-native.core :as rn]
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im.constants :as constants]
|
[status-im.constants :as constants]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
||||||
|
@ -10,14 +11,15 @@
|
||||||
[utils.re-frame :as rf]))
|
[utils.re-frame :as rf]))
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable extra-fn]} child]
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child])
|
child])
|
||||||
|
|
||||||
(defn- get-header-text-and-context
|
(defn- get-header-text-and-context
|
||||||
|
@ -56,22 +58,23 @@
|
||||||
:t/joined-community
|
:t/joined-community
|
||||||
:t/community-request-accepted-body-text)
|
:t/community-request-accepted-body-text)
|
||||||
(when open? {:community community-name}))]
|
(when open? {:community community-name}))]
|
||||||
community-context-tag]}
|
community-context-tag]})))
|
||||||
|
|
||||||
:else nil)))
|
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
||||||
(let [{:keys [community-id membership-status read
|
(let [{:keys [community-id membership-status read
|
||||||
timestamp]} notification
|
timestamp]} notification
|
||||||
community (rf/sub [:communities/community community-id])
|
community (rf/sub [:communities/community community-id])
|
||||||
{:keys [header-text context]} (get-header-text-and-context community
|
{:keys [header-text
|
||||||
membership-status)]
|
context]} (get-header-text-and-context community
|
||||||
|
membership-status)
|
||||||
|
on-press (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:navigate-back])
|
||||||
|
(rf/dispatch [:communities/navigate-to-community-overview community-id]))
|
||||||
|
[community-id])]
|
||||||
[swipeable props
|
[swipeable props
|
||||||
[gesture/touchable-without-feedback
|
[gesture/touchable-without-feedback {:on-press on-press}
|
||||||
{:on-press (fn []
|
|
||||||
(rf/dispatch [:navigate-back])
|
|
||||||
(rf/dispatch [:communities/navigate-to-community-overview community-id]))}
|
|
||||||
[quo/activity-log
|
[quo/activity-log
|
||||||
{:title header-text
|
{:title header-text
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
|
|
|
@ -112,8 +112,17 @@
|
||||||
|
|
||||||
(defn- incoming-contact-request-view
|
(defn- incoming-contact-request-view
|
||||||
[{:keys [notification set-swipeable-height customization-color]} theme]
|
[{:keys [notification set-swipeable-height customization-color]} theme]
|
||||||
(let [{:keys [id author message last-message]} notification
|
(let [{:keys [id author message
|
||||||
message (or message last-message)]
|
last-message]} notification
|
||||||
|
message (or message last-message)
|
||||||
|
accept (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:activity-center.contact-requests/accept id]))
|
||||||
|
[id])
|
||||||
|
decline (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:activity-center.contact-requests/decline id]))
|
||||||
|
[id])]
|
||||||
[quo/activity-log
|
[quo/activity-log
|
||||||
{:title (i18n/label :t/contact-request)
|
{:title (i18n/label :t/contact-request)
|
||||||
:customization-color customization-color
|
:customization-color customization-color
|
||||||
|
@ -149,13 +158,13 @@
|
||||||
:key :button-decline
|
:key :button-decline
|
||||||
:label (i18n/label :t/decline)
|
:label (i18n/label :t/decline)
|
||||||
:accessibility-label :decline-contact-request
|
:accessibility-label :decline-contact-request
|
||||||
:on-press #(rf/dispatch [:activity-center.contact-requests/decline id])}
|
:on-press decline}
|
||||||
{:type :button
|
{:type :button
|
||||||
:subtype :positive
|
:subtype :positive
|
||||||
:key :button-accept
|
:key :button-accept
|
||||||
:label (i18n/label :t/accept)
|
:label (i18n/label :t/accept)
|
||||||
:accessibility-label :accept-contact-request
|
:accessibility-label :accept-contact-request
|
||||||
:on-press #(rf/dispatch [:activity-center.contact-requests/accept id])}]
|
:on-press accept}]
|
||||||
|
|
||||||
nil)}]))
|
nil)}]))
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@
|
||||||
(rf/dispatch [:activity-center.notifications/mark-as-read id]))
|
(rf/dispatch [:activity-center.notifications/mark-as-read id]))
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable extra-fn notification replying?] :as props} child]
|
[{:keys [active-swipeable set-active-swipeable extra-fn notification replying?] :as props} child]
|
||||||
(let [{:keys [id message
|
(let [{:keys [id message
|
||||||
contact-verification-status]} notification
|
contact-verification-status]} notification
|
||||||
challenger? (:outgoing message)]
|
challenger? (:outgoing message)]
|
||||||
|
@ -116,23 +116,25 @@
|
||||||
(and (not challenger?)
|
(and (not challenger?)
|
||||||
(= contact-verification-status constants/contact-verification-status-pending))
|
(= contact-verification-status constants/contact-verification-status-pending))
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button swipe-button-reply
|
{:left-button swipe-button-reply
|
||||||
:left-on-press #(prepare-challenge-reply props)
|
:left-on-press #(prepare-challenge-reply props)
|
||||||
:right-button swipe-button-decline
|
:right-button swipe-button-decline
|
||||||
:right-on-press #(decline-challenge id)
|
:right-on-press #(decline-challenge id)
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
(and challenger?
|
(and challenger?
|
||||||
(= contact-verification-status constants/contact-verification-status-accepted))
|
(= contact-verification-status constants/contact-verification-status-accepted))
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button swipe-button-trust
|
{:left-button swipe-button-trust
|
||||||
:left-on-press #(mark-challenge-trusted id)
|
:left-on-press #(mark-challenge-trusted id)
|
||||||
:right-button swipe-button-untrustworthy
|
:right-button swipe-button-untrustworthy
|
||||||
:right-on-press #(mark-challenge-untrustworthy id)
|
:right-on-press #(mark-challenge-untrustworthy id)
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
(#{constants/contact-verification-status-accepted
|
(#{constants/contact-verification-status-accepted
|
||||||
|
@ -140,12 +142,13 @@
|
||||||
constants/contact-verification-status-trusted}
|
constants/contact-verification-status-trusted}
|
||||||
contact-verification-status)
|
contact-verification-status)
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
|
|
||||||
:else
|
:else
|
||||||
|
@ -165,86 +168,88 @@
|
||||||
(= contact-verification-status constants/contact-verification-status-declined))
|
(= contact-verification-status constants/contact-verification-status-declined))
|
||||||
[swipeable props
|
[swipeable props
|
||||||
[quo/activity-log
|
[quo/activity-log
|
||||||
(merge
|
(cond->
|
||||||
(when-not replying?
|
{:title (i18n/label :t/identity-verification-request)
|
||||||
{:on-layout set-swipeable-height})
|
:customization-color customization-color
|
||||||
{:title (i18n/label :t/identity-verification-request)
|
:icon :i/friend
|
||||||
:customization-color customization-color
|
:timestamp (datetime/timestamp->relative (:timestamp notification))
|
||||||
:icon :i/friend
|
:unread? (not (:read notification))
|
||||||
:timestamp (datetime/timestamp->relative (:timestamp notification))
|
:on-update-reply #(reset! reply %)
|
||||||
:unread? (not (:read notification))
|
:replying? replying?
|
||||||
:on-update-reply #(reset! reply %)
|
:max-reply-length max-reply-length
|
||||||
:replying? replying?
|
:valid-reply? valid-reply?
|
||||||
:max-reply-length max-reply-length
|
:context (context-tags challenger? notification)
|
||||||
:valid-reply? valid-reply?
|
:message (activity-message challenger? notification)
|
||||||
:context (context-tags challenger? notification)
|
:items
|
||||||
:message (activity-message challenger? notification)
|
(cond-> []
|
||||||
:items
|
(and challenger?
|
||||||
(cond-> []
|
(= contact-verification-status constants/contact-verification-status-accepted))
|
||||||
(and challenger?
|
(concat
|
||||||
(= contact-verification-status constants/contact-verification-status-accepted))
|
[{:type :button
|
||||||
(concat
|
:subtype :danger
|
||||||
[{:type :button
|
:key :button-mark-as-untrustworthy
|
||||||
:subtype :danger
|
:label (i18n/label :t/untrustworthy)
|
||||||
:key :button-mark-as-untrustworthy
|
:accessibility-label :mark-contact-verification-as-untrustworthy
|
||||||
:label (i18n/label :t/untrustworthy)
|
:on-press #(mark-challenge-untrustworthy id)}
|
||||||
:accessibility-label :mark-contact-verification-as-untrustworthy
|
{:type :button
|
||||||
:on-press #(mark-challenge-untrustworthy id)}
|
:subtype :positive
|
||||||
{:type :button
|
:key :button-accept
|
||||||
:subtype :positive
|
:label (i18n/label :t/accept)
|
||||||
:key :button-accept
|
:accessibility-label :mark-contact-verification-as-trusted
|
||||||
:label (i18n/label :t/accept)
|
:on-press #(mark-challenge-trusted id)}])
|
||||||
:accessibility-label :mark-contact-verification-as-trusted
|
|
||||||
:on-press #(mark-challenge-trusted id)}])
|
|
||||||
|
|
||||||
(and challenger?
|
(and challenger?
|
||||||
(= contact-verification-status constants/contact-verification-status-trusted))
|
(= contact-verification-status constants/contact-verification-status-trusted))
|
||||||
(concat [{:type :status
|
(concat [{:type :status
|
||||||
:subtype :positive
|
:subtype :positive
|
||||||
:key :status-trusted
|
:key :status-trusted
|
||||||
:label (i18n/label :t/status-confirmed)}])
|
:label (i18n/label :t/status-confirmed)}])
|
||||||
|
|
||||||
(and challenger?
|
(and challenger?
|
||||||
(= contact-verification-status constants/contact-verification-status-untrustworthy))
|
(= contact-verification-status
|
||||||
(concat [{:type :status
|
constants/contact-verification-status-untrustworthy))
|
||||||
:subtype :negative
|
(concat [{:type :status
|
||||||
:key :status-untrustworthy
|
:subtype :negative
|
||||||
:label (i18n/label :t/untrustworthy)}])
|
:key :status-untrustworthy
|
||||||
|
:label (i18n/label :t/untrustworthy)}])
|
||||||
|
|
||||||
(and (not challenger?)
|
(and (not challenger?)
|
||||||
(= contact-verification-status constants/contact-verification-status-accepted))
|
(= contact-verification-status constants/contact-verification-status-accepted))
|
||||||
(concat [{:type :status
|
(concat [{:type :status
|
||||||
:subtype :positive
|
:subtype :positive
|
||||||
:key :status-accepted
|
:key :status-accepted
|
||||||
:label (i18n/label :t/replied)}])
|
:label (i18n/label :t/replied)}])
|
||||||
|
|
||||||
(and (not challenger?)
|
(and (not challenger?)
|
||||||
(= contact-verification-status constants/contact-verification-status-declined))
|
(= contact-verification-status constants/contact-verification-status-declined))
|
||||||
(concat [{:type :status
|
(concat [{:type :status
|
||||||
:subtype :negative
|
:subtype :negative
|
||||||
:key :status-declined
|
:key :status-declined
|
||||||
:label (i18n/label :t/declined)}])
|
:label (i18n/label :t/declined)}])
|
||||||
|
|
||||||
(and (not challenger?)
|
(and (not challenger?)
|
||||||
(= contact-verification-status constants/contact-verification-status-pending))
|
(= contact-verification-status constants/contact-verification-status-pending))
|
||||||
(concat
|
(concat
|
||||||
[{:type :button
|
[{:type :button
|
||||||
:subtype :danger
|
:subtype :danger
|
||||||
:key :button-decline
|
:key :button-decline
|
||||||
:label (i18n/label :t/decline)
|
:label (i18n/label :t/decline)
|
||||||
:accessibility-label :decline-contact-verification
|
:accessibility-label :decline-contact-verification
|
||||||
:on-press #(decline-challenge id)}
|
:on-press #(decline-challenge id)}
|
||||||
(if replying?
|
(if replying?
|
||||||
{:type :button
|
{:type :button
|
||||||
:subtype :primary
|
:subtype :primary
|
||||||
:key :button-reply
|
:key :button-reply
|
||||||
:label (i18n/label :t/send-reply)
|
:label (i18n/label :t/send-reply)
|
||||||
:accessibility-label :reply-to-contact-verification
|
:accessibility-label :reply-to-contact-verification
|
||||||
:disable-when invalid-reply?
|
:disable-when invalid-reply?
|
||||||
:on-press #(send-challenge-reply id @reply)}
|
:on-press #(send-challenge-reply id @reply)}
|
||||||
{:type :button
|
{:type :button
|
||||||
:subtype :primary
|
:subtype :primary
|
||||||
:key :button-send-reply
|
:key :button-send-reply
|
||||||
:label (i18n/label :t/message-reply)
|
:label (i18n/label :t/message-reply)
|
||||||
:accessibility-label :send-reply-to-contact-verification
|
:accessibility-label :send-reply-to-contact-verification
|
||||||
:on-press #(prepare-challenge-reply props)})]))})]])))))
|
:on-press #(prepare-challenge-reply props)})]))}
|
||||||
|
|
||||||
|
(not replying?)
|
||||||
|
(assoc :on-layout set-swipeable-height))]])))))
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
(ns status-im.contexts.shell.activity-center.notification.membership.view
|
(ns status-im.contexts.shell.activity-center.notification.membership.view
|
||||||
(:require
|
(:require
|
||||||
[quo.core :as quo]
|
[quo.core :as quo]
|
||||||
|
[react-native.core :as rn]
|
||||||
[react-native.gesture :as gesture]
|
[react-native.gesture :as gesture]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
[status-im.contexts.shell.activity-center.notification.common.style :as common-style]
|
||||||
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
[status-im.contexts.shell.activity-center.notification.common.view :as common]
|
||||||
|
@ -33,29 +34,48 @@
|
||||||
:text (i18n/label :t/decline)}])
|
:text (i18n/label :t/decline)}])
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable notification extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable notification extra-fn]} child]
|
||||||
(let [{:keys [accepted dismissed id]} notification]
|
(let [{:keys [accepted dismissed
|
||||||
|
id]} notification
|
||||||
|
accept (rn/use-callback
|
||||||
|
(fn [] (rf/dispatch [:activity-center.notifications/accept id]))
|
||||||
|
[id])
|
||||||
|
dismiss (rn/use-callback
|
||||||
|
(fn [] (rf/dispatch [:activity-center.notifications/dismiss id]))
|
||||||
|
[id])]
|
||||||
(if (or accepted dismissed)
|
(if (or accepted dismissed)
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child]
|
child]
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button swipe-button-accept
|
{:left-button swipe-button-accept
|
||||||
:left-on-press #(rf/dispatch [:activity-center.notifications/accept id])
|
:left-on-press accept
|
||||||
:right-button swipe-button-decline
|
:right-button swipe-button-decline
|
||||||
:right-on-press #(rf/dispatch [:activity-center.notifications/dismiss id])
|
:right-on-press dismiss
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child])))
|
child])))
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
||||||
(let [{:keys [id accepted dismissed author read timestamp chat-name chat-id]} notification]
|
(let [{:keys [id accepted dismissed author read
|
||||||
|
timestamp chat-name
|
||||||
|
chat-id]} notification
|
||||||
|
accept (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:activity-center.notifications/accept id]))
|
||||||
|
[id])
|
||||||
|
dismiss (rn/use-callback
|
||||||
|
(fn []
|
||||||
|
(rf/dispatch [:activity-center.notifications/dismiss id]))
|
||||||
|
[id])]
|
||||||
[swipeable props
|
[swipeable props
|
||||||
[pressable {:accepted accepted :chat-id chat-id}
|
[pressable {:accepted accepted :chat-id chat-id}
|
||||||
[quo/activity-log
|
[quo/activity-log
|
||||||
|
@ -78,13 +98,10 @@
|
||||||
:key :button-accept
|
:key :button-accept
|
||||||
:label (i18n/label :t/accept)
|
:label (i18n/label :t/accept)
|
||||||
:accessibility-label :accept-group-chat-invitation
|
:accessibility-label :accept-group-chat-invitation
|
||||||
:on-press #(rf/dispatch
|
:on-press accept}
|
||||||
[:activity-center.notifications/accept id])}
|
|
||||||
{:type :button
|
{:type :button
|
||||||
:subtype :danger
|
:subtype :danger
|
||||||
:key :button-decline
|
:key :button-decline
|
||||||
:label (i18n/label :t/decline)
|
:label (i18n/label :t/decline)
|
||||||
:accessibility-label :decline-group-chat-invitation
|
:accessibility-label :decline-group-chat-invitation
|
||||||
:on-press #(rf/dispatch
|
:on-press dismiss}])}]]]))
|
||||||
[:activity-center.notifications/dismiss
|
|
||||||
id])}])}]]]))
|
|
||||||
|
|
|
@ -30,14 +30,15 @@
|
||||||
parsed-text-children))))
|
parsed-text-children))))
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable extra-fn]} child]
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child])
|
child])
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
|
|
|
@ -51,25 +51,27 @@
|
||||||
nil))
|
nil))
|
||||||
|
|
||||||
(defn- swipeable
|
(defn- swipeable
|
||||||
[{:keys [active-swipeable extra-fn]} child]
|
[{:keys [active-swipeable set-active-swipeable extra-fn]} child]
|
||||||
[common/swipeable
|
[common/swipeable
|
||||||
{:left-button common/swipe-button-read-or-unread
|
{:left-button common/swipe-button-read-or-unread
|
||||||
:left-on-press common/swipe-on-press-toggle-read
|
:left-on-press common/swipe-on-press-toggle-read
|
||||||
:right-button common/swipe-button-delete
|
:right-button common/swipe-button-delete
|
||||||
:right-on-press common/swipe-on-press-delete
|
:right-on-press common/swipe-on-press-delete
|
||||||
:active-swipeable active-swipeable
|
:active-swipeable active-swipeable
|
||||||
:extra-fn extra-fn}
|
:set-active-swipeable set-active-swipeable
|
||||||
|
:extra-fn extra-fn}
|
||||||
child])
|
child])
|
||||||
|
|
||||||
(defn view
|
(defn view
|
||||||
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
[{:keys [notification set-swipeable-height customization-color] :as props}]
|
||||||
(let [{:keys [author chat-name community-id chat-id
|
(let [{:keys [author chat-name community-id chat-id
|
||||||
message read timestamp album-messages]} notification
|
message read timestamp
|
||||||
community-chat? (not (string/blank? community-id))
|
album-messages]} notification
|
||||||
community (rf/sub [:communities/community community-id])
|
community-chat? (not (string/blank? community-id))
|
||||||
community-name (:name community)
|
community (rf/sub [:communities/community community-id])
|
||||||
community-image (get-in community [:images :thumbnail :uri])
|
community-name (:name community)
|
||||||
media-server-port (rf/sub [:mediaserver/port])]
|
community-image (get-in community [:images :thumbnail :uri])
|
||||||
|
media-server-port (rf/sub [:mediaserver/port])]
|
||||||
[swipeable props
|
[swipeable props
|
||||||
[gesture/touchable-without-feedback
|
[gesture/touchable-without-feedback
|
||||||
{:on-press (fn []
|
{:on-press (fn []
|
||||||
|
|
|
@ -40,29 +40,30 @@
|
||||||
:set-swipeable-height set-swipeable-height
|
:set-swipeable-height set-swipeable-height
|
||||||
:notification notification
|
:notification notification
|
||||||
:extra-fn extra-fn}]
|
:extra-fn extra-fn}]
|
||||||
[rn/view {:style (style/notification-container index)}
|
(rn/delay-render
|
||||||
(cond
|
[rn/view {:style (style/notification-container index)}
|
||||||
(= type types/contact-verification)
|
(cond
|
||||||
[contact-verification/view props]
|
(= type types/contact-verification)
|
||||||
|
[contact-verification/view props]
|
||||||
|
|
||||||
(= type types/contact-request)
|
(= type types/contact-request)
|
||||||
[contact-requests/view props]
|
[contact-requests/view props]
|
||||||
|
|
||||||
(= type types/mention)
|
(= type types/mention)
|
||||||
[mentions/view props]
|
[mentions/view props]
|
||||||
|
|
||||||
(= type types/reply)
|
(= type types/reply)
|
||||||
[reply/view props]
|
[reply/view props]
|
||||||
|
|
||||||
(= type types/admin)
|
(= type types/admin)
|
||||||
[admin/view props]
|
[admin/view props]
|
||||||
|
|
||||||
(some types/membership [type])
|
(some types/membership [type])
|
||||||
(condp = type
|
(condp = type
|
||||||
types/private-group-chat [membership/view props]
|
types/private-group-chat [membership/view props]
|
||||||
types/community-request [community-request/view props]
|
types/community-request [community-request/view props]
|
||||||
types/community-kicked [community-kicked/view props]
|
types/community-kicked [community-kicked/view props]
|
||||||
nil))]))
|
nil))])))
|
||||||
|
|
||||||
(defn- fetch-next-page
|
(defn- fetch-next-page
|
||||||
[]
|
[]
|
||||||
|
|
Loading…
Reference in New Issue