Skip to content

Commit

Permalink
Release 8.2.0
Browse files Browse the repository at this point in the history
## 8.2.0
### ⚠️ BREAKING CHANGE
* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024)

### 🎉 Features
* Issue #361: Migrate to dart:js_interop to support Webassamebly. Thanks @hnvn

### 🐛 Bug Fixes
* Fix issue #368: "-118, Warning. Session initialization already happened" triggered in the listSession callback
  • Loading branch information
RodrigoSMarques committed Aug 27, 2024
1 parent 9b7f2d0 commit 38b894c
Show file tree
Hide file tree
Showing 9 changed files with 109 additions and 59 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 8.2.0
### ⚠️ BREAKING CHANGE
* Minimum required Dart SDK version 3.3.0 (Flutter 3.19.0 - 15/02/2024)

### 🎉 Features
* Issue #361: Migrate to dart:js_interop to support Webassamebly. Thanks @hnvn

### 🐛 Bug Fixes
* Fix issue #368: "-118, Warning. Session initialization already happened" triggered in the listSession callback

## 8.1.0
### 🔧 Native SDK Updates

Expand Down
1 change: 0 additions & 1 deletion android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
rootProject.name = 'flutter_branch_sdk'
android.defaults.buildfeatures.buildconfig=true
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.os.Looper;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import org.json.JSONException;
import org.json.JSONObject;
Expand Down Expand Up @@ -50,18 +51,63 @@ public class FlutterBranchSdkPlugin implements FlutterPlugin, MethodCallHandler,
private static final String DEBUG_NAME = "FlutterBranchSDK";
private static final String MESSAGE_CHANNEL = "flutter_branch_sdk/message";
private static final String EVENT_CHANNEL = "flutter_branch_sdk/event";
private Activity activity;
private Context context;
private ActivityPluginBinding activityPluginBinding;
private EventSink eventSink = null;
private Map<String, Object> sessionParams = null;
private BranchError initialError = null;
private final FlutterBranchSdkHelper branchSdkHelper = new FlutterBranchSdkHelper();
private final JSONObject requestMetadata = new JSONObject();
private final JSONObject facebookParameters = new JSONObject();
private final JSONObject snapParameters = new JSONObject();
private final ArrayList<String> preInstallParameters = new ArrayList<String>();
private final ArrayList<String> campaingParameters = new ArrayList<String>();
private Activity activity;
private Context context;
private ActivityPluginBinding activityPluginBinding;
private EventSink eventSink = null;
private Map<String, Object> sessionParams = null;
private BranchError initialError = null;
/**
* ---------------------------------------------------------------------------------------------
* Branch SDK Call Methods
* --------------------------------------------------------------------------------------------
**/
private final Branch.BranchReferralInitListener branchReferralInitListener = new
Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject params, BranchError error) {
LogUtils.debug(DEBUG_NAME, "triggered onInitFinished");
if (error == null) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - params: " + params.toString());
try {
sessionParams = branchSdkHelper.paramsToMap(params);
} catch (JSONException e) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error to Map: " + e.getLocalizedMessage());
return;
}
if (eventSink != null) {
eventSink.success(sessionParams);
sessionParams = null;
}
} else if (error.getErrorCode() == BranchError.ERR_BRANCH_ALREADY_INITIALIZED) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener : " + error.getMessage());
try {
sessionParams = branchSdkHelper.paramsToMap(Branch.getInstance().getLatestReferringParams());
} catch (JSONException e) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error to Map: " + e.getLocalizedMessage());
return;
}
if (eventSink != null) {
eventSink.success(sessionParams);
sessionParams = null;
}
} else {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error: " + error);
if (eventSink != null) {
eventSink.error(String.valueOf(error.getErrorCode()), error.getMessage(), null);
initialError = null;
} else {
initialError = error;
}
}
}
};
private boolean isInitialized = false;

/**
Expand All @@ -74,6 +120,7 @@ public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
LogUtils.debug(DEBUG_NAME, "triggered onAttachedToEngine");
setupChannels(binding.getBinaryMessenger(), binding.getApplicationContext());
}

@Override
public void onDetachedFromEngine(@NonNull FlutterPluginBinding binding) {
LogUtils.debug(DEBUG_NAME, "triggered onDetachedFromEngine");
Expand Down Expand Up @@ -342,41 +389,6 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) {
}
}

/**
* ---------------------------------------------------------------------------------------------
* Branch SDK Call Methods
* --------------------------------------------------------------------------------------------
**/
private final Branch.BranchReferralInitListener branchReferralInitListener = new
Branch.BranchReferralInitListener() {
@Override
public void onInitFinished(JSONObject params, BranchError error) {
LogUtils.debug(DEBUG_NAME, "triggered onInitFinished");
if (error == null) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - params: " + params.toString());

try {
sessionParams = branchSdkHelper.paramsToMap(params);
} catch (JSONException e) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error to Map: " + e.getLocalizedMessage());
return;
}
if (eventSink != null) {
eventSink.success(sessionParams);
sessionParams = null;
}
} else {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error: " + error);
if (eventSink != null) {
eventSink.error(String.valueOf(error.getErrorCode()), error.getMessage(), null);
initialError = null;
} else {
initialError = error;
}
}
}
};

private void setupBranch(MethodCall call, final Result result) {
LogUtils.debug(DEBUG_NAME, "triggered setupBranch");
if (!(call.arguments instanceof Map)) {
Expand Down
30 changes: 30 additions & 0 deletions example/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819"
channel: "stable"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
- platform: web
create_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819
base_revision: 80c2e84975bbd28ecf5f8d4bd4ca5a2490bfc819

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PODS:
- BranchSDK (3.6.0)
- Flutter (1.0.0)
- flutter_branch_sdk (8.1.0):
- flutter_branch_sdk (8.2.0):
- BranchSDK (~> 3.6.0)
- Flutter

Expand All @@ -22,7 +22,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
BranchSDK: 40ff1a13b1dc0729f79a9aae230418d25bf739a8
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_branch_sdk: e5b94559acdc8596fe7b68598a706879602cb0e7
flutter_branch_sdk: b3763b3d53a7cfbc87c51136bed66fcdc282bdf5

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

Expand Down
18 changes: 9 additions & 9 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ packages:
path: ".."
relative: true
source: path
version: "8.1.0"
version: "8.2.0"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
version: "4.0.0"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down Expand Up @@ -139,10 +139,10 @@ packages:
dependency: transitive
description:
name: lints
sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235"
url: "https://pub.dev"
source: hosted
version: "3.0.0"
version: "4.0.0"
matcher:
dependency: transitive
description:
Expand Down Expand Up @@ -256,10 +256,10 @@ packages:
dependency: "direct main"
description:
name: uuid
sha256: "814e9e88f21a176ae1359149021870e87f7cddaf633ab678a5d2b0bff7fd1ba8"
sha256: "83d37c7ad7aaf9aa8e275490669535c8080377cfa7a7004c24dfac53afffaa90"
url: "https://pub.dev"
source: hosted
version: "4.4.0"
version: "4.4.2"
vector_math:
dependency: transitive
description:
Expand All @@ -272,10 +272,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
4 changes: 2 additions & 2 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
uuid: ^4.4.0
uuid: ^4.4.2
intl: ^0.19.0

dev_dependencies:
Expand All @@ -41,7 +41,7 @@ dev_dependencies:
# activated in the `analysis_options.yaml` file located at the root of your
# package. See that file for information about deactivating specific lint
# rules and activating additional ones.
flutter_lints: ^3.0.1
flutter_lints: ^4.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
Expand Down
4 changes: 2 additions & 2 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -209,10 +209,10 @@ packages:
dependency: transitive
description:
name: vm_service
sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc
sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d"
url: "https://pub.dev"
source: hosted
version: "14.2.4"
version: "14.2.5"
sdks:
dart: ">=3.3.0 <4.0.0"
flutter: ">=3.18.0-18.0.pre.54"
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
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: 8.1.0
version: 8.2.0
homepage: https://github.com/RodrigoSMarques/flutter_branch_sdk

environment:
sdk: ">=3.3.0 <4.0.0"
flutter: ">=3.3.0"

dependencies:
flutter:
Expand Down

0 comments on commit 38b894c

Please sign in to comment.