Page MenuHomePhabricator

Implement native method to check for notifications permissions and use it in JavaScript
ClosedPublic

Authored by marcin on Jan 25 2023, 1:18 AM.
Tags
None
Referenced Files
F3487500: D6380.id21295.diff
Wed, Dec 18, 8:14 AM
F3486807: D6380.diff
Wed, Dec 18, 5:59 AM
Unknown Object (File)
Nov 8 2024, 3:04 AM
Unknown Object (File)
Nov 8 2024, 3:04 AM
Unknown Object (File)
Nov 8 2024, 3:03 AM
Unknown Object (File)
Nov 8 2024, 3:03 AM
Unknown Object (File)
Nov 8 2024, 3:03 AM
Unknown Object (File)
Nov 8 2024, 3:03 AM
Subscribers

Details

Summary

This differential implements native method to check for notifications permissions and uses it in JavaScript. Relevant types are updated as well.

Test Plan

Build the app and open it. Open settings and revoke comm notifications permissions. Go back to app and ensure that "Failed to register push notifs" message is displayed and no notifications
are delivered. Close the app. Go back to settings, bring notifications permissions back. Open the app, ensure that previous message is not displayed and notifications are succesfully delivered.

Diff Detail

Repository
rCOMM Comm
Branch
marcin/eng-2501
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

Harbormaster returned this revision to the author for changes because remote builds failed.Jan 25 2023, 1:18 AM
Harbormaster failed remote builds in B15619: Diff 21293!
tomek added inline comments.
native/android/app/src/main/java/app/comm/android/notifications/CommAndroidNotifications.java
99 ↗(On Diff #21295)

A Boolean has three values: Boolean.FALSE, Boolean.TRUE, null. What happens when we call promise.resolve(null)? Is it transformed to js boolean as false? If that's not the case, we can convert Boolean to boolean on java side using Boolean.TRUE.equals(...).

This revision is now accepted and ready to land.Jan 26 2023, 3:06 AM
native/android/app/src/main/java/app/comm/android/notifications/CommAndroidNotifications.java
99 ↗(On Diff #21295)

According to docs of this method: https://developer.android.com/reference/androidx/core/app/NotificationManagerCompat#areNotificationsEnabled() it returns primitive type boolean. Assigning it to class type Boolean works but it is my silly mistake to do it this way. I will change type to boolean here.