CAKE-192 | implemented unstoppable domain address to the app

This commit is contained in:
OleksandrSobol
2021-04-20 20:49:53 +03:00
parent 5faf7f5cba
commit ae9efb0ae8
29 changed files with 327 additions and 46 deletions
+2 -1
View File
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
platform :ios, '9.0'
platform :ios, '11.0'
source 'https://github.com/CocoaPods/Specs.git'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
@@ -36,6 +36,7 @@ target 'Runner' do
# Cake Wallet (Legacy)
pod 'CryptoSwift'
pod 'UnstoppableDomainsResolution', '~> 0.3.6'
end
post_install do |installer|
+16 -2
View File
@@ -3,6 +3,7 @@ PODS:
- Flutter
- MTBBarcodeScanner
- SwiftProtobuf
- BigInt (5.2.0)
- connectivity (0.0.1):
- Flutter
- Reachability
@@ -59,6 +60,8 @@ PODS:
- SwiftyGif
- esys_flutter_share (0.0.1):
- Flutter
- EthereumAddress (1.3.0):
- CryptoSwift (~> 1.0)
- file_picker (0.0.1):
- DKImagePickerController/PhotoGallery
- Flutter
@@ -84,6 +87,10 @@ PODS:
- Flutter
- SwiftProtobuf (1.12.0)
- SwiftyGif (5.3.0)
- UnstoppableDomainsResolution (0.3.6):
- BigInt
- CryptoSwift (~> 1.0)
- EthereumAddress (~> 1.3)
- url_launcher (0.0.1):
- Flutter
- webview_flutter (0.0.1):
@@ -105,19 +112,23 @@ DEPENDENCIES:
- permission_handler (from `.symlinks/plugins/permission_handler/ios`)
- share (from `.symlinks/plugins/share/ios`)
- shared_preferences (from `.symlinks/plugins/shared_preferences/ios`)
- UnstoppableDomainsResolution (~> 0.3.6)
- url_launcher (from `.symlinks/plugins/url_launcher/ios`)
- webview_flutter (from `.symlinks/plugins/webview_flutter/ios`)
SPEC REPOS:
https://github.com/CocoaPods/Specs.git:
- BigInt
- CryptoSwift
- DKImagePickerController
- DKPhotoGallery
- EthereumAddress
- MTBBarcodeScanner
- Reachability
- SDWebImage
- SwiftProtobuf
- SwiftyGif
- UnstoppableDomainsResolution
EXTERNAL SOURCES:
barcode_scan:
@@ -155,6 +166,7 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
barcode_scan: a5c27959edfafaa0c771905bad0b29d6d39e4479
BigInt: f668a80089607f521586bbe29513d708491ef2f7
connectivity: c4130b2985d4ef6fd26f9702e886bd5260681467
CryptoSwift: 093499be1a94b0cae36e6c26b70870668cb56060
cw_monero: 2e1f79929880cc2293b5bc1b25e28152e4d84649
@@ -162,6 +174,7 @@ SPEC CHECKSUMS:
DKImagePickerController: b5eb7f7a388e4643264105d648d01f727110fc3d
DKPhotoGallery: fdfad5125a9fdda9cc57df834d49df790dbb4179
esys_flutter_share: 403498dab005b36ce1f8d7aff377e81f0621b0b4
EthereumAddress: 39fe8e11cf04e4e9902b55ae653dbc4e0aee5f30
file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1
Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c
flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec
@@ -176,9 +189,10 @@ SPEC CHECKSUMS:
shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d
SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699
SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40
UnstoppableDomainsResolution: 63abb84858d3e91eb838a5bfa6f7e3c0e0593f24
url_launcher: 6fef411d543ceb26efce54b05a0a40bfd74cbbef
webview_flutter: 9f491a9b5a66f2573946a389b2677987b0ff8c0b
PODFILE CHECKSUM: 5b5f101b119a1b6eb857c967d462832a9062dec4
PODFILE CHECKSUM: 2172f10eb8ff8378f8d6e3e2c1366a0e6cdea018
COCOAPODS: 1.9.3
COCOAPODS: 1.10.1
+40
View File
@@ -1,8 +1,13 @@
import UIKit
import Flutter
import UnstoppableDomainsResolution
@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {
lazy var resolution : Resolution? = {
return try? Resolution()
}()
override func application(
_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
@@ -10,6 +15,8 @@ import Flutter
let controller : FlutterViewController = window?.rootViewController as! FlutterViewController
let batteryChannel = FlutterMethodChannel(name: "com.cakewallet.cakewallet/legacy_wallet_migration",
binaryMessenger: controller.binaryMessenger)
let unstoppableDomainChannel = FlutterMethodChannel(name: "com.cakewallet.cake_wallet/unstoppable-domain", binaryMessenger: controller.binaryMessenger)
batteryChannel.setMethodCallHandler({
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
@@ -52,6 +59,39 @@ import Flutter
}
})
unstoppableDomainChannel.setMethodCallHandler({ [weak self]
(call: FlutterMethodCall, result: @escaping FlutterResult) -> Void in
switch call.method {
case "getUnstoppableDomainAddress":
guard let args = call.arguments as? Dictionary<String, String>,
let domain = args["domain"],
let ticker = args["ticker"] else {
result(nil)
return
}
guard let resolution = self?.resolution else {
result(nil)
return
}
resolution.addr(domain: domain, ticker: ticker) { addrResult in
var address : String = ""
switch addrResult {
case .success(let returnValue):
address = returnValue
case .failure(let error):
print("Expected Address, but got \(error)")
}
result(address)
}
default:
result(FlutterMethodNotImplemented)
}
})
GeneratedPluginRegistrant.register(with: self)
return super.application(application, didFinishLaunchingWithOptions: launchOptions)
}