fix: notification center blur (#19861)

This commit is contained in:
codemaster 2024-05-07 06:35:32 -07:00 committed by GitHub
parent 45129b8244
commit be59785a1f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 42 additions and 35 deletions

View File

@ -13,11 +13,11 @@
[legacy.status-im.utils.utils :as utils] [legacy.status-im.utils.utils :as utils]
[re-frame.core :as re-frame] [re-frame.core :as re-frame]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]
[reagent.core :as reagent] [reagent.core :as reagent]
[utils.i18n :as i18n] [utils.i18n :as i18n]
[utils.re-frame :as rf] [utils.re-frame :as rf]))
[react-native.platform :as platform]
[react-native.safe-area :as safe-area]))
(def steps-numbers (def steps-numbers
{:intro 1 {:intro 1

View File

@ -8,6 +8,7 @@
[quo.components.notifications.activity-log.style :as style] [quo.components.notifications.activity-log.style :as style]
[quo.components.tags.status-tags :as status-tags] [quo.components.tags.status-tags :as status-tags]
[quo.foundations.colors :as colors] [quo.foundations.colors :as colors]
[quo.theme]
[react-native.core :as rn] [react-native.core :as rn]
[utils.i18n :as i18n])) [utils.i18n :as i18n]))
@ -144,12 +145,13 @@
label])) label]))
(defmethod footer-item-view :status (defmethod footer-item-view :status
[{:keys [label subtype blur?]} _ _] [{:keys [label subtype blur? theme]} _ _]
[quo.theme/provider theme
[status-tags/status-tag [status-tags/status-tag
{:size :small {:size :small
:label label :label label
:status {:type subtype} :status {:type subtype}
:blur? blur?}]) :blur? blur?}]])
(defn- footer (defn- footer
[{:keys [replying? items] :as props}] [{:keys [replying? items] :as props}]

View File

@ -58,7 +58,7 @@
child))) child)))
(defn- outgoing-contact-request-view (defn- outgoing-contact-request-view
[{:keys [notification set-swipeable-height customization-color]}] [{:keys [notification set-swipeable-height customization-color]} theme]
(let [{:keys [chat-id message last-message accepted]} notification (let [{:keys [chat-id message last-message accepted]} notification
{:keys [contact-request-state] :as message} (or message last-message)] {:keys [contact-request-state] :as message} (or message last-message)]
(if accepted (if accepted
@ -89,19 +89,20 @@
:subtype :pending :subtype :pending
:key :status-pending :key :status-pending
:blur? true :blur? true
:label (i18n/label :t/pending)}] :label (i18n/label :t/pending)
:theme theme}]
constants/contact-request-message-state-declined constants/contact-request-message-state-declined
[{:type :status [{:type :status
:subtype :pending :subtype :pending
:key :status-pending :key :status-pending
:blur? true :blur? true
:label (i18n/label :t/pending)}] :label (i18n/label :t/pending)
:theme theme}]
nil)}]))) nil)}])))
(defn- incoming-contact-request-view (defn- incoming-contact-request-view
[{:keys [notification set-swipeable-height customization-color]}] [{:keys [notification set-swipeable-height customization-color]} theme]
(let [{:keys [id author message last-message]} notification (let [{:keys [id author message last-message]} notification
message (or message last-message)] message (or message last-message)]
[quo/activity-log [quo/activity-log
@ -122,14 +123,16 @@
:subtype :positive :subtype :positive
:key :status-accepted :key :status-accepted
:blur? true :blur? true
:label (i18n/label :t/accepted)}] :label (i18n/label :t/accepted)
:theme theme}]
constants/contact-request-message-state-declined constants/contact-request-message-state-declined
[{:type :status [{:type :status
:subtype :negative :subtype :negative
:key :status-declined :key :status-declined
:blur? true :blur? true
:label (i18n/label :t/declined)}] :label (i18n/label :t/declined)
:theme theme}]
constants/contact-request-message-state-pending constants/contact-request-message-state-pending
[{:type :button [{:type :button
@ -151,18 +154,19 @@
[{:keys [notification] :as props}] [{:keys [notification] :as props}]
(let [{:keys [author message last-message]} notification (let [{:keys [author message last-message]} notification
{:keys [public-key]} (rf/sub [:multiaccount/contact]) {:keys [public-key]} (rf/sub [:multiaccount/contact])
{:keys [contact-request-state]} (or message last-message)] {:keys [contact-request-state]} (or message last-message)
app-theme (rf/sub [:theme])]
[swipeable props [swipeable props
(cond (cond
(= public-key author) (= public-key author)
[outgoing-contact-request-view props] [outgoing-contact-request-view props app-theme]
(= contact-request-state constants/contact-request-message-state-accepted) (= contact-request-state constants/contact-request-message-state-accepted)
[gesture/touchable-without-feedback [gesture/touchable-without-feedback
{:on-press (fn [] {:on-press (fn []
(rf/dispatch [:hide-popover]) (rf/dispatch [:hide-popover])
(rf/dispatch [:chat.ui/start-chat author]))} (rf/dispatch [:chat.ui/start-chat author]))}
[incoming-contact-request-view props]] [incoming-contact-request-view props app-theme]]
:else :else
[incoming-contact-request-view props])])) [incoming-contact-request-view props app-theme])]))

View File

@ -56,5 +56,5 @@
(def blur (def blur
{:style {:position :absolute :top 0 :left 0 :right 0 :bottom 0} {:style {:position :absolute :top 0 :left 0 :right 0 :bottom 0}
:overlayColor colors/neutral-80-opa-80 :overlayColor colors/neutral-80-opa-80-blur
:blur-amount 20}) :blur-amount 20})

View File

@ -1,7 +1,7 @@
(ns status-im.contexts.shell.activity-center.view (ns status-im.contexts.shell.activity-center.view
(:require (:require
[oops.core :as oops] [oops.core :as oops]
[react-native.blur :as blur] [quo.core :as quo]
[react-native.core :as rn] [react-native.core :as rn]
[react-native.navigation :as navigation] [react-native.navigation :as navigation]
[status-im.contexts.shell.activity-center.header.view :as header] [status-im.contexts.shell.activity-center.header.view :as header]
@ -67,8 +67,8 @@
(fn [] (fn []
(let [notifications (rf/sub [:activity-center/notifications]) (let [notifications (rf/sub [:activity-center/notifications])
customization-color (rf/sub [:profile/customization-color])] customization-color (rf/sub [:profile/customization-color])]
[quo/overlay {:type :shell}
[rn/view {:flex 1 :padding-top (navigation/status-bar-height)} [rn/view {:flex 1 :padding-top (navigation/status-bar-height)}
[blur/view style/blur]
[header/header] [header/header]
[rn/flat-list [rn/flat-list
{:data notifications {:data notifications
@ -79,4 +79,5 @@
:key-fn :id :key-fn :id
:on-scroll-to-index-failed identity :on-scroll-to-index-failed identity
:on-end-reached #(rf/dispatch [:activity-center.notifications/fetch-next-page]) :on-end-reached #(rf/dispatch [:activity-center.notifications/fetch-next-page])
:render-fn notification-component}]])))) :render-fn notification-component}]]
]))))