Repository navigation
fix(native): iOS push payload crash, and currency/payload parity across platforms - #523
Merged
Merged
Conversation
Member
Author
|
All commits of this PR reached |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #522 (this branch contains its commits); merge that first.
From the project analysis: places where the same Dart call behaved differently per platform. One of them is an app crash on iOS.
Currency codes (
logPurchase,logProductItem)"dollars"INVALID_ARGUMENT. iOS: logged as is.INVALID_ARGUMENTon both"usd"INVALID_ARGUMENT. iOS: logged asusd.USDThe Android SDK takes a
java.util.Currency, so that handler must reject unknown codes. The iOS SDK takes any string, so the iOS handler now checks against the ISO 4217 list itself (Locale.Currency.isoCurrencieson iOS 16+,Locale.isoCurrencyCodeson iOS 15).Behavior change on iOS: a call with a currency that is not an ISO 4217 code used to be logged and now throws
FacebookAppEventsException(invalidArgument). Worth a line in the release notes.Push payloads (
logPushNotificationOpen)iOS crash on a JSON-string
fb_push_payloadFound while writing integration tests. The iOS SDK does this with the payload, without checking types (
FBSDKAppEvents.m, v19.0.1):Firebase Cloud Messaging delivers data entries as strings, so
fb_push_payloadis normally a JSON string, which is also the form the Android SDK expects. Passing that on iOS subscripts anNSStringand raises an Objective-C exception, which terminates the app. The same happens for acampaignthat is not a string.The iOS handler now parses a string entry into a dictionary, stringifies a numeric
campaign, and drops an entry it cannot bring into shape (the SDK then ignores the notification).Android ignored a map-shaped
fb_push_payloadThe Android SDK reads the entry with
getString, so the nested map an APNs-style payload carries was silently ignored. The Android handler now serializes a map entry to JSON.Android failed on unrelated list values
Android returned
INVALID_ARGUMENTwhen the payload held a value aBundlecannot store, such as a list, while iOS accepted the same payload. The SDK only readsfb_push_payload, so the handler now leaves unsupported values out instead of failing.Verification
Kotlin and Swift are compile-checked by this PR's CI only. None of these changes has run on a device, and the iOS crash itself was found by reading the SDK source, not reproduced. The integration tests in the follow-up PR exercise all of them on an emulator and a simulator.