diff options
| author | levlam <levlam@telegram.org> | 2018-02-28 13:25:07 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2018-02-28 13:25:07 +0300 |
| commit | 1ac97a6ba73b07e93bbce96c7a47d0ec1852569a (patch) | |
| tree | d1c38eddc2a45351c3b112b80170c5feaba5b9fb /example/swift | |
| parent | 110f2c5b7bd367ad565c43c306c2f2b7ae3f835a (diff) | |
Various fixes.
GitOrigin-RevId: 80fa34e64e6824a0f96c38d2e8b0a32455267ea8
Diffstat (limited to 'example/swift')
| -rw-r--r-- | example/swift/src/main.swift | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/example/swift/src/main.swift b/example/swift/src/main.swift index 84ca2b963..10b075dc8 100644 --- a/example/swift/src/main.swift +++ b/example/swift/src/main.swift @@ -97,8 +97,8 @@ func myReadLine() -> String { } } -func updateAuthorizationState(authState: Dictionary<String, Any>) { - switch(authState["@type"] as! String) { +func updateAuthorizationState(authorizationState: Dictionary<String, Any>) { + switch(authorizationState["@type"] as! String) { case "authorizationStateWaitTdlibParameters": client.queryAsync(query:[ "@type":"setTdlibParameters", @@ -122,13 +122,13 @@ func updateAuthorizationState(authState: Dictionary<String, Any>) { case "authorizationStateWaitPhoneNumber": print("Enter your phone: ") let phone = myReadLine() - client.queryAsync(query:["@type":"setAuthenticationPhoneNumber", "phone_number":phone], f:checkAuthError) + client.queryAsync(query:["@type":"setAuthenticationPhoneNumber", "phone_number":phone], f:checkAuthenticationError) case "authorizationStateWaitCode": var first_name: String = "" var last_name: String = "" var code: String = "" - if let is_registered = authState["is_registered"] as? Bool, is_registered { + if let is_registered = authorizationState["is_registered"] as? Bool, is_registered { } else { print("Enter your first name: ") first_name = myReadLine() @@ -137,12 +137,12 @@ func updateAuthorizationState(authState: Dictionary<String, Any>) { } print("Enter (SMS) code: ") code = myReadLine() - client.queryAsync(query:["@type":"checkAuthenticationCode", "code":code, "first_name":first_name, "last_name":last_name], f:checkAuthError) + client.queryAsync(query:["@type":"checkAuthenticationCode", "code":code, "first_name":first_name, "last_name":last_name], f:checkAuthenticationError) case "authorizationStateWaitPassword": print("Enter password: ") let password = myReadLine() - client.queryAsync(query:["@type":"checkAuthenticationPassword", "password":password], f:checkAuthError) + client.queryAsync(query:["@type":"checkAuthenticationPassword", "password":password], f:checkAuthenticationError) case "authorizationStateReady": () @@ -152,7 +152,7 @@ func updateAuthorizationState(authState: Dictionary<String, Any>) { } } -func checkAuthError(error: Dictionary<String, Any>) { +func checkAuthenticationError(error: Dictionary<String, Any>) { if (error["@type"] as! String == "error") { client.queryAsync(query:["@type":"getAuthorizationState"], f:updateAuthorizationState) } @@ -162,7 +162,7 @@ client.run { let update = $0 print(update) if update["@type"] as! String == "updateAuthorizationState" { - updateAuthorizationState(authState: update["authorization_state"] as! Dictionary<String, Any>) + updateAuthorizationState(authorizationState: update["authorization_state"] as! Dictionary<String, Any>) } } |
