Skip to content

Commit

Permalink
Merge pull request #2395 from meganz/release/v3.7.8
Browse files Browse the repository at this point in the history
Release/v3.7.8
  • Loading branch information
sergiohs84 authored Dec 10, 2020
2 parents d4023b5 + 927e2f2 commit 3e1a680
Show file tree
Hide file tree
Showing 63 changed files with 2,704 additions and 535 deletions.
8 changes: 4 additions & 4 deletions bindings/ios/MEGAAccountDetails.mm
Original file line number Diff line number Diff line change
Expand Up @@ -139,19 +139,19 @@ + (NSString *)stringForAccountType:(MEGAAccountType)accountType {
break;

case MEGAAccountTypeProI:
result = @"PRO I";
result = @"Pro I";
break;

case MEGAAccountTypeProII:
result = @"PRO II";
result = @"Pro II";
break;

case MEGAAccountTypeProIII:
result = @"PRO III";
result = @"Pro III";
break;

case MEGAAccountTypeLite:
result = @"LITE";
result = @"Pro Lite";
break;

case MEGAAccountTypeBusiness:
Expand Down
22 changes: 17 additions & 5 deletions bindings/ios/MEGABackgroundMediaUpload.mm
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,21 @@ - (BOOL)analyseMediaInfoForFileAtPath:(NSString *)inputFilepath {
}

- (NSString *)encryptFileAtPath:(NSString *)inputFilePath startPosition:(int64_t)start length:(int64_t *)length outputFilePath:(NSString *)outputFilePath adjustsSizeOnly:(BOOL)adjustsSizeOnly {
const char *suffix = self.mediaUpload->encryptFile(inputFilePath.UTF8String, start, length, outputFilePath.UTF8String, adjustsSizeOnly);
return suffix == NULL ? nil : @(suffix);
const char *val = self.mediaUpload->encryptFile(inputFilePath.UTF8String, start, length, outputFilePath.UTF8String, adjustsSizeOnly);
NSString *suffix = val == NULL ? nil : @(val);

delete [] val;

return suffix;
}

- (NSString *)uploadURLString {
const char *urlString = self.mediaUpload->getUploadURL();
return urlString == NULL ? nil : @(urlString);
const char *val = self.mediaUpload->getUploadURL();
NSString *urlString = val == NULL ? nil : @(val);

delete [] val;

return urlString;
}

- (void)setCoordinatesWithLatitude:(double)latitude longitude:(double)longitude isUnshareable:(BOOL)unshareable {
Expand All @@ -73,7 +81,11 @@ - (void)setCoordinatesWithLatitude:(double)latitude longitude:(double)longitude

- (NSData *)serialize {
const char *binary = self.mediaUpload->serialize();
return binary == NULL ? nil : [NSData dataWithBytes:binary length:strlen(binary)];
NSData *data = binary == NULL ? nil : [NSData dataWithBytes:binary length:strlen(binary)];

delete [] binary;

return data;
}

+ (instancetype)unserializByData:(NSData *)data MEGASdk:(MEGASdk *)sdk {
Expand Down
76 changes: 76 additions & 0 deletions bindings/ios/MEGABanner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/**
* @file MEGABanner.h
* @brief Represents an user banner in MEGA
*
* (c) 2013-2014 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/

#import <Foundation/Foundation.h>

@interface MEGABanner : NSObject

/**
* @brief Returns the id of the MEGABanner
*
* @return Id of this banner
*/
@property (nonatomic, readonly) NSUInteger identifier;

/**
* @brief Returns the title associated with the MEGABanner object
*
* @return Title associated with the MEGABanner object
*/
@property (nonatomic, readonly, nullable) NSString *title;

/**
* @brief Returns the description associated with the MEGABanner object
*
* @return Description associated with the MEGABanner object
*/
@property (nonatomic, readonly, nullable) NSString *description;

/**
* @brief Returns the filename of the image used by the MegaBanner object
*
* @return Filename of the image used by the MegaBanner object
*/
@property (nonatomic, readonly, nullable) NSString *imageFilename;

/**
* @brief Returns the filename of the background image used by the MEGABanner object
*
* @return Filename of the background image used by the MEGABanner object
*/
@property (nonatomic, readonly, nullable) NSString *backgroundImageFilename;

/**
* @brief Returns the URL where images are located
*
* @return URL where images are located
*/
@property (nonatomic, readonly, nullable) NSString *imageLocationURLString;

/**
* @brief Returns the URL associated with the MEGABanner object
*
* @return URL associated with the MEGABanner object
*/
@property (nonatomic, readonly, nullable) NSString *URLString;


@end
97 changes: 97 additions & 0 deletions bindings/ios/MEGABanner.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/**
* @file MEGABanner.mm
* @brief Represents an user banner in MEGA
*
* (c) 2013-2014 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#import "MEGABanner.h"
#import "megaapi.h"

using namespace mega;

@interface MEGABanner ()

@property MegaBanner *megaBanner;
@property BOOL cMemoryOwn;

@end

@implementation MEGABanner

- (instancetype)initWithMegaBanner:(MegaBanner *)megaBanner cMemoryOwn:(BOOL)cMemoryOwn {
self = [super init];

if (self != nil) {
_megaBanner = megaBanner;
_cMemoryOwn = cMemoryOwn;
}

return self;
}

- (void)dealloc {
if (self.cMemoryOwn) {
delete _megaBanner;
}
}

- (instancetype)clone {
return self.megaBanner ? [[MEGABanner alloc] initWithMegaBanner:self.megaBanner->copy() cMemoryOwn:YES] : nil;
}

- (MegaBanner *)getCPtr {
return self.megaBanner;
}

- (NSString *)title{
if (!self.megaBanner) return nil;

return self.megaBanner->getTitle() ? @(self.megaBanner->getTitle()) : nil;
}

- (NSString *)description {
if (!self.megaBanner) return nil;

return self.megaBanner->getDescription() ? @(self.megaBanner->getDescription()) : nil;
}

- (NSString *)imageFilename {
if (!self.megaBanner) return nil;

return self.megaBanner->getImage() ? @(self.megaBanner->getImage()) : nil;
}

- (NSString *)backgroundImageFilename {
if (!self.megaBanner) return nil;

return self.megaBanner->getBackgroundImage() ? @(self.megaBanner->getBackgroundImage()) : nil;
}


- (NSString *)imageLocationURLString {
if (!self.megaBanner) return nil;

return self.megaBanner->getImageLocation() ? @(self.megaBanner->getImageLocation()) : nil;
}

- (NSString *)URLString {
if (!self.megaBanner) return nil;

return self.megaBanner->getUrl() ? @(self.megaBanner->getUrl()) : nil;
}

@end
54 changes: 54 additions & 0 deletions bindings/ios/MEGABannerList.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/**
* @file MEGABannerList.h
* @brief List of MEGABanner
*
* (c) 2017- by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/

#import <Foundation/Foundation.h>
#import "MEGABanner.h"

/**
* @brief List of MEGABanner objects
*
* A MEGABannerList has the ownership of the MEGABanner objects that it contains, so they will be
* only valid until the MEGABannerList is deleted.
*
*/
@interface MEGABannerList : NSObject

/**
* @brief The number of banners in the list
*/
@property (nonatomic, readonly) NSInteger size;

- (nonnull instancetype)clone;

/**
* @brief Returns the MEGABanner at position i in the MEGABannerList
*
* The MEGABannerList retains the ownership of the returned MEGABanner. It will be only valid until
* the MEGABannerList is deleted.
*
* If the index is >= the size of the list, this function returns NULL.
*
* @param i Position of the MEGABanner that we want to get for the list
* @return MEGABanner at position i in the list
*/
- (nullable MEGABanner *)bannerAtIndex:(NSInteger)index;

@end
68 changes: 68 additions & 0 deletions bindings/ios/MEGABannerList.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/**
* @file MEGABannerList.mm
* @brief List of MEGABanner objects
*
* (c) 2018-Present by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
* Applications using the MEGA API must present a valid application key
* and comply with the the rules set forth in the Terms of Service.
*
* The MEGA SDK is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* @copyright Simplified (2-clause) BSD License.
*
* You should have received a copy of the license along with this
* program.
*/
#import "megaapi.h"
#import "MEGABanner.h"
#import "MEGABanner+init.h"
#import "MEGABannerList.h"

using namespace mega;

@interface MEGABannerList ()

@property MegaBannerList *megaBannerList;
@property BOOL cMemoryOwn;

@end

@implementation MEGABannerList

- (instancetype)initWithMegaBannerList:(MegaBannerList *)megaBannerList cMemoryOwn:(BOOL)cMemoryOwn {
self = [super init];

if (self) {
_megaBannerList = megaBannerList;
_cMemoryOwn = cMemoryOwn;
}

return self;
}

- (void)dealloc {
if (self.cMemoryOwn) {
delete _megaBannerList;
}
}

- (instancetype)clone {
return self.megaBannerList ? [[MEGABannerList alloc] initWithMegaBannerList:self.megaBannerList->copy() cMemoryOwn:YES] : nil;
}

- (MEGABanner *)bannerAtIndex:(NSInteger)index {
return self.megaBannerList ?
[[MEGABanner alloc] initWithMegaBanner:self.megaBannerList->get((int)index)->copy() cMemoryOwn:YES] : nil;
}

- (NSInteger)size {
return self.megaBannerList ? self.megaBannerList->size() : 0;
}

@end

8 changes: 7 additions & 1 deletion bindings/ios/MEGANode.mm
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,13 @@ - (MEGANode *)publicNode {
}

- (NSString *)publicLink {
return self.megaNode ? [[NSString alloc] initWithUTF8String:self.megaNode->getPublicLink()] : nil;
const char *val = self.megaNode->getPublicLink();
if (!val) return nil;

NSString *ret = [NSString stringWithUTF8String:val];

delete [] val;
return ret;
}

- (uint64_t)owner {
Expand Down
Loading

0 comments on commit 3e1a680

Please sign in to comment.