mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
parent
2e9e3b3751
commit
d289bbdc5e
9 changed files with 86 additions and 18 deletions
|
@ -1141,6 +1141,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_report_group_title" = "Report group";
|
"lng_report_group_title" = "Report group";
|
||||||
"lng_report_bot_title" = "Report bot";
|
"lng_report_bot_title" = "Report bot";
|
||||||
"lng_report_message_title" = "Report message";
|
"lng_report_message_title" = "Report message";
|
||||||
|
"lng_report_profile_photo_title" = "Report profile photo";
|
||||||
|
"lng_report_profile_video_title" = "Report profile video";
|
||||||
"lng_report_please_select_messages" = "Please select messages to report.";
|
"lng_report_please_select_messages" = "Please select messages to report.";
|
||||||
"lng_report_select_messages" = "Select messages";
|
"lng_report_select_messages" = "Select messages";
|
||||||
"lng_report_messages_none" = "Select Messages";
|
"lng_report_messages_none" = "Select Messages";
|
||||||
|
@ -2053,6 +2055,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_mediaview_yesterday" = "yesterday at {time}";
|
"lng_mediaview_yesterday" = "yesterday at {time}";
|
||||||
"lng_mediaview_date_time" = "{date} at {time}";
|
"lng_mediaview_date_time" = "{date} at {time}";
|
||||||
"lng_mediaview_set_userpic" = "Set as Main";
|
"lng_mediaview_set_userpic" = "Set as Main";
|
||||||
|
"lng_mediaview_report_profile_photo" = "Report";
|
||||||
|
|
||||||
"lng_mediaview_saved_to" = "Image was saved to your {downloads} folder";
|
"lng_mediaview_saved_to" = "Image was saved to your {downloads} folder";
|
||||||
"lng_mediaview_downloads" = "Downloads";
|
"lng_mediaview_downloads" = "Downloads";
|
||||||
|
|
|
@ -9,6 +9,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_photo.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "ui/boxes/report_box.h"
|
#include "ui/boxes/report_box.h"
|
||||||
|
@ -42,16 +43,17 @@ void SendReport(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
const QString &comment,
|
const QString &comment,
|
||||||
MessageIdsList ids) {
|
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data) {
|
||||||
if (ids.empty()) {
|
auto done = [=] {
|
||||||
|
Ui::Toast::Show(toastParent, tr::lng_report_thanks(tr::now));
|
||||||
|
};
|
||||||
|
v::match(data, [&](v::null_t) {
|
||||||
peer->session().api().request(MTPaccount_ReportPeer(
|
peer->session().api().request(MTPaccount_ReportPeer(
|
||||||
peer->input,
|
peer->input,
|
||||||
ReasonToTL(reason),
|
ReasonToTL(reason),
|
||||||
MTP_string(comment)
|
MTP_string(comment)
|
||||||
)).done([=] {
|
)).done(std::move(done)).send();
|
||||||
Ui::Toast::Show(toastParent, tr::lng_report_thanks(tr::now));
|
}, [&](const MessageIdsList &ids) {
|
||||||
}).send();
|
|
||||||
} else {
|
|
||||||
auto apiIds = QVector<MTPint>();
|
auto apiIds = QVector<MTPint>();
|
||||||
apiIds.reserve(ids.size());
|
apiIds.reserve(ids.size());
|
||||||
for (const auto &fullId : ids) {
|
for (const auto &fullId : ids) {
|
||||||
|
@ -62,10 +64,15 @@ void SendReport(
|
||||||
MTP_vector<MTPint>(apiIds),
|
MTP_vector<MTPint>(apiIds),
|
||||||
ReasonToTL(reason),
|
ReasonToTL(reason),
|
||||||
MTP_string(comment)
|
MTP_string(comment)
|
||||||
)).done([=] {
|
)).done(std::move(done)).send();
|
||||||
Ui::Toast::Show(toastParent, tr::lng_report_thanks(tr::now));
|
}, [&](not_null<PhotoData*> photo) {
|
||||||
}).send();
|
peer->session().api().request(MTPaccount_ReportProfilePhoto(
|
||||||
}
|
peer->input,
|
||||||
|
photo->mtpInput(),
|
||||||
|
ReasonToTL(reason),
|
||||||
|
MTP_string(comment)
|
||||||
|
)).done(std::move(done)).send();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
class PeerData;
|
class PeerData;
|
||||||
|
class PhotoData;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
enum class ReportReason;
|
enum class ReportReason;
|
||||||
|
@ -20,6 +21,6 @@ void SendReport(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Ui::ReportReason reason,
|
Ui::ReportReason reason,
|
||||||
const QString &comment,
|
const QString &comment,
|
||||||
MessageIdsList ids = {});
|
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data);
|
||||||
|
|
||||||
} // namespace Api
|
} // namespace Api
|
||||||
|
|
|
@ -9,23 +9,34 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
|
|
||||||
#include "api/api_report.h"
|
#include "api/api_report.h"
|
||||||
#include "data/data_peer.h"
|
#include "data/data_peer.h"
|
||||||
|
#include "data/data_photo.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "ui/boxes/report_box.h"
|
#include "ui/boxes/report_box.h"
|
||||||
#include "ui/layers/generic_box.h"
|
#include "ui/layers/generic_box.h"
|
||||||
#include "window/window_session_controller.h"
|
#include "window/window_session_controller.h"
|
||||||
|
|
||||||
object_ptr<Ui::BoxContent> ReportItemsBox(
|
namespace {
|
||||||
|
|
||||||
|
[[nodiscard]] object_ptr<Ui::BoxContent> Report(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
MessageIdsList ids) {
|
std::variant<v::null_t, MessageIdsList, not_null<PhotoData*>> data) {
|
||||||
|
const auto source = v::match(data, [](const MessageIdsList &ids) {
|
||||||
|
return Ui::ReportSource::Message;
|
||||||
|
}, [](not_null<PhotoData*> photo) {
|
||||||
|
return photo->hasVideo()
|
||||||
|
? Ui::ReportSource::ProfileVideo
|
||||||
|
: Ui::ReportSource::ProfilePhoto;
|
||||||
|
}, [](v::null_t) {
|
||||||
|
Unexpected("Bad source report.");
|
||||||
|
return Ui::ReportSource::Bot;
|
||||||
|
});
|
||||||
return Box([=](not_null<Ui::GenericBox*> box) {
|
return Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
using Source = Ui::ReportSource;
|
Ui::ReportReasonBox(box, source, [=](Ui::ReportReason reason) {
|
||||||
using Reason = Ui::ReportReason;
|
|
||||||
Ui::ReportReasonBox(box, Source::Message, [=](Reason reason) {
|
|
||||||
Ui::BoxShow(box).showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
Ui::BoxShow(box).showBox(Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
const auto show = Ui::BoxShow(box);
|
const auto show = Ui::BoxShow(box);
|
||||||
Ui::ReportDetailsBox(box, [=](const QString &text) {
|
Ui::ReportDetailsBox(box, [=](const QString &text) {
|
||||||
const auto toastParent = show.toastParent();
|
const auto toastParent = show.toastParent();
|
||||||
Api::SendReport(toastParent, peer, reason, text, ids);
|
Api::SendReport(toastParent, peer, reason, text, data);
|
||||||
show.hideLayer();
|
show.hideLayer();
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
@ -33,6 +44,20 @@ object_ptr<Ui::BoxContent> ReportItemsBox(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
object_ptr<Ui::BoxContent> ReportItemsBox(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
MessageIdsList ids) {
|
||||||
|
return Report(peer, ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
object_ptr<Ui::BoxContent> ReportProfilePhotoBox(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
not_null<PhotoData*> photo) {
|
||||||
|
return Report(peer, photo);
|
||||||
|
}
|
||||||
|
|
||||||
void ShowReportPeerBox(
|
void ShowReportPeerBox(
|
||||||
not_null<Window::SessionController*> window,
|
not_null<Window::SessionController*> window,
|
||||||
not_null<PeerData*> peer) {
|
not_null<PeerData*> peer) {
|
||||||
|
|
|
@ -23,6 +23,9 @@ class PeerData;
|
||||||
[[nodiscard]] object_ptr<Ui::BoxContent> ReportItemsBox(
|
[[nodiscard]] object_ptr<Ui::BoxContent> ReportItemsBox(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
MessageIdsList ids);
|
MessageIdsList ids);
|
||||||
|
[[nodiscard]] object_ptr<Ui::BoxContent> ReportProfilePhotoBox(
|
||||||
|
not_null<PeerData*> peer,
|
||||||
|
not_null<PhotoData*> photo);
|
||||||
void ShowReportPeerBox(
|
void ShowReportPeerBox(
|
||||||
not_null<Window::SessionController*> window,
|
not_null<Window::SessionController*> window,
|
||||||
not_null<PeerData*> peer);
|
not_null<PeerData*> peer);
|
||||||
|
|
|
@ -32,6 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/gl/gl_surface.h"
|
#include "ui/gl/gl_surface.h"
|
||||||
#include "ui/boxes/confirm_box.h"
|
#include "ui/boxes/confirm_box.h"
|
||||||
#include "boxes/delete_messages_box.h"
|
#include "boxes/delete_messages_box.h"
|
||||||
|
#include "boxes/report_messages_box.h"
|
||||||
#include "media/audio/media_audio.h"
|
#include "media/audio/media_audio.h"
|
||||||
#include "media/view/media_view_playback_controls.h"
|
#include "media/view/media_view_playback_controls.h"
|
||||||
#include "media/view/media_view_group_thumbs.h"
|
#include "media/view/media_view_group_thumbs.h"
|
||||||
|
@ -1034,6 +1035,25 @@ void OverlayWidget::fillContextMenuActions(const MenuCallback &addAction) {
|
||||||
peer->session().api().peerPhoto().set(peer, photo);
|
peer->session().api().peerPhoto().set(peer, photo);
|
||||||
}, &st::mediaMenuIconProfile);
|
}, &st::mediaMenuIconProfile);
|
||||||
}();
|
}();
|
||||||
|
[&] { // Report userpic.
|
||||||
|
if (!_peer
|
||||||
|
|| !_photo
|
||||||
|
|| _peer->isSelf()
|
||||||
|
|| _peer->isNotificationsUser()
|
||||||
|
|| !userPhotosKey()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto photo = _photo;
|
||||||
|
const auto peer = _peer;
|
||||||
|
addAction(tr::lng_mediaview_report_profile_photo(tr::now), [=] {
|
||||||
|
if (const auto window = findWindow()) {
|
||||||
|
close();
|
||||||
|
window->show(
|
||||||
|
ReportProfilePhotoBox(peer, photo),
|
||||||
|
Ui::LayerOption::CloseOther);
|
||||||
|
}
|
||||||
|
}, &st::mediaMenuIconReport);
|
||||||
|
}();
|
||||||
}
|
}
|
||||||
|
|
||||||
auto OverlayWidget::computeOverviewType() const
|
auto OverlayWidget::computeOverviewType() const
|
||||||
|
|
|
@ -40,9 +40,15 @@ void ReportReasonBox(
|
||||||
case Source::Channel: return tr::lng_report_title();
|
case Source::Channel: return tr::lng_report_title();
|
||||||
case Source::Group: return tr::lng_report_group_title();
|
case Source::Group: return tr::lng_report_group_title();
|
||||||
case Source::Bot: return tr::lng_report_bot_title();
|
case Source::Bot: return tr::lng_report_bot_title();
|
||||||
|
case Source::ProfilePhoto:
|
||||||
|
return tr::lng_report_profile_photo_title();
|
||||||
|
case Source::ProfileVideo:
|
||||||
|
return tr::lng_report_profile_video_title();
|
||||||
}
|
}
|
||||||
Unexpected("'source' in ReportReasonBox.");
|
Unexpected("'source' in ReportReasonBox.");
|
||||||
}());
|
}());
|
||||||
|
const auto isProfileSource = (source == Source::ProfilePhoto)
|
||||||
|
|| (source == Source::ProfileVideo);
|
||||||
auto margin = style::margins{ 0, st::reportReasonTopSkip, 0, 0 };
|
auto margin = style::margins{ 0, st::reportReasonTopSkip, 0, 0 };
|
||||||
const auto add = [&](
|
const auto add = [&](
|
||||||
Reason reason,
|
Reason reason,
|
||||||
|
@ -69,7 +75,7 @@ void ReportReasonBox(
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
add(Reason::Spam, tr::lng_report_reason_spam, st::menuIconDelete);
|
add(Reason::Spam, tr::lng_report_reason_spam, st::menuIconDelete);
|
||||||
if (source != Source::Message) {
|
if (source != Source::Message && !isProfileSource) {
|
||||||
add(Reason::Fake, tr::lng_report_reason_fake, st::menuIconFake);
|
add(Reason::Fake, tr::lng_report_reason_fake, st::menuIconFake);
|
||||||
}
|
}
|
||||||
add(
|
add(
|
||||||
|
|
|
@ -16,6 +16,8 @@ enum class ReportSource {
|
||||||
Channel,
|
Channel,
|
||||||
Group,
|
Group,
|
||||||
Bot,
|
Bot,
|
||||||
|
ProfilePhoto,
|
||||||
|
ProfileVideo,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class ReportReason {
|
enum class ReportReason {
|
||||||
|
|
|
@ -131,6 +131,7 @@ mediaMenuIconForward: icon {{ "menu/forward", mediaviewMenuFg }};
|
||||||
mediaMenuIconDelete: icon {{ "menu/delete", mediaviewMenuFg }};
|
mediaMenuIconDelete: icon {{ "menu/delete", mediaviewMenuFg }};
|
||||||
mediaMenuIconShowAll: icon {{ "menu/all_media", mediaviewMenuFg }};
|
mediaMenuIconShowAll: icon {{ "menu/all_media", mediaviewMenuFg }};
|
||||||
mediaMenuIconProfile: icon {{ "menu/profile", mediaviewMenuFg }};
|
mediaMenuIconProfile: icon {{ "menu/profile", mediaviewMenuFg }};
|
||||||
|
mediaMenuIconReport: icon {{ "menu/report", mediaviewMenuFg }};
|
||||||
|
|
||||||
menuIconStartStream: icon {{ "menu/start_stream", menuIconColor }};
|
menuIconStartStream: icon {{ "menu/start_stream", menuIconColor }};
|
||||||
menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }};
|
menuIconStartStreamWith: icon {{ "menu/start_stream_with", menuIconColor }};
|
||||||
|
|
Loading…
Add table
Reference in a new issue