From 121170268020bb89426832d82333ab5386813a66 Mon Sep 17 00:00:00 2001 From: ijunaid Date: Thu, 15 Dec 2022 16:53:25 +0500 Subject: [PATCH] iOS production push token fix (#81) * iOS production push token fix * Changelog updated --- CHANGELOG.md | 1 + ios/Classes/CountlyFlutterPlugin.m | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bd747b4d..74d0647b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ ## 22.02.1 * SDK has been internally slightly reworked to support a "no push notification" variant. +* Fixed incorrect iOS push token type when passing "Countly.messagingMode.PRODUCTION" as token type. * Underlying android SDK version is 22.02.1 * Underlying iOS SDK version is 22.06.0 diff --git a/ios/Classes/CountlyFlutterPlugin.m b/ios/Classes/CountlyFlutterPlugin.m index 138583ab..9d74cfca 100644 --- a/ios/Classes/CountlyFlutterPlugin.m +++ b/ios/Classes/CountlyFlutterPlugin.m @@ -18,6 +18,8 @@ + (CountlyFeedbackWidget *)createWithDictionary:(NSDictionary *)dictionary; // #define COUNTLY_EXCLUDE_PUSHNOTIFICATIONS BOOL BUILDING_WITH_PUSH_DISABLED = false; +CLYPushTestMode const CLYPushTestModeProduction = @"CLYPushTestModeProduction"; + NSString* const kCountlyFlutterSDKVersion = @"22.02.1"; NSString* const kCountlyFlutterSDKName = @"dart-flutterb-ios"; NSString* const kCountlyFlutterSDKNameNoPush = @"dart-flutterbnp-ios"; @@ -452,10 +454,13 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { dispatch_async(dispatch_get_main_queue(), ^ { config.sendPushTokenAlways = YES; NSString* tokenType = [command objectAtIndex:0]; + config.pushTestMode = CLYPushTestModeProduction; + if([tokenType isEqualToString: @"1"]){ - config.pushTestMode = @"CLYPushTestModeDevelopment"; - } else { - config.pushTestMode = @"CLYPushTestModeTestFlightOrAdHoc"; + config.pushTestMode = CLYPushTestModeDevelopment; + } + else if([tokenType isEqualToString: @"2"]) { + config.pushTestMode = CLYPushTestModeTestFlightOrAdHoc; } }); #endif