Fix uploading new group / account photo.

This commit is contained in:
John Preston 2022-12-29 12:16:13 +04:00
parent cad6faa790
commit 7e98e9ecf2
5 changed files with 11 additions and 6 deletions

View File

@ -467,6 +467,7 @@ void GroupInfoBox::prepare() {
&_navigation->parentController()->window(),
Ui::UserpicButton::Role::ChoosePhoto,
st::defaultUserpicButton);
_photo->showCustomOnChosen();
_title.create(
this,
st::defaultInputField,

View File

@ -477,6 +477,7 @@ object_ptr<Ui::RpWidget> Controller::createPhotoEdit() {
st::defaultUserpicButton),
st::editPeerPhotoMargins);
_controls.photo = photoWrap->entity();
_controls.photo->showCustomOnChosen();
return photoWrap;
}

View File

@ -34,6 +34,8 @@ SignupWidget::SignupWidget(
, _first(this, st::introName, tr::lng_signup_firstname())
, _last(this, st::introName, tr::lng_signup_lastname())
, _invertOrder(langFirstNameGoesSecond()) {
_photo->showCustomOnChosen();
Lang::Updated(
) | rpl::start_with_next([=] {
refreshLang();

View File

@ -207,13 +207,13 @@ void UserpicButton::prepare() {
prepareUserpicPixmap();
}
setClickHandlerByRole();
}
if (_role == Role::ChangePhoto) {
chosenImages(
) | rpl::start_with_next([=](ChosenImage &&chosen) {
showCustom(std::move(chosen.image));
}, lifetime());
}
void UserpicButton::showCustomOnChosen() {
chosenImages(
) | rpl::start_with_next([=](ChosenImage &&chosen) {
showCustom(std::move(chosen.image));
}, lifetime());
}
void UserpicButton::requestSuggestAvailability() {

View File

@ -100,6 +100,7 @@ public:
void showCustom(QImage &&image);
void showSource(Source source);
void showCustomOnChosen();
void overrideHasPersonalPhoto(bool has);
[[nodiscard]] rpl::producer<> resetPersonalRequests() const;