openStrikeApp method

Future<void> openStrikeApp({
  1. String? invoiceId,
})

Launches the platform-specific app store to the Strike app

Implementation

Future<void> openStrikeApp({String? invoiceId}) async {
  if (defaultTargetPlatform == TargetPlatform.android || defaultTargetPlatform == TargetPlatform.iOS) {
    bool launchable = await canLaunchUrl(Uri.parse('lightning:$lnInvoice'));
    if (launchable) {
      launchUrl(Uri.parse('lightning:$lnInvoice'));
    } else {
      Strike.openInAppStore();
    }
  } else {
    if (invoiceId != null) {
      bool launchable = await canLaunchUrl(Uri.parse('https://strike.me/pay/$invoiceId/lightning:$lnInvoice'));
      if (launchable) {
        launchUrl(
          Uri.parse('https://strike.me/pay/$invoiceId/lightning:$lnInvoice'),
          webOnlyWindowName: '_blank',
        );
      } else {
        Strike.openInAppStore();
      }
    }
  }
}