mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-04-10 03:31:17 +00:00
Simplified conditions for hiding hint for photo editor.
This commit is contained in:
parent
150dbef19f
commit
ce7a3c354c
@ -399,10 +399,20 @@ void EditCaptionBox::setupEditEventHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void EditCaptionBox::setupPhotoEditorEventHandler() {
|
void EditCaptionBox::setupPhotoEditorEventHandler() {
|
||||||
|
const auto openedOnce = lifetime().make_state<bool>(false);
|
||||||
_photoEditorOpens.events(
|
_photoEditorOpens.events(
|
||||||
) | rpl::start_with_next([=, controller = _controller] {
|
) | rpl::start_with_next([=, controller = _controller] {
|
||||||
|
const auto increment = [=] {
|
||||||
|
if (*openedOnce) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
*openedOnce = true;
|
||||||
|
controller->session().settings().incrementPhotoEditorHintShown();
|
||||||
|
controller->session().saveSettings();
|
||||||
|
};
|
||||||
const auto previewWidth = st::sendMediaPreviewSize;
|
const auto previewWidth = st::sendMediaPreviewSize;
|
||||||
if (!_preparedList.files.empty()) {
|
if (!_preparedList.files.empty()) {
|
||||||
|
increment();
|
||||||
Editor::OpenWithPreparedFile(
|
Editor::OpenWithPreparedFile(
|
||||||
this,
|
this,
|
||||||
controller,
|
controller,
|
||||||
@ -414,6 +424,7 @@ void EditCaptionBox::setupPhotoEditorEventHandler() {
|
|||||||
if (!large) {
|
if (!large) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
increment();
|
||||||
auto callback = [=](const Editor::PhotoModifications &mods) {
|
auto callback = [=](const Editor::PhotoModifications &mods) {
|
||||||
if (!mods || !_photoMedia) {
|
if (!mods || !_photoMedia) {
|
||||||
return;
|
return;
|
||||||
@ -663,10 +674,7 @@ void EditCaptionBox::save() {
|
|||||||
action.options = options;
|
action.options = options;
|
||||||
action.replaceMediaOf = item->fullId().msg;
|
action.replaceMediaOf = item->fullId().msg;
|
||||||
|
|
||||||
if (Storage::ApplyModifications(_preparedList)) {
|
Storage::ApplyModifications(_preparedList);
|
||||||
_controller->session().settings().incrementPhotoEditorHintShown();
|
|
||||||
_controller->session().saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
_controller->session().api().editMedia(
|
_controller->session().api().editMedia(
|
||||||
std::move(_preparedList),
|
std::move(_preparedList),
|
||||||
|
@ -613,8 +613,14 @@ void SendFilesBox::pushBlock(int from, int till) {
|
|||||||
crl::guard(this, callback));
|
crl::guard(this, callback));
|
||||||
}, widget->lifetime());
|
}, widget->lifetime());
|
||||||
|
|
||||||
|
const auto openedOnce = widget->lifetime().make_state<bool>(false);
|
||||||
block.itemModifyRequest(
|
block.itemModifyRequest(
|
||||||
) | rpl::start_with_next([=, controller = _controller](int index) {
|
) | rpl::start_with_next([=, controller = _controller](int index) {
|
||||||
|
if (!(*openedOnce)) {
|
||||||
|
controller->session().settings().incrementPhotoEditorHintShown();
|
||||||
|
controller->session().saveSettings();
|
||||||
|
}
|
||||||
|
*openedOnce = true;
|
||||||
Editor::OpenWithPreparedFile(
|
Editor::OpenWithPreparedFile(
|
||||||
this,
|
this,
|
||||||
controller,
|
controller,
|
||||||
@ -1008,10 +1014,7 @@ void SendFilesBox::send(
|
|||||||
block.applyAlbumOrder();
|
block.applyAlbumOrder();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Storage::ApplyModifications(_list)) {
|
Storage::ApplyModifications(_list);
|
||||||
_controller->session().settings().incrementPhotoEditorHintShown();
|
|
||||||
_controller->session().saveSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
_confirmed = true;
|
_confirmed = true;
|
||||||
if (_confirmedCallback) {
|
if (_confirmedCallback) {
|
||||||
|
@ -125,7 +125,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr auto kDefaultSupportChatsLimitSlice = 7 * 24 * 60 * 60;
|
static constexpr auto kDefaultSupportChatsLimitSlice = 7 * 24 * 60 * 60;
|
||||||
static constexpr auto kPhotoEditorHintMaxShowsCount = 10;
|
static constexpr auto kPhotoEditorHintMaxShowsCount = 5;
|
||||||
|
|
||||||
ChatHelpers::SelectorTab _selectorTab; // per-window
|
ChatHelpers::SelectorTab _selectorTab; // per-window
|
||||||
base::flat_set<PeerId> _groupStickersSectionHidden;
|
base::flat_set<PeerId> _groupStickersSectionHidden;
|
||||||
|
@ -50,6 +50,6 @@ enum class MimeDataState {
|
|||||||
void PrepareDetails(Ui::PreparedFile &file, int previewWidth);
|
void PrepareDetails(Ui::PreparedFile &file, int previewWidth);
|
||||||
void UpdateImageDetails(Ui::PreparedFile &file, int previewWidth);
|
void UpdateImageDetails(Ui::PreparedFile &file, int previewWidth);
|
||||||
|
|
||||||
[[nodiscard]] bool ApplyModifications(Ui::PreparedList &list);
|
bool ApplyModifications(Ui::PreparedList &list);
|
||||||
|
|
||||||
} // namespace Storage
|
} // namespace Storage
|
||||||
|
Loading…
Reference in New Issue
Block a user