Always keep current self-userpic loaded.

This commit is contained in:
John Preston 2020-06-16 19:40:43 +04:00
parent 571a15bf92
commit 99704e973b
2 changed files with 15 additions and 1 deletions

View file

@ -400,6 +400,15 @@ MainWidget::MainWidget(
floatPlayerClosed(itemId);
}, lifetime());
// Load current userpic and keep it loaded.
Notify::PeerUpdateValue(
session().user(),
Notify::PeerUpdate::Flag::PhotoChanged
) | rpl::start_with_next([=] {
[[maybe_unused]] const auto image = session().user()->currentUserpic(
_selfUserpicView);
}, lifetime());
_ptsWaiter.setRequesting(true);
updateScrollColors();
setupConnectingWidget();

View file

@ -38,6 +38,7 @@ struct PeerUpdate;
namespace Data {
class WallPaper;
class CloudImageView;
} // namespace Data
namespace Dialogs {
@ -107,7 +108,9 @@ class MainWidget
public:
using SectionShow = Window::SectionShow;
MainWidget(QWidget *parent, not_null<Window::SessionController*> controller);
MainWidget(
QWidget *parent,
not_null<Window::SessionController*> controller);
[[nodiscard]] Main::Session &session() const;
@ -459,6 +462,8 @@ private:
int _thirdColumnWidth = 0;
Ui::Animations::Simple _a_dialogsWidth;
std::shared_ptr<Data::CloudImageView> _selfUserpicView;
object_ptr<Ui::PlainShadow> _sideShadow;
object_ptr<Ui::PlainShadow> _thirdShadow = { nullptr };
object_ptr<Ui::ResizeArea> _firstColumnResizeArea = { nullptr };