Merge pull request #607 from Chlup/fix_sample_compilation

Fix Sample SDK app compilation
This commit is contained in:
Francisco Gindre 2022-11-03 15:16:32 -03:00 committed by GitHub
commit b745cb807a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 42 additions and 39 deletions

View File

@ -18,42 +18,44 @@ class GetAddressViewController: UIViewController {
let synchronizer = SDKSynchronizer.shared
guard let uAddress = synchronizer.getUnifiedAddress(accountIndex: 0) else {
unifiedAddressLabel.text = "could not derive UA"
tAddressLabel.text = "could not derive tAddress"
saplingAddress.text = "could not derive zAddress"
return
Task { @MainActor in
guard let uAddress = await synchronizer.getUnifiedAddress(accountIndex: 0) else {
unifiedAddressLabel.text = "could not derive UA"
tAddressLabel.text = "could not derive tAddress"
saplingAddress.text = "could not derive zAddress"
return
}
// you can either try to extract receivers from the UA itself or request the Synchronizer to do it for you. Certain UAs might not contain all the receivers you expect.
unifiedAddressLabel.text = uAddress.stringEncoded
tAddressLabel.text = uAddress.transparentReceiver()?.stringEncoded ?? "could not extract transparent receiver from UA"
saplingAddress.text = uAddress.saplingReceiver()?.stringEncoded ?? "could not extract sapling receiver from UA"
unifiedAddressLabel.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(addressTapped(_:))
)
)
unifiedAddressLabel.isUserInteractionEnabled = true
tAddressLabel.isUserInteractionEnabled = true
tAddressLabel.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(tAddressTapped(_:))
)
)
saplingAddress.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(spendingKeyTapped(_:))
)
)
saplingAddress.isUserInteractionEnabled = true
loggerProxy.info("Address: \(String(describing: uAddress))")
}
// you can either try to extract receivers from the UA itself or request the Synchronizer to do it for you. Certain UAs might not contain all the receivers you expect.
unifiedAddressLabel.text = uAddress.stringEncoded
tAddressLabel.text = uAddress.transparentReceiver()?.stringEncoded ?? "could not extract transparent receiver from UA"
saplingAddress.text = uAddress.saplingReceiver()?.stringEncoded ?? "could not extract sapling receiver from UA"
unifiedAddressLabel.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(addressTapped(_:))
)
)
unifiedAddressLabel.isUserInteractionEnabled = true
tAddressLabel.isUserInteractionEnabled = true
tAddressLabel.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(tAddressTapped(_:))
)
)
saplingAddress.addGestureRecognizer(
UITapGestureRecognizer(
target: self,
action: #selector(spendingKeyTapped(_:))
)
)
saplingAddress.isUserInteractionEnabled = true
loggerProxy.info("Address: \(String(describing: uAddress))")
}
@IBAction func spendingKeyTapped(_ gesture: UIGestureRecognizer) {

View File

@ -24,11 +24,12 @@ class GetUTXOsViewController: UIViewController {
func updateUI() {
let synchronizer = SDKSynchronizer.shared
let tAddress = synchronizer.getTransparentAddress(accountIndex: 0)?.stringEncoded ?? "no t-address found"
self.transparentAddressLabel.text = tAddress
Task { @MainActor in
let tAddress = await synchronizer.getTransparentAddress(accountIndex: 0)?.stringEncoded ?? "no t-address found"
self.transparentAddressLabel.text = tAddress
// swiftlint:disable:next force_try
let balance = try! await AppDelegate.shared.sharedSynchronizer.getTransparentBalance(accountIndex: 0)

View File

@ -38,7 +38,7 @@ class SendViewController: UIViewController {
setUp()
Task { @MainActor in
// swiftlint:disable:next force_try
try! await synchronizer.prepare()
try! await synchronizer.prepare(with: DemoAppConfig.seed)
}
}