Skip to content

Commit

Permalink
fix(ios): put cancel button of confirm/prompt on the left (#4464)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Apr 15, 2021
1 parent b3faa97 commit e5b53aa
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions ios/Capacitor/Capacitor/WebViewDelegationHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ internal class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDel

let alertController = UIAlertController(title: nil, message: message, preferredStyle: .alert)

alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (_) in
completionHandler(true)
}))

alertController.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (_) in
completionHandler(false)
}))

alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (_) in
completionHandler(true)
}))

viewController.present(alertController, animated: true, completion: nil)
}

Expand All @@ -211,19 +211,16 @@ internal class WebViewDelegationHandler: NSObject, WKNavigationDelegate, WKUIDel
textField.text = defaultText
}

alertController.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (_) in
completionHandler(nil)
}))

alertController.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (_) in
if let text = alertController.textFields?.first?.text {
completionHandler(text)
} else {
completionHandler(defaultText)
}

}))

alertController.addAction(UIAlertAction(title: "Cancel", style: .default, handler: { (_) in

completionHandler(nil)

}))

viewController.present(alertController, animated: true, completion: nil)
Expand Down

0 comments on commit e5b53aa

Please sign in to comment.