Page MenuHomePhabricator

Export Background Fetch result constants from CommIOSNotifications to JavaScript
ClosedPublic

Authored by marcin on Jan 2 2023, 6:34 AM.
Tags
None
Referenced Files
F3497392: D6139.id21434.diff
Thu, Dec 19, 7:05 PM
Unknown Object (File)
Thu, Dec 19, 3:32 PM
Unknown Object (File)
Wed, Dec 18, 7:21 PM
Unknown Object (File)
Wed, Dec 18, 7:10 PM
Unknown Object (File)
Wed, Dec 18, 7:09 PM
Unknown Object (File)
Wed, Dec 18, 7:00 PM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Subscribers

Details

Summary

This differential implements method in CommIOSNotifications that allows JavaScript to use native string constants that describe background fetch result, without direct hardcoding

Test Plan

Log CommIOSNotifications.getConstants() somwhere in JS and examine its content

Diff Detail

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

Event Timeline

marcin requested review of this revision.Jan 2 2023, 6:49 AM

There is a bug - planning changes until resolved.

Fix bug by introducing RCT_CONVERTER

native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
53 ↗(On Diff #20506)

This is copied (partially) from Ashoats fork: https://github.com/Ashoat/react-native-notifications/blob/master/RNNotifications/RNNotifications.m#L108. It allows to convert particular strings passed from JavaScript to Objective C enum instances. In order not to directly hardcode those strings in JavaScript we export them as constants in constantsToExport method a couple of lines below.

152 ↗(On Diff #20506)
tomek added inline comments.
native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
53 ↗(On Diff #20506)

The code is simple and I don't think we can write something significantly different than in the library.

55 ↗(On Diff #20506)

Shouldn't we indent it?

This revision is now accepted and ready to land.Jan 5 2023, 8:35 AM
native/ios/Comm/CommIOSNotifications/CommIOSNotifications.mm
55 ↗(On Diff #20506)

It was formatted this way by clang-format-all.