2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Move 'Add to contacts' button up in Info.

This commit is contained in:
John Preston
2019-07-04 12:07:32 +02:00
parent dd38da7737
commit 729da4a6b4
4 changed files with 47 additions and 24 deletions

View File

@@ -12,6 +12,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "auth_session.h"
#include "ui/wrap/slide_wrap.h"
#include "ui/text/text_utilities.h"
#include "lang/lang_keys.h"
#include "data/data_peer_values.h"
#include "data/data_shared_media.h"
#include "data/data_folder.h"
@@ -24,6 +25,25 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace Info {
namespace Profile {
namespace {
auto PlainBioValue(not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::AboutChanged
) | rpl::map([=] { return user->about(); });
}
auto PlainUsernameValue(not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::UsernameChanged
) | rpl::map([=] {
return peer->userName();
});
}
} // namespace
rpl::producer<TextWithEntities> NameValue(not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
@@ -43,11 +63,21 @@ rpl::producer<TextWithEntities> PhoneValue(not_null<UserData*> user) {
}) | Ui::Text::ToWithEntities();
}
auto PlainBioValue(not_null<UserData*> user) {
return Notify::PeerUpdateValue(
user,
Notify::PeerUpdate::Flag::AboutChanged
) | rpl::map([user] { return user->about(); });
rpl::producer<TextWithEntities> PhoneOrHiddenValue(not_null<UserData*> user) {
return rpl::combine(
PhoneValue(user),
PlainUsernameValue(user),
PlainBioValue(user),
tr::lng_info_mobile_hidden()
) | rpl::map([](
const TextWithEntities &phone,
const QString &username,
const QString &bio,
const QString &hidden) {
return (phone.text.isEmpty() && username.isEmpty() && bio.isEmpty())
? Ui::Text::WithEntities(hidden)
: phone;
});
}
rpl::producer<TextWithEntities> BioValue(not_null<UserData*> user) {
@@ -56,15 +86,6 @@ rpl::producer<TextWithEntities> BioValue(not_null<UserData*> user) {
| Ui::Text::ToWithEntities();
}
auto PlainUsernameValue(not_null<PeerData*> peer) {
return Notify::PeerUpdateValue(
peer,
Notify::PeerUpdate::Flag::UsernameChanged
) | rpl::map([peer] {
return peer->userName();
});
}
rpl::producer<TextWithEntities> UsernameValue(not_null<UserData*> user) {
return PlainUsernameValue(
user