Skip to content

Commit

Permalink
fix(dialogs): put cancel button of confirm/prompt on the left (#346)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Apr 15, 2021
1 parent 5b03a7f commit 1ac23db
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions dialog/ios/Plugin/DialogPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ public class DialogPlugin: CAPPlugin {

DispatchQueue.main.async { [weak self] in
let alert = UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert)
alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
call.resolve([
"value": true
"value": false
])
}))
alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
call.resolve([
"value": false
"value": true
])
}))
self?.bridge?.viewController?.present(alert, animated: true, completion: nil)
Expand All @@ -68,19 +68,19 @@ public class DialogPlugin: CAPPlugin {
textField.text = inputText
}

alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
call.resolve([
"value": "",
"cancelled": true
])
}))
alert.addAction(UIAlertAction(title: okButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
let textField = alert.textFields?[0]
call.resolve([
"value": textField?.text ?? "",
"cancelled": false
])
}))
alert.addAction(UIAlertAction(title: cancelButtonTitle, style: UIAlertAction.Style.default, handler: { (_) -> Void in
call.resolve([
"value": "",
"cancelled": true
])
}))

self?.bridge?.viewController?.present(alert, animated: true, completion: nil)
}
Expand Down

0 comments on commit 1ac23db

Please sign in to comment.