Move device token check to DeviceTokenManager.
This commit is contained in:
parent
dbd397cb0e
commit
e065cce247
@ -133,7 +133,9 @@ StringBuilder &operator<<(StringBuilder &string_builder, const DeviceTokenManage
|
|||||||
void DeviceTokenManager::register_device(tl_object_ptr<td_api::DeviceToken> device_token_ptr,
|
void DeviceTokenManager::register_device(tl_object_ptr<td_api::DeviceToken> device_token_ptr,
|
||||||
const vector<UserId> &other_user_ids,
|
const vector<UserId> &other_user_ids,
|
||||||
Promise<td_api::object_ptr<td_api::pushReceiverId>> promise) {
|
Promise<td_api::object_ptr<td_api::pushReceiverId>> promise) {
|
||||||
CHECK(device_token_ptr != nullptr);
|
if (device_token_ptr == nullptr) {
|
||||||
|
return promise.set_error(Status::Error(400, "Device token must be non-empty"));
|
||||||
|
}
|
||||||
TokenType token_type;
|
TokenType token_type;
|
||||||
string token;
|
string token;
|
||||||
bool is_app_sandbox = false;
|
bool is_app_sandbox = false;
|
||||||
|
@ -4555,9 +4555,6 @@ void Td::on_request(uint64 id, td_api::processPushNotification &request) {
|
|||||||
|
|
||||||
void Td::on_request(uint64 id, td_api::registerDevice &request) {
|
void Td::on_request(uint64 id, td_api::registerDevice &request) {
|
||||||
CHECK_IS_USER();
|
CHECK_IS_USER();
|
||||||
if (request.device_token_ == nullptr) {
|
|
||||||
return send_error_raw(id, 400, "Device token must be non-empty");
|
|
||||||
}
|
|
||||||
CREATE_REQUEST_PROMISE();
|
CREATE_REQUEST_PROMISE();
|
||||||
send_closure(device_token_manager_, &DeviceTokenManager::register_device, std::move(request.device_token_),
|
send_closure(device_token_manager_, &DeviceTokenManager::register_device, std::move(request.device_token_),
|
||||||
UserId::get_user_ids(request.other_user_ids_), std::move(promise));
|
UserId::get_user_ids(request.other_user_ids_), std::move(promise));
|
||||||
|
Loading…
Reference in New Issue
Block a user