1
0
mirror of https://github.com/danog/Telegram.git synced 2024-12-04 02:17:51 +01:00
Telegram/Telegraph/TGAccountSettings.m

39 lines
1.7 KiB
Mathematica
Raw Normal View History

2015-10-01 18:19:52 +02:00
#import "TGAccountSettings.h"
@implementation TGAccountSettings
- (instancetype)initWithDefaultValues
{
2016-02-25 01:03:51 +01:00
return [self initWithNotificationSettings:[[TGNotificationPrivacyAccountSetting alloc] initWithDefaultValues] groupsAndChannelsSettings:[[TGNotificationPrivacyAccountSetting alloc] initWithDefaultValues] accountTTLSetting:[[TGAccountTTLSetting alloc] initWithDefaultValues]];
2015-10-01 18:19:52 +02:00
}
2016-02-25 01:03:51 +01:00
- (instancetype)initWithNotificationSettings:(TGNotificationPrivacyAccountSetting *)notificationSettings groupsAndChannelsSettings:(TGNotificationPrivacyAccountSetting *)groupsAndChannelsSettings accountTTLSetting:(TGAccountTTLSetting *)accountTTLSetting
2015-10-01 18:19:52 +02:00
{
self = [super init];
if (self != nil)
{
_notificationSettings = notificationSettings;
2016-02-25 01:03:51 +01:00
_groupsAndChannelsSettings = groupsAndChannelsSettings;
2015-10-01 18:19:52 +02:00
_accountTTLSetting = accountTTLSetting;
}
return self;
}
- (instancetype)initWithCoder:(NSCoder *)aDecoder
{
2016-02-25 01:03:51 +01:00
TGNotificationPrivacyAccountSetting *groupsAndChannelsSettings = [aDecoder decodeObjectForKey:@"groupsAndChannelsSettings"];
if (groupsAndChannelsSettings == nil) {
groupsAndChannelsSettings = [[TGNotificationPrivacyAccountSetting alloc] initWithDefaultValues];
}
return [self initWithNotificationSettings:[aDecoder decodeObjectForKey:@"notificationSettings"] groupsAndChannelsSettings:groupsAndChannelsSettings accountTTLSetting:[aDecoder decodeObjectForKey:@"accountTTLSetting"]];
2015-10-01 18:19:52 +02:00
}
- (void)encodeWithCoder:(NSCoder *)aCoder
{
[aCoder encodeObject:_notificationSettings forKey:@"notificationSettings"];
2016-02-25 01:03:51 +01:00
[aCoder encodeObject:_groupsAndChannelsSettings forKey:@"groupsAndChannelsSettings"];
2015-10-01 18:19:52 +02:00
[aCoder encodeObject:_accountTTLSetting forKey:@"accountTTLSetting"];
}
@end