mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Play ringtones on click in select box.
This commit is contained in:
@@ -510,7 +510,7 @@ void System::showNext() {
|
||||
}
|
||||
if (settings.soundNotify() && !_manager->skipAudio()) {
|
||||
const auto track = lookupSound(
|
||||
alertPeer,
|
||||
&alertPeer->owner(),
|
||||
alertPeer->owner().notifySettings().sound(alertPeer).id);
|
||||
track->playOnce();
|
||||
Media::Player::mixer()->suppressAll(track->getLengthMs());
|
||||
@@ -699,7 +699,7 @@ void System::showNext() {
|
||||
}
|
||||
|
||||
not_null<Media::Audio::Track*> System::lookupSound(
|
||||
not_null<PeerData*> peer,
|
||||
not_null<Data::Session*> owner,
|
||||
DocumentId id) {
|
||||
if (!id) {
|
||||
ensureSoundCreated();
|
||||
@@ -709,7 +709,7 @@ not_null<Media::Audio::Track*> System::lookupSound(
|
||||
if (i != end(_customSoundTracks)) {
|
||||
return i->second.get();
|
||||
}
|
||||
const auto ¬ifySettings = peer->owner().notifySettings();
|
||||
const auto ¬ifySettings = owner->notifySettings();
|
||||
const auto custom = notifySettings.lookupRingtone(id);
|
||||
if (custom && !custom->bytes().isEmpty()) {
|
||||
const auto j = _customSoundTracks.emplace(
|
||||
@@ -747,6 +747,10 @@ void System::notifySettingsChanged(ChangeType type) {
|
||||
return _settingsChanged.fire(std::move(type));
|
||||
}
|
||||
|
||||
void System::playSound(not_null<Main::Session*> session, DocumentId id) {
|
||||
lookupSound(&session->data(), id)->playOnce();
|
||||
}
|
||||
|
||||
Manager::DisplayOptions Manager::getNotificationOptions(
|
||||
HistoryItem *item,
|
||||
ItemNotificationType type) const {
|
||||
|
@@ -15,6 +15,7 @@ struct ItemNotification;
|
||||
enum class ItemNotificationType;
|
||||
|
||||
namespace Data {
|
||||
class Session;
|
||||
class CloudImageView;
|
||||
} // namespace Data
|
||||
|
||||
@@ -99,6 +100,8 @@ public:
|
||||
[[nodiscard]] rpl::producer<ChangeType> settingsChanged() const;
|
||||
void notifySettingsChanged(ChangeType type);
|
||||
|
||||
void playSound(not_null<Main::Session*> session, DocumentId id);
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime() {
|
||||
return _lifetime;
|
||||
}
|
||||
@@ -159,7 +162,7 @@ private:
|
||||
void showGrouped();
|
||||
void ensureSoundCreated();
|
||||
[[nodiscard]] not_null<Media::Audio::Track*> lookupSound(
|
||||
not_null<PeerData*> peer,
|
||||
not_null<Data::Session*> owner,
|
||||
DocumentId id);
|
||||
|
||||
base::flat_map<
|
||||
|
Reference in New Issue
Block a user