diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 066802d3..38587093 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -26,15 +26,16 @@ If applicable, add screenshots to help explain your problem. **Smartphone (Please complete the following information. remove session if not platform):** - Flutter: version: [e.g. 2.2.3] - Package version: [e.g. 3.3.0] - - Device: [e.g. iPhone6] - - OS: [e.g. iOS8.1] - -**Web (Please complete the following information. remove session if not platform)):** + - OS: [e.g. iOS16.0, Android 12] + - Device: [e.g. iPhone14, Google Pixel] + +**Web (please complete the following information. remove session if not platform):** - Flutter: version: [e.g. 2.2.3] - Package version: [e.g. 3.3.0] - - OS: [e.g. iOS] - - Browser [e.g. chrome, safari] - - Version [e.g. 22] + - OS: [e.g. Windows, Mac, Linux] + - Browser [e.g. chrome, safari, edge] + - Version [e.g. 22] + + - **Additional context** -**Additional context** Add any other context about the problem here. diff --git a/CHANGELOG.md b/CHANGELOG.md index 1089b15a..d55fc1cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ +## 6.3.0 +* New Method `handleDeepLink` +* Fix issue #188: `Failed to handle method call: java.lang.NullPointerException` +* Fix issue #189: `Fix crash when adding a boolean control param` +* Fix issue #190: `getTrackingAuthorizationStatus will open the iOS-dialog to requestTrackingAuthorization` + ## 6.2.1 -* Fix issue #181: `Calling the getLastAttributedTouchData() exit with exception on IOS 15.7 +* Fix issue #181: `Calling the getLastAttributedTouchData() exit with exception on IOS 15.7` ## 6.2.0 * Update `BranchStandardEvent` list. diff --git a/README.md b/README.md index 3e7797b8..f75a77e5 100644 --- a/README.md +++ b/README.md @@ -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.43.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases) +* iOS - Branch SDK Version >= 1.44.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases) Implemented functions in plugin: @@ -28,6 +28,7 @@ Init Branch Session and Deep Link| X | X | X Last Attributed Touch Data| X | X | X QR codes| X | X | X Share with LPLinkMetadata | | X | +Handle Links in Your Own App| X | X | X ## Getting Started ### Configure Branch Dashboard @@ -385,6 +386,19 @@ centerLogoUrl|String (HTTP URL)|URL to the image you want as a center logo e.g. - Method `getQRCodeAsImage` returns the QR code as a Image. - Method `getQRCodeAsData` returns the QR code as Uint8List. Can be stored in a file or converted to image. +### Handle Links in Your Own App + +Allows you to deep link into your own from your app itself + +```dart + FlutterBranchSdk.handleDeepLink( + 'https://flutterbranchsdk.test-app.link/sxz79EtAPub'); +``` + +Replace *"https://flutterbranchsdk.test-app.link/sxz79EtAPub"* with your own link URL. + +> Handling a new deep link in your app will clear the current session data and a new referred "open" will be attributed. + ### List content on Search * For Android list BUO links in Google Search with Firebase App Indexing API and locally in Google In Apps search * For iOs list BUO links in Spotlight @@ -619,6 +633,7 @@ To enable: ``` ### Enabled Clipboard Deferred Deep Linking in iOS +> Enabled by default starting with **iOS 15+ Only** Use iOS pasteboard to enable deferred deep linking. diff --git a/android/build.gradle b/android/build.gradle index 712d3eac..dad11ea6 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -39,5 +39,6 @@ dependencies { implementation 'com.google.firebase:firebase-appindexing:19.0.0' implementation 'com.google.android.gms:play-services-ads-identifier:18.0.1+' implementation 'androidx.browser:browser:1.4.0' - implementation 'androidx.lifecycle:lifecycle-runtime:2.4.1' + implementation 'androidx.lifecycle:lifecycle-runtime:2.5.1' + implementation 'androidx.browser:browser:1.4.0' } \ No newline at end of file diff --git a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkInit.java b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkInit.java index 3d3d1e59..6f09d870 100644 --- a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkInit.java +++ b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkInit.java @@ -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.0.0"; + private static final String PLUGIN_VERSION = "6.3.0"; public static void init(Context context) { ApplicationInfoHelper applicationInfoHelper = new ApplicationInfoHelper(context); diff --git a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkPlugin.java b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkPlugin.java index 569c924c..c3aa69b4 100644 --- a/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkPlugin.java +++ b/android/src/main/java/br/com/rsmarques/flutter_branch_sdk/FlutterBranchSdkPlugin.java @@ -237,6 +237,7 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) { case "getShortUrl": getShortUrl(call, result); break; + case "shareWithLPLinkMetadata": case "showShareSheet": showShareSheet(call, result); break; @@ -297,6 +298,9 @@ public void onMethodCall(@NonNull MethodCall call, @NonNull Result rawResult) { case "getQRCode": getQRCode(call, result); break; + case "handleDeepLink": + handleDeepLink(call); + break; default: result.notImplemented(); break; @@ -750,6 +754,22 @@ public void onFailure(Exception error) { result.success(response); } } + private void handleDeepLink(final MethodCall call) { + + LogUtils.debug(DEBUG_NAME, "handleDeepLink call"); + if (!(call.arguments instanceof Map)) { + throw new IllegalArgumentException("Map argument expected"); + } + HashMap argsMap = (HashMap) call.arguments; + + final String url = call.argument("url"); + + Intent intent = new Intent(context, activity.getClass()); + intent.putExtra("branch",url); + intent.putExtra("branch_force_new_session",true); + activity.startActivity(intent); + } + } diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 80391e41..9625e105 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -1,26 +1,26 @@ - - - - - CFBundleDevelopmentRegion - en - CFBundleExecutable - App - CFBundleIdentifier - io.flutter.flutter.app - CFBundleInfoDictionaryVersion - 6.0 - CFBundleName - App - CFBundlePackageType - FMWK - CFBundleShortVersionString - 1.0 - CFBundleSignature - ???? - CFBundleVersion - 1.0 - MinimumOSVersion - 9.0 - - + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 11.0 + + diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c90..88359b22 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '11.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index b7fcc920..34625716 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -21,9 +21,9 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: Branch: b5b57fc2e6f098916fd2ea26c9b66f52ffe7e293 - Flutter: 50d75fe2f02b26cc09d224853bb45737f8b3214a + Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 flutter_branch_sdk: dcf38505c8dcb3249841e2acaf323f4a39f30e2b -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: ef19549a9bc3046e7bb7d2fab4d021637c0c58a3 COCOAPODS: 1.11.3 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 15c0cdc0..194eb1be 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -343,7 +343,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -422,7 +422,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -471,7 +471,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 11.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/lib/main.dart b/example/lib/main.dart index ccfeb5db..69df7499 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -1,5 +1,4 @@ import 'dart:async'; -import 'dart:io'; import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; @@ -105,7 +104,7 @@ class _HomePageState extends State { void initDeepLinkData() { metadata = BranchContentMetaData() - ..addCustomMetadata('custom_string', 'abc') + ..addCustomMetadata('custom_string', 'abcd') ..addCustomMetadata('custom_number', 12345) ..addCustomMetadata('custom_bool', true) ..addCustomMetadata('custom_list_number', [1, 2, 3, 4, 5]) @@ -152,7 +151,7 @@ class _HomePageState extends State { ..addCustomMetadata('custom_list_number', [1, 2, 3, 4, 5]) ..addCustomMetadata('custom_list_string', ['a', 'b', 'c']), */ - //contentMetadata: metadata, + contentMetadata: metadata, keywords: ['Plugin', 'Branch', 'Flutter'], publiclyIndex: true, locallyIndex: true, @@ -172,6 +171,10 @@ class _HomePageState extends State { campaign: 'campaign', tags: ['one', 'two', 'three']) ..addControlParam('\$uri_redirect_mode', '1') + ..addControlParam('\$ios_nativelink', true) + ..addControlParam('\$match_duration', 7200) + ..addControlParam('\$always_deeplink', true) + ..addControlParam('\$android_redirect_timeout', 750) ..addControlParam('referring_user_id', 'user_id'); eventStandart = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART) @@ -215,10 +218,14 @@ class _HomePageState extends State { return; } + /* FlutterBranchSdk.validateSDKIntegration(); if (Platform.isAndroid) { showSnackBar(message: 'Check messages in run log or logcat'); } + */ + FlutterBranchSdk.handleDeepLink( + 'https://flutterbranchsdk.test-app.link/sxz79EtAPub'); } void enableTracking() { @@ -375,7 +382,7 @@ class _HomePageState extends State { builder: (_) { return Container( padding: const EdgeInsets.all(12), - height: 150, + height: 200, child: Column( children: [ const Center( @@ -400,6 +407,18 @@ class _HomePageState extends State { }, child: const Center(child: Text('Copy link'))), ), + const SizedBox( + height: 10, + ), + IntrinsicWidth( + stepWidth: 300, + child: CustomButton( + onPressed: () { + FlutterBranchSdk.handleDeepLink(url); + Navigator.pop(this.context); + }, + child: const Center(child: Text('Handle deep link'))), + ), ], ), ); @@ -479,17 +498,11 @@ class _HomePageState extends State { .asUint8List(); */ - if (Platform.isIOS) { - FlutterBranchSdk.shareWithLPLinkMetadata( - buo: buo!, - linkProperties: lp, - title: "Share With LPLinkMetadata", - icon: iconData); - } else { - showSnackBar( - message: 'shareWithLPLinkMetadata() available only in iOS devices'); - return; - } + FlutterBranchSdk.shareWithLPLinkMetadata( + buo: buo!, + linkProperties: lp, + title: "Share With LPLinkMetadata", + icon: iconData); } @override diff --git a/example/pubspec.lock b/example/pubspec.lock index d7ee612f..443b456e 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -61,7 +61,7 @@ packages: path: ".." relative: true source: path - version: "6.2.0" + version: "6.3.0" flutter_lints: dependency: "direct dev" description: diff --git a/ios/Classes/FlutterBranchIoSdkHelper.swift b/ios/Classes/FlutterBranchIoSdkHelper.swift index 12854000..213a2b84 100644 --- a/ios/Classes/FlutterBranchIoSdkHelper.swift +++ b/ios/Classes/FlutterBranchIoSdkHelper.swift @@ -263,9 +263,9 @@ extension Bundle { } public var icon: UIImage? { if let icons = infoDictionary?["CFBundleIcons"] as? [String: Any], - let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], - let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], - let lastIcon = iconFiles.last { + let primaryIcon = icons["CFBundlePrimaryIcon"] as? [String: Any], + let iconFiles = primaryIcon["CFBundleIconFiles"] as? [String], + let lastIcon = iconFiles.last { return UIImage(named: lastIcon) } return nil @@ -315,5 +315,5 @@ extension UIImage { } } } - + } diff --git a/ios/Classes/SwiftFlutterBranchSdkPlugin.swift b/ios/Classes/SwiftFlutterBranchSdkPlugin.swift index 472a5a61..63b83166 100644 --- a/ios/Classes/SwiftFlutterBranchSdkPlugin.swift +++ b/ios/Classes/SwiftFlutterBranchSdkPlugin.swift @@ -10,7 +10,7 @@ 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 = "6.0.0" +let PLUGIN_VERSION = "6.3.0" public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStreamHandler { var eventSink: FlutterEventSink? @@ -78,6 +78,8 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream if checkPasteboard { Branch.getInstance().checkPasteboardOnInstall() + } else if #available(iOS 15.0, *) { + Branch.getInstance().checkPasteboardOnInstall() } Branch.getInstance().initSession(launchOptions: launchOptions) { (params, error) in @@ -201,7 +203,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream requestTrackingAuthorization(result: result) break case "getTrackingAuthorizationStatus" : - requestTrackingAuthorization(result: result) + getTrackingAuthorizationStatus(result: result) break case "getAdvertisingIdentifier" : getAdvertisingIdentifier(result: result) @@ -226,6 +228,10 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream break case"shareWithLPLinkMetadata": shareWithLPLinkMetadata(call: call, result: result) + break + case"handleDeepLink": + handleDeepLink(call: call) + break default: result(FlutterMethodNotImplemented) break @@ -558,6 +564,12 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream } } + private func handleDeepLink(call: FlutterMethodCall) { + let args = call.arguments as! [String: Any?] + let url = args["url"] as! String + Branch.getInstance().handleDeepLink(withNewSession: URL(string: url)) + } + /* https://developer.apple.com/documentation/apptrackingtransparency/attrackingmanager diff --git a/lib/src/flutter_branch_sdk.dart b/lib/src/flutter_branch_sdk.dart index b7bd045c..3eaeec75 100644 --- a/lib/src/flutter_branch_sdk.dart +++ b/lib/src/flutter_branch_sdk.dart @@ -203,4 +203,8 @@ class FlutterBranchSdk { FlutterBranchSdkPlatform.instance.shareWithLPLinkMetadata( buo: buo, linkProperties: linkProperties, icon: icon, title: title); } + + static void handleDeepLink(String url) { + FlutterBranchSdkPlatform.instance.handleDeepLink(url); + } } diff --git a/lib/src/flutter_branch_sdk_method_channel.dart b/lib/src/flutter_branch_sdk_method_channel.dart index 2c943f23..2c3a652b 100644 --- a/lib/src/flutter_branch_sdk_method_channel.dart +++ b/lib/src/flutter_branch_sdk_method_channel.dart @@ -1,6 +1,8 @@ import 'dart:io'; -import 'dart:typed_data'; +//import 'dart:typed_data'; + +import 'package:flutter/foundation.dart'; import 'package:flutter/services.dart'; import 'package:flutter/widgets.dart'; @@ -331,10 +333,15 @@ class FlutterBranchSdkMethodChannel implements FlutterBranchSdkPlatform { params['messageText'] = title; params['iconData'] = icon; - if (Platform.isIOS) { - messageChannel.invokeMethod('shareWithLPLinkMetadata', params); - } else { - messageChannel.invokeMethod('showShareSheet', {params}); + messageChannel.invokeMethod('shareWithLPLinkMetadata', params); + } + + ///Have Branch end the current deep link session and start a new session with the provided URL. + @override + void handleDeepLink(String url) { + if (url.isEmpty) { + throw ArgumentError('url is required'); } + messageChannel.invokeMethod('handleDeepLink', {'url': url}); } } diff --git a/lib/src/flutter_branch_sdk_platform_interface.dart b/lib/src/flutter_branch_sdk_platform_interface.dart index 5c0c2bd4..becd1693 100644 --- a/lib/src/flutter_branch_sdk_platform_interface.dart +++ b/lib/src/flutter_branch_sdk_platform_interface.dart @@ -218,4 +218,9 @@ abstract class FlutterBranchSdkPlatform extends PlatformInterface { throw UnimplementedError( 'shareWithLPLinkMetadata has not been implemented'); } + + ///Have Branch end the current deep link session and start a new session with the provided URL. + void handleDeepLink(String url) async { + throw UnimplementedError('handleDeepLink has not been implemented'); + } } diff --git a/lib/src/flutter_branch_sdk_web.dart b/lib/src/flutter_branch_sdk_web.dart index 53a071f3..af7cde71 100644 --- a/lib/src/flutter_branch_sdk_web.dart +++ b/lib/src/flutter_branch_sdk_web.dart @@ -4,7 +4,7 @@ // ignore: avoid_web_libraries_in_flutter import 'dart:async'; import 'dart:convert'; -import 'dart:js'; +import 'dart:js' as js; import 'dart:js_util'; import 'dart:typed_data'; @@ -57,7 +57,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { final Completer> response = Completer(); try { - BranchJS.data(allowInterop((err, data) { + BranchJS.data(js.allowInterop((err, data) { if (err == null) { if (data != null) { var responseData = @@ -84,7 +84,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { Completer>(); try { - BranchJS.first(allowInterop((err, data) { + BranchJS.first(js.allowInterop((err, data) { if (err == null) { if (data != null) { var responseData = @@ -108,7 +108,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { @override void setIdentity(String userId) { try { - BranchJS.setIdentity(userId, allowInterop((error, data) { + BranchJS.setIdentity(userId, js.allowInterop((error, data) { if (error == null) { _userIdentified = true; } @@ -122,7 +122,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { @override void logout() { try { - BranchJS.logout(allowInterop((error) { + BranchJS.logout(js.allowInterop((error) { if (error == null) { _userIdentified = false; } @@ -158,7 +158,8 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { Completer responseCompleter = Completer(); try { - BranchJS.link(_dartObjectToJsObject(linkData), allowInterop((err, url) { + BranchJS.link(_dartObjectToJsObject(linkData), + js.allowInterop((err, url) { if (err == null) { responseCompleter.complete(BranchResponse.success(result: url)); } else { @@ -203,7 +204,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { void trackContent( {required List buo, required BranchEvent branchEvent}) { - JsArray contentItems = JsArray(); + js.JsArray contentItems = js.JsArray(); for (var element in buo) { contentItems.add(_dartObjectToJsObject(element.toMap())); @@ -354,7 +355,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { try { BranchJS.lastAttributedTouchData(attributionWindow, - allowInterop((err, data) { + js.allowInterop((err, data) { if (err == null) { if (data != null) { responseCompleter.complete( @@ -368,7 +369,6 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { } })); } catch (e) { - print(e); debugPrint('getLastAttributedTouchData() error: ${e.toString()}'); responseCompleter.complete(BranchResponse.error( errorCode: '-1', errorMessage: 'getLastAttributedTouchData() error')); @@ -394,7 +394,7 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { try { BranchJS.qrCode(_dartObjectToJsObject(linkData), _dartObjectToJsObject(qrCodeSettings.toMap()), - allowInterop((err, qrCode) { + js.allowInterop((err, qrCode) { if (err == null) { if (qrCode != null) { responseCompleter.complete( @@ -447,8 +447,16 @@ class FlutterBranchSdkWeb extends FlutterBranchSdkPlatform { required BranchLinkProperties linkProperties, required Uint8List icon, required String title}) { - throw UnsupportedError( - 'shareWithLPLinkMetadata() Not available in Branch JS SDK'); + //throw UnsupportedError( + // 'shareWithLPLinkMetadata() Not available in Branch JS SDK'); + showShareSheet( + buo: buo, linkProperties: linkProperties, messageText: title); + } + + ///Have Branch end the current deep link session and start a new session with the provided URL. + @override + void handleDeepLink(String url) { + js.context.callMethod('open', [url, '_self']); } void close() { diff --git a/lib/src/objects/branch_universal_object.dart b/lib/src/objects/branch_universal_object.dart index a63beed4..7bf75421 100644 --- a/lib/src/objects/branch_universal_object.dart +++ b/lib/src/objects/branch_universal_object.dart @@ -38,7 +38,7 @@ class BranchUniversalObject { bool publiclyIndex = true; /* Any keyword associated with the content. Used for indexing */ - List keywords; + List keywords; /* Expiry date for the content and any associated links. Represented as epoch milli second */ int expirationDateInMilliSec = 0; @@ -61,7 +61,7 @@ class BranchUniversalObject { this.expirationDateInMilliSec = 0}); ///Adds any keywords associated with the content referred - void addKeyWords(List keywords) { + void addKeyWords(List keywords) { keywords.addAll(keywords); } @@ -76,7 +76,7 @@ class BranchUniversalObject { } ///Get the keywords associated with this BranchUniversalObject - List getKeywords() { + List getKeywords() { return keywords; } diff --git a/lib/src/objects/content_meta_data.dart b/lib/src/objects/content_meta_data.dart index b232c0a6..ca0469c5 100644 --- a/lib/src/objects/content_meta_data.dart +++ b/lib/src/objects/content_meta_data.dart @@ -352,6 +352,7 @@ class BranchContentMetaData { } BranchContentMetaData addCustomMetadata(String key, dynamic value) { + assert(value != null, 'Null value not allowed in CustomMetadata'); _customMetadata[key] = value; return this; } diff --git a/lib/src/objects/link_properties.dart b/lib/src/objects/link_properties.dart index b84faf05..00d28a4e 100644 --- a/lib/src/objects/link_properties.dart +++ b/lib/src/objects/link_properties.dart @@ -37,7 +37,11 @@ class BranchLinkProperties { } BranchLinkProperties addControlParam(String key, dynamic value) { - _controlParams[key] = value; + assert(value != null, 'Null value not allowed in ControlParam'); + if (value is List) { + throw ArgumentError('List value not allowed in ControlParms '); + } + _controlParams[key] = value.toString(); return this; } diff --git a/pubspec.yaml b/pubspec.yaml index afd79f8a..d1748194 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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: 6.2.1 +version: 6.3.0 homepage: https://github.com/RodrigoSMarques/flutter_branch_sdk environment: