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
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:15 AM
Unknown Object (File)
Sat, Dec 14, 4:14 AM
Unknown Object (File)
Sat, Dec 14, 4:07 AM
Unknown Object (File)
Sun, Dec 1, 3:41 PM
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
Lint
Lint Not Applicable
Unit
Tests Not Applicable

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.