Skip to content

Commit

Permalink
Merge pull request #757 from meganz/release/v3.1.9
Browse files Browse the repository at this point in the history
Release/v3.1.9
  • Loading branch information
sergiohs84 authored Aug 11, 2017
2 parents 57a6ee2 + 9a7559a commit 4edf31a
Show file tree
Hide file tree
Showing 197 changed files with 3,908 additions and 3,112 deletions.
49 changes: 49 additions & 0 deletions bindings/ios/MEGAChildrenLists.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/**
* @file MEGAChildrenLists.h
* @brief Provides information about node's children organize
* them into two list (files and folders)
*
* (c) 2013-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 "MEGANodeList.h"

/**
* @brief Lists of file and folder children MEGANode objects
*
* A MEGAChildrenLists object has the ownership of the MEGANodeList objects that it contains,
* so they will be only valid until the MEGAChildrenLists is deleted. If you want to retain
* a MEGANodeList returned by a MEGAChildrenLists, use [MEGANodeList clone].
*
* Objects of this class are immutable.
*/
@interface MEGAChildrenLists : NSObject

/**
* @brief List of MEGANode folders
*/
@property (nonatomic, readonly) MEGANodeList *folderList;

/**
* @brief List of MEGANode files
*/
@property (nonatomic, readonly) MEGANodeList *fileList;

- (instancetype)clone;

@end
72 changes: 72 additions & 0 deletions bindings/ios/MEGAChildrenLists.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* @file MEGAChildrenLists.m
* @brief Provides information about node's children organize
* them into two list (files and folders)
*
* (c) 2013-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 "MEGAChildrenLists.h"
#import "MEGAChildrenLists+init.h"
#import "MEGANodeList+init.h"
#import "megaapi.h"

using namespace mega;

@interface MEGAChildrenLists ()

@property MegaChildrenLists *megaChildrenLists;
@property BOOL cMemoryOwn;

@end

@implementation MEGAChildrenLists

- (instancetype)initWithMegaChildrenLists:(mega::MegaChildrenLists *)megaChildrenLists cMemoryOwn:(BOOL)cMemoryOwn {
self = [super init];

if (self) {
_megaChildrenLists = megaChildrenLists;
_cMemoryOwn = cMemoryOwn;
}

return self;
}

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

- (instancetype)clone {
return self.megaChildrenLists ? [[MEGAChildrenLists alloc] initWithMegaChildrenLists:self.megaChildrenLists->copy() cMemoryOwn:YES] : nil;
}

- (MegaChildrenLists *)getCPtr {
return self.megaChildrenLists;
}

- (MEGANodeList *)folderList {
return self.megaChildrenLists ? [[MEGANodeList alloc] initWithNodeList:self.megaChildrenLists->getFolderList()->copy() cMemoryOwn:YES] : nil;
}

- (MEGANodeList *)fileList {
return self.megaChildrenLists ? [[MEGANodeList alloc] initWithNodeList:self.megaChildrenLists->getFileList()->copy() cMemoryOwn:YES] : nil;
}

@end
13 changes: 9 additions & 4 deletions bindings/ios/MEGARequest.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,12 @@ typedef NS_ENUM (NSInteger, MEGARequestType) {
MEGARequestTypeGetUserEmail,
MEGARequestTypeAppVersion,
MEGARequestTypeGetLocalSSLCertificate,
MEGARequestTypeSendSignupLink
MEGARequestTypeSendSignupLink,
MEGARequestTypeQueryDns,
MEGARequestTypeQueryGelb,
MEGARequestTypeChatStats,
MEGARequestTypeDownloadFile,
MEGARequestTypeQueryTransferQuota
};

typedef NS_ENUM (NSInteger, MEGANodeAccessLevel) {
Expand Down Expand Up @@ -364,9 +369,9 @@ typedef NS_ENUM (NSInteger, MEGANodeAccessLevel) {
/**
* @brief A flag related to the request.
*
* This value is valid for these requests:
* - [MEGASdk retryPendingConnections] - Returns if request are disconnected
* - [MEGASdk pauseTransfers:] - Returns the direction of the transfers to pause/resume
* This value is valid for these request in onRequestFinish when the
* error code is MEGAErrorTypeApiOk:
* - [MEGASdk queryTransferQuota] - YES if it is expected to get an overquota error, otherwise NO
*
*/
@property (readonly, nonatomic) BOOL flag;
Expand Down
8 changes: 8 additions & 0 deletions bindings/ios/MEGASDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
940BF01919ED97B9007E7FA2 /* MEGAUserList.mm in Sources */ = {isa = PBXBuildFile; fileRef = 940BF00919ED97B9007E7FA2 /* MEGAUserList.mm */; };
A81790101EFACE6400110E91 /* MEGAHandleList.mm in Sources */ = {isa = PBXBuildFile; fileRef = A817900F1EFACE6400110E91 /* MEGAHandleList.mm */; };
A81790151EFADDDE00110E91 /* MEGAEvent.mm in Sources */ = {isa = PBXBuildFile; fileRef = A81790141EFADDDE00110E91 /* MEGAEvent.mm */; };
A8464B201F25F53A00102C75 /* MEGAChildrenLists.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8464B1F1F25F53A00102C75 /* MEGAChildrenLists.mm */; };
A8827A5C1F178A0D0097B5DE /* DelegateMEGATreeProcessorListener.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8827A5B1F178A0D0097B5DE /* DelegateMEGATreeProcessorListener.mm */; };
A8FD7B641E93B40E0031FC50 /* osxutils.mm in Sources */ = {isa = PBXBuildFile; fileRef = A8FD7B631E93B40E0031FC50 /* osxutils.mm */; };
/* End PBXBuildFile section */
Expand Down Expand Up @@ -254,6 +255,9 @@
A81790121EFAD24F00110E91 /* MEGAHandleList+init.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "MEGAHandleList+init.h"; sourceTree = "<group>"; };
A81790131EFADDDE00110E91 /* MEGAEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MEGAEvent.h; sourceTree = "<group>"; };
A81790141EFADDDE00110E91 /* MEGAEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MEGAEvent.mm; sourceTree = "<group>"; };
A8464B1E1F25F53A00102C75 /* MEGAChildrenLists.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MEGAChildrenLists.h; sourceTree = "<group>"; };
A8464B1F1F25F53A00102C75 /* MEGAChildrenLists.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MEGAChildrenLists.mm; sourceTree = "<group>"; };
A8464B211F25F68C00102C75 /* MEGAChildrenLists+init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "MEGAChildrenLists+init.h"; sourceTree = "<group>"; };
A8827A591F176BCA0097B5DE /* MEGATreeProcessorDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MEGATreeProcessorDelegate.h; sourceTree = "<group>"; };
A8827A5A1F178A0D0097B5DE /* DelegateMEGATreeProcessorListener.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DelegateMEGATreeProcessorListener.h; sourceTree = "<group>"; };
A8827A5B1F178A0D0097B5DE /* DelegateMEGATreeProcessorListener.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DelegateMEGATreeProcessorListener.mm; sourceTree = "<group>"; };
Expand Down Expand Up @@ -416,6 +420,8 @@
A817900F1EFACE6400110E91 /* MEGAHandleList.mm */,
A81790131EFADDDE00110E91 /* MEGAEvent.h */,
A81790141EFADDDE00110E91 /* MEGAEvent.mm */,
A8464B1E1F25F53A00102C75 /* MEGAChildrenLists.h */,
A8464B1F1F25F53A00102C75 /* MEGAChildrenLists.mm */,
);
name = bindings;
sourceTree = "<group>";
Expand Down Expand Up @@ -560,6 +566,7 @@
41D98D081BD5679C00764370 /* MEGAContactRequestList+init.h */,
A81790121EFAD24F00110E91 /* MEGAHandleList+init.h */,
A8EBFDD21EFAE14C00DF89DA /* MEGAEvent+init.h */,
A8464B211F25F68C00102C75 /* MEGAChildrenLists+init.h */,
);
path = Private;
sourceTree = "<group>";
Expand Down Expand Up @@ -708,6 +715,7 @@
41AD7A7E1A1E10F900D66856 /* DelegateMEGALoggerListener.mm in Sources */,
41A990731A5D305700B2094A /* mega_utf8proc.cpp in Sources */,
A81790101EFACE6400110E91 /* MEGAHandleList.mm in Sources */,
A8464B201F25F53A00102C75 /* MEGAChildrenLists.mm in Sources */,
A8827A5C1F178A0D0097B5DE /* DelegateMEGATreeProcessorListener.mm in Sources */,
41B2AEDC1A0A859C006C40FB /* DelegateMEGATransferListener.mm in Sources */,
41B538CC1A0284CB00EABDC9 /* MEGAPricing.mm in Sources */,
Expand Down
92 changes: 92 additions & 0 deletions bindings/ios/MEGASdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#import "MEGAUserList.h"
#import "MEGAShareList.h"
#import "MEGAContactRequestList.h"
#import "MEGAChildrenLists.h"
#import "MEGARequestDelegate.h"
#import "MEGADelegate.h"
#import "MEGATransferDelegate.h"
Expand Down Expand Up @@ -2273,6 +2274,39 @@ typedef NS_ENUM(NSUInteger, PushNotificationTokenType) {
*/
- (void)getAccountDetails;

/**
* @brief Check if the available bandwidth quota is enough to transfer an amount of bytes
*
* The associated request type with this request is MEGARequestTypeQueryTransferQuota
*
* Valid data in the MegaRequest object received on callbacks:
* - [MEGARequest number] - Returns the amount of bytes to be transferred
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MEGAErrorTypeApiOk:
* - [MEGARequest flag] - YES if it is expected to get an overquota error, otherwise NO
*
* @param size Amount of bytes to be transferred
* @param delegate MEGARequestDelegate to track this request
*/
- (void)queryTransferQuotaWithSize:(long long)size delegate:(id<MEGARequestDelegate>)delegate;

/**
* @brief Check if the available bandwidth quota is enough to transfer an amount of bytes
*
* The associated request type with this request is MEGARequestTypeQueryTransferQuota
*
* Valid data in the MegaRequest object received on callbacks:
* - [MEGARequest number] - Returns the amount of bytes to be transferred
*
* Valid data in the MegaRequest object received in onRequestFinish when the error code
* is MEGAErrorTypeApiOk:
* - [MEGARequest flag] - YES if it is expected to get an overquota error, otherwise NO
*
* @param size Amount of bytes to be transferred
*/
- (void)queryTransferQuotaWithSize:(long long)size;

/**
* @brief Get the available pricing plans to upgrade a MEGA account.
*
Expand Down Expand Up @@ -3264,6 +3298,64 @@ typedef NS_ENUM(NSUInteger, PushNotificationTokenType) {
*/
- (MEGANode *)childNodeForParent:(MEGANode *)parent name:(NSString *)name;

/**
* @brief Get file and folder children of a MEGANode separatedly
*
* If the parent node doesn't exist or it isn't a folder, this function
* returns nil.
*
* @param parent Parent node.
* @param order Order for the returned list.
* Valid values for this parameter are:
* - MEGASortOrderTypeNone = 0
* Undefined order
*
* - MEGASortOrderTypeDefaultAsc = 1
* Folders first in alphabetical order, then files in the same order
*
* - MEGASortOrderTypeDefaultDesc = 2
* Files first in reverse alphabetical order, then folders in the same order
*
* - MEGASortOrderTypeSizeAsc = 3
* Sort by size, ascending
*
* - MEGASortOrderTypeSizeDesc = 4
* Sort by size, descending
*
* - MEGASortOrderTypeCreationAsc = 5
* Sort by creation time in MEGA, ascending
*
* - MEGASortOrderTypeCreationDesc = 6
* Sort by creation time in MEGA, descending
*
* - MEGASortOrderTypeModificationAsc = 7
* Sort by modification time of the original file, ascending
*
* - MEGASortOrderTypeModificationDesc = 8
* Sort by modification time of the original file, descending
*
* - MEGASortOrderTypeAlphabeticalAsc = 9
* Sort in alphabetical order, ascending
*
* - MEGASortOrderTypeAlphabeticalDesc = 10
* Sort in alphabetical order, descending
*
* @return Lists with files and folders child MegaNode objects
*/
- (MEGAChildrenLists *)fileFolderChildrenForParent:(MEGANode *)parent order:(NSInteger)order;

/**
* @brief Get file and folder children of a MEGANode separatedly
*
* If the parent node doesn't exist or it isn't a folder, this function
* returns nil.
*
* @param parent Parent node.
*
* @return Lists with files and folders child MegaNode objects
*/
- (MEGAChildrenLists *)fileFolderChildrenForParent:(MEGANode *)parent;

/**
* @brief Get the parent node of a MEGANode.
*
Expand Down
17 changes: 17 additions & 0 deletions bindings/ios/MEGASdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#import "MEGAShareList+init.h"
#import "MEGAContactRequest+init.h"
#import "MEGAContactRequestList+init.h"
#import "MEGAChildrenLists+init.h"
#import "DelegateMEGARequestListener.h"
#import "DelegateMEGATransferListener.h"
#import "DelegateMEGAGlobalListener.h"
Expand Down Expand Up @@ -841,6 +842,14 @@ - (void)getAccountDetails {
self.megaApi->getAccountDetails();
}

- (void)queryTransferQuotaWithSize:(long long)size delegate:(id<MEGARequestDelegate>)delegate {
self.megaApi->queryTransferQuota(size, [self createDelegateMEGARequestListener:delegate singleListener:YES]);
}

- (void)queryTransferQuotaWithSize:(long long)size {
self.megaApi->queryTransferQuota(size);
}

- (void)getPricingWithDelegate:(id<MEGARequestDelegate>)delegate {
self.megaApi->getPricing([self createDelegateMEGARequestListener:delegate singleListener:YES]);
}
Expand Down Expand Up @@ -1095,6 +1104,14 @@ - (MEGANodeList *)childrenForParent:(MEGANode *)parent {
return [[MEGANodeList alloc] initWithNodeList:self.megaApi->getChildren((parent != nil) ? [parent getCPtr] : NULL) cMemoryOwn:YES];
}

- (MEGAChildrenLists *)fileFolderChildrenForParent:(MEGANode *)parent order:(NSInteger)order {
return [[MEGAChildrenLists alloc] initWithMegaChildrenLists:self.megaApi->getFileFolderChildren(parent ? [parent getCPtr] : NULL, (int)order) cMemoryOwn:YES];
}

- (MEGAChildrenLists *)fileFolderChildrenForParent:(MEGANode *)parent {
return [[MEGAChildrenLists alloc] initWithMegaChildrenLists:self.megaApi->getFileFolderChildren(parent ? [parent getCPtr] : NULL) cMemoryOwn:YES];
}

- (MEGANode *)childNodeForParent:(MEGANode *)parent name:(NSString *)name {
if (parent == nil || name == nil) return nil;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/**
* AndroidLogger.java
* Class for managing logs
* @file MEGAChildrenLists+init
* @brief Private functions of MEGAChildrenLists
*
* (c) 2013-2014 by Mega Limited, Auckland, New Zealand
* (c) 2013-2017 by Mega Limited, Auckland, New Zealand
*
* This file is part of the MEGA SDK - Client Access Engine.
*
Expand All @@ -18,16 +18,13 @@
* You should have received a copy of the license along with this
* program.
*/
package nz.mega.android.bindingsample;

#import "MEGAChildrenLists.h"
#import "megaapi.h"

import nz.mega.sdk.MegaLoggerInterface;
import android.util.Log;
@interface MEGAChildrenLists (init)

- (instancetype)initWithMegaChildrenLists:(mega::MegaChildrenLists *)megaChildrenLists cMemoryOwn:(BOOL)cMemoryOwn;
- (mega::MegaChildrenLists *)getCPtr;

public class AndroidLogger implements MegaLoggerInterface {

public void log(String time, int loglevel, String source, String message) {
Log.d("AndroidLogger", source + ": " + message);
}
}
@end
Loading

0 comments on commit 4edf31a

Please sign in to comment.