Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR Branch MASTER into BUGFIX #401

Merged
merged 25 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
bac5d34
Gradle version update / Fix when API error is not returned
RodrigoSMarques Dec 9, 2024
05bec02
Release 8.3.0
RodrigoSMarques Dec 14, 2024
c6bb689
Fix Lint Alerts
RodrigoSMarques Dec 14, 2024
11872a1
Fix Lint Alerts
RodrigoSMarques Dec 14, 2024
b850986
Adjustment in the script for web build
RodrigoSMarques Dec 14, 2024
d6670d4
Update README.md
RodrigoSMarques Dec 14, 2024
c297df3
Update README.md
RodrigoSMarques Dec 14, 2024
3e97aa4
deprecated `initSession` method removed
RodrigoSMarques Dec 15, 2024
ebb15f3
Review Example App
RodrigoSMarques Dec 15, 2024
7ff50e6
Update example.png
RodrigoSMarques Dec 15, 2024
dcba07e
Add Support do Swfit Package Manager
RodrigoSMarques Dec 15, 2024
f8c49ae
Add Support do SPM
RodrigoSMarques Dec 16, 2024
fa30398
Add Support do SPM
RodrigoSMarques Dec 16, 2024
7d305b7
Add Support do SPM
RodrigoSMarques Dec 17, 2024
1906fe6
Reviewing the sample application / Updating dependencies
RodrigoSMarques Dec 17, 2024
ad3fc47
Merge branch 'migrate_spm' into dev
RodrigoSMarques Dec 17, 2024
4edc89d
build.gradle update
RodrigoSMarques Dec 20, 2024
0b3c25a
Update CHANGELOG.md
RodrigoSMarques Dec 20, 2024
ec0fe56
Merge pull request #400 from RodrigoSMarques/dev
RodrigoSMarques Dec 20, 2024
289c3a5
Update CHANGELOG.md
RodrigoSMarques Dec 20, 2024
e45821b
Merge pull request #402 from RodrigoSMarques/dev
RodrigoSMarques Dec 20, 2024
c234eba
Release 8.3.1
RodrigoSMarques Dec 25, 2024
896f5f6
Rename option `branch_disable_pasteboard_check` to `branch_disable_na…
RodrigoSMarques Dec 25, 2024
a0805d2
Update pubspec.lock
RodrigoSMarques Dec 28, 2024
e015812
Merge pull request #404 from RodrigoSMarques/dev
RodrigoSMarques Dec 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
/ios/flutter_branch_sdk/.build
28 changes: 27 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,30 @@
## 8.3.1
### ⚠️ BREAKING CHANGE
* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024)

### 🎉 Features
* Revised documentation including section to change **Flutter Deep link flag**
* New option in INFO.PLIST (`branch_disable_nativelink`) that allows disable NativeLink™ Deferred Deep Linking

## 8.3.0
### ⚠️ BREAKING CHANGE
* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024)

### 🎉 Features
* New Methods:
- `setConsumerProtectionAttributionLevel` - Sets the consumer protection attribution level. Read Branch documentation for details:
* [Introducing Consumer Protection Preference Levels](https://help.branch.io/using-branch/changelog/introducing-consumer-protection-preference-levels)
* [Consumer Protection Preferences](https://help.branch.io/developers-hub/docs/consumer-protection-preferences)

#### Deprecated / Removed
* `FlutterBranchSdk.disableTracking()`. Use `FlutterBranchSdk.setConsumerProtectionAttributionLevel()`.
* Removed `initSession` method.

### Native SDK Updates
### 🔧 Native SDK Updates
* Updated included iOS SDK to 3.7.0 - [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)
* Updated included Branch Android SDK to 5.15.0 - [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)

## 8.2.0
### ⚠️ BREAKING CHANGE
* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024)
Expand Down Expand Up @@ -78,7 +105,6 @@ This is a major release which contains breaking API changes.
### 🔧 Native SDK Updates

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

* Updated included Branch Android SDK to 5.12.0 - [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)


Expand Down
107 changes: 99 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,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.12.0 [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* iOS - Branch SDK Version >= 3.6.0 [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)
* Android - Branch SDK Version >= 5.15.0 [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* iOS - Branch SDK Version >= 3.7.0 [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

Implemented functions in plugin:

Expand Down Expand Up @@ -68,6 +68,41 @@ Follow the steps on the [page](https://help.branch.io/developers-hub/docs/ios-ad

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

#### Disable NativeLink™ Deferred Deep Linking
If you want to disable NativeLink™ Deferred Deep Linking, follow the instructions below:

1. Navigate to **ios/Runner/Info.plist** file.
2. Add the following in `<dict>` chapter:

```xml
<key>branch_disable_nativelink</key>
<true/>
```

### Change Flutter Deep link flag (Android / iOS)

**Flutter version 3.27** has a [_breaking change_](https://docs.google.com/document/d/1TUhaEhNdi2BUgKWQFEbOzJgmUAlLJwIAhnFfZraKgQs/edit?tab=t.0) that alters the behavior of the Deep link default flag.

You must manually set the value to **FALSE** in the project, according to the instructions below.

#### iOS

1. Navigate to **ios/Runner/Info.plist** file.
2. Add the following in `<dict>` chapter:

```xml
<key>FlutterDeepLinkingEnabled</key>
<false/>
```
#### Android

1. Navigate to **android/app/src/main/AndroidManifest.xml** file.
2. Add the following metadata tag and intent filter inside the tag with `.MainActivity`

```xml
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
```

### Web Integration

You need add Branch Javascript in your `web\index.html` at the top of your `<body>` tag, to be able to use this package.
Expand Down Expand Up @@ -159,7 +194,16 @@ await FlutterBranchSdk.init(enableLogging: false, disableTracking: false);
The optional parameters are:

- *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
- *disableTracking*: Sets `true` to disable tracking in Branch SDK for GDPR compliant on start. Default value: false
- *branchAttributionLevel* : The level of attribution data to collect.
- `BranchAttributionLevel.FULL`: Full Attribution (Default)
- `BranchAttributionLevel.REDUCE`: Reduced Attribution (Non-Ads + Privacy Frameworks)
- `BranchAttributionLevel.MINIMAL`: Minimal Attribution - Analytics Only
- `BranchAttributionLevel.NONE`: No Attribution - No Analytics (GDPR, CCPA)

Read Branch documentation for details: [Introducing Consumer Protection Preference Levels](https://help.branch.io/using-branch/changelog/introducing-consumer-protection-preference-levels) and [Consumer Protection Preferences](https://help.branch.io/developers-hub/docs/consumer-protection-preferences)

*Note: The `disableTracking` parameter is deprecated and should no longer be used. Please use `branchAttributionLevel` to control tracking behavior.*

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

Expand Down Expand Up @@ -531,7 +575,7 @@ FlutterBranchSdk.logout();
bool isUserIdentified = await FlutterBranchSdk.isUserIdentified();
```

### Enable or Disable User Tracking
### Enable or Disable User Tracking (Deprecated. Read Consumer Preference Levels)
If you need to comply with a user's request to not be tracked for GDPR purposes, or otherwise determine that a user should not be tracked, utilize this field to prevent Branch from sending network requests. This setting can also be enabled across all users for a particular link, or across your Branch links.

```dart
Expand All @@ -544,6 +588,35 @@ You can choose to call this throughout the lifecycle of the app. Once called, ne

More information [here](https://help.branch.io/developers-hub/docs/honoring-opt-out-of-processing-requests)

### Consumer Preference Levels
Sets the consumer protection attribution level:

* `BranchAttributionLevel.FULL`: Full Attribution (Default)

```dart
FlutterBranchSdk.setConsumerProtectionAttributionLevel(BranchAttributionLevel.FULL);
```
* `BranchAttributionLevel.REDUCE`: Reduced Attribution (Non-Ads + Privacy Frameworks)

```dart
FlutterBranchSdk.setConsumerProtectionAttributionLevel(BranchAttributionLevel.REDUCED);
```
* `BranchAttributionLevel.MINIMAL`: Minimal Attribution - Analytics

```dart
FlutterBranchSdk.setConsumerProtectionAttributionLevel(BranchAttributionLevel.MINIMAL);
```
* `BranchAttributionLevel.NONE`: No Attribution - No Analytics (GDPR, CCPA)

```dart
FlutterBranchSdk.setConsumerProtectionAttributionLevel(BranchAttributionLevel.NONE);
```
Read Branch documentation for details:

- [Introducing Consumer Protection Preference Levels](https://help.branch.io/using-branch/changelog/introducing-consumer-protection-preference-levels)
- [Consumer Protection Preferences](https://help.branch.io/developers-hub/docs/consumer-protection-preferences)


### Set Request Meta data
Add key value pairs to all requests

Expand Down Expand Up @@ -634,6 +707,7 @@ adUserDataUsageConsent | Boolean | Whether end user has granted or denied consen

When parameters are successfully set using `setDMAParamsForEEA`, they will be sent along with every future request to the following Branch endpoint.


# Configuring the project to use Branch Test Key
## Android

Expand Down Expand Up @@ -694,11 +768,28 @@ Practices to avoid:
3. Don't wait to initialize the object until you conveniently need a link.
4. Don't create many objects at once and register views in a for loop.

# Deep links with Short Links
More information [here](https://help.branch.io/using-branch/docs/creating-a-deep-link#short-links)
# Create Deep Links
* Deep links with [Short Links](https://help.branch.io/using-branch/docs/creating-a-deep-link#short-links)
* Deep links with [Long links](https://help.branch.io/using-branch/docs/creating-a-deep-link#long-links)

# Data Privacy
* [Introducing Consumer Protection Preference Levels] (https://help.branch.io/using-branch/changelog/introducing-consumer-protection-preference-levels)
* [Consumer Protection Preferences](https://help.branch.io/developers-hub/docs/consumer-protection-preferences)
* [Answering the App Store Connect Privacy Questions](https://help.branch.io/using-branch/docs/answering-the-app-store-connect-privacy-questions)
* [Answering the Google Play Store Privacy Questions](https://help.branch.io/using-branch/docs/answering-the-google-play-store-privacy-questions)


# SDK FAQs
* [Android SDK FAQs](https://help.branch.io/faq/docs/android-sdk)
* [iOS SDK FAQs](https://help.branch.io/faq/docs/ios-sdk)

# Testing
* [Android Testing](https://help.branch.io/developers-hub/docs/android-testing)
* [iOS Testing](https://help.branch.io/developers-hub/docs/ios-testing)

# Deep links with Long links
More information [here](https://help.branch.io/using-branch/docs/creating-a-deep-link#long-links)
# Troubleshooting
* [Android Troubleshooting](https://help.branch.io/developers-hub/docs/android-troubleshooting)
* [iOS Troubleshooting](https://help.branch.io/developers-hub/docs/ios-troubleshooting)

# Branch Documentation
Read the iOS or Android documentation for all Branch object parameters:
Expand Down
4 changes: 3 additions & 1 deletion analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ include: package:flutter_lints/flutter.yaml
# https://dart.dev/guides/language/analysis-options
linter:
rules:
constant_identifier_names: false
constant_identifier_names: false
# public_member_api_docs: true
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
15 changes: 8 additions & 7 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:8.1.4'
}
}

Expand All @@ -38,22 +38,23 @@ android {
buildConfig = true
}

compileSdk 35

defaultConfig {
minSdkVersion 21
compileSdk 34
buildConfigField("String", "FBRANCH_VERSION", "\"${getPackageVersion()}\"")
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
}

dependencies {
implementation 'io.branch.sdk.android:library:5.12.+'
implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1'
implementation 'androidx.lifecycle:lifecycle-runtime:2.7.0'
implementation 'io.branch.sdk.android:library:5.15.+'
implementation 'com.google.android.gms:play-services-ads-identifier:18.2.0'
implementation 'androidx.lifecycle:lifecycle-runtime:2.8.7'
implementation 'androidx.browser:browser:1.8.0'
implementation "store.galaxy.samsung.installreferrer:samsung_galaxystore_install_referrer:4.0.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.branch.referral.Branch;
import io.branch.referral.BranchError;
import io.branch.referral.BranchLogger;
import io.branch.referral.Defines;
import io.branch.referral.QRCode.BranchQRCode;
import io.branch.referral.ServerRequestGetLATD;
import io.branch.referral.util.BranchEvent;
Expand Down Expand Up @@ -279,7 +280,7 @@ public boolean onNewIntent(@NonNull Intent intent) {
return false;
}
this.activity.setIntent(intent);
if (intent.hasExtra("branch_force_new_session") && intent.getBooleanExtra("branch_force_new_session",false)) {
if (intent.hasExtra("branch_force_new_session") && intent.getBooleanExtra("branch_force_new_session", false)) {
Branch.sessionBuilder(this.activity).withCallback(branchReferralInitListener).reInit();
LogUtils.debug(DEBUG_NAME, "triggered SessionBuilder reInit");
}
Expand Down Expand Up @@ -383,6 +384,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) {
case "setDMAParamsForEEA":
setDMAParamsForEEA(call);
break;
case "setConsumerProtectionAttributionLevel":
setConsumerProtectionAttributionLevel(call);
break;
default:
result.notImplemented();
break;
Expand Down Expand Up @@ -450,20 +454,26 @@ private void setupBranch(MethodCall call, final Result result) {
Branch.getAutoInstance(context).setPreinstallCampaign(campaingParameters.get(i));
}
}

if ((Boolean) argsMap.get("disableTracking")) {
Branch.getInstance().disableTracking(true);
} else {
Branch.getInstance().disableTracking(false);
}

final String branchAttributionLevelString = call.argument("branchAttributionLevel");
if (branchAttributionLevelString != null && !branchAttributionLevelString.isEmpty()) {
Branch.getInstance().setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel.valueOf(branchAttributionLevelString));
}

LogUtils.debug(DEBUG_NAME, "notifyNativeToInit()");
Branch.notifyNativeToInit();
isInitialized = true;
result.success(Boolean.TRUE);
}

private void validateSDKIntegration() {
IntegrationValidator.validate(activity);
IntegrationValidator.validate(this.activity);
}

private void getShortUrl(MethodCall call, final Result result) {
Expand Down Expand Up @@ -520,6 +530,7 @@ public void onLinkShareResponse(String sharedLink, BranchError error) {
}
result.success(response);
}

@Override
public void onChannelSelected(String channelName) {
LogUtils.debug(DEBUG_NAME, "Branch link share channel: " + channelName);
Expand Down Expand Up @@ -996,7 +1007,16 @@ private void setDMAParamsForEEA(MethodCall call) {
final boolean adPersonalizationConsent = Boolean.TRUE.equals(call.argument("adPersonalizationConsent"));
final boolean adUserDataUsageConsent = Boolean.TRUE.equals(call.argument("adUserDataUsageConsent"));

Branch.getInstance().setDMAParamsForEEA(eeaRegion,adPersonalizationConsent,adUserDataUsageConsent);
Branch.getInstance().setDMAParamsForEEA(eeaRegion, adPersonalizationConsent, adUserDataUsageConsent);
}

private void setConsumerProtectionAttributionLevel(MethodCall call) {
LogUtils.debug(DEBUG_NAME, "triggered setConsumerProtectionAttributionLevel");
if (!(call.arguments instanceof Map)) {
throw new IllegalArgumentException("Map argument expected");
}
final String branchAttributionLevelString = call.argument("branchAttributionLevel");
Branch.getInstance().setConsumerProtectionAttributionLevel(Defines.BranchAttributionLevel.valueOf(branchAttributionLevelString));
}
}

Expand Down
Binary file modified assets/example.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
Expand Down
3 changes: 2 additions & 1 deletion example/analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ linter:
# producing the lint.
rules:
avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule


# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
6 changes: 3 additions & 3 deletions example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ android {
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "br.com.rsmarques.flutter_branch_sdk_example"
Expand Down
1 change: 1 addition & 0 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
<data android:scheme="https" android:host="flutterbranchsdk-alternate.test-app.link" />
<data android:scheme="https" android:host="flutterbranchsdk.test-app.link" />
</intent-filter>
<meta-data android:name="flutter_deeplinking_enabled" android:value="false" />
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
Expand Down
2 changes: 1 addition & 1 deletion example/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:8.0.0'
classpath 'com.android.tools.build:gradle:8.2.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
Expand Down
13 changes: 7 additions & 6 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Fri Jun 23 08:50:38 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading