1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374 |
- import Foundation
- @objc protocol NCAppConfigViewDelegate: class {
- func loginSuccess(_: NSInteger)
- @objc optional func appConfigViewDismiss()
- }
- class NCAppConfigView: UIViewController {
- let appDelegate = UIApplication.shared.delegate as! AppDelegate
- @objc var serverUrl: String?
- @objc var username: String?
- @objc var password: String?
- @objc weak var delegate: NCAppConfigViewDelegate?
- @IBOutlet weak var logoImage: UIImageView!
-
- override func viewDidLoad() {
- super.viewDidLoad()
-
- self.view.backgroundColor = NCBrandColor.sharedInstance.brand
-
- let serverConfig = UserDefaults.standard.dictionary(forKey: NCBrandConfiguration.sharedInstance.configuration_key)
- serverUrl = serverConfig?[NCBrandConfiguration.sharedInstance.configuration_serverUrl] as? String
- username = serverConfig?[NCBrandConfiguration.sharedInstance.configuration_username] as? String
- password = serverConfig?[NCBrandConfiguration.sharedInstance.configuration_password] as? String
- }
-
- override func viewDidAppear(_ animated: Bool) {
- super.viewDidAppear(animated)
-
-
- appDelegate.timerErrorNetworking.invalidate()
-
- OCNetworking.sharedManager()?.getAppPassword(serverUrl, username: username, password: password, completion: { (token, message, errorCode) in
- if errorCode == 0 {
-
- } else {
- self.appDelegate.messageNotification("_error_", description: message, visible: true, delay: TimeInterval(k_dismissAfterSecond), type: TWMessageBarMessageType.error, errorCode: errorCode)
- }
- })
- }
-
- override func viewDidDisappear(_ animated: Bool) {
- super.viewDidDisappear(animated)
-
-
- appDelegate.startTimerErrorNetworking()
- }
- }
|