Skip to content

Commit

Permalink
Merge pull request #197 from RodrigoSMarques/dev
Browse files Browse the repository at this point in the history
Release 6.4.0
  • Loading branch information
RodrigoSMarques authored Dec 4, 2022
2 parents 1ac419d + 78afc25 commit e00a325
Show file tree
Hide file tree
Showing 16 changed files with 345 additions and 116 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
## 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`

* New Methods:
- `addFacebookPartnerParameter` - See [documentation](https://help.branch.io/developers-hub/docs/pass-hashed-information-for-facebook-advanced-matching) on partner parameters for details.
- `clearPartnerParameter` - Clears all Partner Parameters
- `setPreinstallCampaign` - [Add the pre-install campaign analytics](https://help.branch.io/developers-hub/docs/pre-install-analytics)
- `setPreinstallPartner` - [Add the pre-install campaign analytics](https://help.branch.io/developers-hub/docs/pre-install-analytics)
* Updated Native `iOS` SDK:
* iOS Native SDK Update 1.45.0 - [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)

> Note: _Requires Xcode 14+_
## 6.3.0
* New Method `handleDeepLink`
* Fix issue #188: `Failed to handle method call: java.lang.NullPointerException`
Expand Down
2 changes: 1 addition & 1 deletion 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.2.+ [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases)
* iOS - Branch SDK Version >= 1.44.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases)
* iOS - Branch SDK Version >= 1.45.+ [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 @@ -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.3.0";
private static final String PLUGIN_VERSION = "6.4.0";

public static void init(Context context) {
ApplicationInfoHelper applicationInfoHelper = new ApplicationInfoHelper(context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ private void setActivity(Activity activity) {
activity.getApplication().registerActivityLifecycleCallbacks(this);

if (this.activity != null && FlutterFragmentActivity.class.isAssignableFrom(activity.getClass())) {
Branch.sessionBuilder(activity).withCallback(branchReferralInitListener).withData(activity.getIntent() != null ? activity.getIntent().getData() : null).init();
Branch.sessionBuilder(activity).withCallback(branchReferralInitListener).withData(activity.getIntent().getData()).init();
}
}

Expand Down Expand Up @@ -176,7 +176,7 @@ public void onActivityCreated(Activity activity, Bundle bundle) {
@Override
public void onActivityStarted(Activity activity) {
LogUtils.debug(DEBUG_NAME, "onActivityStarted call");
Branch.sessionBuilder(activity).withCallback(branchReferralInitListener).withData(activity.getIntent() != null ? activity.getIntent().getData() : null).init();
Branch.sessionBuilder(activity).withCallback(branchReferralInitListener).withData(activity.getIntent().getData()).init();
}

@Override
Expand Down Expand Up @@ -212,17 +212,19 @@ public void onActivityDestroyed(Activity activity) {
@Override
public boolean onNewIntent(Intent intent) {
LogUtils.debug(DEBUG_NAME, "onNewIntent call");
if (this.activity != null) {
this.activity.setIntent(intent);

if (intent != null &&
intent.hasExtra("branch_force_new_session") &&
intent.getBooleanExtra("branch_force_new_session", false)) {
Branch.sessionBuilder(this.activity).withCallback(branchReferralInitListener).reInit();
}
return true;
if (this.activity == null) {
return false;
}
if (intent == null) {
return false;
}
Intent newIntent = intent;
if (!intent.hasExtra("branch_force_new_session")) {
newIntent.putExtra("branch_force_new_session",true);
}
return false;
this.activity.setIntent(newIntent);
Branch.sessionBuilder(this.activity).withCallback(branchReferralInitListener).reInit();
return true;
}

/**
Expand Down Expand Up @@ -301,6 +303,18 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) {
case "handleDeepLink":
handleDeepLink(call);
break;
case "addFacebookPartnerParameter":
addFacebookPartnerParameter(call);
break;
case "clearPartnerParameters" :
clearPartnerParameters();
break;
case "setPreinstallCampaign" :
setPreinstallCampaign(call);
break;
case "setPreinstallPartner" :
setPreinstallPartner(call);
break;
default:
result.notImplemented();
break;
Expand Down Expand Up @@ -330,6 +344,7 @@ public void onInitFinished(JSONObject params, BranchError error) {
}
} else {
if (error.getErrorCode() == BranchError.ERR_BRANCH_ALREADY_INITIALIZED || error.getErrorCode() == BranchError.ERR_IMPROPER_REINITIALIZATION) {
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - warning: " + error);
return;
}
LogUtils.debug(DEBUG_NAME, "BranchReferralInitListener - error: " + error);
Expand Down Expand Up @@ -754,6 +769,7 @@ public void onFailure(Exception error) {
result.success(response);
}
}

private void handleDeepLink(final MethodCall call) {

LogUtils.debug(DEBUG_NAME, "handleDeepLink call");
Expand All @@ -770,6 +786,64 @@ private void handleDeepLink(final MethodCall call) {
activity.startActivity(intent);
}

private void addFacebookPartnerParameter(MethodCall call) {
LogUtils.debug(DEBUG_NAME, "addFacebookPartnerParameter 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).addFacebookPartnerParameterWithName(key, value);
}
});
}

private void clearPartnerParameters() {
LogUtils.debug(DEBUG_NAME, "clearPartnerParameters call");

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

private void setPreinstallCampaign(MethodCall call) {
LogUtils.debug(DEBUG_NAME, "setPreinstallCampaign call");
if (!(call.arguments instanceof Map)) {
throw new IllegalArgumentException("Map argument expected");
}

final String value = call.argument("value");

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

private void setPreinstallPartner(MethodCall call) {
LogUtils.debug(DEBUG_NAME, "setPreinstallPartner call");
if (!(call.arguments instanceof Map)) {
throw new IllegalArgumentException("Map argument expected");
}

final String value = call.argument("value");

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


10 changes: 5 additions & 5 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
PODS:
- Branch (1.43.1)
- Branch (1.45.0)
- Flutter (1.0.0)
- flutter_branch_sdk (3.0.0):
- Branch (~> 1.43.0)
- flutter_branch_sdk (6.4.0):
- Branch (~> 1.45.0)
- Flutter

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

SPEC CHECKSUMS:
Branch: b5b57fc2e6f098916fd2ea26c9b66f52ffe7e293
Branch: ef0aa28182506c63a50618a0862f63a0f7b3fe9d
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
flutter_branch_sdk: dcf38505c8dcb3249841e2acaf323f4a39f30e2b
flutter_branch_sdk: 71c67c3436adb82d62a817a906f6eaf52ec0e176

PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3

Expand Down
174 changes: 87 additions & 87 deletions example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
Original file line number Diff line number Diff line change
@@ -1,87 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</MacroExpansion>
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Profile"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "97C146ED1CF9000F007C117D"
BuildableName = "Runner.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
6 changes: 6 additions & 0 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ import 'custom_button.dart';

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

runApp(const MyApp());
}

Expand Down
Loading

1 comment on commit e00a325

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