Skip to content

Commit

Permalink
Merge pull request #250 from RodrigoSMarques/version7
Browse files Browse the repository at this point in the history
Release 7.0.0
  • Loading branch information
RodrigoSMarques committed Nov 3, 2023
2 parents d2e470c + 04b75af commit 6e11aa9
Show file tree
Hide file tree
Showing 22 changed files with 1,471 additions and 1,149 deletions.
38 changes: 36 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,39 @@
## 7.0.0
⚠️ This is a major release which contains breaking API changes.
### BREAKING CHANGE

* Minimum required Dart SDK version to 2.18 (Flutter 3.3.0)
* Xcode 15 is the min version
* iOS 12 is the min version

#### SDK Initialization Required
* Use `FlutterBranchSdk.init()` method to initialize the SDK.

Initialization must be called from `main` or at any time (for example after getting consent for GPDR).

```dart
await FlutterBranchSdk.init(
useTestKey: false, enableLogging: false, disableTracking: false);
```

Check additional instructions in the README

#### Deprecated / Removed

* `FlutterBranchSdk.initSession()`. Use `FlutterBranchSdk.listSession()`.
* Removed `setIOSSKAdNetworkMaxTime` method
* Removed Facebook App Install Ads on iOS

### Features

* Issue #244 - Support for setting customer_event_alias for BranchEvent
* Updated compile & target SDK to Android API 33.
* Updated example app Android compileSdkVersion to 33.

### Native SDK Updates

* Updated included iOS SDK to 3.0.0 - [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

## 6.9.0
### Enhancement
* Issue #244 - Support for setting customer_event_alias for BranchEvent
Expand Down Expand Up @@ -120,9 +156,7 @@
------------

* Updated Native `Android` and `iOS` SDKs:

* Android Native SDK Update 5.1.0 - [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)

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

## 4.0.0
Expand Down
140 changes: 46 additions & 94 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,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.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)
* iOS - Branch SDK Version >= 3.0.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

Implemented functions in plugin:

Expand Down Expand Up @@ -44,18 +44,26 @@ For details see:
### Android Integration

Follow the steps on the page [https://help.branch.io/developers-hub/docs/android-basic-integration#configure-app](https://help.branch.io/developers-hub/docs/android-basic-integration#configure-app), session _**Configure app**_:

* Add Branch to your `AndroidManifest.xml`

-

### iOS Integration
Follow the steps on the page [https://help.branch.io/developers-hub/docs/ios-basic-integration#configure-bundle-identifier](https://help.branch.io/developers-hub/docs/ios-basic-integration#configure-bundle-identifier), from session ```Configure bundle identifier```:

* Configure bundle identifier
* Configure associated domains
* Configure entitlements
* Configure Info.plist
* Confirm app prefix

> Note: In `Info.plist` not add `branch_key` `live` and `test` at the same time.<br />
Use only `branch_key` and update as needed.
#### NativeLink™ Deferred Deep Linking
Use iOS pasteboard to enable deferred deep linking via Branch NativeLink™, which enables 100% matching on iOS through Installs.

Follow the steps on the [page](https://help.branch.io/developers-hub/docs/ios-advanced-features#nativelink-deferred-deep-linking), session _**NativeLink™ Deferred Deep Linking**_,

Note: Code implementation in Swift is not necessary. The plugin already implements the code, requiring only configuration on the Dashboard.

-

### Web Integration

Expand All @@ -64,10 +72,10 @@ You need add Branch Javascript in your `web\index.html` at the top of your `<bod
```javascript
<script>
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode autoAppIndex banner closeBanner closeJourney creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode trackCommerceEvent logEvent disableTracking".split(" "), 0);
branch.init('key_live_YOUR_KEY_GOES_HERE');
branch.init('key_live_or_test_YOUR_KEY_GOES_HERE');
</script>
```
Change `key_live_YOUR_KEY_GOES_HERE` to match your [Branch Dashboard](https://dashboard.branch.io/account-settings/app)
Change `key_live_or_test_YOUR_KEY_GOES_HERE ` to match your [Branch Dashboard](https://dashboard.branch.io/account-settings/app)

If `branch.init()` fails, all subsequent Branch methods will fail.

Expand Down Expand Up @@ -108,7 +116,7 @@ Full example `index.html`:
<body>
<script>
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode autoAppIndex banner closeBanner closeJourney creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setBranchViewData setIdentity track validateCode trackCommerceEvent logEvent disableTracking".split(" "), 0);
branch.init('key_live_YOUR_KEY_GOES_HERE');
branch.init('key_live_or_test_YOUR_KEY_GOES_HERE');
</script>
<!-- This script installs service_worker.js to provide PWA functionality to
application. For more information, see:
Expand All @@ -131,6 +139,31 @@ To use the plugin, add `flutter_branch_sdk` as a [dependency in your pubspec.yam

## How to use

### Initializing

To initialize Branch:

```dart
import 'package:flutter_branch_sdk/flutter_branch_sdk.dart';
await FlutterBranchSdk.init(
useTestKey: false, enableLogging: false, disableTracking: false);
```

The optional parameters are:

- *useTestKey* : Sets `true` to use the test `key_test_....` .Default value: false
- *enableLogging* : Sets `true` turn on debug logging. Default value: false
- *disableTracking*: Sets `true` to disable tracking in Branch SDK for GDPR compliant on start. Default value: false

Initialization must be called from `main` or at any time, for example after getting consent for GPDR.

To guarantee the success of this function, ensure you've called the below in the app's main function

```dart
WidgetsFlutterBinding.ensureInitialized();
```

### Test Branch Integration
Test your Branch Integration by calling:

Expand Down Expand Up @@ -182,14 +215,14 @@ Make sure to comment out or remove `validateSDKIntegration` in your production b
To listen to the clicks on the deep link and retrieve the data it is necessary to add the code below:
```dart
StreamSubscription<Map> streamSubscription = FlutterBranchSdk.initSession().listen((data) {
StreamSubscription<Map> streamSubscription = FlutterBranchSdk.listSession().listen((data) {
if (data.containsKey("+clicked_branch_link") &&
data["+clicked_branch_link"] == true) {
//Link clicked. Add logic to get link data
print('Custom string: ${data["custom_string"]}');
}
}, onError: (error) {
print('InitSesseion error: ${error.toString()}');
print('listSession error: ${error.toString()}');
});
```
Expand All @@ -202,7 +235,10 @@ If you ever want to access the original session params (the parameters passed in
Map<dynamic, dynamic> params = await FlutterBranchSdk.getFirstReferringParams();
```
*Note: You must call this method on `iOS` to obtain installation data if the return of the `FlutterBranchSdk.listSession()` function is {+is_first_session: true, +clicked_branch_link: false}*
### Retrieve session (install or open) parameters
These session parameters will be available at any point later on with this command. If no parameters are available then Branch will return an empty dictionary. This refreshes with every new session (app installs AND app opens).
```dart
Expand Down Expand Up @@ -510,13 +546,6 @@ Add key value pairs to all requests
FlutterBranchSdk.setRequestMetadata(requestMetadataKey, requestMetadataValue);
```

### Set time window (in Hours) for SKAdNetwork callouts (iOS only)
By default, Branch limits calls to SKAdNetwork to within 72 hours after first install.

```dart
FlutterBranchSdk.setIOSSKAdNetworkMaxTime(24);
```

### iOS 14+ App Tracking Transparency
Starting with iOS 14.5, iPadOS 14.5, and tvOS 14.5, you’ll need to receive the user’s permission through the AppTrackingTransparency framework to track them or access their device’s advertising identifier. Tracking refers to the act of linking user or device data collected from your app with user or device data collected from other companies’ apps, websites, or offline properties for targeted advertising or advertising measurement purposes. Tracking also refers to sharing user or device data with data brokers.

Expand Down Expand Up @@ -580,83 +609,6 @@ print(status);

See: [https://developer.apple.com/documentation/adsupport/asidentifiermanager/1614151-advertisingidentifier](https://developer.apple.com/documentation/adsupport/asidentifiermanager/1614151-advertisingidentifier)


### Enable Logging
Use the Branch test key instead of the live key.

Logging is enabled by default in debug mode and disabled in release mode.

To enable/disable logging update `INFO.PLIST` on `iOS` or `AndroidManifest.xml` on Android:

For `iOS` add to `INFO.PLIST`:

To disable:

```swift
<key>branch_enable_log</key>
<false/>
```

To enable:

```swift
<key>branch_enable_log</key>
<true/>
```

For `Android` add to `AndroidManifest.xml`:

To disable:

```java
<meta-data android:name="branch_enable_log"
android:value="false" />
```

To enable:

```java
<meta-data android:name="branch_enable_log"
android:value="true" />
```

### Facebook App Install Ads

Branch links can be used together with Facebook App Install Campaign ads, allowing you to track ad-driven installs on the Branch dashboard and deep link those new users directly to content the first time they open your app.

Follow the instructions on the link
<a href="https://help.branch.io/using-branch/docs/facebook-app-install-ads" target="_blank">https://help.branch.io/using-branch/docs/facebook-app-install-ads</a>.



To read Facebook App Install deep links update `INFO.PLIST` on `iOS` or `AndroidManifest.xml` on `Android` as in the example:

For `iOS` add to `INFO.PLIST`:

```swift
<key>branch_enable_facebook_ads</key>
<true/>
```
** Deprecated on version 6.8.0 **
For `Android` add to `AndroidManifest.xml`:

```java
<meta-data android:name="branch_enable_facebook_ads"
android:value="true" />
```

Follow the instructions to install Facebook Android / iOS SDK:

`iOS`:

<a href="https://developers.facebook.com/docs/ios/use-cocoapods" target="_blank">https://developers.facebook.com/docs/ios/use-cocoapods</a>

`Android`:

<a href="https://developers.facebook.com/docs/android/getting-started" target="_blank">https://developers.facebook.com/docs/android/getting-started</a>



# Getting Started
See the `example` directory for a complete sample app using Branch SDK.

Expand Down
15 changes: 13 additions & 2 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
group 'br.com.rsmarques.flutter_branch_sdk'
version '1.0'

def getPackageVersion() {
def props = new Properties()
file('../pubspec.yaml').withInputStream { props.load(it) }
println props.getProperty("version")
props.getProperty("version")
}

buildscript {
repositories {
google()
Expand All @@ -22,10 +29,14 @@ rootProject.allprojects {
apply plugin: 'com.android.library'

android {
//compileSdkVersion 31
defaultConfig {
minSdkVersion 21
compileSdk 31
compileSdk 33
buildConfigField("String", "FBRANCH_VERSION", "\"${getPackageVersion()}\"")
}

buildFeatures {
buildConfig = true
}

compileOptions {
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.9.0";
private static final String PLUGIN_VERSION = "7.0.0";

public static void init(Context context) {
ApplicationInfoHelper applicationInfoHelper = new ApplicationInfoHelper(context);
Expand All @@ -21,7 +21,6 @@ public static void init(Context context) {
}

// Branch object initialization
Branch.registerPlugin(PLUGIN_NAME, PLUGIN_VERSION);
Branch.getAutoInstance(context);
}
}

1 comment on commit 6e11aa9

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