mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
de218146f4
5 changed files with 49 additions and 10 deletions
|
@ -230,6 +230,11 @@ namespace AyuSettings
|
||||||
voiceConfirmation = val;
|
voiceConfirmation = val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AyuGramSettings::set_copyUsernameAsLink(bool val)
|
||||||
|
{
|
||||||
|
copyUsernameAsLink = val;
|
||||||
|
}
|
||||||
|
|
||||||
bool get_ghostModeEnabled()
|
bool get_ghostModeEnabled()
|
||||||
{
|
{
|
||||||
return ghostModeEnabled.current();
|
return ghostModeEnabled.current();
|
||||||
|
|
|
@ -35,6 +35,7 @@ namespace AyuSettings
|
||||||
|
|
||||||
// ~ QoL toggles
|
// ~ QoL toggles
|
||||||
enableAds = false;
|
enableAds = false;
|
||||||
|
copyUsernameAsLink = true;
|
||||||
|
|
||||||
// ~ Customization
|
// ~ Customization
|
||||||
deletedMark = "🧹";
|
deletedMark = "🧹";
|
||||||
|
@ -75,6 +76,7 @@ namespace AyuSettings
|
||||||
bool stickerConfirmation;
|
bool stickerConfirmation;
|
||||||
bool GIFConfirmation;
|
bool GIFConfirmation;
|
||||||
bool voiceConfirmation;
|
bool voiceConfirmation;
|
||||||
|
bool copyUsernameAsLink;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void set_sendReadPackets(bool val);
|
void set_sendReadPackets(bool val);
|
||||||
|
@ -112,6 +114,8 @@ namespace AyuSettings
|
||||||
void set_GIFConfirmation(bool val);
|
void set_GIFConfirmation(bool val);
|
||||||
|
|
||||||
void set_voiceConfirmation(bool val);
|
void set_voiceConfirmation(bool val);
|
||||||
|
|
||||||
|
void set_copyUsernameAsLink(bool val);
|
||||||
};
|
};
|
||||||
|
|
||||||
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE(
|
||||||
|
@ -133,7 +137,8 @@ namespace AyuSettings
|
||||||
showMessageSeconds,
|
showMessageSeconds,
|
||||||
stickerConfirmation,
|
stickerConfirmation,
|
||||||
GIFConfirmation,
|
GIFConfirmation,
|
||||||
voiceConfirmation
|
voiceConfirmation,
|
||||||
|
copyUsernameAsLink
|
||||||
);
|
);
|
||||||
|
|
||||||
AyuGramSettings& getInstance();
|
AyuGramSettings& getInstance();
|
||||||
|
@ -152,4 +157,4 @@ namespace AyuSettings
|
||||||
bool get_ghostModeEnabled();
|
bool get_ghostModeEnabled();
|
||||||
|
|
||||||
rpl::producer<bool> get_ghostModeEnabledReactive();
|
rpl::producer<bool> get_ghostModeEnabledReactive();
|
||||||
}
|
}
|
|
@ -23,7 +23,9 @@
|
||||||
#include "platform/platform_specific.h"
|
#include "platform/platform_specific.h"
|
||||||
#include "settings/settings_common.h"
|
#include "settings/settings_common.h"
|
||||||
#include "storage/localstorage.h"
|
#include "storage/localstorage.h"
|
||||||
|
#include "styles/style_basic.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
|
#include "styles/style_widgets.h"
|
||||||
#include "ui/boxes/single_choice_box.h"
|
#include "ui/boxes/single_choice_box.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
#include "ui/widgets/checkbox.h"
|
#include "ui/widgets/checkbox.h"
|
||||||
|
@ -209,6 +211,22 @@ namespace Settings
|
||||||
settings->set_enableAds(enabled);
|
settings->set_enableAds(enabled);
|
||||||
AyuSettings::save();
|
AyuSettings::save();
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
|
|
||||||
|
AddButton(
|
||||||
|
container,
|
||||||
|
rpl::single(QString("Copy username as link")),
|
||||||
|
st::settingsButtonNoIcon
|
||||||
|
)->toggleOn(
|
||||||
|
rpl::single(settings->copyUsernameAsLink)
|
||||||
|
)->toggledValue(
|
||||||
|
) | rpl::filter([=](bool enabled)
|
||||||
|
{
|
||||||
|
return (enabled != settings->copyUsernameAsLink);
|
||||||
|
}) | start_with_next([=](bool enabled)
|
||||||
|
{
|
||||||
|
settings->set_copyUsernameAsLink(enabled);
|
||||||
|
AyuSettings::save();
|
||||||
|
}, container->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::SetupCustomization(not_null<Ui::VerticalLayout*> container,
|
void Ayu::SetupCustomization(not_null<Ui::VerticalLayout*> container,
|
||||||
|
@ -381,7 +399,7 @@ namespace Settings
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void Ayu::SetupBetaFunctions(not_null<Ui::VerticalLayout*> container)
|
void Ayu::SetupSendConfirmations(not_null<Ui::VerticalLayout*> container)
|
||||||
{
|
{
|
||||||
auto settings = &AyuSettings::getInstance();
|
auto settings = &AyuSettings::getInstance();
|
||||||
|
|
||||||
|
@ -463,8 +481,8 @@ namespace Settings
|
||||||
AddDivider(container);
|
AddDivider(container);
|
||||||
|
|
||||||
AddSkip(container);
|
AddSkip(container);
|
||||||
SetupBetaFunctions(container);
|
SetupSendConfirmations(container);
|
||||||
|
|
||||||
AddDividerText(container, tr::ayu_SettingsWatermark());
|
AddDividerText(container, tr::ayu_SettingsWatermark());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ namespace Settings
|
||||||
|
|
||||||
void SetupAyuSync(not_null<Ui::VerticalLayout*> container);
|
void SetupAyuSync(not_null<Ui::VerticalLayout*> container);
|
||||||
|
|
||||||
void SetupBetaFunctions(not_null<Ui::VerticalLayout*> container);
|
void SetupSendConfirmations(not_null<Ui::VerticalLayout*> container);
|
||||||
|
|
||||||
void SetupAyuGramSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> null);
|
void SetupAyuGramSettings(not_null<Ui::VerticalLayout*> container, not_null<Window::SessionController*> null);
|
||||||
|
|
||||||
|
|
|
@ -110,11 +110,22 @@ namespace {
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
const QString &addToLink) {
|
const QString &addToLink) {
|
||||||
return [=](QString link) {
|
return [=](QString link) {
|
||||||
if (!link.startsWith(u"https://"_q)) {
|
auto settings = &AyuSettings::getInstance();
|
||||||
link = peer->session().createInternalLinkFull(peer->userName())
|
if (!settings->copyUsernameAsLink)
|
||||||
+ addToLink;
|
{
|
||||||
|
link = '@' + peer->userName();
|
||||||
}
|
}
|
||||||
if (!link.isEmpty()) {
|
else
|
||||||
|
{
|
||||||
|
if (!link.startsWith(u"https://"_q))
|
||||||
|
{
|
||||||
|
link = peer->session().createInternalLinkFull(peer->userName())
|
||||||
|
+ addToLink;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!link.isEmpty())
|
||||||
|
{
|
||||||
QGuiApplication::clipboard()->setText(link);
|
QGuiApplication::clipboard()->setText(link);
|
||||||
show->showToast(tr::lng_username_copied(tr::now));
|
show->showToast(tr::lng_username_copied(tr::now));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue