mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-07 23:53:58 +02:00
Added touchbar hiding while recording voice message.
This commit is contained in:
parent
041d8571c2
commit
b3925a3bec
3 changed files with 18 additions and 3 deletions
|
@ -96,6 +96,9 @@ void Instance::start() {
|
||||||
_updates.fire_error({});
|
_updates.fire_error({});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
crl::on_main(this, [=] {
|
||||||
|
_started = true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,11 +106,13 @@ void Instance::stop(Fn<void(Result&&)> callback) {
|
||||||
InvokeQueued(_inner.get(), [=] {
|
InvokeQueued(_inner.get(), [=] {
|
||||||
if (!callback) {
|
if (!callback) {
|
||||||
_inner->stop();
|
_inner->stop();
|
||||||
|
crl::on_main(this, [=] { _started = false; });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_inner->stop([=](Result &&result) {
|
_inner->stop([=](Result &&result) {
|
||||||
crl::on_main([=, result = std::move(result)]() mutable {
|
crl::on_main([=, result = std::move(result)]() mutable {
|
||||||
callback(std::move(result));
|
callback(std::move(result));
|
||||||
|
_started = false;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -42,6 +42,10 @@ public:
|
||||||
return _updates.events();
|
return _updates.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::producer<bool> startedChanges() const {
|
||||||
|
return _started.changes();
|
||||||
|
}
|
||||||
|
|
||||||
void start();
|
void start();
|
||||||
void stop(Fn<void(Result&&)> callback = nullptr);
|
void stop(Fn<void(Result&&)> callback = nullptr);
|
||||||
|
|
||||||
|
@ -50,6 +54,7 @@ private:
|
||||||
friend class Inner;
|
friend class Inner;
|
||||||
|
|
||||||
bool _available = false;
|
bool _available = false;
|
||||||
|
rpl::variable<bool> _started = false;;
|
||||||
rpl::event_stream<Update, rpl::empty_error> _updates;
|
rpl::event_stream<Update, rpl::empty_error> _updates;
|
||||||
QThread _thread;
|
QThread _thread;
|
||||||
std::unique_ptr<Inner> _inner;
|
std::unique_ptr<Inner> _inner;
|
||||||
|
|
|
@ -17,6 +17,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_domain.h"
|
#include "main/main_domain.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "mainwidget.h" // MainWidget::closeBothPlayers
|
#include "mainwidget.h" // MainWidget::closeBothPlayers
|
||||||
|
#include "media/audio/media_audio_capture.h"
|
||||||
#include "media/player/media_player_instance.h"
|
#include "media/player/media_player_instance.h"
|
||||||
#include "platform/mac/touchbar/mac_touchbar_audio.h"
|
#include "platform/mac/touchbar/mac_touchbar_audio.h"
|
||||||
#include "platform/mac/touchbar/mac_touchbar_common.h"
|
#include "platform/mac/touchbar/mac_touchbar_common.h"
|
||||||
|
@ -91,20 +92,24 @@ const auto kAudioItemIdentifier = @"touchbarAudio";
|
||||||
Media::Player::instance()->startsPlay(type) | rpl::map_to(true)
|
Media::Player::instance()->startsPlay(type) | rpl::map_to(true)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
auto voiceRecording = ::Media::Capture::instance()->startedChanges();
|
||||||
|
|
||||||
rpl::combine(
|
rpl::combine(
|
||||||
std::move(sessionChanges),
|
std::move(sessionChanges),
|
||||||
rpl::single(false) | rpl::then(Core::App().passcodeLockChanges()),
|
rpl::single(false) | rpl::then(Core::App().passcodeLockChanges()),
|
||||||
rpl::single(false) | rpl::then(std::move(audioPlayer))
|
rpl::single(false) | rpl::then(std::move(audioPlayer)),
|
||||||
|
rpl::single(false) | rpl::then(std::move(voiceRecording))
|
||||||
) | rpl::start_with_next([=](
|
) | rpl::start_with_next([=](
|
||||||
Main::Session *session,
|
Main::Session *session,
|
||||||
bool lock,
|
bool lock,
|
||||||
bool audio) {
|
bool audio,
|
||||||
|
bool recording) {
|
||||||
TouchBar::CustomEnterToCocoaEventLoop([=] {
|
TouchBar::CustomEnterToCocoaEventLoop([=] {
|
||||||
_touchBarSwitches.fire({});
|
_touchBarSwitches.fire({});
|
||||||
if (!audio) {
|
if (!audio) {
|
||||||
self.defaultItemIdentifiers = @[];
|
self.defaultItemIdentifiers = @[];
|
||||||
}
|
}
|
||||||
self.defaultItemIdentifiers = lock
|
self.defaultItemIdentifiers = (lock || recording)
|
||||||
? @[]
|
? @[]
|
||||||
: audio
|
: audio
|
||||||
? @[kAudioItemIdentifier]
|
? @[kAudioItemIdentifier]
|
||||||
|
|
Loading…
Add table
Reference in a new issue