1/** 2 * @file MEGARecentActionBucket.mm 3 * @brief Represents a set of files uploaded or updated in MEGA. 4 * 5 * (c) 2019 - Present by Mega Limited, Auckland, New Zealand 6 * 7 * This file is part of the MEGA SDK - Client Access Engine. 8 * 9 * Applications using the MEGA API must present a valid application key 10 * and comply with the the rules set forth in the Terms of Service. 11 * 12 * The MEGA SDK is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 15 * 16 * @copyright Simplified (2-clause) BSD License. 17 * 18 * You should have received a copy of the license along with this 19 * program. 20 */ 21 22#import "MEGARecentActionBucket.h" 23 24#import "megaapi.h" 25 26#import "MEGARecentActionBucket+init.h" 27#import "MEGANodeList+init.h" 28 29using namespace mega; 30 31@interface MEGARecentActionBucket () 32 33@property MegaRecentActionBucket *recentActionBucket; 34@property BOOL cMemoryOwn; 35 36@end 37 38@implementation MEGARecentActionBucket 39 40- (instancetype)initWithMegaRecentActionBucket:(MegaRecentActionBucket *)megaRecentActionBucket cMemoryOwn:(BOOL)cMemoryOwn { 41 self = [super init]; 42 if (self) { 43 _recentActionBucket = megaRecentActionBucket; 44 _cMemoryOwn = cMemoryOwn; 45 } 46 47 return self; 48} 49 50- (instancetype)clone { 51 return self.recentActionBucket ? [MEGARecentActionBucket.alloc initWithMegaRecentActionBucket:self.recentActionBucket->copy() cMemoryOwn:YES] : nil; 52} 53 54- (MegaRecentActionBucket *)getCPtr { 55 return self.recentActionBucket; 56} 57 58- (void)dealloc { 59 if (self.cMemoryOwn) { 60 delete _recentActionBucket; 61 } 62} 63 64- (NSDate *)timestamp { 65 return self.recentActionBucket ? [NSDate.alloc initWithTimeIntervalSince1970:self.recentActionBucket->getTimestamp()] : nil; 66} 67 68- (NSString *)userEmail { 69 if (self.recentActionBucket) { 70 return self.recentActionBucket->getUserEmail() ? [NSString.alloc initWithUTF8String:self.recentActionBucket->getUserEmail()] : nil; 71 } else { 72 return nil; 73 } 74} 75 76- (uint64_t)parentHandle { 77 return self.recentActionBucket ? self.recentActionBucket->getParentHandle() : ::mega::INVALID_HANDLE; 78} 79 80- (BOOL)isUpdate { 81 return self.recentActionBucket->isUpdate(); 82} 83 84- (BOOL)isMedia { 85 return self.recentActionBucket->isMedia(); 86} 87 88- (MEGANodeList *)nodesList { 89 return self.recentActionBucket ? [MEGANodeList.alloc initWithNodeList:self.recentActionBucket->getNodes()->copy() cMemoryOwn:YES] : nil; 90} 91 92@end 93 94