Skip to content

Commit

Permalink
Merge pull request #247 from RodrigoSMarques/dev
Browse files Browse the repository at this point in the history
Release 6.9.0
  • Loading branch information
RodrigoSMarques committed Oct 7, 2023
2 parents e48d363 + 3ae526b commit d2e470c
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 42 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 6.9.0
### Enhancement
* Issue #244 - Support for setting customer_event_alias for BranchEvent

## 6.8.0
* Updated Native `Android` SDKs:
* Android Native SDK Update 5.7.+ - [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Branch.io helps mobile apps grow with deep links that power referral systems, sh

Supports Android, iOS and Web.

* Android - Branch SDK Version >= 5.6.+ [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* Android - Branch SDK Version >= 5.7.+ [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* iOS - Branch SDK Version >= 2.2.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

Implemented functions in plugin:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,6 @@ BranchEvent convertToEvent(HashMap<String, Object> eventMap) {
} else {
event = new BranchEvent((String) eventMap.get("eventName"));
}

if (eventMap.containsKey("transactionID"))
event.setTransactionID((String) eventMap.get("transactionID"));
if (eventMap.containsKey("currency"))
Expand All @@ -202,6 +201,9 @@ BranchEvent convertToEvent(HashMap<String, Object> eventMap) {
event.addCustomDataProperty(customData.getKey(), customData.getValue());
}
}
if (eventMap.containsKey("alias")) {
event.setCustomerEventAlias((String) eventMap.get("alias"));
}
return event;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
public class FlutterBranchSdkInit {
private static final String DEBUG_NAME = "FlutterBranchSDK";
private static final String PLUGIN_NAME = "Flutter";
private static final String PLUGIN_VERSION = "6.8.0";
private static final String PLUGIN_VERSION = "6.9.0";

public static void init(Context context) {
ApplicationInfoHelper applicationInfoHelper = new ApplicationInfoHelper(context);
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
package="br.com.rsmarques.flutter_branch_sdk_example">
<uses-permission android:name="android.permission.INTERNET" />
<application
android:label="flutter_branch_sdk_example"
android:label="Flutter Branch SDK Example"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
6 changes: 3 additions & 3 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- BranchSDK (2.2.1)
- Flutter (1.0.0)
- flutter_branch_sdk (6.4.0):
- flutter_branch_sdk (6.8.0):
- BranchSDK (~> 2.2.1)
- Flutter

Expand All @@ -22,8 +22,8 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
BranchSDK: cb046c2714b03e573484ce9e349e2ddbad7016e8
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_branch_sdk: 4abdebac9688050516f1fba611c60539ab8557e1
flutter_branch_sdk: 938f6f386a976356ee7e5f60969e53d4ae5704d9

PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d

COCOAPODS: 1.11.3
COCOAPODS: 1.12.1
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ packages:
path: ".."
relative: true
source: path
version: "6.8.0"
version: "6.9.0"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
3 changes: 3 additions & 0 deletions ios/Classes/FlutterBranchIoSdkHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,9 @@ func convertToEvent(dict: [String: Any?]) -> BranchEvent? {
event.customData[customData.key] = (customData.value as! String)
}
}
if let alias = dict["alias"] as? String {
event.alias = alias
}
return event
}

Expand Down
2 changes: 1 addition & 1 deletion ios/Classes/SwiftFlutterBranchSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ let MESSAGE_CHANNEL = "flutter_branch_sdk/message";
let EVENT_CHANNEL = "flutter_branch_sdk/event";
let ERROR_CODE = "FLUTTER_BRANCH_SDK_ERROR";
let PLUGIN_NAME = "Flutter";
let PLUGIN_VERSION = "6.8.0"
let PLUGIN_VERSION = "6.9.0"

public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
var eventSink: FlutterEventSink?
Expand Down
14 changes: 11 additions & 3 deletions lib/src/flutter_branch_sdk_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,23 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform {
void trackContent(
{required List<BranchUniversalObject> buo,
required BranchEvent branchEvent}) {
js.JsArray<Object> contentItems = js.JsArray();
List<Object> contentItems = [];

for (var element in buo) {
contentItems.add(_dartObjectToJsObject(element.toMap()));
}

try {
BranchJS.logEvent(branchEvent.eventName,
_dartObjectToJsObject(branchEvent.toMap()), contentItems);
if (branchEvent.alias.isNotEmpty) {
BranchJS.logEvent(
branchEvent.eventName,
_dartObjectToJsObject(branchEvent.toMap()),
contentItems,
branchEvent.alias);
} else {
BranchJS.logEvent(branchEvent.eventName,
_dartObjectToJsObject(branchEvent.toMap()), contentItems);
}
} catch (e) {
debugPrint('trackContent() error: ${e.toString()}');
}
Expand Down
54 changes: 28 additions & 26 deletions lib/src/objects/branch_event.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class BranchEvent {
String searchQuery = '';
BranchEventAdType? adType;
final Map<String, String> _customData = {};
String alias = '';

BranchEvent.standardEvent(BranchStandardEvent branchStandardEvent) {
_eventName = getBranchStandardEventString(branchStandardEvent);
Expand All @@ -82,59 +83,60 @@ class BranchEvent {
}

Map<String, dynamic> toMap() {
Map<String, dynamic> ret = <String, dynamic>{};
Map<String, dynamic> data = <String, dynamic>{};

if (!kIsWeb) {
ret["eventName"] = _eventName;
ret["isStandardEvent"] = _isStandardEvent;
data["eventName"] = _eventName;
data["isStandardEvent"] = _isStandardEvent;
if (transactionID.isNotEmpty) {
ret["transactionID"] = transactionID;
data["transactionID"] = transactionID;
}
if (currency != null) {
ret["currency"] = getCurrencyTypeString(currency!);
data["currency"] = getCurrencyTypeString(currency!);
}
if (revenue != -1) ret["revenue"] = revenue;
if (shipping != -1) ret["shipping"] = shipping;
if (tax != -1) ret["tax"] = tax;
if (coupon.isNotEmpty) ret["coupon"] = coupon;
if (affiliation.isNotEmpty) ret["affiliation"] = affiliation;
if (revenue != -1) data["revenue"] = revenue;
if (shipping != -1) data["shipping"] = shipping;
if (tax != -1) data["tax"] = tax;
if (coupon.isNotEmpty) data["coupon"] = coupon;
if (affiliation.isNotEmpty) data["affiliation"] = affiliation;
if (eventDescription.isNotEmpty) {
ret["eventDescription"] = eventDescription;
data["eventDescription"] = eventDescription;
}
if (searchQuery.isNotEmpty) {
ret["searchQuery"] = searchQuery;
data["searchQuery"] = searchQuery;
}
if (adType != null) {
ret["adType"] = getBranchEventAdTypeString(adType!);
data["adType"] = getBranchEventAdTypeString(adType!);
}
if (_customData.isNotEmpty) ret["customData"] = _customData;
if (_customData.isNotEmpty) data["customData"] = _customData;
if (alias.isNotEmpty) data["alias"] = alias;
} else {
if (_isStandardEvent) {
if (transactionID.isNotEmpty) {
ret["transactionID"] = transactionID;
data["transactionID"] = transactionID;
}
if (currency != null) {
ret["currency"] = getCurrencyTypeString(currency!);
data["currency"] = getCurrencyTypeString(currency!);
}
if (revenue != -1) ret["revenue"] = revenue;
if (shipping != -1) ret["shipping"] = shipping;
if (tax != -1) ret["tax"] = tax;
if (coupon.isNotEmpty) ret["coupon"] = coupon;
if (affiliation.isNotEmpty) ret["affiliation"] = affiliation;
if (revenue != -1) data["revenue"] = revenue;
if (shipping != -1) data["shipping"] = shipping;
if (tax != -1) data["tax"] = tax;
if (coupon.isNotEmpty) data["coupon"] = coupon;
if (affiliation.isNotEmpty) data["affiliation"] = affiliation;
if (eventDescription.isNotEmpty) {
ret["eventDescription"] = eventDescription;
data["eventDescription"] = eventDescription;
}
if (searchQuery.isNotEmpty) {
ret["searchQuery"] = searchQuery;
data["searchQuery"] = searchQuery;
}
if (adType != null) {
ret["adType"] = getBranchEventAdTypeString(adType!);
data["adType"] = getBranchEventAdTypeString(adType!);
}
}
_customData.forEach((key, value) {
ret[key] = value;
data[key] = value;
});
}
return ret;
return data;
}
}
4 changes: 1 addition & 3 deletions lib/src/web/branch_js.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
@JS()
library branchjs;

// ignore: avoid_web_libraries_in_flutter
import 'dart:js';
import 'dart:typed_data';

import 'package:js/js.dart';
Expand Down Expand Up @@ -757,7 +755,7 @@ class BranchJS {
@JS('logEvent')
external static void logEvent(String event,
[Object eventDataAndCustomData,
JsArray contentItems,
Object contentItems,
String customerEventAlias,
Function callback]);

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_branch_sdk
description: Flutter Plugin for create deep link using Brach SDK (https://branch.io). This plugin provides a cross-platform (iOS, Android, Web).
version: 6.8.0
version: 6.9.0
homepage: https://github.com/RodrigoSMarques/flutter_branch_sdk

environment:
Expand Down

1 comment on commit d2e470c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.