diff --git a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift index 41d1217fd55fd10493612736ea24565720f9fba9..b475d2baae924625af013508963ab0deae5442d1 100644 --- a/AgileWorks/AgileWorks/Login/View/LoginViewController.swift +++ b/AgileWorks/AgileWorks/Login/View/LoginViewController.swift @@ -65,7 +65,7 @@ class LoginViewController: UIViewController { KeychainDataStore().removeSessionID() KeychainDataStore().removeLanguage() KeychainDataStore().removeDeviceID() - + //ウィジェットの更新 if #available(iOS 14.0, *) { WidgetCenter.shared.reloadAllTimelines() @@ -379,21 +379,22 @@ extension LoginViewController: AVCaptureMetadataOutputObjectsDelegate { do { // JSON をパースする let loginQr = try JSONSerialization.jsonObject(with: jsonData) as! Dictionary - print(loginQr["system_url"] as! String) // サーバーテキストボックス / コンテキストパステキストボックスに 値をセット let system = (loginQr["system_url"] as? String)?.replacingOccurrences(of: self.serverProtocol, with: "") let mobile = (loginQr["mobile_system_url"] as? String)?.replacingOccurrences(of: self.serverProtocol, with: "") var serverUrl = "" if mobile != nil && !mobile!.isEmpty { serverUrl = mobile! - } else { + } else if system != nil && !system!.isEmpty { serverUrl = system! } - let serverInfo: [String] = serverUrl.components(separatedBy: "/") - if !serverInfo.isEmpty { - serverTextField.text = serverInfo[0] - if serverInfo.count >= 2 { - contextTextField.text = serverInfo[1] + if !serverUrl.isEmpty { + let serverInfo: [String] = serverUrl.components(separatedBy: "/") + if !serverInfo.isEmpty { + serverTextField.text = serverInfo[0] + if serverInfo.count >= 2 { + contextTextField.text = serverInfo[1] + } } } loginButton.isEnabled = isTextFieldValue()