2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Support personal photo edit in EditContactBox.

This commit is contained in:
John Preston
2022-12-20 17:12:32 +04:00
parent c7c652a277
commit 1dd83f3d34
26 changed files with 484 additions and 182 deletions

View File

@@ -245,6 +245,7 @@ void SetupPhoto(
controller,
self,
Ui::UserpicButton::Role::OpenPhoto,
Ui::UserpicButton::Source::PeerPhoto,
st::settingsInfoPhoto);
const auto upload = CreateUploadSubButton(wrap, controller);
@@ -252,7 +253,7 @@ void SetupPhoto(
) | rpl::start_with_next([=](Ui::UserpicButton::ChosenImage &&chosen) {
auto &image = chosen.image;
UpdatePhotoLocally(self, image);
photo->changeTo(base::duplicate(image));
photo->showCustom(base::duplicate(image));
self->session().api().peerPhoto().upload(self, std::move(image));
}, upload->lifetime());

View File

@@ -123,6 +123,7 @@ Cover::Cover(
controller,
_user,
Ui::UserpicButton::Role::OpenPhoto,
Ui::UserpicButton::Source::PeerPhoto,
st::infoProfileCover.photo)
, _name(this, st::infoProfileCover.name)
, _phone(this, st::defaultFlatLabel)
@@ -141,7 +142,7 @@ Cover::Cover(
_userpic->switchChangePhotoOverlay(_user->isSelf(), [=](
Ui::UserpicButton::ChosenImage chosen) {
auto &image = chosen.image;
_userpic->changeTo(base::duplicate(image));
_userpic->showCustom(base::duplicate(image));
_user->session().api().peerPhoto().upload(_user, std::move(image));
});