Skip to content

Commit

Permalink
Merge branch 'release/v2.4.0' into 'master'
Browse files Browse the repository at this point in the history
Release/v2.4.0

See merge request megachat/MEGAchat!978
  • Loading branch information
sergiohs84 committed Dec 9, 2020
2 parents d839a0d + 75a3d7f commit e844a41
Show file tree
Hide file tree
Showing 17 changed files with 255 additions and 276 deletions.
3 changes: 3 additions & 0 deletions bindings/Objective-C/MEGAChatListItem.mm
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,9 @@ + (NSString *)stringForMessageType:(MEGAChatMessageType)type {
case MEGAChatMessageTypeAttachment:
result = @"Attachment";
break;
case MEGAChatMessageTypeSetRetentionTime:
result = @"Set Retention Time";
break;
case MEGAChatMessageTypeRevokeAttachment:
result = @"Revoke attachment";
break;
Expand Down
4 changes: 3 additions & 1 deletion bindings/Objective-C/MEGAChatMessage.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ typedef NS_ENUM(NSInteger, MEGAChatMessageType) {
MEGAChatMessageTypePublicHandleCreate = 8,
MEGAChatMessageTypePublicHandleDelete = 9,
MEGAChatMessageTypeSetPrivateMode = 10,
MEGAChatMessageTypeHighestManagement = 10,
MEGAChatMessageTypeSetRetentionTime = 11,
MEGAChatMessageTypeHighestManagement = 11,
MEGAChatMessageTypeAttachment = 101,
MEGAChatMessageTypeRevokeAttachment = 102, /// Obsolete
MEGAChatMessageTypeContact = 103,
Expand Down Expand Up @@ -83,6 +84,7 @@ typedef NS_ENUM(NSInteger, MEGAChatMessageEndCallReason) {
@property (readonly, nonatomic) MEGANodeList *nodeList;
@property (readonly, nonatomic) MEGAHandleList *handleList;
@property (readonly, nonatomic) NSInteger duration;
@property (readonly, nonatomic) NSUInteger retentionTime;
@property (readonly, nonatomic) MEGAChatMessageEndCallReason termCode;
@property (readonly, nonatomic) uint64_t rowId;
@property (readonly, nonatomic) MEGAChatContainsMeta *containsMeta;
Expand Down
4 changes: 4 additions & 0 deletions bindings/Objective-C/MEGAChatMessage.mm
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ - (NSInteger)duration {
return self.megaChatMessage ? self.megaChatMessage->getDuration() : 0;
}

- (NSUInteger)retentionTime {
return self.megaChatMessage ? self.megaChatMessage->getRetentionTime() : 0;
}

- (MEGAChatMessageEndCallReason)termCode {
return (MEGAChatMessageEndCallReason) (self.megaChatMessage ? self.megaChatMessage->getTermCode() : 0);
}
Expand Down
4 changes: 3 additions & 1 deletion bindings/Objective-C/MEGAChatRoom.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ typedef NS_ENUM (NSInteger, MEGAChatRoomChangeType) {
MEGAChatRoomChangeTypeArchive = 0x100,
MEGAChatRoomChangeTypeCall = 0x200,
MEGAChatRoomChangeTypeChatMode = 0x400,
MEGAChatRoomChangeTypeUpdatePreviewers = 0x800
MEGAChatRoomChangeTypeUpdatePreviewers = 0x800,
MEGAChatRoomChangeTypeRetentionTime = 0x1000
};

typedef NS_ENUM (NSInteger, MEGAChatRoomPrivilege) {
Expand Down Expand Up @@ -48,6 +49,7 @@ typedef NS_ENUM (NSInteger, MEGAChatRoomPrivilege) {
@property (readonly, nonatomic) uint64_t userTypingHandle;
@property (readonly, nonatomic, getter=isActive) BOOL active;
@property (readonly, nonatomic, getter=isArchived) BOOL archived;
@property (readonly, nonatomic) NSUInteger retentionTime;
@property (readonly, nonatomic) uint64_t creationTimeStamp;

@property (readonly, nonatomic) NSUInteger previewersCount;
Expand Down
4 changes: 4 additions & 0 deletions bindings/Objective-C/MEGAChatRoom.mm
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ - (BOOL)isArchived {
return self.megaChatRoom ? self.megaChatRoom->isArchived() : NO;
}

- (NSUInteger)retentionTime {
return self.megaChatRoom ? self.megaChatRoom->getRetentionTime() : 0;
}

- (uint64_t)creationTimeStamp {
return self.megaChatRoom ? self.megaChatRoom->getCreationTs() : MEGACHAT_INVALID_HANDLE;
}
Expand Down
3 changes: 3 additions & 0 deletions bindings/Objective-C/MEGAChatSdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,9 @@ typedef NS_ENUM (NSInteger, MEGAChatConnection) {
- (void)archiveChat:(uint64_t)chatId archive:(BOOL)archive delegate:(id<MEGAChatRequestDelegate>)delegate;
- (void)archiveChat:(uint64_t)chatId archive:(BOOL)archive;

- (void)setChatRetentionTime:(uint64_t)chatID period:(NSUInteger)period delegate:(id<MEGAChatRequestDelegate>)delegate;
- (void)setChatRetentionTime:(uint64_t)chatID period:(NSUInteger)period;

- (BOOL)openChatRoom:(uint64_t)chatId delegate:(id<MEGAChatRoomDelegate>)delegate;

- (void)closeChatRoom:(uint64_t)chatId delegate:(id<MEGAChatRoomDelegate>)delegate;
Expand Down
8 changes: 8 additions & 0 deletions bindings/Objective-C/MEGAChatSdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,14 @@ - (void)archiveChat:(uint64_t)chatId archive:(BOOL)archive {
self.megaChatApi->archiveChat(chatId, archive);
}

- (void)setChatRetentionTime:(uint64_t)chatID period:(NSUInteger)period delegate:(id<MEGAChatRequestDelegate>)delegate {
self.megaChatApi->setChatRetentionTime(chatID, (unsigned)period, [self createDelegateMEGAChatRequestListener:delegate singleListener:YES]);
}

- (void)setChatRetentionTime:(uint64_t)chatID period:(NSUInteger)period {
self.megaChatApi->setChatRetentionTime(chatID, (unsigned)period);
}

- (BOOL)openChatRoom:(uint64_t)chatId delegate:(id<MEGAChatRoomDelegate>)delegate {
return self.megaChatApi->openChatRoom(chatId, [self createDelegateMEGAChatRoomListener:delegate singleListener:YES]);
}
Expand Down
45 changes: 45 additions & 0 deletions bindings/java/nz/mega/sdk/MegaChatApiJava.java
Original file line number Diff line number Diff line change
Expand Up @@ -1948,6 +1948,51 @@ public void archiveChat(long chatid, boolean archive, MegaChatRequestListenerInt
megaChatApi.archiveChat(chatid, archive, createDelegateRequestListener(listener));
}

/**
* This function allows a logged in operator/moderator to specify a message retention
* timeframe in seconds, after which older messages in the chat are automatically deleted.
* In order to disable the feature, the period of time can be set to zero (infinite).
*
* The associated request type with this request is MegaChatRequest::TYPE_SET_RETENTION_TIME
* Valid data in the MegaChatRequest object received on callbacks:
* - MegaChatRequest::getChatHandle - Returns the chat identifier
* - MegaChatRequest::getNumber - Returns the retention timeframe in seconds
*
* On the onRequestFinish error, the error code associated to the MegaChatError can be:
* - MegaChatError::ERROR_ARGS - If the chatid is invalid
* - MegaChatError::ERROR_NOENT - If there isn't any chat with the specified chatid.
* - MegaChatError::ERROR_ACCESS - If the logged in user doesn't have operator privileges
*
* @param chatid MegaChatHandle that identifies the chat room
* @param period retention timeframe in seconds, after which older messages in the chat are automatically deleted
* @param listener MegaChatRequestListener to track this request
*/
void setChatRetentionTime(long chatid, long period, MegaChatRequestListenerInterface listener) {
megaChatApi.setChatRetentionTime(chatid, period, createDelegateRequestListener(listener));
}

/**
* This function allows a logged in operator/moderator to specify a message retention
* timeframe in seconds, after which older messages in the chat are automatically deleted.
* In order to disable the feature, the period of time can be set to zero (infinite).
*
* The associated request type with this request is MegaChatRequest::TYPE_SET_RETENTION_TIME
* Valid data in the MegaChatRequest object received on callbacks:
* - MegaChatRequest::getChatHandle - Returns the chat identifier
* - MegaChatRequest::getNumber - Returns the retention timeframe in seconds
*
* On the onRequestFinish error, the error code associated to the MegaChatError can be:
* - MegaChatError::ERROR_ARGS - If the chatid is invalid
* - MegaChatError::ERROR_NOENT - If there isn't any chat with the specified chatid.
* - MegaChatError::ERROR_ACCESS - If the logged in user doesn't have operator privileges
*
* @param chatid MegaChatHandle that identifies the chat room
* @param period retention timeframe in seconds, after which older messages in the chat are automatically deleted
*/
void setChatRetentionTime(long chatid, long period) {
megaChatApi.setChatRetentionTime(chatid, period);
}

/**
* This method should be called when a chat is opened
*
Expand Down

0 comments on commit e844a41

Please sign in to comment.