Add updateSavedNotificationSounds.
This commit is contained in:
parent
a59201f913
commit
147697fdf5
@ -4127,6 +4127,9 @@ updateFavoriteStickers sticker_ids:vector<int32> = Update;
|
||||
//@description The list of saved animations was updated @animation_ids The new list of file identifiers of saved animations
|
||||
updateSavedAnimations animation_ids:vector<int32> = Update;
|
||||
|
||||
//@description The list of saved notifications sounds was updated. This update may not be sent until information about a notification sound was requested for the first time @notification_sound_ids The new list of identifiers of saved notification sounds
|
||||
updateSavedNotificationSounds notification_sound_ids:vector<int64> = Update;
|
||||
|
||||
//@description The selected background has changed @for_dark_theme True, if background for dark theme has changed @background The new selected background; may be null
|
||||
updateSelectedBackground for_dark_theme:Bool background:background = Update;
|
||||
|
||||
|
@ -1188,6 +1188,18 @@ void NotificationSettingsManager::on_reload_saved_ringtones(
|
||||
}
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::updateSavedNotificationSounds>
|
||||
NotificationSettingsManager::get_update_saved_notification_sounds_object() const {
|
||||
auto ringtone_ids = transform(saved_ringtone_file_ids_, [file_manager = td_->file_manager_.get()](FileId file_id) {
|
||||
auto file_view = file_manager->get_file_view(file_id);
|
||||
CHECK(!file_view.empty());
|
||||
CHECK(file_view.get_type() == FileType::Ringtone);
|
||||
CHECK(file_view.has_remote_location());
|
||||
return file_view.remote_location().get_id();
|
||||
});
|
||||
return td_api::make_object<td_api::updateSavedNotificationSounds>(std::move(ringtone_ids));
|
||||
}
|
||||
|
||||
void NotificationSettingsManager::on_saved_ringtones_updated(bool from_database) {
|
||||
CHECK(are_saved_ringtones_loaded_);
|
||||
vector<FileId> new_sorted_saved_ringtone_file_ids = saved_ringtone_file_ids_;
|
||||
@ -1201,6 +1213,8 @@ void NotificationSettingsManager::on_saved_ringtones_updated(bool from_database)
|
||||
if (!from_database) {
|
||||
// save_saved_ringtones_to_database();
|
||||
}
|
||||
|
||||
send_closure(G()->td(), &Td::send_update, get_update_saved_notification_sounds_object());
|
||||
}
|
||||
|
||||
FileSourceId NotificationSettingsManager::get_saved_ringtones_file_source_id() {
|
||||
@ -1388,6 +1402,10 @@ void NotificationSettingsManager::get_current_state(vector<td_api::object_ptr<td
|
||||
updates.push_back(get_update_scope_notification_settings_object(scope));
|
||||
}
|
||||
}
|
||||
|
||||
if (are_saved_ringtones_loaded_) {
|
||||
updates.push_back(get_update_saved_notification_sounds_object());
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace td
|
||||
|
@ -144,6 +144,8 @@ class NotificationSettingsManager final : public Actor {
|
||||
td_api::object_ptr<td_api::updateScopeNotificationSettings> get_update_scope_notification_settings_object(
|
||||
NotificationSettingsScope scope) const;
|
||||
|
||||
td_api::object_ptr<td_api::updateSavedNotificationSounds> get_update_saved_notification_sounds_object() const;
|
||||
|
||||
void on_scope_unmute(NotificationSettingsScope scope);
|
||||
|
||||
static string get_notification_settings_scope_database_key(NotificationSettingsScope scope);
|
||||
|
@ -4109,6 +4109,7 @@ void Td::send_update(tl_object_ptr<td_api::Update> &&object) {
|
||||
case td_api::updateInstalledStickerSets::ID:
|
||||
case td_api::updateRecentStickers::ID:
|
||||
case td_api::updateSavedAnimations::ID:
|
||||
case td_api::updateSavedNotificationSounds::ID:
|
||||
case td_api::updateUserStatus::ID:
|
||||
VLOG(td_requests) << "Sending update: " << oneline(to_string(object));
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user