mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00

git-subtree-dir: submodules/HockeySDK-iOS git-subtree-mainline: 085acd26c4432939403765234266e3c1be0f3dd9 git-subtree-split: c7d0c7026303253e2ac576c02655691e5d314fe2
40 lines
1.1 KiB
Objective-C
40 lines
1.1 KiB
Objective-C
#import "BITData.h"
|
|
#import "BITHockeyLogger.h"
|
|
|
|
/// Data contract class for type Data.
|
|
@implementation BITData
|
|
|
|
///
|
|
/// Adds all members of this class to a dictionary
|
|
/// @returns dictionary to which the members of this class will be added.
|
|
///
|
|
- (NSDictionary *)serializeToDictionary {
|
|
NSMutableDictionary *dict = [super serializeToDictionary].mutableCopy;
|
|
NSDictionary *baseDataDict = [self.baseData serializeToDictionary];
|
|
if ([NSJSONSerialization isValidJSONObject:baseDataDict]) {
|
|
[dict setObject:baseDataDict forKey:@"baseData"];
|
|
} else {
|
|
BITHockeyLogError(@"[HockeySDK] Some of the telemetry data was not NSJSONSerialization compatible and could not be serialized!");
|
|
}
|
|
return dict;
|
|
}
|
|
|
|
#pragma mark - NSCoding
|
|
|
|
- (instancetype)initWithCoder:(NSCoder *)coder {
|
|
self = [super initWithCoder:coder];
|
|
if(self) {
|
|
_baseData = [coder decodeObjectForKey:@"self.baseData"];
|
|
}
|
|
|
|
return self;
|
|
}
|
|
|
|
- (void)encodeWithCoder:(NSCoder *)coder {
|
|
[super encodeWithCoder:coder];
|
|
[coder encodeObject:self.baseData forKey:@"self.baseData"];
|
|
}
|
|
|
|
|
|
@end
|