1
0
mirror of https://github.com/danog/Telegram.git synced 2024-11-30 04:29:15 +01:00
Telegram/Share/TGUserModel.m
2015-10-01 19:19:52 +03:00

31 lines
803 B
Objective-C

#import "TGUserModel.h"
@implementation TGUserModel
- (instancetype)initWithUserId:(int32_t)userId accessHash:(int64_t)accessHash firstName:(NSString *)firstName lastName:(NSString *)lastName avatarLocation:(TGFileLocation *)avatarLocation
{
self = [super init];
if (self != nil)
{
_userId = userId;
_accessHash = accessHash;
_firstName = firstName;
_lastName = lastName;
_avatarLocation = avatarLocation;
}
return self;
}
- (NSString *)displayName
{
if (_firstName.length != 0 && _lastName.length != 0)
return [[NSString alloc] initWithFormat:@"%@ %@", _firstName, _lastName];
else if (_firstName.length != 0)
return _firstName;
else if (_lastName.length != 0)
return _lastName;
return @"";
}
@end