Skip to content

Commit

Permalink
Merge pull request #207 from RodrigoSMarques/master
Browse files Browse the repository at this point in the history
PR Branch MASTER into BUGFIX
  • Loading branch information
RodrigoSMarques committed Mar 23, 2023
2 parents 768b42f + 78c0868 commit e1eb764
Show file tree
Hide file tree
Showing 20 changed files with 300 additions and 172 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## 6.6.0
* Updated Native `Android` and `iOS` SDKs:
* Android Native SDK Update 5.4.+ - [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* iOS Native SDK Update 2.1.0 - [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

* New Methods:
- `addSnapPartnerParameter` - See [documentation](https://help.branch.io/using-branch/docs/snap) on partner parameters for details.

## 6.5.0
* Updated Native `iOS` SDK:
* iOS Native SDK Update 2.0.0 - [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

## 6.4.0
* Fix issue #193: `Flutter app won't get notified about the quick link event if the app is at foreground on Android devices`

Expand Down
36 changes: 17 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ Branch.io helps mobile apps grow with deep links that power referral systems, sh

Supports Android, iOS and Web.

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

Implemented functions in plugin:

Expand Down Expand Up @@ -429,8 +429,8 @@ The `BranchEvent` interface provides an interface to add contents represented by
Analytics about your app's BranchEvents can be found on the Branch dashboard, and BranchEvents also provide tight integration with many third party analytics providers.

```dart
BranchEvent eventStandart = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART);
FlutterBranchSdk.trackContent(buo: [buo], branchEvent: eventStandart);
BranchEvent eventStandard = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART);
FlutterBranchSdk.trackContent(buo: [buo], branchEvent: eventStandard);
```
You can use your own custom event names too:

Expand All @@ -441,21 +441,19 @@ FlutterBranchSdk.trackContent(buo: [buo], branchEvent: eventCustom);
Extra event specific data can be tracked with the event as well:

```dart
eventStandart.transactionID = '12344555';
eventStandart.currency = BranchCurrencyType.BRL;
eventStandart.revenue = 1.5;
eventStandart.shipping = 10.2;
eventStandart.tax = 12.3;
eventStandart.coupon = 'test_coupon';
eventStandart.affiliation = 'test_affiliation';
eventStandart.eventDescription = 'Event_description';
eventStandart.searchQuery = 'item 123';
eventStandart.adType = BranchEventAdType.BANNER;
eventStandart.addCustomData(
'Custom_Event_Property_Key1', 'Custom_Event_Property_val1');
eventStandart.addCustomData(
'Custom_Event_Property_Key2', 'Custom_Event_Property_val2');
FlutterBranchSdk.trackContent(buo: [buo], branchEvent: eventStandart);
eventStandard.transactionID = '12344555';
eventStandard.currency = BranchCurrencyType.BRL;
eventStandard.revenue = 1.5;
eventStandard.shipping = 10.2;
eventStandard.tax = 12.3;
eventStandard.coupon = 'test_coupon';
eventStandard.affiliation = 'test_affiliation';
eventStandard.eventDescription = 'Event_description';
eventStandard.searchQuery = 'item 123';
eventStandard.adType = BranchEventAdType.BANNER;
eventStandard.addCustomData('Custom_Event_Property_Key1', 'Custom_Event_Property_val1');
eventStandard.addCustomData('Custom_Event_Property_Key2', 'Custom_Event_Property_val2');
FlutterBranchSdk.trackContent(buo: [buo], branchEvent: eventStandard);
```

`trackContent` accepts a list of Branch Universal Object.
Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ android {
}

dependencies {
implementation 'io.branch.sdk.android:library:5.2.+'
implementation 'io.branch.sdk.android:library:5.4.+'
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1+'
implementation 'androidx.browser:browser:1.4.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,10 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) {
case "setPreinstallPartner" :
setPreinstallPartner(call);
break;
case "addSnapPartnerParameter" :
addSnapPartnerParameter(call);
break;

default:
result.notImplemented();
break;
Expand Down Expand Up @@ -844,6 +848,21 @@ public void run() {
}
});
}
private void addSnapPartnerParameter(MethodCall call) {
LogUtils.debug(DEBUG_NAME, "addSnapPartnerParameter call");
if (!(call.arguments instanceof Map)) {
throw new IllegalArgumentException("Map argument expected");
}
final String key = call.argument("key");
final String value = call.argument("value");

new Handler(Looper.getMainLooper()).post(new Runnable() {
@Override
public void run() {
Branch.getAutoInstance(context).addSnapPartnerParameterWithName(key, value);
}
});
}
}


93 changes: 46 additions & 47 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -1,47 +1,46 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'
platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
12 changes: 6 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- Branch (1.45.0)
- BranchSDK (2.1.0)
- Flutter (1.0.0)
- flutter_branch_sdk (6.4.0):
- Branch (~> 1.45.0)
- BranchSDK (~> 2.1.0)
- Flutter

DEPENDENCIES:
Expand All @@ -11,7 +11,7 @@ DEPENDENCIES:

SPEC REPOS:
trunk:
- Branch
- BranchSDK

EXTERNAL SOURCES:
Flutter:
Expand All @@ -20,10 +20,10 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/flutter_branch_sdk/ios"

SPEC CHECKSUMS:
Branch: ef0aa28182506c63a50618a0862f63a0f7b3fe9d
BranchSDK: ce28650272c658fcdb66675769e670ef83845d17
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_branch_sdk: 71c67c3436adb82d62a817a906f6eaf52ec0e176
flutter_branch_sdk: cc0393df011973fe6ab0380bc54bce1a3726e8a3

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3
PODFILE CHECKSUM: 7368163408c647b7eb699d0d788ba6718e18fb8d

COCOAPODS: 1.11.3
4 changes: 3 additions & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 51;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -203,6 +203,7 @@
/* Begin PBXShellScriptBuildPhase section */
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -239,6 +240,7 @@
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down
2 changes: 2 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -68,5 +68,7 @@
<true/>
<key>branch_key</key>
<string>key_test_ipQTteg11ENANDeCzSXgqdgfuycWoXYH</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
</plist>
28 changes: 16 additions & 12 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand All @@ -9,12 +10,19 @@ import 'custom_button.dart';

void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterBranchSdk.setPreinstallCampaign('My Campaign Name');
FlutterBranchSdk.setPreinstallPartner('Branch \$3p Parameter Value');
FlutterBranchSdk.addFacebookPartnerParameter(
'em', '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088');
//FlutterBranchSdk.setPreinstallCampaign('My Campaign Name');
//FlutterBranchSdk.setPreinstallPartner('Branch \$3p Parameter Value');

//FlutterBranchSdk.addFacebookPartnerParameter(
// key: 'em',
// value: '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088');
//FlutterBranchSdk.clearPartnerParameters();

//FlutterBranchSdk.addSnapPartnerParameter(
// key: 'hashed_email_address',
// value:
// '11234e56af071e9c79927651156bd7a10bca8ac34672aba121056e2698ee7088');

runApp(const MyApp());
}

Expand Down Expand Up @@ -45,7 +53,7 @@ class _HomePageState extends State<HomePage> {
BranchContentMetaData metadata = BranchContentMetaData();
BranchUniversalObject? buo;
BranchLinkProperties lp = BranchLinkProperties();
BranchEvent? eventStandart;
BranchEvent? eventStandard;
BranchEvent? eventCustom;

StreamSubscription<Map>? streamSubscription;
Expand Down Expand Up @@ -183,7 +191,7 @@ class _HomePageState extends State<HomePage> {
..addControlParam('\$android_redirect_timeout', 750)
..addControlParam('referring_user_id', 'user_id');

eventStandart = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART)
eventStandard = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART)
//--optional Event data
..transactionID = '12344555'
..currency = BranchCurrencyType.BRL
Expand Down Expand Up @@ -224,14 +232,10 @@ class _HomePageState extends State<HomePage> {
return;
}

/*
FlutterBranchSdk.validateSDKIntegration();
if (Platform.isAndroid) {
showSnackBar(message: 'Check messages in run log or logcat');
}
*/
FlutterBranchSdk.handleDeepLink(
'https://flutterbranchsdk.test-app.link/sxz79EtAPub');
}

void enableTracking() {
Expand Down Expand Up @@ -260,11 +264,11 @@ class _HomePageState extends State<HomePage> {
}

void trackContent() {
FlutterBranchSdk.trackContent(buo: [buo!], branchEvent: eventStandart!);
FlutterBranchSdk.trackContent(buo: [buo!], branchEvent: eventStandard!);

FlutterBranchSdk.trackContent(buo: [buo!], branchEvent: eventCustom!);

FlutterBranchSdk.trackContentWithoutBuo(branchEvent: eventStandart!);
FlutterBranchSdk.trackContentWithoutBuo(branchEvent: eventStandard!);

FlutterBranchSdk.trackContentWithoutBuo(branchEvent: eventCustom!);

Expand Down

0 comments on commit e1eb764

Please sign in to comment.