Skip to content

Commit

Permalink
Merge pull request #25 from oracle-samples/release/7.0.0
Browse files Browse the repository at this point in the history
Release 7.0.0
  • Loading branch information
neerhaj authored Sep 30, 2024
2 parents 4757603 + 7667844 commit e94ae2e
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 64 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
115 changes: 104 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -25,6 +26,7 @@ This plugin makes it easy to integrate the Responsys Mobile SDK with your Flutte
- [Support](#support)
- [License](#license)

<br/>

## Requirements

Expand All @@ -36,10 +38,14 @@ This plugin makes it easy to integrate the Responsys Mobile SDK with your Flutte
### For iOS
- iOS 12 or later

<br/>

## Setup

Before installing the plugin, you must setup your app to receive push notifications.

<br/>

### 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.
Expand All @@ -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:
Expand All @@ -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')
```

<br/>

### 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
<key>NSLocationAlwaysUsageDescription</key>
<string>Add description for background location usage</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Add description for foreground only location usage.</string>
```

- 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.

<br/>

## Installation

Add the following dependency to your `pubspec.yaml`,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -280,7 +355,7 @@ Each Message Center message now supports an additional property called custom ke
}
}
);
```
```
- To get the message content call,

Expand All @@ -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"));
```


Expand Down Expand Up @@ -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
<https://oss.oracle.com/licenses/upl/>.
7 changes: 4 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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'
Expand All @@ -38,10 +39,10 @@ android {
namespace 'com.pushio.manager.flutter'
}

compileSdkVersion 31
compileSdkVersion 34

defaultConfig {
minSdkVersion 21
targetSdkVersion 31
targetSdkVersion 34
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ static List<HashMap<String, Object>> messageCenterMessagesAsList(List<PIOMCMessa
messageMap.put("richMessageURL", message.getRichMessageUrl());
messageMap.put("sentTimestamp", getDateAsString(message.getSentTimestamp()));
messageMap.put("expiryTimestamp", getDateAsString(message.getExpiryTimestamp()));
messageMap.put("customKeyValuePairs", message.getCustomKeyValue());

messageList.add(messageMap);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,16 @@ public void onSuccess(String requestUrl, String deeplinkUrl, String weblinkUrl)
response.put("deeplinkUrl", deeplinkUrl);
response.put("weblinkUrl", weblinkUrl);

channel.invokeMethod("setIAMUrlResolveLinkHandler", response);
if(mActivity != null) {
mUIThreadHandler.post(new Runnable() {
@Override
public void run() {
channel.invokeMethod("setIAMUrlResolveLinkHandler", response);
}
});
}else{
PIOLogger.v("PIOFP sERWU mActivity is null");
}
}

@Override
Expand Down Expand Up @@ -1056,7 +1065,12 @@ public void onDeepLinkReceived(final String deeplinkUrl, final String webLinkUrl
response.put("deeplinkUrl", deeplinkUrl);
response.put("weblinkUrl", webLinkUrl);

channel.invokeMethod("setAppOpenLinkHandler", response);
mUIThreadHandler.post(new Runnable() {
@Override
public void run () {
channel.invokeMethod("setAppOpenLinkHandler", response);
}
});
}
});
}
Expand Down
3 changes: 2 additions & 1 deletion example/android/PushIOManager/build.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
configurations.maybeCreate("default")
artifacts.add("default", file('PushIOManager-6.56.3.aar'))
artifacts.add("default", file('oracle-cx-mobile-base-7.0.0.aar'))
artifacts.add("default", file('oracle-cx-mobile-location-7.0.0.aar'))
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 6.56.6
version: 7.0.0

environment:
sdk: '>=2.14.0 <3.0.0'
Expand Down
Binary file modified img/ios_framework.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion ios/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,13 @@ Icon?
.tags*

/Flutter/Generated.xcconfig
/Flutter/flutter_export_environment.sh
/Flutter/flutter_export_environment.sh

PushIOManager.xcframework
PushIOManager.xcframework/*

CX_Mobile_SDK.xcframework
CX_Mobile_SDK.xcframework/*

OracleCXLocationSDK.xcframework
OracleCXLocationSDK.xcframework/*
2 changes: 1 addition & 1 deletion ios/Classes/NSArray+PIOConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#import "NSArray+PIOConvert.h"
#import "NSDictionary+PIOConvert.h"
#import <PushIOManager/PushIOManagerAll.h>
#import <CX_Mobile_SDK/CX_Mobile_SDK.h>

@implementation NSArray (PIOConvert)
- (NSArray *)messageDictionary {
Expand Down
4 changes: 3 additions & 1 deletion ios/Classes/NSDictionary+PIOConvert.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@


#import <Foundation/Foundation.h>
#import <PushIOManager/PushIOManagerAll.h>
#import <CX_Mobile_SDK/CX_Mobile_SDK.h>
#import <UIKit/UIKit.h>

NS_ASSUME_NONNULL_BEGIN
Expand All @@ -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
38 changes: 38 additions & 0 deletions ios/Classes/NSDictionary+PIOConvert.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading

0 comments on commit e94ae2e

Please sign in to comment.