breez / breez-sdk-flutter

Breez SDK flutter plugin
MIT License
3 stars 7 forks source link

breez does not work at all when used on a same app that uses `bdk_flutter` on iOS (only) #7

Open sagarsubedi opened 10 months ago

sagarsubedi commented 10 months ago

We have a flutter app that is a BTC wallet built with bdk_flutter. We then decided to integrate lightning and thus used breez. It was working fine on Android but on iOS, it does not work at all. After spending weeks, I created a completely new flutter app with just breez, and to my surprise, it showed my lightning balance and that little app worked fine. Even the workshop repo created by @JssDWt worked perfectly on ios. But in our app (on ios), it did not. Then in the new app I wrote, I added bdk_flutter just to see if that made a difference: flutter pub add bdk_flutter. And then that new app also did not work. I added bdk_flutter as dependency on that workshop repo, and it also stopped working.

To replicate:

  1. Have a flutter app that uses breez
  2. Add bdk via flutter pub add bdk_flutter
  3. Run the app again (uninstall your current app just to be safe)
  4. Breez will suddenly stop working

You dont have to use any features of bdk. Just having it as a dependency will create this issue. One thing I saw in common is the Network class. Another thing is that they both use flutter_rust_bridge and uuid. Not sure if those have anything to do with this.

Summary: using breez together with bdk_flutter will cause breez to stop completely. No logs, no erros, no exceptions, no nothing. Simply skips the whole sdk functions as if they aren't there. Just add bdk_flutter as dependency to replicate. I tested in ios 17 (that is the only version i have available both physically and simulator). Not sure if this issue persists in other versions of ios. And this is an ios-only issue. Android works just fine all the time. Link to bdk_flutter on pubdev https://pub.dev/packages/bdk_flutter

JssDWt commented 10 months ago

Can confirm. With https://github.com/jssdwt/breez_sdk_flutter_workshop the breez sdk doesn't do anything if you install bdk_flutter. No logs, nothing. Only on iOS.

roeierez commented 10 months ago

@ademar111190 can you please take a look?

roeierez commented 10 months ago

@sagarsubedi still looking into it. We opened meantime an issue in flutter rust bridge repo: https://github.com/fzyzcjy/flutter_rust_bridge/issues/1712

sagarsubedi commented 9 months ago

@roeierez I saw your comment on that issue:

OK removing that line about static linking and now I am able to use DynamicLibrary.open to load the symbols and it works side by side with the bdk_flutter.

So does that mean breez users can expect a fix soon? Or is it more involved that that? Thanks.

roeierez commented 9 months ago

So does that mean breez users can expect a fix soon? Or is it more involved that that? Thanks.

We are totally focusing on this issue. It turns out not an easy one since we may need the way we expose the dependency to flutter, the way we link and the way we load the library. for iOS We still looking for the right approach but I am definitely positive that we will solve this ver soon. I will keep you updated.

roeierez commented 9 months ago

@sagarsubedi we have pushed an early version with dynamic loading that should work side by side with bdk_flutter. Please use this in your pubspec.yaml:

breez_sdk:
    git:
      ref: dloader
      url: https://github.com/breez/breez-sdk-flutter.git

It is an early one that only meant to unblock you, we still need to formalize that and push it as a formal release. Please check and let me know how it goes.

sagarsubedi commented 9 months ago

I've already texted you outside of Github, but just so it is recorded here: The dloader branch does work. I am now able to use breez on my ios device.

roeierez commented 9 months ago

@sagarsubedi thanks for your feedback! We will leave this issue opened untill it is solved in the release process