@@ -20,7 +20,7 @@ import type { LocalizableText } from '../types';
20
20
import { TranslationContext } from '../boot/TranslationProvider' ;
21
21
import { kWarningColor } from '../styles/constants' ;
22
22
import { getIdentities , getIdentity , getIsActiveAccount } from '../account/accountsSelectors' ;
23
- import { getRealmName } from '../directSelectors' ;
23
+ import { getRealm , getRealmName } from '../directSelectors' ;
24
24
import ZulipText from '../common/ZulipText' ;
25
25
import SettingsGroup from './SettingsGroup' ;
26
26
@@ -124,6 +124,7 @@ export default function NotificationsScreen(props: Props): Node {
124
124
getIdentities ( state ) . filter ( identity_ => ! getIsActiveAccount ( state , identity_ ) ) ,
125
125
) ;
126
126
const realmName = useSelector ( getRealmName ) ;
127
+ const pushNotificationsEnabled = useSelector ( state => getRealm ( state ) . pushNotificationsEnabled ) ;
127
128
const offlineNotification = useSelector ( state => getSettings ( state ) . offlineNotification ) ;
128
129
const onlineNotification = useSelector ( state => getSettings ( state ) . onlineNotification ) ;
129
130
const streamNotification = useSelector ( state => getSettings ( state ) . streamNotification ) ;
@@ -213,31 +214,33 @@ export default function NotificationsScreen(props: Props): Node {
213
214
} ) ( ) }
214
215
onPress = { handleSystemSettingsPress }
215
216
/>
216
- < SettingsGroup
217
- title = { {
218
- text : 'Notification settings for this account ({email} in {realmName}):' ,
219
- values : {
220
- email : < ZulipText style = { { fontWeight : 'bold' } } text = { identity . email } /> ,
221
- realmName : < ZulipText style = { { fontWeight : 'bold' } } text = { realmName } /> ,
222
- } ,
223
- } }
224
- >
225
- < SwitchRow
226
- label = "Notifications when offline"
227
- value = { offlineNotification }
228
- onValueChange = { handleOfflineNotificationChange }
229
- />
230
- < SwitchRow
231
- label = "Notifications when online"
232
- value = { onlineNotification }
233
- onValueChange = { handleOnlineNotificationChange }
234
- />
235
- < SwitchRow
236
- label = "Stream notifications"
237
- value = { streamNotification }
238
- onValueChange = { handleStreamNotificationChange }
239
- />
240
- </ SettingsGroup >
217
+ { pushNotificationsEnabled && (
218
+ < SettingsGroup
219
+ title = { {
220
+ text : 'Notification settings for this account ({email} in {realmName}):' ,
221
+ values : {
222
+ email : < ZulipText style = { { fontWeight : 'bold' } } text = { identity . email } /> ,
223
+ realmName : < ZulipText style = { { fontWeight : 'bold' } } text = { realmName } /> ,
224
+ } ,
225
+ } }
226
+ >
227
+ < SwitchRow
228
+ label = "Notifications when offline"
229
+ value = { offlineNotification }
230
+ onValueChange = { handleOfflineNotificationChange }
231
+ />
232
+ < SwitchRow
233
+ label = "Notifications when online"
234
+ value = { onlineNotification }
235
+ onValueChange = { handleOnlineNotificationChange }
236
+ />
237
+ < SwitchRow
238
+ label = "Stream notifications"
239
+ value = { streamNotification }
240
+ onValueChange = { handleStreamNotificationChange }
241
+ />
242
+ </ SettingsGroup >
243
+ ) }
241
244
{ otherAccounts . length > 0 && (
242
245
< NestedNavRow title = "Other accounts" onPress = { handleOtherAccountsPress } />
243
246
) }
0 commit comments