Skip to content

Commit

Permalink
Merge pull request #191 from RodrigoSMarques/dev
Browse files Browse the repository at this point in the history
Version 6.3.0
  • Loading branch information
RodrigoSMarques authored Nov 13, 2022
2 parents 708aaa2 + 80c8551 commit 1ac419d
Show file tree
Hide file tree
Showing 22 changed files with 185 additions and 88 deletions.
17 changes: 9 additions & 8 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
17 changes: 16 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.

Expand Down
3 changes: 2 additions & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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<String, Object> argsMap = (HashMap<String, Object>) 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);
}

}


52 changes: 26 additions & 26 deletions example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>9.0</string>
</dict>
</plist>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>App</string>
<key>CFBundleIdentifier</key>
<string>io.flutter.flutter.app</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>App</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>11.0</string>
</dict>
</plist>
2 changes: 1 addition & 1 deletion example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
4 changes: 2 additions & 2 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
43 changes: 28 additions & 15 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
Expand Down Expand Up @@ -105,7 +104,7 @@ class _HomePageState extends State<HomePage> {

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])
Expand Down Expand Up @@ -152,7 +151,7 @@ class _HomePageState extends State<HomePage> {
..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,
Expand All @@ -172,6 +171,10 @@ class _HomePageState extends State<HomePage> {
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)
Expand Down Expand Up @@ -215,10 +218,14 @@ class _HomePageState extends State<HomePage> {
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() {
Expand Down Expand Up @@ -375,7 +382,7 @@ class _HomePageState extends State<HomePage> {
builder: (_) {
return Container(
padding: const EdgeInsets.all(12),
height: 150,
height: 200,
child: Column(
children: <Widget>[
const Center(
Expand All @@ -400,6 +407,18 @@ class _HomePageState extends State<HomePage> {
},
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'))),
),
],
),
);
Expand Down Expand Up @@ -479,17 +498,11 @@ class _HomePageState extends State<HomePage> {
.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
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ packages:
path: ".."
relative: true
source: path
version: "6.2.0"
version: "6.3.0"
flutter_lints:
dependency: "direct dev"
description:
Expand Down
8 changes: 4 additions & 4 deletions ios/Classes/FlutterBranchIoSdkHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -315,5 +315,5 @@ extension UIImage {
}
}
}

}
Loading

1 comment on commit 1ac419d

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.