Fix mediaview update when image is loaded.
Subscribe on app launch, not only when AuthSession has changed.
This commit is contained in:
parent
ee45bbe4c6
commit
e4f7b3c7c2
|
@ -90,15 +90,20 @@ MediaView::MediaView(QWidget*) : TWidget(nullptr)
|
|||
connect(QApplication::desktop(), SIGNAL(resized(int)), this, SLOT(onScreenResized(int)));
|
||||
|
||||
// While we have one mediaview for all authsessions we have to do this.
|
||||
subscribe(Messenger::Instance().authSessionChanged(), [this] {
|
||||
if (!AuthSession::Exists()) return;
|
||||
|
||||
subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] {
|
||||
if (!isHidden()) {
|
||||
updateControls();
|
||||
}
|
||||
});
|
||||
auto subscribeToDownloadFinished = [this] {
|
||||
if (AuthSession::Exists()) {
|
||||
subscribe(AuthSession::CurrentDownloaderTaskFinished(), [this] {
|
||||
if (!isHidden()) {
|
||||
updateControls();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
subscribe(Messenger::Instance().authSessionChanged(), [this, subscribeToDownloadFinished] {
|
||||
subscribeToDownloadFinished();
|
||||
});
|
||||
subscribeToDownloadFinished();
|
||||
|
||||
auto observeEvents = Notify::PeerUpdate::Flag::SharedMediaChanged;
|
||||
subscribe(Notify::PeerUpdated(), Notify::PeerUpdatedHandler(observeEvents, [this](const Notify::PeerUpdate &update) {
|
||||
mediaOverviewUpdated(update);
|
||||
|
|
Loading…
Reference in New Issue