diff --git a/CHANGELOG.md b/CHANGELOG.md index a81c482..a06d171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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) diff --git a/README.md b/README.md index 74c2680..2726bdb 100644 --- a/README.md +++ b/README.md @@ -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 `` chapter: + +```xml + branch_disable_nativelink + +``` + +### 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 `` chapter: + +```xml +FlutterDeepLinkingEnabled + +``` +#### 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 + +``` + ### Web Integration You need add Branch Javascript in your `web\index.html` at the top of your `` tag, to be able to use this package. @@ -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) diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index df6ddaa..b1c2a0f 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -41,6 +41,7 @@ + diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 00af31d..cef6aa6 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,10 +1,6 @@ PODS: - Flutter (1.0.0) - - flutter_branch_sdk (8.3.0): - - BranchSDK (~> 3.7.0) - - Flutter - DEPENDENCIES: - Flutter (from `Flutter`) @@ -15,8 +11,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_branch_sdk: 5a91002c028d3157155e34ee934c0b216bebef1d - PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 COCOAPODS: 1.16.2 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 6636b20..3ce04d0 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 60; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -49,6 +49,9 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 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 = ""; }; + 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 = ""; }; + 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 = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -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 = ""; @@ -179,7 +185,7 @@ ); mainGroup = 97C146E51CF9000F007C117D; packageReferences = ( - 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */, + 781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "FlutterGeneratedPluginSwiftPackage" */, ); productRefGroup = 97C146EF1CF9000F007C117D /* Products */; projectDirPath = ""; @@ -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; }; diff --git a/example/ios/Runner/Info.plist b/example/ios/Runner/Info.plist index 2b6d06d..4181853 100644 --- a/example/ios/Runner/Info.plist +++ b/example/ios/Runner/Info.plist @@ -74,6 +74,10 @@ flutterbranchsdk-alternate.test-app.link flutterbranchsdk.test-app.link + branch_disable_nativelink + + FlutterDeepLinkingEnabled + UIApplicationSupportsIndirectInputEvents diff --git a/example/pubspec.lock b/example/pubspec.lock index e44af97..8827b94 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -84,7 +84,7 @@ packages: path: ".." relative: true source: path - version: "8.3.0" + version: "8.3.1" flutter_lints: dependency: "direct dev" description: diff --git a/ios/flutter_branch_sdk/Package.swift b/ios/flutter_branch_sdk/Package.swift index e0e7836..26d53ae 100644 --- a/ios/flutter_branch_sdk/Package.swift +++ b/ios/flutter_branch_sdk/Package.swift @@ -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", @@ -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"), diff --git a/ios/flutter_branch_sdk/sources/flutter_branch_sdk/SwiftFlutterBranchSdkPlugin.swift b/ios/flutter_branch_sdk/sources/flutter_branch_sdk/FlutterBranchSdkPlugin.swift similarity index 97% rename from ios/flutter_branch_sdk/sources/flutter_branch_sdk/SwiftFlutterBranchSdkPlugin.swift rename to ios/flutter_branch_sdk/sources/flutter_branch_sdk/FlutterBranchSdkPlugin.swift index ae82092..50ac137 100644 --- a/ios/flutter_branch_sdk/sources/flutter_branch_sdk/SwiftFlutterBranchSdkPlugin.swift +++ b/ios/flutter_branch_sdk/sources/flutter_branch_sdk/FlutterBranchSdkPlugin.swift @@ -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 @@ -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()) @@ -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 diff --git a/pubspec.yaml b/pubspec.yaml index 9e353db..19f9437 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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 \ No newline at end of file