2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

version 0.8.35.dev ready with some optimizations

This commit is contained in:
John Preston
2015-06-30 01:09:23 +03:00
parent 4b2fccf762
commit d57f6a973f
18 changed files with 275 additions and 110 deletions

View File

@@ -77,14 +77,21 @@ ProfileInner::ProfileInner(ProfileWidget *profile, ScrollArea *scroll, const Pee
if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
App::api()->requestFullPeer(_peer);
} else if (_peerChat->photoId) {
PhotoData *ph = App::photo(_peerChat->photoId);
if (ph->date) {
_photoLink = TextLinkPtr(new PhotoLink(ph, _peer));
PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
if (userPhoto && userPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
}
if ((_peerUser->botInfo && !_peerUser->botInfo->inited) || (_peerUser->photoId == UnknownPeerPhotoId) || (_peerUser->photoId && !userPhoto->date)) {
App::api()->requestFullPeer(_peer);
}
} else {
App::api()->requestFullPeer(_peer);
PhotoData *chatPhoto = (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) ? App::photo(_peerChat->photoId) : 0;
if (chatPhoto && chatPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(chatPhoto, _peer));
}
if (_peerChat->photoId == UnknownPeerPhotoId) {
App::api()->requestFullPeer(_peer);
}
}
// profile
@@ -325,7 +332,7 @@ void ProfileInner::chatInviteDone(const MTPExportedChatInvite &result) {
void ProfileInner::onFullPeerUpdated(PeerData *peer) {
if (peer != _peer) return;
if (_peerUser) {
PhotoData *userPhoto = _peerUser->photoId ? App::photo(_peerUser->photoId) : 0;
PhotoData *userPhoto = (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) ? App::photo(_peerUser->photoId) : 0;
if (userPhoto && userPhoto->date) {
_photoLink = TextLinkPtr(new PhotoLink(userPhoto, _peer));
} else {
@@ -376,9 +383,9 @@ void ProfileInner::peerUpdated(PeerData *data) {
PhotoData *photo = 0;
if (_peerUser) {
_phoneText = _peerUser->phone.isEmpty() ? QString() : App::formatPhone(_peerUser->phone);
if (_peerUser->photoId) photo = App::photo(_peerUser->photoId);
if (_peerUser->photoId && _peerUser->photoId != UnknownPeerPhotoId) photo = App::photo(_peerUser->photoId);
} else {
if (_peerChat->photoId) photo = App::photo(_peerChat->photoId);
if (_peerChat->photoId && _peerChat->photoId != UnknownPeerPhotoId) photo = App::photo(_peerChat->photoId);
}
_photoLink = (photo && photo->date) ? TextLinkPtr(new PhotoLink(photo, _peer)) : TextLinkPtr();
if (_peer->name != _nameCache) {