From a0c1d297ad9410e6d8845fb8080e0c7abd20eb19 Mon Sep 17 00:00:00 2001 From: Rodrigo de Souza Marques Date: Wed, 24 Jan 2024 00:27:16 -0300 Subject: [PATCH 1/4] Updated README / Sample App --- README.md | 2 +- example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Podfile.lock | 2 +- example/ios/Runner.xcodeproj/project.pbxproj | 6 +-- example/lib/main.dart | 40 ++++++++++++++------ example/pubspec.lock | 8 ++-- pubspec.lock | 8 ++-- pubspec.yaml | 4 +- 8 files changed, 45 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 00d17c95..4c88e70a 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,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.7.+ [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases) +* Android - Branch SDK Version >= 5.8.+ [Android Version History](https://github.com/BranchMetrics/android-branch-deep-linking-attribution/releases) * iOS - Branch SDK Version >= 3.0.+ [iOS Version History](https://github.com/BranchMetrics/ios-branch-deep-linking-attribution/releases) Implemented functions in plugin: diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9625e105..7c569640 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 11.0 + 12.0 diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index bd55e087..81e7b229 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -21,7 +21,7 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: BranchSDK: e9c0332b2655cf0357d93db479d07152b059e434 - Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854 + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 flutter_branch_sdk: 074b3a7e9c8214c3f19c1b72840c114abb641b06 PODFILE CHECKSUM: 4e8f8b2be68aeea4c0d5beb6ff1e79fface1d048 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index 5ea006b6..1c89b08b 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -346,7 +346,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -425,7 +425,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -474,7 +474,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 11.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; diff --git a/example/lib/main.dart b/example/lib/main.dart index 93945277..f60bb8a6 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -124,14 +124,17 @@ class _HomePageState extends State { data['+clicked_branch_link'] == true) { print( '------------------------------------Link clicked----------------------------------------------'); + print('Title: ${data['\$og_title']}'); print('Custom string: ${data['custom_string']}'); print('Custom number: ${data['custom_number']}'); print('Custom bool: ${data['custom_bool']}'); + print('Custom date: ${data['custom_date_created']}'); print('Custom list number: ${data['custom_list_number']}'); print( '------------------------------------------------------------------------------------------------'); showSnackBar( - message: 'Link clicked: Custom string - ${data['custom_string']}', + message: + 'Link clicked: Custom string - ${data['custom_string']} - Date: ${data['custom_date_created'] ?? ''}', duration: 10); } }, onError: (error) { @@ -140,13 +143,21 @@ class _HomePageState extends State { } void initDeepLinkData() { + final DateTime today = DateTime.now(); + String dateString = + '${today.year}-${today.month}-${today.day} ${today.hour}:${today.minute}:${today.second}'; + String dateKey = + '${today.year}${today.month}${today.day}_${today.hour}${today.minute}${today.second}'; + metadata = BranchContentMetaData() ..addCustomMetadata('custom_string', 'abcd') ..addCustomMetadata('custom_number', 12345) ..addCustomMetadata('custom_bool', true) ..addCustomMetadata('custom_list_number', [1, 2, 3, 4, 5]) ..addCustomMetadata('custom_list_string', ['a', 'b', 'c']) - //--optional Custom Metadata + ..addCustomMetadata('custom_date_created', dateString); + //--optional Custom Metadata + /* ..contentSchema = BranchContentSchema.COMMERCE_PRODUCT ..price = 50.99 ..currencyType = BranchCurrencyType.BRL @@ -168,18 +179,18 @@ class _HomePageState extends State { country: 'Brazil', postalCode: '99999-987') ..setLocation(31.4521685, -114.7352207); - + */ buo = BranchUniversalObject( - canonicalIdentifier: 'flutter/branch', + canonicalIdentifier: 'flutter/branch_$dateKey', //parameter canonicalUrl //If your content lives both on the web and in the app, make sure you set its canonical URL // (i.e. the URL of this piece of content on the web) when building any BUO. // By doing so, we’ll attribute clicks on the links that you generate back to their original web page, // even if the user goes to the app instead of your website! This will help your SEO efforts. canonicalUrl: 'https://flutter.dev', - title: 'Flutter Branch Plugin', + title: 'Flutter Branch Plugin - $dateString', imageUrl: imageURL, - contentDescription: 'Flutter Branch Description', + contentDescription: 'Flutter Branch Description - $dateString', /* contentMetadata: BranchContentMetaData() ..addCustomMetadata('custom_string', 'abc') @@ -195,15 +206,16 @@ class _HomePageState extends State { expirationDateInMilliSec: DateTime.now() .add(const Duration(days: 365)) .millisecondsSinceEpoch); - + var id = 2; lp = BranchLinkProperties( - channel: 'facebook', + channel: 'share', feature: 'sharing', //parameter alias //Instead of our standard encoded short url, you can specify the vanity alias. // For example, instead of a random string of characters/integers, you can set the vanity alias as *.app.link/devonaustin. // Aliases are enforced to be unique** and immutable per domain, and per link - they cannot be reused unless deleted. //alias: 'https://branch.io' //define link url, + //alias: 'p/$id', //define link url, stage: 'new share', campaign: 'campaign', tags: ['one', 'two', 'three']) @@ -212,7 +224,10 @@ class _HomePageState extends State { ..addControlParam('\$match_duration', 7200) ..addControlParam('\$always_deeplink', true) ..addControlParam('\$android_redirect_timeout', 750) - ..addControlParam('referring_user_id', 'user_id'); + ..addControlParam('referring_user_id', 'user_id') //; + ..addControlParam('\$ios_url', 'https://flutter-branch-sdk.netlify.app/') + ..addControlParam( + '\$android_url', 'https://flutter-branch-sdk.netlify.app/'); eventStandard = BranchEvent.standardEvent(BranchStandardEvent.ADD_TO_CART) //--optional Event data @@ -358,6 +373,7 @@ class _HomePageState extends State { } void generateLink(BuildContext context) async { + initDeepLinkData(); BranchResponse response = await FlutterBranchSdk.getShortUrl(buo: buo, linkProperties: lp); if (response.success) { @@ -389,8 +405,8 @@ class _HomePageState extends State { print( 'Error : ${responseQrCodeData.errorCode} - ${responseQrCodeData.errorMessage}'); } - */ + initDeepLinkData(); BranchResponse responseQrCodeImage = await FlutterBranchSdk.getQRCodeAsImage( buo: buo, @@ -413,6 +429,7 @@ class _HomePageState extends State { } void showGeneratedLink(BuildContext context, String url) async { + initDeepLinkData(); showModalBottomSheet( isDismissible: true, isScrollControlled: true, @@ -505,6 +522,7 @@ class _HomePageState extends State { } void shareLink() async { + initDeepLinkData(); BranchResponse response = await FlutterBranchSdk.showShareSheet( buo: buo, linkProperties: lp, @@ -539,7 +557,7 @@ class _HomePageState extends State { .buffer .asUint8List(); */ - + initDeepLinkData(); FlutterBranchSdk.shareWithLPLinkMetadata( buo: buo, linkProperties: lp, diff --git a/example/pubspec.lock b/example/pubspec.lock index 889c3f44..65e5ecc2 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -91,10 +91,10 @@ packages: dependency: transitive description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b" url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.7.0" lints: dependency: transitive description: @@ -139,10 +139,10 @@ packages: dependency: transitive description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.lock b/pubspec.lock index feb6552b..6e4cd8e9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -76,10 +76,10 @@ packages: dependency: "direct main" description: name: js - sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + sha256: "4186c61b32f99e60f011f7160e32c89a758ae9b1d0c6d28e2c02ef0382300e2b" url: "https://pub.dev" source: hosted - version: "0.6.7" + version: "0.7.0" lints: dependency: transitive description: @@ -124,10 +124,10 @@ packages: dependency: "direct main" description: name: plugin_platform_interface - sha256: f4f88d4a900933e7267e2b353594774fc0d07fb072b47eedcd5b54e1ea3269f8 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" url: "https://pub.dev" source: hosted - version: "2.1.7" + version: "2.1.8" sky_engine: dependency: transitive description: flutter diff --git a/pubspec.yaml b/pubspec.yaml index a4558692..595a5e64 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,8 +12,8 @@ dependencies: sdk: flutter flutter_web_plugins: sdk: flutter - plugin_platform_interface: ^2.1.7 - js: ^0.6.7 + plugin_platform_interface: ^2.1.8 + js: ^0.7.0 dev_dependencies: flutter_test: From 1d5dc52cb44f163f0c34149b8a8ca0e9b3a54550 Mon Sep 17 00:00:00 2001 From: Rodrigo de Souza Marques Date: Wed, 24 Jan 2024 08:40:59 -0300 Subject: [PATCH 2/4] Update main.dart --- example/lib/main.dart | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/example/lib/main.dart b/example/lib/main.dart index f60bb8a6..9b8b422b 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -138,7 +138,7 @@ class _HomePageState extends State { duration: 10); } }, onError: (error) { - print('listSesseion error: ${error.toString()}'); + print('listSession error: ${error.toString()}'); }); } @@ -206,7 +206,6 @@ class _HomePageState extends State { expirationDateInMilliSec: DateTime.now() .add(const Duration(days: 365)) .millisecondsSinceEpoch); - var id = 2; lp = BranchLinkProperties( channel: 'share', feature: 'sharing', From 84e4979864bf692ef14d811d300b2c3e84bf58ae Mon Sep 17 00:00:00 2001 From: jamieastley <6836556+jamieastley@users.noreply.github.com> Date: Thu, 25 Jan 2024 12:05:37 +1100 Subject: [PATCH 3/4] export platform_interface --- lib/flutter_branch_sdk.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/flutter_branch_sdk.dart b/lib/flutter_branch_sdk.dart index 1e7f3260..cf430dcc 100644 --- a/lib/flutter_branch_sdk.dart +++ b/lib/flutter_branch_sdk.dart @@ -11,6 +11,7 @@ import 'src/flutter_branch_sdk_platform_interface.dart'; import 'src/objects/app_tracking_transparency.dart'; import 'src/objects/branch_universal_object.dart'; +export 'src/flutter_branch_sdk_platform_interface.dart'; export 'src/objects/app_tracking_transparency.dart'; export 'src/objects/branch_universal_object.dart'; From 155a516d29b6d67f4350fbab41fb92dd017c8aae Mon Sep 17 00:00:00 2001 From: Rodrigo de Souza Marques Date: Thu, 1 Feb 2024 09:37:36 -0300 Subject: [PATCH 4/4] Release 7.0.3 ### Issues * Fix issue #277 : PlatformException - NullPointerException ### Features * PR #286 : fix: export platform_interface * Updated configuration steps in README.MD * Sample app - code review --- CHANGELOG.md | 10 +++++ README.md | 19 +++++---- .../gradle/wrapper/gradle-wrapper.properties | 6 +++ .../FlutterBranchSdkPlugin.java | 10 +++++ example/lib/main.dart | 42 ++++++++++--------- example/pubspec.lock | 42 ++++++++++++++++++- example/pubspec.yaml | 3 +- ios/Classes/SwiftFlutterBranchSdkPlugin.swift | 26 ++++++------ .../flutter_branch_sdk_method_channel.dart | 2 +- pubspec.yaml | 2 +- 10 files changed, 116 insertions(+), 46 deletions(-) create mode 100644 android/gradle/wrapper/gradle-wrapper.properties diff --git a/CHANGELOG.md b/CHANGELOG.md index 5568aef5..738a12cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## 7.0.3 +### Issues + +* Fix issue #277 : PlatformException - NullPointerException + +### Features +* PR #286 : fix: export platform_interface +* Updated configuration steps in README.MD +* Sample app - code review + ## 7.0.2 ### Issues diff --git a/README.md b/README.md index 4c88e70a..eb292560 100644 --- a/README.md +++ b/README.md @@ -35,28 +35,29 @@ Handle Links in Your Own App| X | X | X ## Getting Started ### Configure Branch Dashboard * Register Your App -* Complete the Basic integration in [Branch Dashboard](https://dashboard.branch.io/login) +* Configure Branch Dashboard [Branch Dashboard](https://dashboard.branch.io/login) For details see: -* [iOS - only section: **Configure Branch**](https://help.branch.io/developers-hub/docs/ios-basic-integration#configure-branch) -* [Android - only section: **Configure Branch Dashboard**](https://help.branch.io/developers-hub/docs/android-basic-integration#configure-branch-dashboard) +* [iOS: only section: **Configure Branch Dashboard**](https://help.branch.io/developers-hub/docs/ios-basic-integration#1-configure-branch-dashboard) +* [Android - only section: **Configure Branch Dashboard**](https://help.branch.io/developers-hub/docs/android-basic-integration#1-configure-branch-dashboard) ## Configure Platform Project ### Android Integration -Follow the steps on the page [https://help.branch.io/developers-hub/docs/android-basic-integration#configure-app](https://help.branch.io/developers-hub/docs/android-basic-integration#configure-app), session _**Configure app**_: +Follow the steps: -* Add Branch to your `AndroidManifest.xml` +* [Configure App](https://help.branch.io/developers-hub/docs/android-basic-integration#4-configure-app) +* [Configure ProGuard](https://help.branch.io/developers-hub/docs/android-basic-integration#7-configure-proguard) - ### iOS Integration -Follow the steps on the page [https://help.branch.io/developers-hub/docs/ios-basic-integration#configure-bundle-identifier](https://help.branch.io/developers-hub/docs/ios-basic-integration#configure-bundle-identifier), from session ```Configure bundle identifier```: +Follow the steps: -* Configure bundle identifier -* Configure associated domains -* Configure Info.plist +* [Configure bundle identifier](https://help.branch.io/developers-hub/docs/ios-basic-integration#2-configure-bundle-identifier) +* [Configure associated domains](https://help.branch.io/developers-hub/docs/ios-basic-integration#3-configure-associated-domains) +* [Configure Info.plist](https://help.branch.io/developers-hub/docs/ios-basic-integration#4-configure-infoplist) #### NativeLink™ Deferred Deep Linking Use iOS pasteboard to enable deferred deep linking via Branch NativeLink™, which enables 100% matching on iOS through Installs. diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..42defcc9 --- /dev/null +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +networkTimeout=10000 +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists 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 e98d98c3..2c0b6f87 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 @@ -179,6 +179,8 @@ public void onActivityCreated(@NonNull Activity activity, Bundle bundle) { public void onActivityStarted(@NonNull Activity activity) { LogUtils.debug(DEBUG_NAME, "triggered onActivityStarted"); if (!isInitialized) { + // Delay session initialization + Branch.expectDelayedSessionInitialization(true); return; } LogUtils.debug(DEBUG_NAME, "triggered SessionBuilder init"); @@ -374,6 +376,7 @@ private void setupBranch(MethodCall call, final Result result) { if (isInitialized) { result.success(Boolean.TRUE); } + HashMap argsMap = (HashMap) call.arguments; if ((Boolean) argsMap.get("useTestKey")) { Branch.enableTestMode(); @@ -433,6 +436,13 @@ private void setupBranch(MethodCall call, final Result result) { Branch.getInstance().disableTracking(true); } isInitialized = true; + + if (this.activity == null) { + initialIntent = null; + result.success(Boolean.TRUE); + return; + } + if (initialIntent == null) { initialIntent = new Intent(this.context, this.activity.getClass()); initialIntent.setAction(Intent.ACTION_MAIN); diff --git a/example/lib/main.dart b/example/lib/main.dart index 9b8b422b..e734ab0f 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -5,6 +5,7 @@ import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_branch_sdk/flutter_branch_sdk.dart'; +import 'package:uuid/uuid.dart'; import 'custom_button.dart'; @@ -80,8 +81,6 @@ class _HomePageState extends State { initDeepLinkData(); - FlutterBranchSdk.setIdentity('branch_user_test'); - //requestATTTracking(); } @@ -146,8 +145,6 @@ class _HomePageState extends State { final DateTime today = DateTime.now(); String dateString = '${today.year}-${today.month}-${today.day} ${today.hour}:${today.minute}:${today.second}'; - String dateKey = - '${today.year}${today.month}${today.day}_${today.hour}${today.minute}${today.second}'; metadata = BranchContentMetaData() ..addCustomMetadata('custom_string', 'abcd') @@ -180,25 +177,19 @@ class _HomePageState extends State { postalCode: '99999-987') ..setLocation(31.4521685, -114.7352207); */ + + final canonicalIdentifier = const Uuid().v4(); buo = BranchUniversalObject( - canonicalIdentifier: 'flutter/branch_$dateKey', + canonicalIdentifier: 'flutter/branch_$canonicalIdentifier', //parameter canonicalUrl //If your content lives both on the web and in the app, make sure you set its canonical URL // (i.e. the URL of this piece of content on the web) when building any BUO. // By doing so, we’ll attribute clicks on the links that you generate back to their original web page, // even if the user goes to the app instead of your website! This will help your SEO efforts. - canonicalUrl: 'https://flutter.dev', + //canonicalUrl: 'https://flutter.dev', title: 'Flutter Branch Plugin - $dateString', imageUrl: imageURL, contentDescription: 'Flutter Branch Description - $dateString', - /* - contentMetadata: BranchContentMetaData() - ..addCustomMetadata('custom_string', 'abc') - ..addCustomMetadata('custom_number', 12345) - ..addCustomMetadata('custom_bool', true) - ..addCustomMetadata('custom_list_number', [1, 2, 3, 4, 5]) - ..addCustomMetadata('custom_list_string', ['a', 'b', 'c']), - */ contentMetadata: metadata, keywords: ['Plugin', 'Branch', 'Flutter'], publiclyIndex: true, @@ -254,7 +245,7 @@ class _HomePageState extends State { 'Custom_Event_Property_Key2', 'Custom_Event_Property_val2'); } - void showSnackBar({required String message, int duration = 1}) { + void showSnackBar({required String message, int duration = 2}) { scaffoldMessengerKey.currentState!.removeCurrentSnackBar(); scaffoldMessengerKey.currentState!.showSnackBar( SnackBar( @@ -287,14 +278,25 @@ class _HomePageState extends State { showSnackBar(message: 'Tracking disabled'); } - void identifyUser() { - FlutterBranchSdk.setIdentity('branch_user_test'); - showSnackBar(message: 'User branch_user_test identfied'); + void identifyUser() async { + final isUserIdentified = await FlutterBranchSdk.isUserIdentified(); + if (isUserIdentified) { + showSnackBar(message: 'User logged in'); + return; + } + final userId = const Uuid().v4(); + FlutterBranchSdk.setIdentity(userId); + showSnackBar(message: 'User identified: $userId'); } - void userLogout() { + void userLogout() async { + final isUserIdentified = await FlutterBranchSdk.isUserIdentified(); + if (!isUserIdentified) { + showSnackBar(message: 'No users logged in'); + return; + } FlutterBranchSdk.logout(); - showSnackBar(message: 'User branch_user_test logout'); + showSnackBar(message: 'User logout'); } void registerView() { diff --git a/example/pubspec.lock b/example/pubspec.lock index 65e5ecc2..70c832bd 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -41,6 +41,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.18.0" + crypto: + dependency: transitive + description: + name: crypto + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab + url: "https://pub.dev" + source: hosted + version: "3.0.3" cupertino_icons: dependency: "direct main" description: @@ -57,6 +65,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.3.1" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -68,7 +84,7 @@ packages: path: ".." relative: true source: path - version: "7.0.2" + version: "7.0.3" flutter_lints: dependency: "direct dev" description: @@ -156,6 +172,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.10.0" + sprintf: + dependency: transitive + description: + name: sprintf + sha256: "1fc9ffe69d4df602376b52949af107d8f5703b77cda567c4d7d86a0693120f23" + url: "https://pub.dev" + source: hosted + version: "7.0.0" stack_trace: dependency: transitive description: @@ -196,6 +220,22 @@ packages: url: "https://pub.dev" source: hosted version: "0.6.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c + url: "https://pub.dev" + source: hosted + version: "1.3.2" + uuid: + dependency: "direct main" + description: + name: uuid + sha256: cd210a09f7c18cbe5a02511718e0334de6559871052c90a90c0cca46a4aa81c8 + url: "https://pub.dev" + source: hosted + version: "4.3.3" vector_math: dependency: transitive description: diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 07dc5644..8b6cf69b 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -28,7 +28,8 @@ dependencies: # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. - cupertino_icons: ^1.0.2 + cupertino_icons: ^1.0.6 + uuid: ^4.3.3 dev_dependencies: flutter_test: diff --git a/ios/Classes/SwiftFlutterBranchSdkPlugin.swift b/ios/Classes/SwiftFlutterBranchSdkPlugin.swift index 7fcbaaf0..e0a86a73 100644 --- a/ios/Classes/SwiftFlutterBranchSdkPlugin.swift +++ b/ios/Classes/SwiftFlutterBranchSdkPlugin.swift @@ -35,7 +35,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream var requestMetadata : [String: String] = [:] var facebookParameters : [String: String] = [:] var snapParameters : [String: String] = [:] - + //--------------------------------------------------------------------------------------------- // Plugin registry // -------------------------------------------------------------------------------------------- @@ -157,7 +157,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream break case "setRequestMetadata": setRequestMetadata(call: call); - break; + break case "logout": logout() break @@ -238,13 +238,13 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream if let _ = branch { result(true) } - + let args = call.arguments as! [String: Any?] - + #if DEBUG NSLog("setupBranch args: %@", args) #endif - + if args["useTestKey"] as! Bool == true { Branch.setUseTestBranchKey(true) } @@ -256,7 +256,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream branch = Branch.getInstance() branch!.registerPluginName(PLUGIN_NAME, version: args["version"] as! String) - + #if DEBUG if args["enableLogging"] as! Bool == true { branch!.enableLogging() @@ -267,7 +267,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream if #available(iOS 15, *) { branch!.checkPasteboardOnInstall() } - + if (!requestMetadata.isEmpty) { for param in requestMetadata { Branch.getInstance().setRequestMetadataKey(param.key, value: param.value) @@ -283,7 +283,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream Branch.getInstance().addFacebookPartnerParameter(withName: param.key, value: param.value) } } - + branch!.initSession(launchOptions: initialLaunchOptions) { (params, error) in if error == nil { print("Branch InitSession params: \(String(describing: params as? [String: Any]))") @@ -500,7 +500,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream } return; } - + DispatchQueue.main.async { self.branch!.setRequestMetadataKey(key, value: value) } @@ -564,7 +564,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream } } } - + private func isUserIdentified(result: @escaping FlutterResult) { DispatchQueue.main.async { result(self.branch!.isUserIdentified()) @@ -676,7 +676,7 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream Branch.getInstance().addFacebookPartnerParameter(withName: key, value:value) } } - + private func addSnapPartnerParameter(call: FlutterMethodCall) { let args = call.arguments as! [String: Any?] let key = args["key"] as! String @@ -690,12 +690,12 @@ public class SwiftFlutterBranchSdkPlugin: NSObject, FlutterPlugin, FlutterStream } return; } - + DispatchQueue.main.async { Branch.getInstance().addSnapPartnerParameter(withName: key, value:value) } } - + private func setPreinstallCampaign(call: FlutterMethodCall) { } diff --git a/lib/src/flutter_branch_sdk_method_channel.dart b/lib/src/flutter_branch_sdk_method_channel.dart index 142a28da..9bf559cd 100644 --- a/lib/src/flutter_branch_sdk_method_channel.dart +++ b/lib/src/flutter_branch_sdk_method_channel.dart @@ -9,7 +9,7 @@ import 'objects/branch_universal_object.dart'; /// An implementation of [FlutterBranchSdkPlatform] that uses method channels. class FlutterBranchSdkMethodChannel implements FlutterBranchSdkPlatform { - static const PLUGIN_VERSION = "7.0.2"; + static const PLUGIN_VERSION = "7.0.3"; static const MESSAGE_CHANNEL = 'flutter_branch_sdk/message'; static const EVENT_CHANNEL = 'flutter_branch_sdk/event'; diff --git a/pubspec.yaml b/pubspec.yaml index 595a5e64..1e6651e1 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: 7.0.2 +version: 7.0.3 homepage: https://github.com/RodrigoSMarques/flutter_branch_sdk environment: