[+] Add parameter "okayable" to alert function
This commit is contained in:
@@ -181,8 +181,8 @@ func send<T: Decodable>(_ api: API<T>, _ params: [String: String]? = [:], _ succ
|
||||
var params = params
|
||||
if params != nil
|
||||
{
|
||||
if params!["email"] == nil { params!["email"] = localStorage.string(forKey: "email") }
|
||||
if params!["pass"] == nil { params!["pass"] = localStorage.string(forKey: "pass") }
|
||||
if params!["username"] == nil { params!["username"] = localStorage.string(forKey: "name") }
|
||||
if params!["password"] == nil { params!["password"] = localStorage.string(forKey: "pass") }
|
||||
}
|
||||
|
||||
let url = createUrl(api.loc, params)
|
||||
|
||||
@@ -110,12 +110,25 @@ extension String
|
||||
}
|
||||
|
||||
|
||||
/// Alerts
|
||||
/// UI Extensions
|
||||
extension UIViewController
|
||||
{
|
||||
func alert(_ title: String, _ message: String)
|
||||
/**
|
||||
Send an alert
|
||||
|
||||
- Parameter title: Title of the alert
|
||||
- Parameter message: Body message of the alert
|
||||
- Parameter okayable: Whether the alert can be okayed
|
||||
*/
|
||||
func alert(_ title: String, _ message: String, okayable: Bool = false)
|
||||
{
|
||||
let alert = UIAlertController(title: title, message: message, preferredStyle: .alert)
|
||||
|
||||
if okayable
|
||||
{
|
||||
alert.addAction(UIAlertAction(title: "OK", style: .default))
|
||||
}
|
||||
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user