Skip to content

Commit

Permalink
Merge pull request #344 from RodrigoSMarques/master
Browse files Browse the repository at this point in the history
PR Branch MASTER into BUGFIX
  • Loading branch information
RodrigoSMarques authored Jul 23, 2024
2 parents 2efc8be + f272fba commit 125c467
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 26 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
## 8.0.4
### ⚠️ BREAKING CHANGE
This is a major release which contains breaking API changes.
#### ⚠️ SDK Initialization Changed
* `useTestKey` parameter is no longer supported at `FlutterBranchSdk.init()`.

Check the instructions in `README.MD` on how to activate the `key_test_`.

### 🐛 Bug Fixes
* Fix issue #347: ios plugin v8.0.3 crashes when no url is returned
* Fix issue #338: Changing the return value in didFinishLaunchingWithOptions crashes the application from SDK version above 8.0.0

## 8.0.3
### ⚠️ BREAKING CHANGE
This is a major release which contains breaking API changes.
#### ⚠️ SDK Initialization Changed
* `useTestKey` parameter is no longer supported at `FlutterBranchSdk.init()`.

Check the instructions in `README.MD` on how to activate the `key_test_`.

### 🐛 Bug Fixes
* Fix issue #340: Logging not working in Android Studio Emulator

## 8.0.2
### ⚠️ BREAKING CHANGE
This is a major release which contains breaking API changes.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import io.branch.indexing.BranchUniversalObject;
import io.branch.referral.Branch;
import io.branch.referral.BranchError;
import io.branch.referral.BranchLogger;
import io.branch.referral.QRCode.BranchQRCode;
import io.branch.referral.ServerRequestGetLATD;
import io.branch.referral.util.BranchEvent;
Expand Down Expand Up @@ -389,7 +390,7 @@ private void setupBranch(MethodCall call, final Result result) {
HashMap<String, Object> argsMap = (HashMap<String, Object>) call.arguments;

if ((Boolean) argsMap.get("enableLogging")) {
Branch.enableLogging();
Branch.enableLogging(BranchLogger.BranchLogLevel.VERBOSE);
} else {
Branch.disableLogging();
}
Expand Down Expand Up @@ -465,7 +466,7 @@ private void getShortUrl(MethodCall call, final Result result) {
@Override
public void onLinkCreate(String url, BranchError error) {

if ((error == null) || (error != null && url != null)) {
if ((error == null && url != null) || (error != null && url != null)) {
LogUtils.debug(DEBUG_NAME, "Branch link to share: " + url);
response.put("success", true);
response.put("url", url);
Expand Down
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.4.3)
- Flutter (1.0.0)
- flutter_branch_sdk (8.0.0-beta.0):
- flutter_branch_sdk (8.0.2):
- BranchSDK (~> 3.4.3)
- Flutter

Expand All @@ -22,7 +22,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
BranchSDK: 078e92df232a7cc0a8d900287d1e57057a2e2997
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_branch_sdk: 76e2267c772a75db0c97841233494ee9f79db978
flutter_branch_sdk: 77488aedfda2ec7a4dc65f2c71a98412a7443a2c

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

Expand Down
6 changes: 3 additions & 3 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.0.2"
version: "8.0.4"
flutter_lints:
dependency: "direct dev"
description:
name: flutter_lints
sha256: e2a421b7e59244faef694ba7b30562e489c2b489866e505074eb005cd7060db7
sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
url: "https://pub.dev"
source: hosted
version: "3.0.1"
version: "3.0.2"
flutter_test:
dependency: "direct dev"
description: flutter
Expand Down
25 changes: 12 additions & 13 deletions ios/Classes/SwiftFlutterBranchSdkPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,13 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
}

public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool {
branch = Branch.getInstance();
branch!.registerPluginName(PLUGIN_NAME, version: getPluginVersion())
Branch.getInstance().registerPluginName(PLUGIN_NAME, version: getPluginVersion())

if #available(iOS 15.0, *) {
branch!.checkPasteboardOnInstall()
Branch.getInstance().checkPasteboardOnInstall()
}

branch!.initSession(launchOptions: launchOptions) { (params, error) in
Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
if error == nil {
print("Branch InitSession params: \(String(describing: params as? [String: Any]))")
guard let _ = self.eventSink else {
Expand All @@ -78,22 +77,22 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
}

public func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
let branchHandled = branch!.application(app, open: url, options: options)
let branchHandled = Branch.getInstance().application(app, open: url, options: options)
return branchHandled
}

public func application(_ app: UIApplication, open url: URL, sourceApplication: String, annotation: Any) -> Bool {
let branchHandled = branch!.application(app, open: url, sourceApplication: sourceApplication, annotation: annotation)
let branchHandled = Branch.getInstance().application(app, open: url, sourceApplication: sourceApplication, annotation: annotation)
return branchHandled
}

public func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([Any]) -> Void) -> Bool {
let handledByBranch = branch!.continue(userActivity)
let handledByBranch = Branch.getInstance().continue(userActivity)
return handledByBranch
}

public func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any]) {
branch!.handlePushNotification(userInfo)
Branch.getInstance().handlePushNotification(userInfo)
}

//---------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -255,22 +254,22 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream


if args["enableLogging"] as! Bool == true {
Branch.enableLogging()
Branch.enableLogging(at: BranchLogLevel.debug)
}

if (!requestMetadata.isEmpty) {
for param in requestMetadata {
branch!.setRequestMetadataKey(param.key, value: param.value)
Branch.getInstance().setRequestMetadataKey(param.key, value: param.value)
}
}
if (!snapParameters.isEmpty) {
for param in snapParameters {
branch!.addSnapPartnerParameter(withName: param.key, value: param.value)
Branch.getInstance().addSnapPartnerParameter(withName: param.key, value: param.value)
}
}
if (!facebookParameters.isEmpty) {
for param in facebookParameters {
branch!.addFacebookPartnerParameter(withName: param.key, value: param.value)
Branch.getInstance().addFacebookPartnerParameter(withName: param.key, value: param.value)
}
}
isInitialized = true
Expand All @@ -286,7 +285,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream

let response : NSMutableDictionary! = [:]
buo?.getShortUrl(with: lp!) { (url, error) in
if ((error == nil) || (error != nil && url != nil)) {
if ((error == nil && url != nil) || (error != nil && url != nil)) {
NSLog("getShortUrl: %@", url!)
response["success"] = NSNumber(value: true)
response["url"] = url!
Expand Down
8 changes: 4 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ packages:
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 @@ -108,10 +108,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
4 changes: 2 additions & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
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.0.2
version: 8.0.4
homepage: https://github.com/RodrigoSMarques/flutter_branch_sdk

environment:
Expand All @@ -18,7 +18,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^3.0.2
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

0 comments on commit 125c467

Please # to comment.