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
F3249227: D6070.id21040.diff
Fri, Nov 15, 12:49 PM
F3249140: D6070.id21419.diff
Fri, Nov 15, 12:27 PM
F3249125: D6070.id21009.diff
Fri, Nov 15, 12:21 PM
F3249122: D6070.id20731.diff
Fri, Nov 15, 12:20 PM
F3249076: D6070.id20220.diff
Fri, Nov 15, 12:17 PM
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
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
Branch
marcin/eng-2334
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 ↗(On Diff #20731)
308–309 ↗(On Diff #20731)

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 ↗(On Diff #20731)

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

348 ↗(On Diff #20731)

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 ↗(On Diff #20731)

Yeah let's avoid this

308–309 ↗(On Diff #20731)

Agree

344–346 ↗(On Diff #20731)

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

348 ↗(On Diff #20731)

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