[+] 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
|
var params = params
|
||||||
if params != nil
|
if params != nil
|
||||||
{
|
{
|
||||||
if params!["email"] == nil { params!["email"] = localStorage.string(forKey: "email") }
|
if params!["username"] == nil { params!["username"] = localStorage.string(forKey: "name") }
|
||||||
if params!["pass"] == nil { params!["pass"] = localStorage.string(forKey: "pass") }
|
if params!["password"] == nil { params!["password"] = localStorage.string(forKey: "pass") }
|
||||||
}
|
}
|
||||||
|
|
||||||
let url = createUrl(api.loc, params)
|
let url = createUrl(api.loc, params)
|
||||||
|
|||||||
@@ -110,12 +110,25 @@ extension String
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Alerts
|
/// UI Extensions
|
||||||
extension UIViewController
|
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)
|
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)
|
self.present(alert, animated: true, completion: nil)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user