Skip to content
This repository was archived by the owner on Jul 22, 2026. It is now read-only.

Commit 13959f6

Browse files
authored
feat: Update the enable-notifications flows and notification settings UI (#22524)
This change integrates the Firebase news notifications into the onboarding flow. This change also introduces some changes to the notifications settings screen to match the recent designs and behaviors. Note, that these changes are currently still behind a feature-flag.
1 parent 29f80d2 commit 13959f6

21 files changed

Lines changed: 610 additions & 159 deletions

File tree

ios/GoogleService-Info.plist

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
33
<plist version="1.0">
44
<dict>
5+
<key>CLIENT_ID</key>
6+
<string>854811651919-30s20e3l0me0ins0vc4185jbnj7ja49o.apps.googleusercontent.com</string>
7+
<key>REVERSED_CLIENT_ID</key>
8+
<string>com.googleusercontent.apps.854811651919-30s20e3l0me0ins0vc4185jbnj7ja49o</string>
59
<key>API_KEY</key>
6-
<string>AIzaSyAm5D6giymR_2llh-8SbCRL3oPxX_v3EZs</string>
10+
<string>AIzaSyB_ZCi76uSX1RBqGiLIllUnJ8D6_cKrRGQ</string>
711
<key>GCM_SENDER_ID</key>
812
<string>854811651919</string>
913
<key>PLIST_VERSION</key>

shadow-cljs.edn

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,24 @@
168168
:fn-invoke-direct true
169169
:optimizations :advanced
170170
:js-options {:js-provider :closure}
171-
:reader-features #{:mobile}}}}
171+
:reader-features #{:mobile
172+
;; NOTE(@seanstrom): Here we are allowing for an
173+
;; environment variable to configure the intended store
174+
;; where a user could download the app. For example, we
175+
;; support the FDroid and Google Play stores, so we can
176+
;; configure the app to build for FDroid by setting the
177+
;; `ANDROID_STORE` environment variable to `fdroid`.
178+
;;
179+
;; This value is used for configuring Shadow-CLJS to
180+
;; only require namespaces that will be compatible with
181+
;; some restrictions imposed by the Android stores. For
182+
;; example, FDroid does not allow for Google Play
183+
;; services like Firebase, so we use the
184+
;; reader-conditional of `:fdroid` or `:google` to
185+
;; clearly avoid importing Firebase dependencies in the
186+
;; FDroid builds.
187+
#shadow/env ["ANDROID_STORE" :as :keyword :default
188+
:google]}}}}
172189
;; the tests are ran with node, react-native dependencies are mocked
173190
;; by using node --require override.js, which uses the node-library
174191
;; produced by the target :mocks below and redefines node require

src/legacy/status_im/events.cljs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
(let [new-account? (get db :onboarding/new-account?)
108108
app-in-background-since (get db :app-in-background-since)
109109
signed-up? (get-in db [:profile/profile :signed-up?])
110+
notifications-settings? (= (:view-id db) :screen/settings.notifications)
110111
requires-bio-auth (and
111112
signed-up?
112113
(= (:auth-method db) "biometric")
@@ -121,7 +122,9 @@
121122
#(when-let [chat-id (:current-chat-id db)]
122123
{:dispatch [:chat/mark-all-as-read chat-id]})
123124
#(when requires-bio-auth
124-
{:dispatch [:biometric/authenticate {:on-fail on-biometric-auth-fail}]}))))
125+
{:dispatch [:biometric/authenticate {:on-fail on-biometric-auth-fail}]})
126+
#(when notifications-settings?
127+
{:dispatch [:notifications/check-notifications-blocked]}))))
125128

126129
(rf/defn on-going-in-background
127130
[{:keys [db now]}]

src/react_native/permissions.cljs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(ns react-native.permissions
22
(:require
33
["react-native-permissions" :refer
4-
[check checkNotifications PERMISSIONS requestMultiple
4+
[check checkNotifications openSettings PERMISSIONS requestMultiple
55
requestNotifications RESULTS]]
66
[clojure.string :as string]
77
[promesa.core :as promesa]
@@ -95,3 +95,7 @@
9595
[]
9696
(-> (checkNotifications)
9797
(promesa/then notification-permissions->notification-permission-statuses)))
98+
99+
(defn open-notification-settings
100+
[]
101+
(openSettings "notifications"))
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
(ns status-im.common.kv-storage.effects
2+
(:require
3+
[react-native.mmkv :as mmkv]
4+
[utils.re-frame :as rf]))
5+
6+
(rf/reg-fx :effects.kv/set-object
7+
(fn [{:keys [id value]}]
8+
(mmkv/set-object id value)))
9+
10+
(rf/reg-fx :effects.kv/merge-object
11+
(fn [{key-id :key
12+
:keys [value]}]
13+
(let [kv-object (mmkv/get-object key-id {})]
14+
(mmkv/set-object key-id
15+
(merge kv-object value)))))
16+
17+
(rf/reg-fx :effects.kv/delete-key
18+
(fn [key-id]
19+
(mmkv/delete-key key-id)))

src/status_im/contexts/onboarding/enable_biometrics/view.cljs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,28 @@
2222
[insets]
2323
(let [supported-biometric-type (rf/sub [:biometrics/supported-type])
2424
bio-type-label (biometric/get-label-by-type supported-biometric-type)
25-
profile-color (or (:color (rf/sub [:onboarding/profile]))
25+
onboarding-profile (rf/sub [:onboarding/profile])
26+
profile-color (or (:color onboarding-profile)
2627
(rf/sub [:profile/customization-color]))
27-
syncing? (= (rf/sub [:view-id]) :screen/onboarding.syncing-biometric)
28+
syncing? (:syncing? onboarding-profile)
2829
biometric-type (rf/sub [:biometrics/supported-type])]
2930
[rn/view {:style (style/buttons insets)}
3031
[quo/button
3132
{:size 40
3233
:accessibility-label :enable-biometrics-button
3334
:icon-left (biometric/get-icon-by-type biometric-type)
3435
:customization-color profile-color
35-
:on-press #(rf/dispatch [:onboarding/enable-biometrics])}
36+
:on-press #(rf/dispatch [:onboarding/biometrics-setup-start
37+
{:enable-biometrics? true
38+
:syncing? syncing?}])}
3639
(i18n/label :t/biometric-enable-button {:bio-type-label bio-type-label})]
3740
[quo/button
3841
{:accessibility-label :maybe-later-button
3942
:background :blur
4043
:type :grey
41-
:on-press #(rf/dispatch (if syncing?
42-
[:onboarding/finish-onboarding false]
43-
[:onboarding/create-account-and-login]))
44+
:on-press #(rf/dispatch [:onboarding/biometrics-setup-start
45+
{:enable-biometrics? false
46+
:syncing? syncing?}])
4447
:container-style {:margin-top 12}}
4548
(i18n/label :t/maybe-later)]]))
4649

src/status_im/contexts/onboarding/enable_notifications/style.cljs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,13 @@
2424
[insets]
2525
{:margin default-margin
2626
:margin-bottom (+ 14 (:bottom insets))})
27+
28+
(def news-notifications-checkbox-container
29+
{:flex-direction :row
30+
:gap 8
31+
:padding-top 8
32+
:padding-bottom 12
33+
:padding-horizontal 20})
34+
35+
(def news-notifications-checkbox-text
36+
{:flex 1})
Lines changed: 102 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
11
(ns status-im.contexts.onboarding.enable-notifications.view
22
(:require
3+
[quo.context]
34
[quo.core :as quo]
45
[react-native.core :as rn]
6+
[react-native.platform :as platform]
57
[react-native.safe-area :as safe-area]
68
[status-im.common.resources :as resources]
9+
[status-im.contexts.onboarding.common.background.view :as background]
710
[status-im.contexts.onboarding.enable-notifications.style :as style]
11+
[status-im.feature-flags :as ff]
812
[utils.i18n :as i18n]
913
[utils.re-frame :as rf]))
1014

@@ -17,51 +21,111 @@
1721
:description (i18n/label :t/enable-notifications-sub-title)
1822
:description-accessibility-label :notifications-sub-title}])
1923

20-
(defn enable-notification-buttons
21-
[{:keys [insets]}]
22-
(let [profile-color (rf/sub [:onboarding/customization-color])
23-
ask-permission (fn []
24-
(rf/dispatch
25-
[:request-notifications
26-
{:on-allowed (fn []
27-
(js/setTimeout
28-
#(rf/dispatch [:onboarding/finish-onboarding true])
29-
300))
30-
:on-denied (fn []
31-
(js/setTimeout
32-
#(rf/dispatch [:onboarding/finish-onboarding false])
33-
300))}]))
34-
skip-permission #(rf/dispatch [:onboarding/finish-onboarding false])]
35-
[rn/view {:style (style/buttons insets)}
36-
[quo/button
37-
{:on-press ask-permission
38-
:type :primary
39-
:icon-left :i/notifications
40-
:accessibility-label :enable-notifications-button
41-
:customization-color profile-color}
42-
(i18n/label :t/intro-wizard-title6)]
43-
[quo/button
44-
{:on-press skip-permission
45-
:accessibility-label :enable-notifications-later-button
46-
:type :grey
47-
:background :blur
48-
:container-style {:margin-top 12}}
49-
(i18n/label :t/maybe-later)]]))
24+
(defn on-notifications-setup-start
25+
[params]
26+
(rf/dispatch [:onboarding/notifications-setup-start params]))
5027

51-
(defn enable-notifications-simple
28+
(defn notifications-info-view
29+
[{:keys [blur?]}]
30+
[quo/documentation-drawers
31+
{:title (i18n/label :t/enable-notifications)
32+
:show-button? true
33+
:shell? blur?
34+
:button-label (i18n/label :t/read-more)
35+
:button-icon :i/info}
36+
[quo/text (i18n/label :t/enable-notifications-info-description)]])
37+
38+
(defn on-open-info
39+
[{:keys [blur? theme]
40+
:or {blur? true}}]
41+
(rf/dispatch [:show-bottom-sheet
42+
{:content (fn []
43+
[notifications-info-view {:blur? blur?}])
44+
:theme theme
45+
:shell? blur?}]))
46+
47+
(defn enable-notification-form
48+
[{:keys [insets params]}]
49+
(let [profile-color (rf/sub [:onboarding/customization-color
50+
{:onboarding? (:onboarding? params)}])
51+
[third-party-checked?
52+
set-third-party-checked] (rn/use-state
53+
(boolean? (ff/enabled? ::ff/settings.news-notifications)))
54+
on-enable-notifications (rn/use-callback
55+
(fn []
56+
(on-notifications-setup-start
57+
(assoc params
58+
:enable-notifications? true
59+
:enable-news-notifications? third-party-checked?)))
60+
[params third-party-checked?])
61+
on-skip-notifications (rn/use-callback
62+
(fn []
63+
(on-notifications-setup-start
64+
(assoc params
65+
:enable-notifications? false
66+
:enable-news-notifications? false)))
67+
[params])]
68+
[rn/view
69+
(when (and platform/android?
70+
(ff/enabled? ::ff/settings.news-notifications))
71+
[rn/view
72+
{:style style/news-notifications-checkbox-container}
73+
[quo/selectors
74+
{:type :checkbox
75+
:blur? true
76+
:customization-color profile-color
77+
:checked? third-party-checked?
78+
:on-change set-third-party-checked}]
79+
[quo/text
80+
{:size :paragraph-2
81+
:style style/news-notifications-checkbox-text}
82+
(i18n/label :t/enable-news-notifications-third-party)]])
83+
[rn/view {:style (style/buttons insets)}
84+
[quo/button
85+
{:on-press on-enable-notifications
86+
:type :primary
87+
:icon-left :i/notifications
88+
:accessibility-label :enable-notifications-button
89+
:customization-color profile-color}
90+
(i18n/label :t/intro-wizard-title6)]
91+
[quo/button
92+
{:on-press on-skip-notifications
93+
:accessibility-label :enable-notifications-later-button
94+
:type :grey
95+
:background :blur
96+
:container-style {:margin-top 12}}
97+
(i18n/label :t/maybe-later)]]]))
98+
99+
(defn enable-notifications-illustration
52100
[]
53101
(let [width (:width (rn/get-window))]
54102
[rn/image
55103
{:resize-mode :contain
56104
:style (style/page-illustration width)
57105
:source (resources/get-image :notifications)}]))
58106

107+
(defn background-image
108+
[]
109+
[rn/view {:style rn/stylesheet-absolute-fill}
110+
[background/view true]])
111+
59112
(defn view
60113
[]
61-
(let [insets safe-area/insets]
62-
[rn/view {:style (style/page-container insets)}
63-
[rn/view {:style style/page-heading}
64-
[quo/page-nav {:type :no-title :background :blur}]
65-
[page-title]]
66-
[enable-notifications-simple]
67-
[enable-notification-buttons {:insets insets}]]))
114+
(let [insets safe-area/insets
115+
params (quo.context/use-screen-params)]
116+
[:<>
117+
(when-not (:onboarding? params)
118+
[background-image])
119+
[rn/view {:style (style/page-container insets)}
120+
[rn/view {:style style/page-heading}
121+
[quo/page-nav
122+
{:type :no-title
123+
:background :blur
124+
:right-side [{:icon-name :i/info
125+
:on-press on-open-info
126+
:accessibility-label :notifications-info-button}]}]
127+
[page-title]]
128+
[enable-notifications-illustration]
129+
[enable-notification-form
130+
{:insets insets
131+
:params params}]]]))

0 commit comments

Comments
 (0)