diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d16b0a..c2bdeb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 7.0.0 +- This version merges the functionality of Responsys, CX Core and CX Analytics SDKs. +IMPORTANT: Please check the Upgrade documentation on how to integrate this new version + + ## 6.56.7 - Location Support is removed in iOS diff --git a/README.md b/README.md index bc2cd5a..880c01d 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ This plugin makes it easy to integrate the Responsys Mobile SDK with your Flutte - [Setup](#setup) * [For Android](#for-android-1) * [For iOS](#for-ios-1) + * [Location SDK](#location-sdk) - [Installation](#installation) - [Integration](#integration) * [For Android](#for-android-2) @@ -25,6 +26,7 @@ This plugin makes it easy to integrate the Responsys Mobile SDK with your Flutte - [Support](#support) - [License](#license) +
## Requirements @@ -36,10 +38,14 @@ This plugin makes it easy to integrate the Responsys Mobile SDK with your Flutte ### For iOS - iOS 12 or later +
+ ## Setup Before installing the plugin, you must setup your app to receive push notifications. +
+ ### For Android - [Get FCM Credentials](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/android/fcm-credentials.htm) - Log in to the [Responsys Mobile App Developer Console](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/dev-console/login/) and enter your FCM credentials (Project ID and Server API Key) for your Android app. @@ -50,7 +56,10 @@ Before installing the plugin, you must setup your app to receive push notificati ```gradle configurations.maybeCreate("default") - artifacts.add("default", file('PushIOManager-6.56.3.aar')) + artifacts.add("default", file('oracle-cx-mobile-base-7.0.1.aar')) + + //Optional + //artifacts.add("default", file('oracle-cx-mobile-location-7.0.0.aar')) ``` - Add the following to your project-wide `settings.gradle` file: @@ -59,17 +68,73 @@ Before installing the plugin, you must setup your app to receive push notificati include ':PushIOManager' project(':PushIOManager').projectDir = new File(rootProject.projectDir, './PushIOManager') ``` - +
### For iOS - [Generate Auth Key](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/auth-key/) - Log in to the [Responsys Mobile App Developer Console](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/dev-console/login/) and enter your Auth Key and other details for your iOS app. - Download the `pushio_config.json` file generated from your credentials. - Download the SDK binary from [here](https://www.oracle.com/downloads/applications/cx/responsys-mobile-sdk.html). -- After adding the plugin in your app, copy `PushIOManager.xcframework` and place it in the plugin ios directory - `pushiomanager-flutter/ios/`. -- Run `pod install` in the `your_app_directory/ios/` directory, after adding the plugin in to your app and copying `PushIOManager.xcframework` in `pushiomanager-flutter/ios/` directory. +- After adding the plugin in your app, copy `CX_Mobile_SDK.xcframework` and place it in the plugin ios directory - `pushiomanager-flutter/ios/`. Make sure to remove the `PushIOManager.xcframework` if previously copied to this path + ![framework Image](./img/ios_framework.png "framework Image") +- Run `pod install` in the `your_app_directory/ios/` directory. + + + +#### Location SDK + +Now the Location APIs are part of `OracleCXLocationSDK.xcframework`. If app developer need to track the location info only then app need to include the location API in the app and then follow the App Store guideline. + +##### Setup + - After adding the plugin in your app, copy `OracleCXLocationSDK.xcframework` and place it in the plugin ios directory - `pushiomanager-flutter/ios/`. + - App Developers need to update authorization level of access for Location authorization request. add related Privacy Location descriptiions in Info.plist of xcode project, refer this for more info [Location Descriptions](https://developer.apple.com/documentation/corelocation/requesting-authorization-to-use-location-services#Provide-descriptions-of-how-you-use-location-services) + + + ```xml + NSLocationAlwaysUsageDescription + Add description for background location usage + NSLocationWhenInUseUsageDescription + Add description for foreground only location usage. +``` + +- The flutter `permission_handler` plugin use macros to control whether a permission is enabled. App Developers must list the permission want to use in application. refer this for more information [permission_handler](https://pub.dev/packages/permission_handler) + * Add the following to your Podfile file: + + + ```text + post_install do |installer| + installer.pods_project.targets.each do |target| + flutter_additional_ios_build_settings(target) + target.build_configurations.each do |config| + ## You can remove unused permissions here + ## for more information: https://github.com/BaseflowIT/flutter-permission-handler/blob/master/permission_handler/ios/Classes/PermissionHandlerEnums.h + + config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= [ + '$(inherited)', + + ## The 'PERMISSION_LOCATION' macro enables the `locationWhenInUse` and `locationAlways` permission. If + ## the application only requires `locationWhenInUse`, only specify the `PERMISSION_LOCATION_WHENINUSE` + ## macro. + ## + ## dart: [PermissionGroup.location, PermissionGroup.locationAlways, PermissionGroup.locationWhenInUse] + 'PERMISSION_LOCATION=1', + 'PERMISSION_LOCATION_WHENINUSE=0' + ] + end + end + end + ``` + + + +- In iOS, the registration API accept boolean input for Location. refer [Configure And Register](#configure-and-register) for Register API implementation. + * true - `OracleCXLocationSDK.xcframework` request for Location authorization and Location permission popup will be displayed to user. + * false - SDK will not use Location and Location pop will not be displayed to user. + +
+ ## Installation Add the following dependency to your `pubspec.yaml`, @@ -214,11 +279,15 @@ import 'package:pushiomanager_flutter/pushiomanager_flutter.dart'; .catchError((error) => print("Registration error: $error")); } else if (Platform.isIOS) { PushIOManager.registerForAllRemoteNotificationTypes().then((_) => { - PushIOManager.registerApp() + PushIOManager.registerApp(useLocation: true) }).then((_) => print("Registration Successful")) .catchError((error) => print("Registration error: $error")); } ``` + - For iOS Register API, registerApp will have boolean input which will used to pass Location Attributes in Registration Payload, + * true - SDK will use Core Location and Location permission popup will be displayed to user only if `OracleCXLocationSDK.xcframework` copied to ios folder. + * false - SDK will not use Location and Location pop will not be displayed to user. + ### User Identification @@ -260,16 +329,22 @@ IAM can also be displayed on-demand using custom triggers. PushIOManager.trackEvent("custom_event_name"); ``` +#### For iOS + +These below steps are required for iOS In-App Messages. + + * To Enable Custom URI scheme for displaying In-App Messages and Rich Push content follow the [Step 1](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm). + You can find the API key in the `pushio_config.json` that was placed in your Xcode project earlier during setup. + + * Follow [Step 2](https://docs.oracle.com/en/cloud/saas/marketing/responsys-develop-mobile/ios/in-app-msg.htm) to add the required capabilities in your Xcode project for In-App messages. ### Message Center - Get the Message Center messages list using, -``` -Each Message Center message now supports an additional property called custom key-value pairs, it is a variable sized object with key value pairs and can be accessed like any other property of that message. -``` +Each Message Center message now supports an additional property called custom key-value pairs, it is a variable sized object with key value pairs and can be accessed like any other property of that message. - ```dart +```dart PushIOManager.fetchMessagesForMessageCenter("Primary") .then((messages) => { // messages is a list of MessageCenterMessage @@ -280,7 +355,7 @@ Each Message Center message now supports an additional property called custom ke } } ); - ``` +``` - To get the message content call, @@ -307,6 +382,24 @@ PushIOManager.onGeoRegionEntered(region) "$response['regionType'] with ID - $response['regionID'] successfully reported")) .catchError((error) => print("Unable to report \$GEOFENCE_ENTRY event: $error")); + +PushIOManager.onGeoRegionExited(region) + .then((response) => print( + "$response['regionType'] with ID - $response['regionID'] successfully reported")) + .catchError((error) => + print("Unable to report \$onGeoRegionExited event: $error")); + +PushIOManager.onBeaconRegionEntered(region) + .then((response) => print( + "$response['regionType'] with ID - $response['regionID'] successfully reported")) + .catchError((error) => + print("Unable to report \$onBeaconRegionEntered event: $error")); + +PushIOManager.onBeaconRegionExited(region) + .then((response) => print( + "$response['regionType'] with ID - $response['regionID'] successfully reported")) + .catchError((error) => + print("Unable to report \$onBeaconRegionExited event: $error")); ``` @@ -408,6 +501,6 @@ Please consult the [security guide](./SECURITY.md) for our responsible security ## License -Copyright (c) 2023 Oracle and/or its affiliates. +Copyright (c) 2024 Oracle and/or its affiliates. Released under the Universal Permissive License v1.0 as shown at . diff --git a/android/build.gradle b/android/build.gradle index 2846581..d17fde2 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -2,7 +2,7 @@ // Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl. group 'com.pushio.manager.flutter' -version '6.56.7' +version '7.0.0' buildscript { repositories { @@ -27,6 +27,7 @@ apply plugin: 'com.android.library' dependencies { compileOnly 'com.google.firebase:firebase-messaging:18.0.0' implementation project(":PushIOManager") + implementation "androidx.work:work-runtime:2.9.0" implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0' implementation 'com.android.support:support-annotations:28.0.0' implementation 'org.jetbrains:annotations:15.0' @@ -38,10 +39,10 @@ android { namespace 'com.pushio.manager.flutter' } - compileSdkVersion 31 + compileSdkVersion 34 defaultConfig { minSdkVersion 21 - targetSdkVersion 31 + targetSdkVersion 34 } } diff --git a/android/src/main/java/com/pushio/manager/flutter/PIOUtils.java b/android/src/main/java/com/pushio/manager/flutter/PIOUtils.java index 0fa3540..d5327f7 100644 --- a/android/src/main/java/com/pushio/manager/flutter/PIOUtils.java +++ b/android/src/main/java/com/pushio/manager/flutter/PIOUtils.java @@ -98,6 +98,7 @@ static List> messageCenterMessagesAsList(List=2.14.0 <3.0.0' diff --git a/img/ios_framework.png b/img/ios_framework.png index 7fb30f2..b5ffec1 100644 Binary files a/img/ios_framework.png and b/img/ios_framework.png differ diff --git a/ios/.gitignore b/ios/.gitignore index aa479fd..3cf4841 100644 --- a/ios/.gitignore +++ b/ios/.gitignore @@ -34,4 +34,13 @@ Icon? .tags* /Flutter/Generated.xcconfig -/Flutter/flutter_export_environment.sh \ No newline at end of file +/Flutter/flutter_export_environment.sh + +PushIOManager.xcframework +PushIOManager.xcframework/* + +CX_Mobile_SDK.xcframework +CX_Mobile_SDK.xcframework/* + +OracleCXLocationSDK.xcframework +OracleCXLocationSDK.xcframework/* \ No newline at end of file diff --git a/ios/Classes/NSArray+PIOConvert.m b/ios/Classes/NSArray+PIOConvert.m index bdc02eb..4b7a237 100644 --- a/ios/Classes/NSArray+PIOConvert.m +++ b/ios/Classes/NSArray+PIOConvert.m @@ -7,7 +7,7 @@ #import "NSArray+PIOConvert.h" #import "NSDictionary+PIOConvert.h" -#import +#import @implementation NSArray (PIOConvert) - (NSArray *)messageDictionary { diff --git a/ios/Classes/NSDictionary+PIOConvert.h b/ios/Classes/NSDictionary+PIOConvert.h index 1957255..9a3f382 100644 --- a/ios/Classes/NSDictionary+PIOConvert.h +++ b/ios/Classes/NSDictionary+PIOConvert.h @@ -6,7 +6,7 @@ #import -#import +#import #import NS_ASSUME_NONNULL_BEGIN @@ -17,6 +17,8 @@ NS_ASSUME_NONNULL_BEGIN - (UIButton *)customCloseButton; + (NSDictionary *)dictionaryFromPreference:(PIOPreference *)preference; - (NSString *)JSON; +- (PIOGeoRegion *)geoRegion; +- (PIOBeaconRegion *)beaconRegion; @end NS_ASSUME_NONNULL_END diff --git a/ios/Classes/NSDictionary+PIOConvert.m b/ios/Classes/NSDictionary+PIOConvert.m index e09c343..d08a297 100644 --- a/ios/Classes/NSDictionary+PIOConvert.m +++ b/ios/Classes/NSDictionary+PIOConvert.m @@ -159,4 +159,42 @@ - (CGFloat) colorComponentFrom: (NSString *) string start: (NSUInteger) start le return hexComponent / 255.0; } +- (PIOGeoRegion *)geoRegion { + NSString *geofenceId = self[@"geofenceId" ]; + NSString *geofenceName = self[@"geofenceName" ]; + double speed = [(NSString *)self[@"speed"] doubleValue]; + double bearing = [(NSString *)self[@"bearing"] doubleValue]; + NSString *zoneId = self[@"zoneId"]; + NSString *zoneName = self[@"zoneName"]; + NSString *source = self[@"source"]; + NSInteger dwellTime = [(NSString *)self[@"dwellTime"] integerValue]; + NSDictionary *extra = self[@"extra"]; + + PIOGeoRegion *geoRegion = [[PIOGeoRegion alloc] initWithGeofenceId:geofenceId geofenceName:geofenceName speed:speed bearing:bearing source:source zoneId:zoneId zoneName:zoneName dwellTime:dwellTime extra:extra]; + + return geoRegion; +} + +- (PIOBeaconRegion *)beaconRegion { + NSString *iBeaconUUID = self[@"iBeaconUUID"]; + NSInteger iBeaconMajor = [(NSString *)self[@"iBeaconMajor"] integerValue]; + NSInteger iBeaconMinor = [(NSString *)self[@"iBeaconMinor"] integerValue]; + NSString *beaconId = self[@"beaconId"]; + NSString *beaconName = self[@"beaconName"]; + NSString *beaconTag = self[@"beaconTag"]; + NSString *proximity = self[@"proximity"]; + NSString *zoneId = self[@"zoneId"]; + NSString *zoneName = self[@"zoneName"]; + NSString *source = self[@"source" ]; + NSInteger dwellTime = [(NSString *) self[@"dwellTime" ] integerValue]; + NSDictionary *extra = self[@"extra"]; + NSString *eddyStoneId1 = self[@"eddyStoneId1"]; + NSString *eddyStoneId2 = self[@"eddyStoneId2"]; + PIOBeaconRegion *beaconRegion = [[PIOBeaconRegion alloc] initWithiBeaconUUID:iBeaconUUID iBeaconMajor:iBeaconMajor iBeaconMinor:iBeaconMinor beaconId:beaconId beaconName:beaconName beaconTag:beaconTag proximity:proximity source:source zoneId:zoneId zoneName:zoneName dwellTime:dwellTime extra:extra]; + beaconRegion.eddyStoneId1 = eddyStoneId1; + beaconRegion.eddyStoneId2 = eddyStoneId2; + + return beaconRegion; +} + @end diff --git a/ios/Classes/PushIOManagerFlutterPlugin.m b/ios/Classes/PushIOManagerFlutterPlugin.m index b6c757e..e859312 100644 --- a/ios/Classes/PushIOManagerFlutterPlugin.m +++ b/ios/Classes/PushIOManagerFlutterPlugin.m @@ -5,7 +5,8 @@ */ #import "PushIOManagerFlutterPlugin.h" -#import +#import +#import #import "NSDictionary+PIOConvert.h" #import "NSArray+PIOConvert.h" #import @@ -22,6 +23,10 @@ + (instancetype)sharedInstance { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedInstance = [PushIOManagerFlutterPlugin new]; + + ORACoreConfig *config = [[ORACoreConfig alloc] init]; + [config setConfigValue:@"rsys" forKey:kORAModules]; + [sharedInstance setUpDeeplinkHandler]; }); return sharedInstance; @@ -209,6 +214,14 @@ - (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result { [self isStatusBarHiddenForIAMBannerInterstitial:call withResult:result]; }else if ([@"setInAppCustomCloseButton" isEqualToString:call.method]) { [self setInAppCustomCloseButton:call withResult:result]; + } else if ([@"onGeoRegionEntered" isEqualToString:call.method]) { + [self didEnterGeoRegion:call withResult:result]; + } else if ([@"onGeoRegionExited" isEqualToString:call.method]) { + [self didExitGeoRegion:call withResult:result]; + } else if ([@"onBeaconRegionEntered" isEqualToString:call.method]) { + [self didEnterBeaconRegion:call withResult:result]; + } else if ([@"onBeaconRegionExited" isEqualToString:call.method]) { + [self didExitBeaconRegion:call withResult:result]; } else { result(FlutterMethodNotImplemented); @@ -232,7 +245,10 @@ -(void)isDelayRegistration:(FlutterMethodCall *)call withResult:(FlutterResult)r - (void)registerApp:(FlutterMethodCall *)call withResult:(FlutterResult)result { NSError *error; - [[PushIOManager sharedInstance] registerApp:&error completionHandler:^(NSError *error, NSString *response) { + BOOL useLocation = (BOOL) call.arguments; + + + [[PushIOManager sharedInstance] registerApp:&error useLocation:useLocation completionHandler:^(NSError *error, NSString *response) { [self sendPluginResult:result withResponse:response andError:error]; }]; } @@ -318,6 +334,9 @@ - (void)configureAndRegister:(FlutterMethodCall *)call withResult:(FlutterResult if (filename == (id)[NSNull null]) { filename = nil; } + + BOOL useLocation = call.arguments[@"userLocation"]; + NSLog(@"configureWithFilename %@", filename); [[PushIOManager sharedInstance] configureWithFileName:filename completionHandler:^(NSError *configError, NSString *response) { @@ -336,7 +355,7 @@ - (void)configureAndRegister:(FlutterMethodCall *)call withResult:(FlutterResult //6. Register application with Responsys server. This API is responsible to send registration signal to Responsys server. This API sends all the values configured on SDK to server. NSError *regTrackError = nil; - [[PushIOManager sharedInstance] registerApp:®TrackError completionHandler:^(NSError *regAppError, NSString *response) { + [[PushIOManager sharedInstance] registerApp:®TrackError useLocation:useLocation completionHandler:^(NSError *regAppError, NSString *response) { if (nil == regAppError) { NSLog(@"Application registered successfully!"); } else { @@ -1061,6 +1080,102 @@ -(void)onMessageCenterUpdate:(NSNotification *)notification { } } +-(void)didEnterGeoRegion:(FlutterMethodCall *)call withResult:(FlutterResult)result { + + id value = call.arguments; + if (value == (id)[NSNull null]) { + value = nil; + } + PIOGeoRegion *region = [(NSDictionary *)value geoRegion]; + + [[PushIOManager sharedInstance] didEnterGeoRegion:region completionHandler:^(NSError * _Nullable error, NSString * _Nullable response) { + if(error == nil) { + + NSMutableDictionary *responseDictionary = [NSMutableDictionary dictionary]; + responseDictionary[@"regionType"] = @"GEOFENCE_ENTRY"; + responseDictionary[@"regionID"] = region.geofenceId; + + result(responseDictionary); + + } else { + [self sendPluginResult:result withResponse:region.geofenceId andError:error]; + } + + + }]; +} + +-(void)didExitGeoRegion:(FlutterMethodCall *)call withResult:(FlutterResult)result { + + id value = call.arguments; + if (value == (id)[NSNull null]) { + value = nil; + } + PIOGeoRegion *region = [(NSDictionary *)value geoRegion]; + + [[PushIOManager sharedInstance] didExitGeoRegion:region completionHandler:^(NSError * _Nullable error, NSString * _Nullable response) { + + if(error == nil) { + NSMutableDictionary *responseDictionary = [NSMutableDictionary dictionary]; + responseDictionary[@"regionType"] = @"GEOFENCE_EXIT"; + responseDictionary[@"regionID"] = region.geofenceId; + result(responseDictionary); + } else { + + [self sendPluginResult:result withResponse:region.geofenceId andError:error]; + } + + }]; +} + +-(void)didEnterBeaconRegion:(FlutterMethodCall *)call withResult:(FlutterResult)result { + + id value = call.arguments; + if (value == (id)[NSNull null]) { + value = nil; + } + PIOBeaconRegion* region = [(NSDictionary *)value beaconRegion]; + + + + [[PushIOManager sharedInstance] didEnterBeaconRegion:region completionHandler:^(NSError * _Nullable error, NSString * _Nullable response) { + if(error == nil) { + + NSMutableDictionary *responseDictionary = [NSMutableDictionary dictionary]; + responseDictionary[@"regionType"] = @"BEACON_ENTRY"; + responseDictionary[@"regionID"] = region.beaconId; + result(responseDictionary); + + } else { + [self sendPluginResult:result withResponse:region.beaconId andError:error]; + } + + }]; +} + + +-(void)didExitBeaconRegion:(FlutterMethodCall *)call withResult:(FlutterResult)result { + + id value = call.arguments; + if (value == (id)[NSNull null]) { + value = nil; + } + PIOBeaconRegion* region = [(NSDictionary *)value beaconRegion]; + + [[PushIOManager sharedInstance] didExitBeaconRegion:region completionHandler:^(NSError * _Nullable error, NSString * _Nullable response) { + if(error == nil) { + NSMutableDictionary *responseDictionary = [NSMutableDictionary dictionary]; + responseDictionary[@"regionType"] = @"BEACON_EXIT"; + responseDictionary[@"regionID"] = region.beaconId; + result(responseDictionary); + } else { + [self sendPluginResult:result withResponse:region.beaconId andError:error]; + } + + }]; +} + + @end diff --git a/ios/pushiomanager_flutter.podspec b/ios/pushiomanager_flutter.podspec index 956c0f3..478a238 100644 --- a/ios/pushiomanager_flutter.podspec +++ b/ios/pushiomanager_flutter.podspec @@ -6,7 +6,7 @@ Pod::Spec.new do |s| s.name = 'pushiomanager_flutter' - s.version = '6.56.7' + s.version = '7.0.0' s.summary = 'Flutter Plugin for Responsys Mobile SDK' s.description = 'Flutter Plugin for Responsys Mobile SDK' s.homepage = 'https://github.com/oracle-samples/pushiomanager-flutter' @@ -17,12 +17,12 @@ Pod::Spec.new do |s| s.public_header_files = 'Classes/**/*.h' s.dependency 'Flutter' s.platform = :ios, '12.0' - s.preserve_paths = 'PushIOManager.xcframework' - s.xcconfig = { 'OTHER_LDFLAGS' => '-framework PushIOManager -ObjC' } - s.vendored_frameworks = 'PushIOManager.xcframework' - s.preserve_paths = "PushIOManager.xcframework/**/*" + s.preserve_paths = 'CX_Mobile_SDK.xcframework' + s.xcconfig = { 'OTHER_LDFLAGS' => '-framework CX_Mobile_SDK -ObjC' } + s.vendored_frameworks = 'CX_Mobile_SDK.xcframework','OracleCXLocationSDK.xcframework' + s.preserve_paths = "CX_Mobile_SDK.xcframework/**/*","OracleCXLocationSDK.xcframework/**/*" s.libraries = 'sqlite3' - s.frameworks = 'UserNotifications', 'CoreLocation', 'Foundation', 'UIKit' + s.frameworks = 'UserNotifications', 'Foundation', 'UIKit' s.ios.frameworks = 'WebKit' # Flutter.framework does not contain a i386 slice. diff --git a/lib/pushiomanager_flutter.dart b/lib/pushiomanager_flutter.dart index 0f1ade9..4e1177f 100644 --- a/lib/pushiomanager_flutter.dart +++ b/lib/pushiomanager_flutter.dart @@ -6,18 +6,18 @@ library pushiomanager_flutter; import 'dart:async'; -import 'dart:io'; import 'dart:convert'; +import 'dart:io'; import 'package:flutter/services.dart'; import 'package:pushiomanager_flutter/beacon_region.dart'; import 'package:pushiomanager_flutter/conversion_event.dart'; +import 'package:pushiomanager_flutter/custom_close_button.dart'; import 'package:pushiomanager_flutter/geo_region.dart'; import 'package:pushiomanager_flutter/interactive_notification.dart'; import 'package:pushiomanager_flutter/messagecenter_message.dart'; import 'package:pushiomanager_flutter/preference.dart'; import 'package:pushiomanager_flutter/utils.dart'; -import 'package:pushiomanager_flutter/custom_close_button.dart'; typedef void NotificationDeepLinkHandler(String? url); @@ -165,6 +165,7 @@ class PushIOManager { String messageCenter) async { List? messages = await _channel.invokeMethod( 'fetchMessagesForMessageCenter', messageCenter); + if (messages == null) return null; return messages.map((dynamic payload) { @@ -479,45 +480,29 @@ class PushIOManager { static Future> onGeoRegionEntered( GeoRegion region) async { - if (Platform.isAndroid) { - Map response = - await _channel.invokeMethod('onGeoRegionEntered', region.toJson()); - return response.cast(); - } else { - throw PlatformException(code: "API not supported"); - } + Map response = + await _channel.invokeMethod('onGeoRegionEntered', region.toJson()); + return response.cast(); } static Future> onGeoRegionExited(GeoRegion region) async { - if (Platform.isAndroid) { - Map response = - await _channel.invokeMethod('onGeoRegionExited', region.toJson()); - return response.cast(); - } else { - throw PlatformException(code: "API not supported"); - } + Map response = + await _channel.invokeMethod('onGeoRegionExited', region.toJson()); + return response.cast(); } static Future> onBeaconRegionEntered( BeaconRegion region) async { - if (Platform.isAndroid) { - Map response = - await _channel.invokeMethod('onBeaconRegionEntered', region.toJson()); - return response.cast(); - } else { - throw PlatformException(code: "API not supported"); - } + Map response = + await _channel.invokeMethod('onBeaconRegionEntered', region.toJson()); + return response.cast(); } static Future> onBeaconRegionExited( BeaconRegion region) async { - if (Platform.isAndroid) { - Map response = await (_channel.invokeMethod( - 'onBeaconRegionExited', region.toJson())); - return response.cast(); - } else { - throw PlatformException(code: "API not supported"); - } + Map response = + await (_channel.invokeMethod('onBeaconRegionExited', region.toJson())); + return response.cast(); } static Future getExecuteRsysWebUrl() async { diff --git a/pubspec.yaml b/pubspec.yaml index 1983212..47b52be 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,17 +4,16 @@ name: pushiomanager_flutter description: Flutter plugin for Responsys Mobile SDK -version: 6.56.7 +version: 7.0.0 repository: https://github.com/oracle-samples/pushiomanager-flutter environment: - sdk: '>=2.14.0 <3.0.0' - flutter: ">=1.20.0" + sdk: '>=2.14.0 <4.0.0' dependencies: flutter: sdk: flutter - flutter_plugin_android_lifecycle: ^2.0.1 + flutter_plugin_android_lifecycle: ^2.0.22 dev_dependencies: flutter_test: