mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
no message
This commit is contained in:
parent
8a6d5806c6
commit
b6f2f36fc7
@ -208,6 +208,11 @@ typedef enum {
|
|||||||
@property (nonatomic, strong) NSString *chatPhotoSmall;
|
@property (nonatomic, strong) NSString *chatPhotoSmall;
|
||||||
@property (nonatomic, strong) NSString *chatPhotoMedium;
|
@property (nonatomic, strong) NSString *chatPhotoMedium;
|
||||||
@property (nonatomic, strong) NSString *chatPhotoBig;
|
@property (nonatomic, strong) NSString *chatPhotoBig;
|
||||||
|
@property (nonatomic) NSData *chatPhotoFileReferenceSmall;
|
||||||
|
@property (nonatomic) NSData *chatPhotoFileReferenceBig;
|
||||||
|
|
||||||
|
@property (nonatomic, strong) NSString *chatPhotoFullSmall;
|
||||||
|
@property (nonatomic, strong) NSString *chatPhotoFullBig;
|
||||||
|
|
||||||
@property (nonatomic) int chatParticipantCount;
|
@property (nonatomic) int chatParticipantCount;
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#import "TGConversation.h"
|
#import "TGConversation.h"
|
||||||
|
|
||||||
#import "LegacyComponentsInternal.h"
|
#import "LegacyComponentsInternal.h"
|
||||||
|
#import "TGStringUtils.h"
|
||||||
#import "TGMessage.h"
|
#import "TGMessage.h"
|
||||||
|
|
||||||
#import "PSKeyValueCoder.h"
|
#import "PSKeyValueCoder.h"
|
||||||
@ -502,6 +502,8 @@
|
|||||||
_chatPhotoSmall = [coder decodeStringForCKey:"cp.s"];
|
_chatPhotoSmall = [coder decodeStringForCKey:"cp.s"];
|
||||||
_chatPhotoMedium = [coder decodeStringForCKey:"cp.m"];
|
_chatPhotoMedium = [coder decodeStringForCKey:"cp.m"];
|
||||||
_chatPhotoBig = [coder decodeStringForCKey:"cp.l"];
|
_chatPhotoBig = [coder decodeStringForCKey:"cp.l"];
|
||||||
|
_chatPhotoFileReferenceSmall = [coder decodeDataCorCKey:"cp.frs"];
|
||||||
|
_chatPhotoFileReferenceBig = [coder decodeDataCorCKey:"cp.frb"];
|
||||||
_chatParticipants = nil;
|
_chatParticipants = nil;
|
||||||
_chatParticipantCount = 0;
|
_chatParticipantCount = 0;
|
||||||
_chatVersion = [coder decodeInt32ForCKey:"ver"];
|
_chatVersion = [coder decodeInt32ForCKey:"ver"];
|
||||||
@ -565,6 +567,8 @@
|
|||||||
[coder encodeString:_chatPhotoSmall forCKey:"cp.s"];
|
[coder encodeString:_chatPhotoSmall forCKey:"cp.s"];
|
||||||
[coder encodeString:_chatPhotoMedium forCKey:"cp.m"];
|
[coder encodeString:_chatPhotoMedium forCKey:"cp.m"];
|
||||||
[coder encodeString:_chatPhotoBig forCKey:"cp.l"];
|
[coder encodeString:_chatPhotoBig forCKey:"cp.l"];
|
||||||
|
[coder encodeData:_chatPhotoFileReferenceSmall forCKey:"cp.frs"];
|
||||||
|
[coder encodeData:_chatPhotoFileReferenceBig forCKey:"cp.frb"];
|
||||||
[coder encodeInt32:_chatVersion forCKey:"ver"];
|
[coder encodeInt32:_chatVersion forCKey:"ver"];
|
||||||
[coder encodeInt32:_chatIsAdmin ? 1 : 0 forCKey:"adm"];
|
[coder encodeInt32:_chatIsAdmin ? 1 : 0 forCKey:"adm"];
|
||||||
[coder encodeInt32:_channelRole forCKey:"role"];
|
[coder encodeInt32:_channelRole forCKey:"role"];
|
||||||
@ -1313,4 +1317,28 @@
|
|||||||
return TGPeerIdIsAd(_conversationId);
|
return TGPeerIdIsAd(_conversationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)chatPhotoFullSmall
|
||||||
|
{
|
||||||
|
NSString *finalAvatarUrl = self.chatPhotoSmall;
|
||||||
|
if (finalAvatarUrl.length == 0)
|
||||||
|
return finalAvatarUrl;
|
||||||
|
|
||||||
|
if (self.chatPhotoFileReferenceSmall != nil)
|
||||||
|
finalAvatarUrl = [finalAvatarUrl stringByAppendingFormat:@"_%@", [self.chatPhotoFileReferenceSmall stringByEncodingInHex]];
|
||||||
|
|
||||||
|
return finalAvatarUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)chatPhotoFullBig
|
||||||
|
{
|
||||||
|
NSString *finalAvatarUrl = self.chatPhotoBig;
|
||||||
|
if (finalAvatarUrl.length == 0)
|
||||||
|
return finalAvatarUrl;
|
||||||
|
|
||||||
|
if (self.chatPhotoFileReferenceBig != nil)
|
||||||
|
finalAvatarUrl = [finalAvatarUrl stringByAppendingFormat:@"_%@", [self.chatPhotoFileReferenceBig stringByEncodingInHex]];
|
||||||
|
|
||||||
|
return finalAvatarUrl;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -181,7 +181,7 @@ const CGFloat TGLocationLiveCellHeight = 68;
|
|||||||
UIImage *placeholder = _pallete != nil ? _pallete.avatarPlaceholder : staticPlaceholder;
|
UIImage *placeholder = _pallete != nil ? _pallete.avatarPlaceholder : staticPlaceholder;
|
||||||
|
|
||||||
bool isUser = [peer isKindOfClass:[TGUser class]];
|
bool isUser = [peer isKindOfClass:[TGUser class]];
|
||||||
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoUrlSmall : ((TGConversation *)peer).chatPhotoSmall;
|
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoFullUrlSmall : ((TGConversation *)peer).chatPhotoFullSmall;
|
||||||
if (avatarUrl.length != 0)
|
if (avatarUrl.length != 0)
|
||||||
{
|
{
|
||||||
_avatarView.fadeTransitionDuration = 0.3;
|
_avatarView.fadeTransitionDuration = 0.3;
|
||||||
|
@ -58,7 +58,7 @@
|
|||||||
UIGraphicsEndImageContext();
|
UIGraphicsEndImageContext();
|
||||||
});
|
});
|
||||||
|
|
||||||
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoUrlSmall : ((TGConversation *)peer).chatPhotoSmall;
|
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoFullUrlSmall : ((TGConversation *)peer).chatPhotoFullSmall;
|
||||||
if (avatarUrl.length != 0)
|
if (avatarUrl.length != 0)
|
||||||
{
|
{
|
||||||
_avatarView.fadeTransitionDuration = 0.3;
|
_avatarView.fadeTransitionDuration = 0.3;
|
||||||
|
@ -372,7 +372,7 @@ NSString *const TGLocationPinAnnotationKind = @"TGLocationPinAnnotation";
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool isUser = [peer isKindOfClass:[TGUser class]];
|
bool isUser = [peer isKindOfClass:[TGUser class]];
|
||||||
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoUrlSmall : ((TGConversation *)peer).chatPhotoSmall;
|
NSString *avatarUrl = isUser ? ((TGUser *)peer).photoFullUrlSmall : ((TGConversation *)peer).chatPhotoFullSmall;
|
||||||
if (avatarUrl.length != 0)
|
if (avatarUrl.length != 0)
|
||||||
{
|
{
|
||||||
_avatarView.fadeTransitionDuration = 0.3;
|
_avatarView.fadeTransitionDuration = 0.3;
|
||||||
|
@ -11,6 +11,7 @@ typedef enum {
|
|||||||
@property (nonatomic, readonly) TGMediaOriginType type;
|
@property (nonatomic, readonly) TGMediaOriginType type;
|
||||||
|
|
||||||
@property (nonatomic, readonly, strong) NSData *fileReference;
|
@property (nonatomic, readonly, strong) NSData *fileReference;
|
||||||
|
@property (nonatomic, readonly, strong) NSDictionary *fileReferences;
|
||||||
|
|
||||||
@property (nonatomic, readonly, strong) NSNumber *cid;
|
@property (nonatomic, readonly, strong) NSNumber *cid;
|
||||||
@property (nonatomic, readonly, strong) NSNumber *mid;
|
@property (nonatomic, readonly, strong) NSNumber *mid;
|
||||||
@ -21,8 +22,10 @@ typedef enum {
|
|||||||
@property (nonatomic, readonly, strong) NSNumber *profilePhotoUserId;
|
@property (nonatomic, readonly, strong) NSNumber *profilePhotoUserId;
|
||||||
@property (nonatomic, readonly, strong) NSNumber *profilePhotoOffset;
|
@property (nonatomic, readonly, strong) NSNumber *profilePhotoOffset;
|
||||||
|
|
||||||
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference cid:(int64_t)cid mid:(int32_t)mid;
|
- (NSData *)fileReferenceForVolumeId:(int64_t)volumeId localId:(int32_t)localId;
|
||||||
|
|
||||||
|
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences cid:(int64_t)cid mid:(int32_t)mid;
|
||||||
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference stickerPackId:(int64_t)packId accessHash:(int64_t)accessHash;
|
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference stickerPackId:(int64_t)packId accessHash:(int64_t)accessHash;
|
||||||
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference userId:(int32_t)userId offset:(int32_t)offset;
|
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
@ -2,11 +2,17 @@
|
|||||||
|
|
||||||
@implementation TGMediaOriginInfo
|
@implementation TGMediaOriginInfo
|
||||||
|
|
||||||
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference cid:(int64_t)cid mid:(int32_t)mid
|
- (NSData *)fileReferenceForVolumeId:(int64_t)volumeId localId:(int32_t)localId
|
||||||
|
{
|
||||||
|
return _fileReferences[[NSString stringWithFormat:@"%lld_%d", volumeId, localId]];
|
||||||
|
}
|
||||||
|
|
||||||
|
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences cid:(int64_t)cid mid:(int32_t)mid
|
||||||
{
|
{
|
||||||
TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init];
|
TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init];
|
||||||
info->_type = TGMediaOriginTypeMessage;
|
info->_type = TGMediaOriginTypeMessage;
|
||||||
info->_fileReference = fileReference;
|
info->_fileReference = fileReference;
|
||||||
|
info->_fileReferences = fileReferences;
|
||||||
info->_cid = @(cid);
|
info->_cid = @(cid);
|
||||||
info->_mid = @(mid);
|
info->_mid = @(mid);
|
||||||
return info;
|
return info;
|
||||||
@ -22,11 +28,12 @@
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference userId:(int32_t)userId offset:(int32_t)offset
|
+ (instancetype)mediaOriginInfoWithFileReference:(NSData *)fileReference fileReferences:(NSDictionary *)fileReferences userId:(int32_t)userId offset:(int32_t)offset
|
||||||
{
|
{
|
||||||
TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init];
|
TGMediaOriginInfo *info = [[TGMediaOriginInfo alloc] init];
|
||||||
info->_type = TGMediaOriginTypeProfilePhoto;
|
info->_type = TGMediaOriginTypeProfilePhoto;
|
||||||
info->_fileReference = fileReference;
|
info->_fileReference = fileReference;
|
||||||
|
info->_fileReferences = fileReferences;
|
||||||
info->_profilePhotoUserId = @(userId);
|
info->_profilePhotoUserId = @(userId);
|
||||||
info->_profilePhotoOffset = @(offset);
|
info->_profilePhotoOffset = @(offset);
|
||||||
return info;
|
return info;
|
||||||
|
@ -1177,6 +1177,10 @@ typedef enum
|
|||||||
|
|
||||||
if (zoomedIn)
|
if (zoomedIn)
|
||||||
{
|
{
|
||||||
|
CGFloat zoomedDuration = _zoomedDuration;
|
||||||
|
if (zoomedDuration < FLT_EPSILON)
|
||||||
|
zoomedDuration = _duration;
|
||||||
|
|
||||||
CGFloat newWidth = (CGFloat)(width * _duration / _zoomedDuration);
|
CGFloat newWidth = (CGFloat)(width * _duration / _zoomedDuration);
|
||||||
CGFloat newPosition = _zoomPivotCenter * newWidth / width;
|
CGFloat newPosition = _zoomPivotCenter * newWidth / width;
|
||||||
|
|
||||||
@ -1248,8 +1252,8 @@ typedef enum
|
|||||||
CGRect trimRect = [self _scrubbingRectZoomedIn:zoomedIn];
|
CGRect trimRect = [self _scrubbingRectZoomedIn:zoomedIn];
|
||||||
CGRect normalScrubbingRect = [self _scrubbingRectZoomedIn:false];
|
CGRect normalScrubbingRect = [self _scrubbingRectZoomedIn:false];
|
||||||
|
|
||||||
CGFloat minX = (CGFloat)startPosition * trimRect.size.width / (CGFloat)duration + trimRect.origin.x - normalScrubbingRect.origin.x;
|
CGFloat minX = duration > FLT_EPSILON ? ((CGFloat)startPosition * trimRect.size.width / (CGFloat)duration + trimRect.origin.x - normalScrubbingRect.origin.x) : 0.0f;
|
||||||
CGFloat maxX = (CGFloat)endPosition * trimRect.size.width / (CGFloat)duration + trimRect.origin.x + normalScrubbingRect.origin.x;
|
CGFloat maxX = duration > FLT_EPSILON ? ((CGFloat)endPosition * trimRect.size.width / (CGFloat)duration + trimRect.origin.x + normalScrubbingRect.origin.x) : 0.0f;
|
||||||
|
|
||||||
return CGRectMake(minX, 0, maxX - minX, 36);
|
return CGRectMake(minX, 0, maxX - minX, 36);
|
||||||
}
|
}
|
||||||
|
@ -103,7 +103,7 @@ NSString *const TGMentionPanelCellKind = @"TGMentionPanelCell";
|
|||||||
_nameLabel.text = user.displayName;
|
_nameLabel.text = user.displayName;
|
||||||
_usernameLabel.text = user.userName.length == 0 ? @"" : [[NSString alloc] initWithFormat:@"@%@", user.userName];
|
_usernameLabel.text = user.userName.length == 0 ? @"" : [[NSString alloc] initWithFormat:@"@%@", user.userName];
|
||||||
|
|
||||||
NSString *avatarUrl = user.photoUrlSmall;
|
NSString *avatarUrl = user.photoFullUrlSmall;
|
||||||
|
|
||||||
CGFloat diameter = 32.0f;
|
CGFloat diameter = 32.0f;
|
||||||
|
|
||||||
|
@ -78,6 +78,11 @@ typedef enum {
|
|||||||
@property (nonatomic) NSString *photoUrlSmall;
|
@property (nonatomic) NSString *photoUrlSmall;
|
||||||
@property (nonatomic) NSString *photoUrlMedium;
|
@property (nonatomic) NSString *photoUrlMedium;
|
||||||
@property (nonatomic) NSString *photoUrlBig;
|
@property (nonatomic) NSString *photoUrlBig;
|
||||||
|
@property (nonatomic) NSData *photoFileReferenceSmall;
|
||||||
|
@property (nonatomic) NSData *photoFileReferenceBig;
|
||||||
|
|
||||||
|
@property (nonatomic) NSString *photoFullUrlSmall;
|
||||||
|
@property (nonatomic) NSString *photoFullUrlBig;
|
||||||
|
|
||||||
@property (nonatomic) TGUserPresence presence;
|
@property (nonatomic) TGUserPresence presence;
|
||||||
|
|
||||||
|
@ -59,6 +59,8 @@ typedef enum {
|
|||||||
_contextBotPlaceholder = [coder decodeStringForCKey:"cbp"];
|
_contextBotPlaceholder = [coder decodeStringForCKey:"cbp"];
|
||||||
}
|
}
|
||||||
_about = [coder decodeStringForCKey:"a"];
|
_about = [coder decodeStringForCKey:"a"];
|
||||||
|
_photoFileReferenceSmall = [coder decodeDataCorCKey:"frs"];
|
||||||
|
_photoFileReferenceBig = [coder decodeDataCorCKey:"frb"];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -77,6 +79,8 @@ typedef enum {
|
|||||||
[coder encodeString:_contextBotPlaceholder forCKey:"cbp"];
|
[coder encodeString:_contextBotPlaceholder forCKey:"cbp"];
|
||||||
}
|
}
|
||||||
[coder encodeString:_about forCKey:"a"];
|
[coder encodeString:_about forCKey:"a"];
|
||||||
|
[coder encodeData:_photoFileReferenceSmall forCKey:"frs"];
|
||||||
|
[coder encodeData:_photoFileReferenceBig forCKey:"frb"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (id)copyWithZone:(NSZone *)__unused zone
|
- (id)copyWithZone:(NSZone *)__unused zone
|
||||||
@ -95,6 +99,8 @@ typedef enum {
|
|||||||
user.photoUrlSmall = _photoUrlSmall;
|
user.photoUrlSmall = _photoUrlSmall;
|
||||||
user.photoUrlMedium = _photoUrlMedium;
|
user.photoUrlMedium = _photoUrlMedium;
|
||||||
user.photoUrlBig = _photoUrlBig;
|
user.photoUrlBig = _photoUrlBig;
|
||||||
|
user.photoFileReferenceSmall = _photoFileReferenceSmall;
|
||||||
|
user.photoFileReferenceBig = _photoFileReferenceBig;
|
||||||
user.presence = _presence;
|
user.presence = _presence;
|
||||||
user.customProperties = _customProperties;
|
user.customProperties = _customProperties;
|
||||||
user.contactId = _contactId;
|
user.contactId = _contactId;
|
||||||
@ -261,8 +267,7 @@ typedef enum {
|
|||||||
anotherUser.phoneNumberHash == _phoneNumberHash &&
|
anotherUser.phoneNumberHash == _phoneNumberHash &&
|
||||||
((anotherUser.photoUrlSmall == nil && _photoUrlSmall == nil) || [anotherUser.photoUrlSmall isEqualToString:_photoUrlSmall]) &&
|
((anotherUser.photoUrlSmall == nil && _photoUrlSmall == nil) || [anotherUser.photoUrlSmall isEqualToString:_photoUrlSmall]) &&
|
||||||
((anotherUser.photoUrlMedium == nil && _photoUrlMedium == nil) || [anotherUser.photoUrlMedium isEqualToString:_photoUrlMedium]) &&
|
((anotherUser.photoUrlMedium == nil && _photoUrlMedium == nil) || [anotherUser.photoUrlMedium isEqualToString:_photoUrlMedium]) &&
|
||||||
((anotherUser.photoUrlBig == nil && _photoUrlBig == nil) || [anotherUser.photoUrlBig isEqualToString:_photoUrlBig]) &&
|
((anotherUser.photoUrlBig == nil && _photoUrlBig == nil) || [anotherUser.photoUrlBig isEqualToString:_photoUrlBig]) && TGObjectCompare(anotherUser.photoFileReferenceSmall, _photoFileReferenceSmall) && TGObjectCompare(anotherUser.photoFileReferenceBig, _photoFileReferenceBig) && anotherUser.presence.online == _presence.online && anotherUser.presence.lastSeen == _presence.lastSeen && TGStringCompare(_userName, anotherUser.userName) && anotherUser.kind == _kind && anotherUser.botKind == _botKind &&
|
||||||
anotherUser.presence.online == _presence.online && anotherUser.presence.lastSeen == _presence.lastSeen && TGStringCompare(_userName, anotherUser.userName) && anotherUser.kind == _kind && anotherUser.botKind == _botKind &&
|
|
||||||
TGStringCompare(_restrictionReason, anotherUser.restrictionReason))
|
TGStringCompare(_restrictionReason, anotherUser.restrictionReason))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -412,4 +417,28 @@ typedef enum {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSString *)photoFullUrlSmall
|
||||||
|
{
|
||||||
|
NSString *finalAvatarUrl = self.photoUrlSmall;
|
||||||
|
if (finalAvatarUrl.length == 0)
|
||||||
|
return finalAvatarUrl;
|
||||||
|
|
||||||
|
if (self.photoFileReferenceSmall != nil)
|
||||||
|
finalAvatarUrl = [finalAvatarUrl stringByAppendingFormat:@"_%@", [self.photoFileReferenceSmall stringByEncodingInHex]];
|
||||||
|
|
||||||
|
return finalAvatarUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
- (NSString *)photoFullUrlBig
|
||||||
|
{
|
||||||
|
NSString *finalAvatarUrl = self.photoUrlBig;
|
||||||
|
if (finalAvatarUrl.length == 0)
|
||||||
|
return finalAvatarUrl;
|
||||||
|
|
||||||
|
if (self.photoFileReferenceBig != nil)
|
||||||
|
finalAvatarUrl = [finalAvatarUrl stringByAppendingFormat:@"_%@", [self.photoFileReferenceBig stringByEncodingInHex]];
|
||||||
|
|
||||||
|
return finalAvatarUrl;
|
||||||
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user