Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3509228
D7125.id24279.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7125.id24279.diff
View Options
diff --git a/native/chat/settings/thread-settings-push-notifs.react.js b/native/chat/settings/thread-settings-push-notifs.react.js
--- a/native/chat/settings/thread-settings-push-notifs.react.js
+++ b/native/chat/settings/thread-settings-push-notifs.react.js
@@ -22,6 +22,7 @@
import { SingleLine } from '../../components/single-line.react.js';
import SWMansionIcon from '../../components/swmansion-icon.react.js';
+import { CommAndroidNotifications } from '../../push/android.js';
import { useSelector } from '../../redux/redux-utils.js';
import { useStyles } from '../../themes/colors.js';
@@ -95,22 +96,36 @@
);
};
- onNotificationsSettingsLinkingIconPress = () => {
- const alertTitle =
+ onNotificationsSettingsLinkingIconPress = async () => {
+ let platformRequestsPermission;
+ if (Platform.OS !== 'android') {
+ platformRequestsPermission = true;
+ } else {
+ platformRequestsPermission =
+ await CommAndroidNotifications.canRequestNotificationsPermissionFromUser();
+ }
+
+ const alertTitle = platformRequestsPermission
+ ? 'Need notif permissions'
+ : 'Unable to initialize notifs';
+ const notificationsSettingsPath =
Platform.OS === 'ios'
- ? 'Need notif permissions'
- : 'Unable to initialize notifs';
+ ? 'Settings App → Notifications → Comm'
+ : 'Settings → Apps → Comm → Notifications';
+
let alertMessage;
- if (Platform.OS === 'ios' && this.state.currentValue) {
+ if (platformRequestsPermission && this.state.currentValue) {
alertMessage =
'Notifs for this chat are enabled, but cannot be delivered ' +
'to this device because you haven’t granted notif permissions to Comm. ' +
- 'Please enable them in Settings App → Notifications → Comm';
- } else if (Platform.OS === 'ios') {
+ 'Please enable them in ' +
+ notificationsSettingsPath;
+ } else if (platformRequestsPermission) {
alertMessage =
'In order to enable push notifs for this chat, ' +
'you need to first grant notif permissions to Comm. ' +
- 'Please enable them in Settings App → Notifications → Comm';
+ 'Please enable them in ' +
+ notificationsSettingsPath;
} else {
alertMessage =
'Please check your network connection, make sure Google Play ' +
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 22, 2:42 AM (17 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2690126
Default Alt Text
D7125.id24279.diff (2 KB)
Attached To
Mode
D7125: Use new notifications permission API to modify push notifs settings alerts on Android 13
Attached
Detach File
Event Timeline
Log In to Comment