Add td_api::authorizationStateWaitOtherDeviceConfirmation to examples.
GitOrigin-RevId: 442ceda8e3b538d0e78a34858dc90e742ef4a126
This commit is contained in:
parent
205e68bf8b
commit
b91c4ecf88
@ -261,6 +261,9 @@ class TdExample {
|
||||
send_query(td_api::make_object<td_api::checkAuthenticationPassword>(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;
|
||||
|
@ -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: ");
|
||||
|
@ -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());
|
||||
|
@ -127,9 +127,9 @@ func updateAuthorizationState(authorizationState: Dictionary<String, Any>) {
|
||||
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<String, Any>) {
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user