Add suggestedActionCheckPhoneNumber support.
This commit is contained in:
parent
b60c443edd
commit
c4dab736c9
@ -1074,6 +1074,10 @@ void ConfigManager::do_set_archive_and_mute(bool archive_and_mute) {
|
|||||||
G()->shared_config().set_option_boolean("archive_and_mute_new_chats_from_unknown_users", archive_and_mute);
|
G()->shared_config().set_option_boolean("archive_and_mute_new_chats_from_unknown_users", archive_and_mute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ConfigManager::hide_suggested_action(SuggestedAction suggested_action) {
|
||||||
|
remove_suggested_action(suggested_actions_, suggested_action);
|
||||||
|
}
|
||||||
|
|
||||||
void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise) {
|
void ConfigManager::dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise) {
|
||||||
auto action_str = suggested_action.get_suggested_action_str();
|
auto action_str = suggested_action.get_suggested_action_str();
|
||||||
if (action_str.empty()) {
|
if (action_str.empty()) {
|
||||||
|
@ -101,6 +101,8 @@ class ConfigManager : public NetQueryCallback {
|
|||||||
|
|
||||||
void set_archive_and_mute(bool archive_and_mute, Promise<Unit> &&promise);
|
void set_archive_and_mute(bool archive_and_mute, Promise<Unit> &&promise);
|
||||||
|
|
||||||
|
void hide_suggested_action(SuggestedAction suggested_action);
|
||||||
|
|
||||||
void dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise);
|
void dismiss_suggested_action(SuggestedAction suggested_action, Promise<Unit> &&promise);
|
||||||
|
|
||||||
void on_dc_options_update(DcOptions dc_options);
|
void on_dc_options_update(DcOptions dc_options);
|
||||||
|
@ -6,8 +6,10 @@
|
|||||||
//
|
//
|
||||||
#include "td/telegram/PhoneNumberManager.h"
|
#include "td/telegram/PhoneNumberManager.h"
|
||||||
|
|
||||||
|
#include "td/telegram/ConfigManager.h"
|
||||||
#include "td/telegram/Global.h"
|
#include "td/telegram/Global.h"
|
||||||
#include "td/telegram/net/NetQueryDispatcher.h"
|
#include "td/telegram/net/NetQueryDispatcher.h"
|
||||||
|
#include "td/telegram/SuggestedAction.h"
|
||||||
#include "td/telegram/Td.h"
|
#include "td/telegram/Td.h"
|
||||||
#include "td/telegram/td_api.h"
|
#include "td/telegram/td_api.h"
|
||||||
#include "td/telegram/telegram_api.h"
|
#include "td/telegram/telegram_api.h"
|
||||||
@ -48,6 +50,8 @@ void PhoneNumberManager::set_phone_number(uint64 query_id, string phone_number,
|
|||||||
|
|
||||||
switch (type_) {
|
switch (type_) {
|
||||||
case Type::ChangePhone:
|
case Type::ChangePhone:
|
||||||
|
send_closure(G()->config_manager(), &ConfigManager::hide_suggested_action,
|
||||||
|
SuggestedAction{SuggestedAction::Type::CheckPhoneNumber});
|
||||||
return process_send_code_result(query_id, send_code_helper_.send_change_phone_code(phone_number, settings));
|
return process_send_code_result(query_id, send_code_helper_.send_change_phone_code(phone_number, settings));
|
||||||
case Type::VerifyPhone:
|
case Type::VerifyPhone:
|
||||||
return process_send_code_result(query_id, send_code_helper_.send_verify_phone_code(phone_number, settings));
|
return process_send_code_result(query_id, send_code_helper_.send_verify_phone_code(phone_number, settings));
|
||||||
|
@ -25,6 +25,8 @@ void SuggestedAction::init(Type type) {
|
|||||||
SuggestedAction::SuggestedAction(Slice action_str) {
|
SuggestedAction::SuggestedAction(Slice action_str) {
|
||||||
if (action_str == Slice("AUTOARCHIVE_POPULAR")) {
|
if (action_str == Slice("AUTOARCHIVE_POPULAR")) {
|
||||||
init(Type::EnableArchiveAndMuteNewChats);
|
init(Type::EnableArchiveAndMuteNewChats);
|
||||||
|
} else if (action_str == Slice("VALIDATE_PHONE_NUMBER")) {
|
||||||
|
init(Type::CheckPhoneNumber);
|
||||||
} else if (action_str == Slice("NEWCOMER_TICKS")) {
|
} else if (action_str == Slice("NEWCOMER_TICKS")) {
|
||||||
init(Type::SeeTicksHint);
|
init(Type::SeeTicksHint);
|
||||||
}
|
}
|
||||||
@ -70,6 +72,8 @@ string SuggestedAction::get_suggested_action_str() const {
|
|||||||
switch (type_) {
|
switch (type_) {
|
||||||
case Type::EnableArchiveAndMuteNewChats:
|
case Type::EnableArchiveAndMuteNewChats:
|
||||||
return "AUTOARCHIVE_POPULAR";
|
return "AUTOARCHIVE_POPULAR";
|
||||||
|
case Type::CheckPhoneNumber:
|
||||||
|
return "VALIDATE_PHONE_NUMBER";
|
||||||
case Type::SeeTicksHint:
|
case Type::SeeTicksHint:
|
||||||
return "NEWCOMER_TICKS";
|
return "NEWCOMER_TICKS";
|
||||||
case Type::ConvertToGigagroup:
|
case Type::ConvertToGigagroup:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user