Page MenuHomePhabricator

Export minimal set of CommIOSNotifications RCT methods to use it in AppDelegate
ClosedPublic

Authored by marcin on Dec 28 2022, 6:27 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Nov 12, 12:15 PM
Unknown Object (File)
Tue, Nov 12, 1:22 AM
Unknown Object (File)
Wed, Nov 6, 6:31 AM
Unknown Object (File)
Mon, Nov 4, 4:10 AM
Unknown Object (File)
Mon, Nov 4, 4:08 AM
Unknown Object (File)
Mon, Nov 4, 4:08 AM
Unknown Object (File)
Mon, Nov 4, 4:08 AM
Unknown Object (File)
Mon, Nov 4, 4:05 AM
Subscribers

Details

Summary

In order to correctly use CommIOSNotifications in AppDelegate we must call comsumeBackgroundQueue in ios.js. Therefore this differential exports minimal set of react-native methods that must be called from JavaScript.

Test Plan

build the app.

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

All methods in this differential are copied from Ashoat's fork https://github.com/Ashoat/react-native-notifications/blob/master/RNNotifications/RNNotifications.m. Subtle visual differences are results of applying formatter.

Copy-pasting code requires considering the license of what you're copying. Instead, can you look at the existing code as inspiration and implement something similar, but in your own style?

Copy pasted code will be refactored.

Refactor not to have direct copy pasted methods

Fix race condition in checkPermissions

tomek added inline comments.
native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
293–298
308–309

It feels like a statement jsReady = YES quite obviously means that we're marking the js thread as ready, so I don't think the comment is really useful.

344–346

This is formatted differently that other functions - we usually don't add whitespaces around colons

348

This syntax is inconsistent with the other place in this file

This revision is now accepted and ready to land.Jan 11 2023, 3:54 AM
This revision now requires review to proceed.Jan 11 2023, 3:55 AM

Please address concerns before landing

native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
293–298

Yeah let's avoid this

308–309

Agree

344–346

This makes me suspect that something is wrong with clang-format precommit hooks, which reinforces the concerns I laid out in D6063

348

I personally prefer the dot syntax. @marcin, remember that it's your responsibility to rewrite this code in your own style – that style should be consistent throughout. Using inconsistent style makes me suspect that you're still copy-pasting

This revision is now accepted and ready to land.Jan 11 2023, 8:43 AM
  1. Consequently use dot syntax.
  2. Refactor ugly ternary operator
  3. Remove redundant code.

Nit

native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
268–269 ↗(On Diff #21009)

It would probably be cleaner if you defined this callback before calling requestAuthorizationWithOptions:completionHandler:... that way it wouldn't be so indented, I think