FIX: Issue: Apple Watch invoice gets stuck #1529

This commit is contained in:
Marcos Rodriguez Vélez 2021-07-31 01:38:31 -04:00
parent fd82a9b938
commit e360fa443f
3 changed files with 15 additions and 6 deletions

View file

@ -55,7 +55,7 @@ class ReceiveInterfaceController: WKInterfaceController {
self?.toggleViewButtonPressed()
WCSession.default.sendMessage(["message": "fetchTransactions"], replyHandler: nil, errorHandler: nil)
} else {
self?.presentAlert(withTitle: "Error", message: "Unable to create invoice. Please, make sure your iPhone is paired and nearby.", preferredStyle: .alert, actions: [WKAlertAction(title: "OK", style: .default, handler: { [weak self] in
self?.presentAlert(withTitle: "Error", message: "Unable to create invoice. Please open BlueWallet on your iPhone and unlock your wallets.", preferredStyle: .alert, actions: [WKAlertAction(title: "OK", style: .default, handler: { [weak self] in
self?.dismiss()
self?.pop()
})])

View file

@ -89,8 +89,14 @@ class SpecifyInterfaceController: WKInterfaceController {
}
@IBAction func createButtonTapped() {
NotificationCenter.default.post(name: NotificationName.createQRCode, object: specifiedQRContent)
dismiss()
if (WCSession.default.activationState == .activated) {
NotificationCenter.default.post(name: NotificationName.createQRCode, object: specifiedQRContent)
dismiss()
} else {
presentAlert(withTitle: "Error", message: "Unable to create invoice. Please open BlueWallet on your iPhone and unlock your wallets.", preferredStyle: .alert, actions: [WKAlertAction(title: "OK", style: .default, handler: { [weak self] in
self?.dismiss()
})])
}
}
override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? {

View file

@ -92,7 +92,6 @@ class WalletDetailsInterfaceController: WKInterfaceController {
transactionsTable.setHidden(wallet?.transactions.isEmpty ?? true)
noTransactionsLabel.setHidden(!(wallet?.transactions.isEmpty ?? false))
receiveButton.setHidden(wallet?.receiveAddress.isEmpty ?? true)
createInvoiceButton.setEnabled(WCSession.default.isReachable)
}
@IBAction func receiveMenuItemTapped() {
@ -116,9 +115,13 @@ class WalletDetailsInterfaceController: WKInterfaceController {
}
@IBAction func createInvoiceTapped() {
if (WCSession.default.isReachable) {
if (WCSession.default.activationState == .activated) {
pushController(withName: ReceiveInterfaceController.identifier, context: (wallet?.identifier, "createInvoice"))
}
} else {
presentAlert(withTitle: "Error", message: "Unable to create invoice. Please open BlueWallet on your iPhone and unlock your wallets.", preferredStyle: .alert, actions: [WKAlertAction(title: "OK", style: .default, handler: { [weak self] in
self?.dismiss()
})])
}
}
override func contextForSegue(withIdentifier segueIdentifier: String) -> Any? {