Giter VIP home page Giter VIP logo

flutter-branch-io's People

Contributors

amondnet avatar bejavu avatar blackmenthor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

flutter-branch-io's Issues

Application Crash when link generate

I am trying to generate link on Motorola Device. Tested Moto G Turbo and Moto G3. Application got crashed. Below is log.

E/flutter (11039): [ERROR:flutter/shell/platform/android/platform_view_android_jni.cc(39)] java.lang.NoClassDefFoundError: com.anggach.flutterbranchioplugin.src.HandlerKt$generateLinkHandler$1
E/flutter (11039): 	at com.anggach.flutterbranchioplugin.src.HandlerKt.generateLinkHandler(Handler.kt:66)
E/flutter (11039): 	at com.anggach.flutterbranchioplugin.FlutterBranchIoPlugin.onMethodCall(FlutterBranchIoPlugin.kt:52)
E/flutter (11039): 	at io.flutter.plugin.common.MethodChannel$IncomingMethodCallHandler.onMessage(MethodChannel.java:231)
E/flutter (11039): 	at io.flutter.embedding.engine.dart.DartMessenger.handleMessageFromDart(DartMessenger.java:93)
E/flutter (11039): 	at io.flutter.embedding.engine.FlutterJNI.handlePlatformMessage(FlutterJNI.java:642)
E/flutter (11039): 	at android.os.MessageQueue.nativePollOnce(Native Method)
E/flutter (11039): 	at android.os.MessageQueue.next(MessageQueue.java:323)
E/flutter (11039): 	at android.os.Looper.loop(Looper.java:135)
E/flutter (11039): 	at android.app.ActivityThread.main(ActivityThread.java:5443)
E/flutter (11039): 	at java.lang.reflect.Method.invoke(Native Method)
E/flutter (11039): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:728)
E/flutter (11039): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
E/flutter (11039): 
F/flutter (11039): [FATAL:flutter/shell/platform/android/platform_view_android_jni.cc(76)] Check failed: CheckException(env). 

Flutter version

Flutter 1.12.13+hotfix.5 • channel stable •
https://github.com/flutter/flutter.git
Framework • revision 27321ebbad (2 weeks ago) • 2019-12-10 18:15:01 -0800
Engine • revision 2994f7e1e6
Tools • Dart 2.7.0

iOS always returns "+clicked_branch_link: false"

iOS branch implementation always returning clicked branch link false.

flutter: {
"+clicked_branch_link" : false,
"+is_first_session" : false
}

Even the example provided with plugin returns the same every time when I am clicking on the branch link:

flutter: DEEPLINK {
"+clicked_branch_link" : false,
"+is_first_session" : false
}

deep link listener not firing the when app is opened, unless it was already open on device.

Am trying to get deep link functionality in an App. Followed setup instructions carefully, and have tried using the main.dart in your repo to test, with same results.

Issue is: deep link listener does not fire when the app has been previously been force stopped, closed with the back button, or if the app is a fresh install that's never been opened (install from play store). I've only gotten the deep link listener to fire when I have the app open already, then open it from the play store.

When the App is already in foreground, or moveTaskToBack(true)'d, everything works great.

However, if the app is being launched for the first time from its Play Store link, or if it's been opened from IDE, then closed with back button, then opened from Play Store, we see this message in debug FlutterView.send called on a detached view, channel=flutter_branch_io/event immediately after the BRANCH CALLBACK and NEW BRANCH DATA debug output, and the deep link listener does not fire.

full debug below, with identifying info snipped. all the JSON looks fine.

Working

here I launch app from IDE

Launching lib\main.dart on -snip- in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
I/BranchSDK(18137): !SDK-VERSION-STRING!:io.branch.sdk.android:library:3.1.1
I/BranchSDK(18137): Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.
D/FlutterBranchIo(18137): ON LIstEN

here I open the play store via branch link

I/BranchSDK(18137): Branch is not initialized, cannot close session
V/ActivityThread(18137): updateVisibility : ActivityRecord{3902db9 token=android.os.BinderProxy@fe7177c {-snip-}} show : false

here I launch the app from play store, without having closed it on the device.

I/BranchSDK(18137): Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.
I/BranchSDK(18137): posting to https://api2.branch.io/v1/open
I/BranchSDK(18137): Post value = {-snip-}
I/System.out(18137): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(18137): (HTTPLog)-Static: isSBSettingEnabled false
I/flutter (18137): ONSTART
I/BranchSDK(18137): !SDK-VERSION-STRING!:io.branch.sdk.android:library:3.1.1
I/Timeline(18137): Timeline: Activity_idle id: android.os.BinderProxy@fe7177c time:9714115
I/BranchSDK(18137): returned {-snip-}
D/FlutterBranchIo(18137): BRANCH CALLBACK
D/FlutterBranchIo(18137): NEW BRANCH DATA {-snip-}
I/System.out(18137): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(18137): (HTTPLog)-Static: isSBSettingEnabled false
I/flutter (18137): DEEPLINK {-snip-}

Not Working

here I launch app from IDE

Launching lib\main.dart on -snip- in debug mode...
Built build\app\outputs\apk\debug\app-debug.apk.
I/BranchSDK(13023): !SDK-VERSION-STRING!:io.branch.sdk.android:library:3.1.1
I/BranchSDK(13023): Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.
D/FlutterBranchIo(13023): ON LIstEN

here I click the back button

D/ViewRootImpl(13023): ViewPostImeInputStage processKey 0
D/ViewRootImpl(13023): ViewPostImeInputStage processKey 1
I/BranchSDK(13023): Branch is not initialized, cannot close session
W/art     (13023): Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[15,tid=13037,Native,Thread*=0x9dd98400,peer=0x12eff0a0,"Thread-4086"]
D/ViewRootImpl(13023): #3 mView = null

here I open the the app from the play store after using branch link

W/ResourcesManager(13023): getTopLevelResources: -snip-.apk / 1.0 running in -snip- rsrc of package null
I/BranchSDK(13023): Warning: You are using your test app's Branch Key. Remember to change it to live Branch Key during deployment.
I/BranchSDK(13023): posting to https://api2.branch.io/v1/open
D/SecWifiDisplayUtil(13023): Metadata value : none
I/BranchSDK(13023): Post value = {-snip-}
D/ViewRootImpl(13023): #1 mView = com.android.internal.policy.PhoneWindow$DecorView{86805fe I.E...... R.....ID 0,0-0,0}
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/BranchSDK(13023): returned {-snip-}
D/ViewRootImpl(13023): MSG_RESIZED_REPORT: ci=Rect(0, 72 - 0, 0) vi=Rect(0, 72 - 0, 0) or=1
D/FlutterBranchIo(13023): BRANCH CALLBACK
D/FlutterBranchIo(13023): NEW BRANCH DATA {-snip-}
D/FlutterNativeView(13023): FlutterView.send called on a detached view, channel=flutter_branch_io/event
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/Timeline(13023): Timeline: Activity_idle id: android.os.BinderProxy@7038380 time:6650941
I/BranchSDK(13023): !SDK-VERSION-STRING!:io.branch.sdk.android:library:3.1.1
D/FlutterBranchIo(13023): BRANCH CALLBACK
D/FlutterBranchIo(13023): NEW BRANCH DATA {}
D/FlutterNativeView(13023): FlutterView.send called on a detached view, channel=flutter_branch_io/event
D/FlutterBranchIo(13023): ON LIstEN
V/ActivityThread(13023): updateVisibility : ActivityRecord{eee6310 token=android.os.BinderProxy@7038380 {-snip-}} show : true
I/BranchSDK(13023): posting to https://api2.branch.io/v1/close
I/BranchSDK(13023): Post value = {-snip-}
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/System.out(13023): (HTTPLog)-Static: isSBSettingEnabled false
I/BranchSDK(13023): returned {}

Flutter Build Release Crash

Hi,
doesn't compile, flutter build apk --release

Execution failed for task ':flutter_android_lifecycle:verifyReleaseResources'.
error: resource android:attr/fontVariationSettings not found.
error: resource android:attr/ttcIndex not found.

I remove plugin is build success...

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, v1.12.13+hotfix.5, on Mac OS X 10.14.6 18G87, locale pt-BR)

Listen on link generated not called

Hi @blackmenthor !
in Android platform:
This function FlutterBranchIoPlugin.listenToGeneratedLinkStream().listen((link) {}); never called unless App onResume.

When I debugged on Android, I found that this function buo.generateshorturl was not called, cause link was not generated.

in iOS, It's work perfectly

Please look and help to resolve it.

Error when run on IOS

Hi Blackmenthor
I have got error when run on IOS like this. How do I solve problem

[!] The following Swift pods cannot yet be integrated as static libraries:
   The Swift pod `flutter_branch_io_plugin` depends upon `Branch`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:135:in `verify_swift_pods_have_module_dependencies'
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer/xcode/target_validator.rb:38:in `validate!'
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:415:in `validate_targets'
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/installer.rb:118:in `install!'
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/cocoapods-1.5.3/lib/cocoapods/command/install.rb:41:in `run'
   /usr/local/Cellar/cocoapods/1.5.3/libexec/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'

Clarification re Change the MainActivity class to extend FlutterBranchIOActivity

Hi

when you say Change the MainActivity class to extend FlutterBranchIOActivity
what do you mean needs to be done exactly? My MainActivity looks like this:

package com.xxx.xxx;

import android.os.Bundle;
import io.flutter.app.FlutterActivity;
import io.flutter.plugins.GeneratedPluginRegistrant;

import com.facebook.FacebookSdk;
import com.facebook.appevents.AppEventsLogger;
import com.anggach.flutterandroidlifecycle.FlutterAndroidLifecycleActivity;

public class MainActivity extends FlutterActivity {
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    GeneratedPluginRegistrant.registerWith(this);


//  added this to make the fb stuff below work
    AppEventsLogger logger = AppEventsLogger.newLogger(this);
    logger.logEvent("opened the android app fb");
  }
}

Should I replace public class MainActivity extends FlutterActivity with public class MainActivity extends FlutterBranchIOActivity?? It breaks the app...

Why streams and not async/await for links generation?

Here's the thing, in out app there are few different places where the link can be generated, after the link is created we need to open a share dialog with a content-specific text and data (e.g. images) with the generated link included. The thing is that at this moment there's no way to determine at what place of the app the link was generated and there's no way to associate the link with the appropriate content in the app.

Let me clarify a little: e.g., we have a post (caption+image) and it has a share button, also we have user profile with an "invite" button. Both share and invite buttons should generate a branch link that will be passed to a share plugin (system share dialog). In the plugin itself we're specifying some text related to a particular case (sharing the post or sharing the invite link). The text if different, of course, but when the stream receives the link it lacks the context where the link was generated and we cannot determine whether it was a post share or an invitation.

Probably, it will be much more convenient to be able to receive a link right where you're calling FlutterBranchIoPlugin.generateLink(...)

iOS documentation is not clear

Hello blackmentor,

on the README you explain how to use on iOS but then the dart code is the same for Android platform:

if (Platform.isAndroid) FlutterBranchIoPlugin.setupBranchIO();

Maybe the only needed code is:
FlutterBranchIoPlugin.listenToDeepLinkStream().listen((string) { print("DEEPLINK $string"); // PROCESS DEEPLINK HERE });

but the android part is just creating confusion :)

can you explain or update the readme?

Thanks

Compilation errors on iOS (new version of Swift compiler?)

Hi,

I'm using 1.0.1 version of the plugin. After following the tutorial and trying to deploy it on an iPhone XR simulator, I get these errors:
"cannot use optional chaining on non-optional value of type 'Branch'"

I'm unsure how nullability and optionals work between Obj-C and Swift, but Branch.getInstance returns a pointer (could be nullable), but obviously Swift thinks it's a non-optional. Any proposed solutions?

See below.

/Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:103:29: error: cannot use optional chaining on non-optional value of type 'Branch' Branch.getInstance()?.setIdentity(userId) ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:107:29: error: cannot use optional chaining on non-optional value of type 'Branch' Branch.getInstance()?.logout() ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:111:48: error: cannot use optional chaining on non-optional value of type 'Branch' let latestParams = Branch.getInstance()?.getLatestReferringParams() ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:116:47: error: cannot use optional chaining on non-optional value of type 'Branch' let firstParams = Branch.getInstance()?.getFirstReferringParams() ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:148:29: error: cannot use optional chaining on non-optional value of type 'Branch' Branch.getInstance()?.initSession(launchOptions: launchOptions) { params, error in ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:169:49: error: cannot use optional chaining on non-optional value of type 'Branch' let branchHandled = Branch.getInstance()?.application(app, open: url, options: options) ?? false ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:175:29: error: cannot use optional chaining on non-optional value of type 'Branch' Branch.getInstance()?.handlePushNotification(userInfo) ~~~~~~~~~~~~~~~~~~~~^ /Users/Mark/Downloads/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_branch_io_plugin-1.0.1/ios/Classes/SwiftFlutterBranchIoPlugin.swift:180:51: error: cannot use optional chaining on non-optional value of type 'Branch'

Thanks,

No callback on Branch.io failure

In the case of the Branch.io library failing to get a response from the Branch.io back-end, your plugin does not trigger anything and as such the app does not know that something went wrong with Branch.

For example, in the case of lack of internet connection, the following gets printed in the logs when calling setupBranchIO: I/FlutterBranchIo(24473): Trouble initializing Branch. Branch API Error: poor network connectivity. Please try again later.. The listening stream is not notified in any way however, so the app is completely unaware of this and cannot react appropriately.

My temporary workaround to this issue is a hardcoded 5 second timer - if 5 seconds have passed without getting any value from the listening stream, I assume Branch failed to connect and display a popup that allows retrying.

I don't know if there are other potential failures that Branch can encounter, but they should all be handled and fed back to the listening stream. It could be intermittent internet connection, or Branch.io back-end downtime (happens rarely), or just a very slow internet connection that times out - all of which should be handled by your plugin.

My suggestion is to change listenToDeepLinkStream to return a Stream<Map<String, String>> instead of Stream<String>. This would allow you to return different key-value pairs, with keys such as "errorCode" for different errors that could occur, "data" for the successful JSON string, or "status" to inform that the listener has been attached (for this other issue here)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.