diff --git a/example/dapp/lib/pages/connect_page.dart b/example/dapp/lib/pages/connect_page.dart index 31e02eae..843007fd 100644 --- a/example/dapp/lib/pages/connect_page.dart +++ b/example/dapp/lib/pages/connect_page.dart @@ -167,14 +167,13 @@ class ConnectPageState extends State { }, ); - _showQrCode(res); - - // // Uncomment to use a wallet - // final String encodedUri = Uri.encodeComponent(res.uri.toString()); - // await launchUrlString( - // 'wcflutterwallet://wc?uri=$encodedUri', - // mode: LaunchMode.externalApplication, - // ); + final encodedUri = Uri.encodeComponent(res.uri.toString()); + final uri = 'wcflutterwallet://wc?uri=$encodedUri'; + if (await canLaunchUrlString(uri)) { + launchUrlString(uri, mode: LaunchMode.externalApplication); + } else { + _showQrCode(res); + } try { debugPrint('Awaiting session proposal settlement'); diff --git a/example/wallet/ios/Runner/AppDelegate.swift b/example/wallet/ios/Runner/AppDelegate.swift index c666e71f..2b803573 100644 --- a/example/wallet/ios/Runner/AppDelegate.swift +++ b/example/wallet/ios/Runner/AppDelegate.swift @@ -4,8 +4,11 @@ import Flutter @UIApplicationMain @objc class AppDelegate: FlutterAppDelegate { - private var deepLinkChannel: FlutterEventChannel? - private static let CHANNEL = "com.walletconnect.flutterwallet/events" + private static let EVENTS_CHANNEL = "com.walletconnect.flutterwallet/events" + private static let METHODS_CHANNEL = "com.walletconnect.flutterwallet/methods" + + private var eventsChannel: FlutterEventChannel? + private var methodsChannel: FlutterMethodChannel? var initialLink: String? private let linkStreamHandler = LinkStreamHandler() @@ -14,15 +17,28 @@ import Flutter GeneratedPluginRegistrant.register(with: self) let controller = window.rootViewController as! FlutterViewController - deepLinkChannel = FlutterEventChannel(name: AppDelegate.CHANNEL, binaryMessenger: controller.binaryMessenger) - deepLinkChannel?.setStreamHandler(linkStreamHandler) + eventsChannel = FlutterEventChannel(name: AppDelegate.EVENTS_CHANNEL, binaryMessenger: controller.binaryMessenger) + eventsChannel?.setStreamHandler(linkStreamHandler) + + methodsChannel = FlutterMethodChannel(name: AppDelegate.METHODS_CHANNEL, binaryMessenger: controller.binaryMessenger) + methodsChannel?.setMethodCallHandler({ [weak self] (call: FlutterMethodCall, result: FlutterResult) -> Void in + if (call.method == "initialLink") { + print("\(String(describing: launchOptions))") + } + }) return super.application(application, didFinishLaunchingWithOptions: launchOptions) } override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool { + print("open url \(url)") return linkStreamHandler.handleLink(url.absoluteString) } +// +// override func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool { +// print("\(userActivity)") +// return true +// } } class LinkStreamHandler: NSObject, FlutterStreamHandler { diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png new file mode 100644 index 00000000..f4d4fe6b Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/100.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png new file mode 100644 index 00000000..523d4fd4 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/1024.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png new file mode 100644 index 00000000..d1a65dfa Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/114.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png new file mode 100644 index 00000000..d405d480 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/120.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png new file mode 100644 index 00000000..9832e38f Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/144.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png new file mode 100644 index 00000000..8f5045cd Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/152.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png new file mode 100644 index 00000000..3fc95946 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/167.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png new file mode 100644 index 00000000..cab830c8 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/180.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png new file mode 100644 index 00000000..0f5bd6ca Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/20.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png new file mode 100644 index 00000000..f091c53e Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/29.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png new file mode 100644 index 00000000..7f021b0f Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/40.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png new file mode 100644 index 00000000..81c5036d Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/50.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png new file mode 100644 index 00000000..700ec3cc Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/57.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png new file mode 100644 index 00000000..6e6d5022 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/58.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png new file mode 100644 index 00000000..90950b32 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/60.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png new file mode 100644 index 00000000..908249bf Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/72.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png new file mode 100644 index 00000000..b55a1f50 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/76.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png new file mode 100644 index 00000000..a7a56e80 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/80.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png new file mode 100644 index 00000000..e978232c Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/87.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d36b1fab..4fdf8826 100644 --- a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,122 +1,158 @@ { "images" : [ { - "size" : "20x20", + "filename" : "40.png", "idiom" : "iphone", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "20x20" }, { - "size" : "20x20", + "filename" : "60.png", "idiom" : "iphone", - "filename" : "Icon-App-20x20@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "20x20" }, { - "size" : "29x29", + "filename" : "29.png", "idiom" : "iphone", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "29x29" }, { - "size" : "29x29", + "filename" : "58.png", "idiom" : "iphone", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "29x29" }, { - "size" : "29x29", + "filename" : "87.png", "idiom" : "iphone", - "filename" : "Icon-App-29x29@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "29x29" }, { - "size" : "40x40", + "filename" : "80.png", "idiom" : "iphone", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { - "size" : "40x40", + "filename" : "120.png", "idiom" : "iphone", - "filename" : "Icon-App-40x40@3x.png", - "scale" : "3x" + "scale" : "3x", + "size" : "40x40" }, { - "size" : "60x60", + "filename" : "57.png", "idiom" : "iphone", - "filename" : "Icon-App-60x60@2x.png", - "scale" : "2x" + "scale" : "1x", + "size" : "57x57" }, { - "size" : "60x60", + "filename" : "114.png", "idiom" : "iphone", - "filename" : "Icon-App-60x60@3x.png", - "scale" : "3x" + "scale" : "2x", + "size" : "57x57" }, { - "size" : "20x20", + "filename" : "120.png", + "idiom" : "iphone", + "scale" : "2x", + "size" : "60x60" + }, + { + "filename" : "180.png", + "idiom" : "iphone", + "scale" : "3x", + "size" : "60x60" + }, + { + "filename" : "20.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "20x20" + }, + { + "filename" : "40.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "20x20" + }, + { + "filename" : "29.png", + "idiom" : "ipad", + "scale" : "1x", + "size" : "29x29" + }, + { + "filename" : "58.png", + "idiom" : "ipad", + "scale" : "2x", + "size" : "29x29" + }, + { + "filename" : "40.png", "idiom" : "ipad", - "filename" : "Icon-App-20x20@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "40x40" }, { - "size" : "20x20", + "filename" : "80.png", "idiom" : "ipad", - "filename" : "Icon-App-20x20@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "40x40" }, { - "size" : "29x29", + "filename" : "50.png", "idiom" : "ipad", - "filename" : "Icon-App-29x29@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "50x50" }, { - "size" : "29x29", + "filename" : "100.png", "idiom" : "ipad", - "filename" : "Icon-App-29x29@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "50x50" }, { - "size" : "40x40", + "filename" : "72.png", "idiom" : "ipad", - "filename" : "Icon-App-40x40@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "72x72" }, { - "size" : "40x40", + "filename" : "144.png", "idiom" : "ipad", - "filename" : "Icon-App-40x40@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "72x72" }, { - "size" : "76x76", + "filename" : "76.png", "idiom" : "ipad", - "filename" : "Icon-App-76x76@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "76x76" }, { - "size" : "76x76", + "filename" : "152.png", "idiom" : "ipad", - "filename" : "Icon-App-76x76@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "76x76" }, { - "size" : "83.5x83.5", + "filename" : "167.png", "idiom" : "ipad", - "filename" : "Icon-App-83.5x83.5@2x.png", - "scale" : "2x" + "scale" : "2x", + "size" : "83.5x83.5" }, { - "size" : "1024x1024", + "filename" : "1024.png", "idiom" : "ios-marketing", - "filename" : "Icon-App-1024x1024@1x.png", - "scale" : "1x" + "scale" : "1x", + "size" : "1024x1024" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } } diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png deleted file mode 100644 index dc9ada47..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png deleted file mode 100644 index 28c6bf03..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png deleted file mode 100644 index f091b6b0..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png deleted file mode 100644 index 4cde1211..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png deleted file mode 100644 index d0ef06e7..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png deleted file mode 100644 index dcdc2306..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png deleted file mode 100644 index 2ccbfd96..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png deleted file mode 100644 index c8f9ed8f..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png deleted file mode 100644 index a6d6b860..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png deleted file mode 100644 index 75b2d164..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png deleted file mode 100644 index c4df70d3..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png deleted file mode 100644 index 6a84f41e..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png deleted file mode 100644 index d0e1f585..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/Contents.json b/example/wallet/ios/Runner/Assets.xcassets/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/example/wallet/ios/Runner/Assets.xcassets/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json index 0bedcf2f..cfbbc77d 100644 --- a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json +++ b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json @@ -1,23 +1,23 @@ { "images" : [ { + "filename" : "appstore.png", "idiom" : "universal", - "filename" : "LaunchImage.png", "scale" : "1x" }, { + "filename" : "appstore@2x.png", "idiom" : "universal", - "filename" : "LaunchImage@2x.png", "scale" : "2x" }, { + "filename" : "appstore@3x.png", "idiom" : "universal", - "filename" : "LaunchImage@3x.png", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } } diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png deleted file mode 100644 index 9da19eac..00000000 Binary files a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png and /dev/null differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore.png new file mode 100644 index 00000000..396c5ab5 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@2x.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@2x.png new file mode 100644 index 00000000..8752e4ec Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@2x.png differ diff --git a/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@3x.png b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@3x.png new file mode 100644 index 00000000..523d4fd4 Binary files /dev/null and b/example/wallet/ios/Runner/Assets.xcassets/LaunchImage.imageset/appstore@3x.png differ diff --git a/example/wallet/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/wallet/ios/Runner/Base.lproj/LaunchScreen.storyboard index f2e259c7..7977954b 100644 --- a/example/wallet/ios/Runner/Base.lproj/LaunchScreen.storyboard +++ b/example/wallet/ios/Runner/Base.lproj/LaunchScreen.storyboard @@ -1,8 +1,10 @@ - - + + + - + + @@ -14,24 +16,30 @@ + - + + + + + - + + - + - + diff --git a/example/wallet/lib/dependencies/deep_link_handler.dart b/example/wallet/lib/dependencies/deep_link_handler.dart index bd48dffb..af46536c 100644 --- a/example/wallet/lib/dependencies/deep_link_handler.dart +++ b/example/wallet/lib/dependencies/deep_link_handler.dart @@ -7,7 +7,8 @@ import 'package:url_launcher/url_launcher_string.dart'; class DeepLinkHandler { // static final _linksController = StreamController.broadcast(); - + static const _methodChannel = + MethodChannel('com.walletconnect.flutterwallet/methods'); static const _eventChannel = EventChannel('com.walletconnect.flutterwallet/events'); @@ -25,15 +26,19 @@ class DeepLinkHandler { }, onError: (Object error) { debugPrint('[DeepLinkHandler] _onError $error'); }); + + _methodChannel.invokeMethod('initialLink').then( + (value) => debugPrint('[DeepLinkHandler] initialLink $value'), + ); } static Stream get onLink => _linksController.stream; static Future goTo(String scheme) async { try { - await launchUrlString(scheme, mode: LaunchMode.externalApplication); + launchUrlString(scheme, mode: LaunchMode.externalApplication); } catch (e) { - debugPrint('[$DeepLinkHandler] error re-opening dapp. $e'); + debugPrint('[DeepLinkHandler] error re-opening dapp ($scheme). $e'); } } } diff --git a/example/wallet/lib/dependencies/web3wallet_service.dart b/example/wallet/lib/dependencies/web3wallet_service.dart index d68cb64f..37b0ea63 100644 --- a/example/wallet/lib/dependencies/web3wallet_service.dart +++ b/example/wallet/lib/dependencies/web3wallet_service.dart @@ -6,6 +6,7 @@ import 'package:flutter/material.dart'; import 'package:get_it/get_it.dart'; import 'package:walletconnect_flutter_v2/walletconnect_flutter_v2.dart'; import 'package:walletconnect_flutter_v2_wallet/dependencies/bottom_sheet/i_bottom_sheet_service.dart'; +import 'package:walletconnect_flutter_v2_wallet/dependencies/deep_link_handler.dart'; import 'package:walletconnect_flutter_v2_wallet/dependencies/i_web3wallet_service.dart'; import 'package:walletconnect_flutter_v2_wallet/dependencies/key_service/chain_key.dart'; import 'package:walletconnect_flutter_v2_wallet/dependencies/key_service/i_key_service.dart'; @@ -81,8 +82,6 @@ class Web3WalletService extends IWeb3WalletService { _web3Wallet!.pairings.onSync.subscribe(_onPairingsSync); _web3Wallet!.onSessionProposal.subscribe(_onSessionProposal); _web3Wallet!.onSessionProposalError.subscribe(_onSessionProposalError); - _web3Wallet!.onSessionConnect.subscribe(_onSessionConnect); - _web3Wallet!.onSessionRequest.subscribe(_onSessionRequest); _web3Wallet!.onAuthRequest.subscribe(_onAuthRequest); _web3Wallet!.core.relayClient.onRelayClientError .subscribe(_onRelayClientError); @@ -106,8 +105,6 @@ class Web3WalletService extends IWeb3WalletService { _web3Wallet!.pairings.onSync.unsubscribe(_onPairingsSync); _web3Wallet!.onSessionProposal.unsubscribe(_onSessionProposal); _web3Wallet!.onSessionProposalError.unsubscribe(_onSessionProposalError); - _web3Wallet!.onSessionConnect.unsubscribe(_onSessionConnect); - _web3Wallet!.onSessionRequest.unsubscribe(_onSessionRequest); _web3Wallet!.onAuthRequest.unsubscribe(_onAuthRequest); _web3Wallet!.core.relayClient.onRelayClientError .unsubscribe(_onRelayClientError); @@ -157,6 +154,11 @@ class Web3WalletService extends IWeb3WalletService { reason: Errors.getSdkError(Errors.USER_REJECTED), ); } + + Future.delayed(const Duration(milliseconds: 300), () { + final scheme = args.params.proposer.metadata.redirect?.native ?? ''; + DeepLinkHandler.goTo(scheme); + }); } } @@ -168,25 +170,6 @@ class Web3WalletService extends IWeb3WalletService { debugPrint('[$runtimeType] _onPairingCreate $args'); } - void _onSessionRequest(SessionRequestEvent? args) { - if (args == null) return; - - final id = args.id; - final topic = args.topic; - final chainId = args.chainId; - final method = args.method; - final parameters = args.params; - - debugPrint('On session request event: ' - '$id, $topic, $chainId, $method, $parameters'); - } - - void _onSessionConnect(SessionConnect? args) { - if (args != null) { - sessions.value.add(args.session); - } - } - Future _onAuthRequest(AuthRequest? args) async { if (args != null) { print(args); diff --git a/example/wallet/lib/pages/apps_page.dart b/example/wallet/lib/pages/apps_page.dart index 9db7c4ea..1f13fbda 100644 --- a/example/wallet/lib/pages/apps_page.dart +++ b/example/wallet/lib/pages/apps_page.dart @@ -25,13 +25,12 @@ class AppsPageState extends State with GetItStateMixin { @override void initState() { + super.initState(); web3Wallet = GetIt.I().getWeb3Wallet(); _pairings = web3Wallet.pairings.getAll(); web3Wallet.core.pairing.onPairingDelete.subscribe(_onPairingDelete); web3Wallet.core.pairing.onPairingExpire.subscribe(_onPairingDelete); - web3Wallet.onSessionConnect.subscribe(_callbackToDapp); DeepLinkHandler.onLink.listen(_deepLinkListener); - super.initState(); } void _deepLinkListener(String uri) { @@ -42,13 +41,6 @@ class AppsPageState extends State with GetItStateMixin { } } - void _callbackToDapp(SessionConnect? args) async { - if (args != null) { - final scheme = args.session.peer.metadata.redirect?.native ?? ''; - DeepLinkHandler.goTo(scheme); - } - } - @override void dispose() { web3Wallet.core.pairing.onPairingDelete.unsubscribe(_onPairingDelete);