mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-26 23:42:09 +00:00
Compare commits
6 Commits
v6.3.10
...
dev-bleizix
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a3723a7ee | |||
| 48ec267f7f | |||
| 852f3b2359 | |||
| 8584c8daff | |||
| 1d9af5bafb | |||
| 1c9278d050 |
@@ -652,6 +652,22 @@ QString FormatReadDate(TimeId date, const QDateTime &now) {
|
||||
const auto parsed = base::unixtime::parse(date);
|
||||
const auto readDate = parsed.date();
|
||||
const auto nowDate = now.date();
|
||||
|
||||
if (readDate.year() < nowDate.year()) {
|
||||
return tr::lng_mediaview_date_time(
|
||||
tr::now,
|
||||
lt_date,
|
||||
tr::lng_month_day_year(
|
||||
tr::now,
|
||||
lt_month,
|
||||
Lang::MonthDay(readDate.month())(tr::now),
|
||||
lt_day,
|
||||
QString::number(readDate.day()),
|
||||
lt_year,
|
||||
QString::number(readDate.year())),
|
||||
lt_time,
|
||||
QLocale().toString(parsed.time(), "HH:mm:ss"));
|
||||
}
|
||||
if (readDate == nowDate) {
|
||||
return tr::lng_mediaview_today(
|
||||
tr::now,
|
||||
|
||||
@@ -38,8 +38,7 @@ bool isForwarding(const PeerId &id) {
|
||||
return state.state != ForwardState::State::Finished
|
||||
&& state.currentChunk < state.totalChunks
|
||||
&& !state.stopRequested
|
||||
&& state.totalChunks
|
||||
&& state.totalMessages;
|
||||
&& (state.totalChunks && state.totalMessages || state.state == ForwardState::State::Downloading);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -85,7 +84,7 @@ std::pair<QString, QString> stateName(const PeerId &id) {
|
||||
if (state->state == ForwardState::State::Preparing) {
|
||||
status = tr::ayu_AyuForwardStatusPreparing(tr::now);
|
||||
} else if (state->state == ForwardState::State::Downloading) {
|
||||
status = tr::ayu_AyuForwardStatusLoadingMedia(tr::now);
|
||||
return std::make_pair(tr::ayu_AyuForwardStatusLoadingMedia(tr::now), "");
|
||||
} else if (state->state == ForwardState::State::Sending) {
|
||||
status = tr::ayu_AyuForwardStatusForwarding(tr::now);
|
||||
} else {
|
||||
@@ -367,6 +366,7 @@ void forwardMessages(
|
||||
}
|
||||
|
||||
auto message = Api::MessageToSend(Api::SendAction(session->data().history(peer->id)));
|
||||
message.action.options.invertCaption = item->invertMedia();
|
||||
message.action.replyTo = action.replyTo;
|
||||
|
||||
if (draft.options != Data::ForwardOptions::NoNamesAndCaptions) {
|
||||
|
||||
@@ -85,6 +85,17 @@ QString filePath(not_null<Main::Session*> session, const Data::Media *media) {
|
||||
return pathForSave(session) + "round_" + QString::number(document->getDC()) + "_" +
|
||||
QString::number(document->id) + ".mp4";
|
||||
}
|
||||
|
||||
|
||||
// media without any file name
|
||||
if (document->isGifv()) {
|
||||
return pathForSave(session) + "gif_" + QString::number(document->getDC()) + "_" +
|
||||
QString::number(document->id) + ".gif";
|
||||
}
|
||||
if (document->isVideoFile()) {
|
||||
return pathForSave(session) + "video_" + QString::number(document->getDC()) + "_" +
|
||||
QString::number(document->id) + ".mp4";
|
||||
}
|
||||
} else if (const auto photo = media->photo()) {
|
||||
return pathForSave(session) + QString::number(photo->getDC()) + "_" + QString::number(photo->id) + ".jpg";
|
||||
}
|
||||
@@ -140,9 +151,8 @@ void loadDocumentSync(not_null<Main::Session*> session, DocumentData *data, not_
|
||||
{
|
||||
data->save(Data::FileOriginMessage(item->fullId()), path);
|
||||
|
||||
rpl::single() | rpl::then(
|
||||
session->downloaderTaskFinished()
|
||||
) | rpl::filter([&]
|
||||
|
||||
session->downloaderTaskFinished() | rpl::filter([&]
|
||||
{
|
||||
return data->status == FileDownloadFailed || fileSize(item) == data->size;
|
||||
}) | rpl::start_with_next([&]() mutable
|
||||
@@ -290,13 +300,13 @@ void sendDocumentSync(not_null<Main::Session*> session,
|
||||
SendMediaType type,
|
||||
TextWithTags &&caption,
|
||||
const Api::SendAction &action) {
|
||||
|
||||
auto groupId = std::make_shared<SendingAlbum>();
|
||||
groupId->groupId = base::RandomValue<uint64>();
|
||||
|
||||
crl::on_main([=, lst = std::move(group.list), caption = std::move(caption)]() mutable
|
||||
{
|
||||
session->api().sendFiles(std::move(lst), type, std::move(caption), groupId, action);
|
||||
auto size = lst.files.size();
|
||||
session->api().sendFiles(std::move(lst), type, std::move(caption), size > 1 ? groupId : nullptr, action);
|
||||
});
|
||||
|
||||
waitForMsgSync(session, action);
|
||||
|
||||
@@ -115,8 +115,8 @@ Cover GetCurrentCover(
|
||||
};
|
||||
if (const auto normal = dataMedia->thumbnail()) {
|
||||
return {
|
||||
.pixToDraw = normal->pixSingle(scaled(normal), args),
|
||||
.pixToBg = normal->pix(),
|
||||
.pixToDraw = normal->pixNoCache(scaled(normal), args),
|
||||
.pixToBg = normal->pixNoCache(),
|
||||
.noCover = false
|
||||
};
|
||||
} /*else if (const auto blurred = dataMedia->thumbnailInline()) {
|
||||
|
||||
@@ -78,15 +78,13 @@ void SetupGhostModeToggle(not_null<Ui::VerticalLayout*> container) {
|
||||
AddCollapsibleToggle(container, tr::ayu_GhostModeToggle(), checkboxes, true);
|
||||
}
|
||||
|
||||
void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||
auto *settings = &AyuSettings::getInstance();
|
||||
|
||||
void SetupGhostEssentials(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<AyuSettings::AyuGramSettings*> settings,
|
||||
not_null<rpl::variable<bool>*> markReadAfterActionVal,
|
||||
not_null<rpl::variable<bool>*> useScheduledMessagesVal) {
|
||||
SetupGhostModeToggle(container);
|
||||
|
||||
auto markReadAfterActionVal = container->lifetime().make_state<rpl::variable<bool>>(
|
||||
settings->markReadAfterAction);
|
||||
auto useScheduledMessagesVal = container->lifetime().make_state<rpl::variable<
|
||||
bool>>(settings->useScheduledMessages);
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
@@ -115,14 +113,11 @@ void SetupGhostEssentials(not_null<Ui::VerticalLayout*> container) {
|
||||
AddDividerText(container, tr::ayu_MarkReadAfterActionDescription());
|
||||
}
|
||||
|
||||
void SetupScheduleMessages(not_null<Ui::VerticalLayout*> container) {
|
||||
auto *settings = &AyuSettings::getInstance();
|
||||
|
||||
auto markReadAfterActionVal = container->lifetime().make_state<rpl::variable<bool>>(
|
||||
settings->markReadAfterAction);
|
||||
auto useScheduledMessagesVal = container->lifetime().make_state<rpl::variable<
|
||||
bool>>(settings->useScheduledMessages);
|
||||
|
||||
void SetupScheduleMessages(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
not_null<AyuSettings::AyuGramSettings*> settings,
|
||||
not_null<rpl::variable<bool>*> markReadAfterActionVal,
|
||||
not_null<rpl::variable<bool>*> useScheduledMessagesVal) {
|
||||
AddSkip(container);
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
@@ -290,11 +285,17 @@ void SetupOther(not_null<Ui::VerticalLayout*> container) {
|
||||
|
||||
void AyuGhost::setupContent(not_null<Window::SessionController*> controller) {
|
||||
const auto content = Ui::CreateChild<Ui::VerticalLayout>(this);
|
||||
auto settings = &AyuSettings::getInstance();
|
||||
|
||||
auto markReadAfterActionVal = content->lifetime().make_state<rpl::variable<bool>>(
|
||||
settings->markReadAfterAction);
|
||||
auto useScheduledMessagesVal = content->lifetime().make_state<rpl::variable<bool>>(
|
||||
settings->useScheduledMessages);
|
||||
|
||||
AddSkip(content);
|
||||
|
||||
SetupGhostEssentials(content);
|
||||
SetupScheduleMessages(content);
|
||||
SetupGhostEssentials(content, settings, markReadAfterActionVal, useScheduledMessagesVal);
|
||||
SetupScheduleMessages(content, settings, markReadAfterActionVal, useScheduledMessagesVal);
|
||||
SetupSendWithoutSound(content);
|
||||
|
||||
AddSkip(content);
|
||||
|
||||
@@ -182,6 +182,24 @@ void SetupQoLToggles(not_null<Ui::VerticalLayout*> container, not_null<Window::S
|
||||
|
||||
AddCollapsibleToggle(container, tr::ayu_DisableSimilarChannels(), checkboxes, true);
|
||||
|
||||
|
||||
AddButtonWithIcon(
|
||||
container,
|
||||
tr::ayu_DisableNotificationsDelay(),
|
||||
st::settingsButtonNoIcon
|
||||
)->toggleOn(
|
||||
rpl::single(settings->disableNotificationsDelay)
|
||||
)->toggledValue(
|
||||
) | rpl::filter([=](bool enabled)
|
||||
{
|
||||
return (enabled != settings->disableNotificationsDelay);
|
||||
}) | start_with_next([=](bool enabled)
|
||||
{
|
||||
AyuSettings::set_disableNotificationsDelay(enabled);
|
||||
AyuSettings::save();
|
||||
},
|
||||
container->lifetime());
|
||||
|
||||
AddSkip(container);
|
||||
AddDivider(container);
|
||||
AddSkip(container);
|
||||
|
||||
@@ -917,7 +917,7 @@ void Cover::setupSavedMusic() {
|
||||
dispatchToMainThread(
|
||||
[=]
|
||||
{
|
||||
if (const auto strong = weak.get()) {
|
||||
if (const auto strong = weak.get(); strong && strong->_musicButton) {
|
||||
strong->_musicButton->show(anim::type::normal);
|
||||
}
|
||||
},
|
||||
@@ -928,15 +928,19 @@ void Cover::setupSavedMusic() {
|
||||
widthValue() | rpl::start_with_next(
|
||||
[=](int newWidth)
|
||||
{
|
||||
_musicButton->resizeToWidth(newWidth);
|
||||
_musicButton->moveToLeft(0, _st.height, newWidth);
|
||||
resize(width(), _st.height + _musicButton->height());
|
||||
if (_musicButton) {
|
||||
_musicButton->resizeToWidth(newWidth);
|
||||
_musicButton->moveToLeft(0, _st.height, newWidth);
|
||||
resize(width(), _st.height + _musicButton->height());
|
||||
}
|
||||
},
|
||||
_musicButton->lifetime());
|
||||
_musicButton->heightValue() | rpl::start_with_next(
|
||||
[=]
|
||||
{
|
||||
resize(width(), _st.height + _musicButton->height());
|
||||
if (_musicButton) {
|
||||
resize(width(), _st.height + _musicButton->height());
|
||||
}
|
||||
},
|
||||
_musicButton->lifetime());
|
||||
} else {
|
||||
|
||||
@@ -45,7 +45,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
|
||||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
|
||||
#include "ayu/utils/telegram_helpers.h"
|
||||
|
||||
#if __has_include(<gio/gio.hpp>)
|
||||
#include <gio/gio.hpp>
|
||||
@@ -397,6 +397,10 @@ void System::schedule(Data::ItemNotification notification) {
|
||||
thread->popNotification(notification);
|
||||
return;
|
||||
}
|
||||
if (isMessageHidden(item)) {
|
||||
thread->popNotification(notification);
|
||||
return;
|
||||
}
|
||||
const auto ready = (skip.value != SkipState::Unknown)
|
||||
&& item->notificationReady();
|
||||
|
||||
|
||||
@@ -247,11 +247,6 @@ void Manager::showNextFromQueue() {
|
||||
auto queued = _queuedNotifications.front();
|
||||
_queuedNotifications.pop_front();
|
||||
|
||||
if (queued.item && isMessageHidden(queued.item)) {
|
||||
--count;
|
||||
continue;
|
||||
}
|
||||
|
||||
subscribeToSession(&queued.history->session());
|
||||
_notifications.push_back(std::make_unique<Notification>(
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user