Skip to content

Commit a20ff13

Browse files
committed
fix: address Copilot review on PR #487
- iOS: use setPushNotificationsDeviceTokenString for the String token overload (setPushNotificationsDeviceToken takes Data and would fail to compile), matching the documented Dart->iOS mapping. - Dart: add the currency parameter to logSpentCredits so the dartdoc [currency] reference resolves and the ROAS event mirrors logDonate; cover it in the existing test. https://claude.ai/code/session_011RbXF3u6F2j1NmjJ5jhUkN
1 parent 59d7dcb commit a20ff13

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

ios/facebook_app_events/Sources/facebook_app_events/FacebookAppEventsPlugin.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ public class FacebookAppEventsPlugin: NSObject, FlutterPlugin {
326326
result(FlutterError(code: "INVALID_ARGUMENT", message: "Push notification token is required", details: nil))
327327
return
328328
}
329-
AppEvents.shared.setPushNotificationsDeviceToken(token)
329+
AppEvents.shared.setPushNotificationsDeviceTokenString(token)
330330
result(nil)
331331
}
332332

lib/src/standard_events.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ extension StandardEventLogging on FacebookAppEvents {
7676
/// [valueToSum] (the credits value) and [currency].
7777
Future<void> logSpentCredits({
7878
double? valueToSum,
79+
String? currency,
7980
String? contentType,
8081
String? contentId,
8182
Map<String, dynamic>? parameters,
@@ -85,6 +86,7 @@ extension StandardEventLogging on FacebookAppEvents {
8586
valueToSum: valueToSum,
8687
parameters: {
8788
if (parameters != null) ...parameters,
89+
if (currency != null) FacebookAppEvents.paramNameCurrency: currency,
8890
if (contentType != null)
8991
FacebookAppEvents.paramNameContentType: contentType,
9092
if (contentId != null) FacebookAppEvents.paramNameContentId: contentId,

test/facebook_app_events_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,7 @@ void main() {
739739
test('logSpentCredits forwards valueToSum and content', () async {
740740
await facebookAppEvents.logSpentCredits(
741741
valueToSum: 100.0,
742+
currency: 'USD',
742743
contentType: 'coins',
743744
contentId: 'pack-1',
744745
);
@@ -750,6 +751,7 @@ void main() {
750751
arguments: <String, dynamic>{
751752
'name': 'fb_mobile_spent_credits',
752753
'parameters': <String, dynamic>{
754+
'fb_currency': 'USD',
753755
'fb_content_type': 'coins',
754756
'fb_content_id': 'pack-1',
755757
},

0 commit comments

Comments
 (0)