Add suggestedActionCheckPassword.
This commit is contained in:
parent
c4dab736c9
commit
c1db660d4a
@ -3291,7 +3291,10 @@ tMeUrls urls:vector<tMeUrl> = TMeUrls;
|
||||
//@description Suggests the user to enable "archive_and_mute_new_chats_from_unknown_users" option
|
||||
suggestedActionEnableArchiveAndMuteNewChats = SuggestedAction;
|
||||
|
||||
//@description Suggests the user to check authorization phone number and change the phone number if it is inaccessible
|
||||
//@description Suggests the user to check whether 2-step verification password is still remembered
|
||||
suggestedActionCheckPassword = SuggestedAction;
|
||||
|
||||
//@description Suggests the user to check whether authorization phone number is correct and change the phone number if it is inaccessible
|
||||
suggestedActionCheckPhoneNumber = SuggestedAction;
|
||||
|
||||
//@description Suggests the user to see a hint about meaning of one and two ticks on sent message
|
||||
|
@ -10,6 +10,7 @@
|
||||
#include "td/telegram/Global.h"
|
||||
#include "td/telegram/logevent/LogEvent.h"
|
||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||
#include "td/telegram/SuggestedAction.h"
|
||||
#include "td/telegram/TdDb.h"
|
||||
|
||||
#include "td/mtproto/DhHandshake.h"
|
||||
@ -303,6 +304,9 @@ void PasswordManager::on_finish_create_temp_password(Result<TempPasswordState> r
|
||||
}
|
||||
|
||||
void PasswordManager::get_full_state(string password, Promise<PasswordFullState> promise) {
|
||||
send_closure(G()->config_manager(), &ConfigManager::hide_suggested_action,
|
||||
SuggestedAction{SuggestedAction::Type::CheckPassword});
|
||||
|
||||
do_get_state(PromiseCreator::lambda([password = std::move(password), promise = std::move(promise),
|
||||
actor_id = actor_id(this)](Result<PasswordState> r_state) mutable {
|
||||
if (r_state.is_error()) {
|
||||
|
@ -6,9 +6,10 @@
|
||||
//
|
||||
#pragma once
|
||||
|
||||
#include "td/telegram/ConfigManager.h"
|
||||
#include "td/telegram/net/NetQuery.h"
|
||||
#include "td/telegram/SecureStorage.h"
|
||||
|
||||
#include "td/telegram/SuggestedAction.h"
|
||||
#include "td/telegram/td_api.h"
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
|
@ -25,6 +25,8 @@ void SuggestedAction::init(Type type) {
|
||||
SuggestedAction::SuggestedAction(Slice action_str) {
|
||||
if (action_str == Slice("AUTOARCHIVE_POPULAR")) {
|
||||
init(Type::EnableArchiveAndMuteNewChats);
|
||||
} else if (action_str == Slice("VALIDATE_PASSWORD")) {
|
||||
init(Type::CheckPassword);
|
||||
} else if (action_str == Slice("VALIDATE_PHONE_NUMBER")) {
|
||||
init(Type::CheckPhoneNumber);
|
||||
} else if (action_str == Slice("NEWCOMER_TICKS")) {
|
||||
@ -48,6 +50,9 @@ SuggestedAction::SuggestedAction(const td_api::object_ptr<td_api::SuggestedActio
|
||||
case td_api::suggestedActionEnableArchiveAndMuteNewChats::ID:
|
||||
init(Type::EnableArchiveAndMuteNewChats);
|
||||
break;
|
||||
case td_api::suggestedActionCheckPassword::ID:
|
||||
init(Type::CheckPassword);
|
||||
break;
|
||||
case td_api::suggestedActionCheckPhoneNumber::ID:
|
||||
init(Type::CheckPhoneNumber);
|
||||
break;
|
||||
@ -72,6 +77,8 @@ string SuggestedAction::get_suggested_action_str() const {
|
||||
switch (type_) {
|
||||
case Type::EnableArchiveAndMuteNewChats:
|
||||
return "AUTOARCHIVE_POPULAR";
|
||||
case Type::CheckPassword:
|
||||
return "VALIDATE_PASSWORD";
|
||||
case Type::CheckPhoneNumber:
|
||||
return "VALIDATE_PHONE_NUMBER";
|
||||
case Type::SeeTicksHint:
|
||||
@ -89,6 +96,8 @@ td_api::object_ptr<td_api::SuggestedAction> SuggestedAction::get_suggested_actio
|
||||
return nullptr;
|
||||
case Type::EnableArchiveAndMuteNewChats:
|
||||
return td_api::make_object<td_api::suggestedActionEnableArchiveAndMuteNewChats>();
|
||||
case Type::CheckPassword:
|
||||
return td_api::make_object<td_api::suggestedActionCheckPassword>();
|
||||
case Type::CheckPhoneNumber:
|
||||
return td_api::make_object<td_api::suggestedActionCheckPhoneNumber>();
|
||||
case Type::SeeTicksHint:
|
||||
|
@ -15,7 +15,14 @@
|
||||
namespace td {
|
||||
|
||||
struct SuggestedAction {
|
||||
enum class Type : int32 { Empty, EnableArchiveAndMuteNewChats, CheckPhoneNumber, SeeTicksHint, ConvertToGigagroup };
|
||||
enum class Type : int32 {
|
||||
Empty,
|
||||
EnableArchiveAndMuteNewChats,
|
||||
CheckPhoneNumber,
|
||||
SeeTicksHint,
|
||||
ConvertToGigagroup,
|
||||
CheckPassword
|
||||
};
|
||||
Type type_ = Type::Empty;
|
||||
DialogId dialog_id_;
|
||||
|
||||
|
@ -1388,6 +1388,9 @@ class CliClient final : public Actor {
|
||||
if (action == "unarchive") {
|
||||
return td_api::make_object<td_api::suggestedActionEnableArchiveAndMuteNewChats>();
|
||||
}
|
||||
if (action == "pass") {
|
||||
return td_api::make_object<td_api::suggestedActionCheckPassword>();
|
||||
}
|
||||
if (action == "number") {
|
||||
return td_api::make_object<td_api::suggestedActionCheckPhoneNumber>();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user