Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 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)
Expand Down
36 changes: 35 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
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 @@ -744,7 +779,6 @@ Practices to avoid:
* [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)
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
6 changes: 0 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
PODS:
- Flutter (1.0.0)

- flutter_branch_sdk (8.3.0):
- BranchSDK (~> 3.7.0)
- Flutter

DEPENDENCIES:
- Flutter (from `Flutter`)

Expand All @@ -15,8 +11,6 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7

flutter_branch_sdk: 5a91002c028d3157155e34ee934c0b216bebef1d

PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048

COCOAPODS: 1.16.2
12 changes: 9 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 60;
objectVersion = 54;
objects = {

/* Begin PBXBuildFile section */
Expand Down Expand Up @@ -49,6 +49,9 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
AB1D5F54BAB544003F61E88D /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
EA0E68F4285672D0306D38B1 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
F19994400E82ADF824F766FF /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand All @@ -75,6 +78,9 @@
83204363E71EE2485FF0D939 /* Pods */ = {
isa = PBXGroup;
children = (
EA0E68F4285672D0306D38B1 /* Pods-Runner.debug.xcconfig */,
F19994400E82ADF824F766FF /* Pods-Runner.release.xcconfig */,
AB1D5F54BAB544003F61E88D /* Pods-Runner.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
Expand Down Expand Up @@ -179,7 +185,7 @@
);
mainGroup = 97C146E51CF9000F007C117D;
packageReferences = (
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */,
);
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
projectDirPath = "";
Expand Down Expand Up @@ -556,7 +562,7 @@
/* End XCConfigurationList section */

/* Begin XCLocalSwiftPackageReference section */
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */ = {
isa = XCLocalSwiftPackageReference;
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
};
Expand Down
4 changes: 4 additions & 0 deletions example/ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
<string>flutterbranchsdk-alternate.test-app.link</string>
<string>flutterbranchsdk.test-app.link</string>
</array>
<key>branch_disable_nativelink</key>
<false/>
<key>FlutterDeepLinkingEnabled</key>
<false/>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
</dict>
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ packages:
path: ".."
relative: true
source: path
version: "8.3.0"
version: "8.3.1"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
42 changes: 0 additions & 42 deletions ios/flutter_branch_sdk/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,45 +2,6 @@
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription
/*
import Foundation


enum ConfigurationError: Error {
case fileNotFound(String)
case parsingError(String)
case invalidFormat(String)
}

let branchDirectory = String(URL(string: #file)!.deletingLastPathComponent().absoluteString.dropLast())

func loadPubspecVersions() throws -> String {
let pubspecPath = NSString.path(withComponents: [branchDirectory,"..","..","pubspec.yaml"])
do {
let yamlString = try String(contentsOfFile: pubspecPath, encoding: .utf8)
let lines = yamlString.split(separator: "\\\\r\\\\n")

guard let packageVersionLine = lines.first(where: { $0.starts(with: "version:") }) else {
throw ConfigurationError.invalidFormat("No package version line found in pubspec.yaml: \(lines.count)")
}
var packageVersion = packageVersionLine.split(separator: ":")[1]
.trimmingCharacters(in: .whitespaces)
.replacingOccurrences(of: "+", with: "-")
packageVersion = packageVersion.replacingOccurrences(of: "^", with: "")
return packageVersion
} catch {
throw ConfigurationError.fileNotFound("Error loading or parsing pubspec.yaml \(pubspecPath) :\n Error: \(error)")
}
}

let library_version: String

do {
library_version = try loadPubspecVersions()
} catch {
fatalError("Failed to load configuration: \(error)")
}
*/

let package = Package(
name: "flutter_branch_sdk",
Expand All @@ -59,9 +20,6 @@ let package = Package(
dependencies: [
.product(name: "BranchSDK", package: "ios-branch-sdk-spm"),
],
//cSettings: [
// .define("LIBRARY_VERSION", to: "\"\(library_version)\""),
//],
linkerSettings: [
.linkedFramework("CoreServices"),
.linkedFramework("SystemConfiguration"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ let MESSAGE_CHANNEL = "flutter_branch_sdk/message";
let EVENT_CHANNEL = "flutter_branch_sdk/event";
let ERROR_CODE = "FLUTTER_BRANCH_SDK_ERROR";
let PLUGIN_NAME = "Flutter";
let PLUGIN_VERSION = "8.3.0";
let PLUGIN_VERSION = "8.3.1";
let COCOA_POD_NAME = "org.cocoapods.flutter-branch-sdk";

public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
public class FlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStreamHandler {
var eventSink: FlutterEventSink?
var initialParams : [String: Any]? = nil
var initialError : NSError? = nil
Expand All @@ -29,7 +29,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
// Plugin registry
// --------------------------------------------------------------------------------------------
public static func register(with registrar: FlutterPluginRegistrar) {
let instance = SwiftFlutterBranchSdkPlugin()
let instance = FlutterBranchSdkPlugin()

methodChannel = FlutterMethodChannel(name: MESSAGE_CHANNEL, binaryMessenger: registrar.messenger())
eventChannel = FlutterEventChannel(name: EVENT_CHANNEL, binaryMessenger: registrar.messenger())
Expand All @@ -38,30 +38,24 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream
registrar.addApplicationDelegate(instance)
registrar.addMethodCallDelegate(instance, channel: methodChannel!)
}

func getPluginVersion() -> String {

var pluginVersion : String = ""
#if SWIFT_PACKAGE
pluginVersion = PLUGIN_VERSION;
#else
if let version = Bundle(identifier: COCOA_POD_NAME)?.infoDictionary?["CFBundleShortVersionString"] as? String {
pluginVersion = version;
}
#endif

#if DEBUG
print("Plugin: \(PLUGIN_NAME) - \(pluginVersion)")
#endif
return pluginVersion
}

public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [AnyHashable : Any] = [:]) -> Bool {

Branch.getInstance().registerPluginName(PLUGIN_NAME, version: getPluginVersion())
Branch.getInstance().registerPluginName(PLUGIN_NAME, version: PLUGIN_VERSION)

let disable_nativelink : Bool = {
guard let value = Bundle.main.object(forInfoDictionaryKey: "branch_disable_nativelink") as? Bool else {
return false
}
return value
}()

print("Branch Disable NativeLink: \(String(describing:disable_nativelink))");

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

Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in
Expand Down
91 changes: 46 additions & 45 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,45 +1,46 @@
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).
repository: https://github.com/RodrigoSMarques/flutter_branch_sdk
version: 8.3.0
environment:
sdk: ">=3.3.0 <4.0.0"
flutter: ">=3.19.0"

dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter
plugin_platform_interface: ^2.1.8

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
# This section identifies this Flutter project as a plugin project.
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
# which should be registered in the plugin registry. This is required for
# using method channels.
# The Android 'package' specifies package in which the registered class is.
# This is required for using method channels on Android.
# The 'ffiPlugin' specifies that native code should be built and bundled.
# This is required for using `dart:ffi`.
# All these are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
platforms:
android:
package: br.com.rsmarques.flutter_branch_sdk
pluginClass: FlutterBranchSdkPlugin
ios:
pluginClass: SwiftFlutterBranchSdkPlugin
web:
pluginClass: FlutterBranchSdkWeb
fileName: src/flutter_branch_sdk_web.dart
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.3.1
repository: https://github.com/RodrigoSMarques/flutter_branch_sdk

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

dependencies:
flutter:
sdk: flutter
flutter_web_plugins:
sdk: flutter
plugin_platform_interface: ^2.1.8

dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0

# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec

# The following section is specific to Flutter packages.
flutter:
# This section identifies this Flutter project as a plugin project.
# The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
# which should be registered in the plugin registry. This is required for
# using method channels.
# The Android 'package' specifies package in which the registered class is.
# This is required for using method channels on Android.
# The 'ffiPlugin' specifies that native code should be built and bundled.
# This is required for using `dart:ffi`.
# All these are used by the tooling to maintain consistency when
# adding or updating assets for this project.
plugin:
platforms:
android:
package: br.com.rsmarques.flutter_branch_sdk
pluginClass: FlutterBranchSdkPlugin
ios:
pluginClass: FlutterBranchSdkPlugin
web:
pluginClass: FlutterBranchSdkWeb
fileName: src/flutter_branch_sdk_web.dart
Loading