diff --git a/example/cpp/td_example.cpp b/example/cpp/td_example.cpp index befb2125..54ce939d 100644 --- a/example/cpp/td_example.cpp +++ b/example/cpp/td_example.cpp @@ -261,6 +261,9 @@ class TdExample { send_query(td_api::make_object(password), create_authentication_query_handler()); }, + [this](td_api::authorizationStateWaitOtherDeviceConfirmation &state) { + std::cout << "Confirm this login link on another device: " << state.link_ << std::endl; + }, [this](td_api::authorizationStateWaitPhoneNumber &) { std::cout << "Enter phone number: " << std::flush; std::string phone_number; diff --git a/example/csharp/TdExample.cs b/example/csharp/TdExample.cs index 3479bd74..f54923a2 100644 --- a/example/csharp/TdExample.cs +++ b/example/csharp/TdExample.cs @@ -95,6 +95,10 @@ namespace TdExample string phoneNumber = ReadLine("Please enter phone number: "); _client.Send(new TdApi.SetAuthenticationPhoneNumber(phoneNumber, null), new AuthorizationRequestHandler()); } + else if (_authorizationState is TdApi.AuthorizationStateWaitOtherDeviceConfirmation state) + { + Console.WriteLine("Please confirm this login link on another device: " + state.Link); + } else if (_authorizationState is TdApi.AuthorizationStateWaitCode) { string code = ReadLine("Please enter authentication code: "); diff --git a/example/java/org/drinkless/tdlib/example/Example.java b/example/java/org/drinkless/tdlib/example/Example.java index f3548740..9e42949b 100644 --- a/example/java/org/drinkless/tdlib/example/Example.java +++ b/example/java/org/drinkless/tdlib/example/Example.java @@ -121,6 +121,11 @@ public final class Example { client.send(new TdApi.SetAuthenticationPhoneNumber(phoneNumber, null), new AuthorizationRequestHandler()); break; } + case TdApi.AuthorizationStateWaitOtherDeviceConfirmation.CONSTRUCTOR: { + String link = ((TdApi.AuthorizationStateWaitOtherDeviceConfirmation) Example.authorizationState).link; + System.out.println("Please confirm this login link on another device: " + link); + break; + } case TdApi.AuthorizationStateWaitCode.CONSTRUCTOR: { String code = promptString("Please enter authentication code: "); client.send(new TdApi.CheckAuthenticationCode(code), new AuthorizationRequestHandler()); diff --git a/example/swift/src/main.swift b/example/swift/src/main.swift index f66c01ba..54bd6a66 100644 --- a/example/swift/src/main.swift +++ b/example/swift/src/main.swift @@ -127,9 +127,9 @@ func updateAuthorizationState(authorizationState: Dictionary) { client.queryAsync(query: ["@type":"checkDatabaseEncryptionKey", "key":"cucumber"]) case "authorizationStateWaitPhoneNumber": - print("Enter your phone: ") - let phone = myReadLine() - client.queryAsync(query:["@type":"setAuthenticationPhoneNumber", "phone_number":phone], f:checkAuthenticationError) + print("Enter your phone number: ") + let phone_number = myReadLine() + client.queryAsync(query:["@type":"setAuthenticationPhoneNumber", "phone_number":phone_number], f:checkAuthenticationError) case "authorizationStateWaitCode": var code: String = "" @@ -154,8 +154,17 @@ func updateAuthorizationState(authorizationState: Dictionary) { case "authorizationStateReady": () + case "authorizationStateLoggingOut": + print("Logging out...") + + case "authorizationStateClosing": + print("Closing...") + + case "authorizationStateLoggingOut": + print("Closed.") + default: - assert(false, "TODO: Unknown authorization state"); + assert(false, "TODO: Unexpected authorization state"); } }