Skip to content

Commit

Permalink
renamed phone hide feature to streamer mode, and made it hide phone w…
Browse files Browse the repository at this point in the history
…hile showing self profile as external
  • Loading branch information
xmdnx committed Jun 19, 2024
1 parent 3ce038e commit 79768ce
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Telegram/Resources/langs/rabbit/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"rtg_profile_group_id": "Group ID",
"rtg_profile_supergroup_id": "Supergroup ID",
"rtg_profile_channel_id": "Channel ID",
"rtg_settings_show_phone_number": "Show phone number",
"rtg_settings_show_phone_number": "Streamer mode",
"rtg_settings_call_confirm": "Confirm before calling",
"rtg_call_sure": "Are you sure you want to call this user?",
"rtg_call_button": "Call",
Expand Down
2 changes: 1 addition & 1 deletion Telegram/Resources/langs/rabbit/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"rtg_profile_group_id": "ID группы",
"rtg_profile_supergroup_id": "ID супергруппы",
"rtg_profile_channel_id": "ID канала",
"rtg_settings_show_phone_number": "Показывать телефон",
"rtg_settings_show_phone_number": "Режим стримера",
"rtg_settings_call_confirm": "Подтверждение перед звонком",
"rtg_call_sure": "Вы уверены, что хотите позвонить этому пользователю?",
"rtg_call_button": "Позвонить",
Expand Down
8 changes: 6 additions & 2 deletions Telegram/SourceFiles/info/profile/info_profile_values.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,9 @@ rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user) {
user,
UpdateFlag::PhoneNumber) | rpl::to_empty
) | rpl::map([=] {
return Ui::FormatPhone(user->phone());
return (RabbitSettings::JsonSettings::GetBool("streamer_mode") && user->isSelf())
? ktr("rtg_phone_hidden")
: Ui::FormatPhone(user->phone());
}) | Ui::Text::ToWithEntities();
}

Expand All @@ -144,7 +146,9 @@ rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user) {
const QString &username,
const QString &about,
const QString &hidden) {
if (phone.text.isEmpty() && username.isEmpty() && about.isEmpty()) {
if (
(phone.text.isEmpty() && username.isEmpty() && about.isEmpty())
|| (RabbitSettings::JsonSettings::GetBool("streamer_mode") && user->isSelf())) {
return Ui::Text::WithEntities(hidden);
} else if (IsCollectiblePhone(user)) {
return Ui::Text::Link(phone, u"internal:collectible_phone/"_q
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/rabbit/settings/rabbit_settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ const std::map<QString, Definition, std::greater<QString>> DefinitionMap {

// Stored settings
// General
{ "show_phone_in_settings", {
{ "streamer_mode", {
.type = SettingType::BoolSetting,
.defaultValue = true, }},
{ "auto_hide_notifications", {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace Settings {
void RabbitGeneral::SetupGeneral(not_null<Ui::VerticalLayout *> container) {
Ui::AddSubsectionTitle(container, rktr("rtg_settings_general"));

SettingsMenuJsonSwitch(rtg_settings_show_phone_number, show_phone_in_settings);
SettingsMenuJsonSwitch(rtg_settings_show_phone_number, streamer_mode);
SettingsMenuJsonSwitch(rtg_settings_auto_hide_notifications, auto_hide_notifications);

container->add(object_ptr<Button>(
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/settings/settings_information.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ void SetupRows(
AddRow(
container,
tr::lng_settings_phone_label(),
::RabbitSettings::JsonSettings::GetBool("show_phone_in_settings")
::RabbitSettings::JsonSettings::GetBool("streamer_mode")
? Info::Profile::PhoneValue(self)
: rktre("rtg_phone_hidden"),
tr::lng_profile_copy_phone(tr::now),
Expand Down
2 changes: 1 addition & 1 deletion Telegram/SourceFiles/settings/settings_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ void Cover::initViewers() {
_user
) | rpl::start_with_next([=](const TextWithEntities &value) {
_phone->setText(
::RabbitSettings::JsonSettings::GetBool("show_phone_in_settings")
::RabbitSettings::JsonSettings::GetBool("streamer_mode")
? value.text // shown
: ktr("rtg_phone_hidden") // hidden
);
Expand Down

0 comments on commit 79768ce

Please sign in to comment.