mirror of
https://github.com/danog/Telegram.git
synced 2024-11-30 04:29:15 +01:00
31 lines
803 B
Objective-C
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
|