Skip to content

Commit

Permalink
Merge branch 'task/cht-1095-fix-mute' into 'develop'
Browse files Browse the repository at this point in the history
CHT-1095. Fix MegaChatRequest::TYPE_MUTE

See merge request megachat/MEGAchat!1792
  • Loading branch information
jgandres committed Jan 9, 2024
2 parents ad72670 + 95c411a commit 4150da6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions bindings/Objective-C/MEGAChatSdk.mm
Original file line number Diff line number Diff line change
Expand Up @@ -1018,6 +1018,12 @@ - (void)pushUsersIntoWaitingRoom:(uint64_t)chatId usersHandles:(NSArray<NSNumber
}
}

- (void)mutePeers:(uint64_t)chatId client:(uint64_t)clientId delegate:(id<MEGAChatRequestDelegate>)delegate {
if (self.megaChatApi) {
self.megaChatApi->mutePeers(chatId, clientId, [self createDelegateMEGAChatRequestListener:delegate singleListener:YES]);
}
}

- (void)autojoinPublicChat:(uint64_t)chatId delegate:(id<MEGAChatRequestDelegate>)delegate {
if (self.megaChatApi) {
self.megaChatApi->autojoinPublicChat(chatId, [self createDelegateMEGAChatRequestListener:delegate singleListener:YES]);
Expand Down
2 changes: 2 additions & 0 deletions bindings/Objective-C/include/MEGAChatSdk.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ NS_ASSUME_NONNULL_BEGIN
- (void)kickUsersFromCall:(uint64_t)chatId usersHandles:(NSArray<NSNumber *> *)usersHandles delegate:(id<MEGAChatRequestDelegate>)delegate;
- (void)kickUsersFromCall:(uint64_t)chatId usersHandles:(NSArray<NSNumber *> *)usersHandles;

- (void)mutePeers:(uint64_t)chatId client:(uint64_t)clientId delegate:(id<MEGAChatRequestDelegate>)delegate;

- (void)pushUsersIntoWaitingRoom:(uint64_t)chatId usersHandles:(NSArray<NSNumber *> *)usersHandles delegate:(id<MEGAChatRequestDelegate>)delegate;
- (void)pushUsersIntoWaitingRoom:(uint64_t)chatId usersHandles:(NSArray<NSNumber *> *)usersHandles;

Expand Down
5 changes: 5 additions & 0 deletions src/megachatapi_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2916,6 +2916,8 @@ int MegaChatApiImpl::performRequest_mutePeersInCall(MegaChatRequestPrivate* requ
}

call->mutePeers(cid, karere::AvFlags::kAudio);
MegaChatErrorPrivate* megaChatError = new MegaChatErrorPrivate(MegaChatError::ERROR_OK);
fireOnChatRequestFinish(request, megaChatError);
return MegaChatError::ERROR_OK;
}
#endif // ifndef KARERE_DISABLE_WEBRTC
Expand Down Expand Up @@ -6066,6 +6068,9 @@ int MegaChatApiImpl::performRequest_sendRingIndividualInACall(MegaChatRequestPri
MegaChatErrorPrivate* megaChatError = new MegaChatErrorPrivate(err.msg(), err.code(), err.type());
fireOnChatRequestFinish(request, megaChatError);
});

// REMINDER: when Client::ringIndividualInACall call is removed (chatd has applied the required fix) we need to
// add a call to fireOnChatRequestFinish with MegaChatError::ERROR_OK
return MegaChatError::ERROR_OK;
}

Expand Down
8 changes: 7 additions & 1 deletion tests/sdk_test/sdk_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4408,7 +4408,13 @@ TEST_F(MegaChatApiTest, EstablishedCalls)
LOG_debug << "#### Test3: A mutes B in call ####";
bool* remoteAvFlagsChanged = &mChatCallAudioDisabled[a1]; *remoteAvFlagsChanged = false; // a2 will receive onChatSessionUpdate (CHANGE_TYPE_REMOTE_AVFLAGS)
exitFlag = &mChatCallAudioDisabled[a2]; *exitFlag = false; // a2 will receive onChatCallUpdate (CHANGE_TYPE_LOCAL_AVFLAGS)
action = [this, a1, chatid, secondaryCid](){ megaChatApi[a1]->mutePeers(chatid, secondaryCid); };
action = [this, a1, chatid, secondaryCid]()
{
ChatRequestTracker crtMutePeers(megaChatApi[a1]);
megaChatApi[a1]->mutePeers(chatid, secondaryCid, &crtMutePeers);
ASSERT_EQ(crtMutePeers.waitForResult(), MegaChatError::ERROR_OK)
<< "Failed to mute peer. Error: " << crtMutePeers.getErrorString();
};
ASSERT_NO_FATAL_FAILURE({
waitForCallAction(a1 /*performer*/, MAX_ATTEMPTS, exitFlag, "receiving MUTED notification from SFU for secondary account", maxTimeout, action);
});
Expand Down

0 comments on commit 4150da6

Please sign in to comment.