Conference

This commit is contained in:
Isaac 2025-04-15 19:30:05 +04:00
parent c7269fa310
commit 9a2215de29
11 changed files with 23 additions and 22 deletions

View File

@ -14187,3 +14187,4 @@ Sorry for the inconvenience.";
"SendInviteLink.TextCallsRestrictedOneUser" = "%@ does not accept calls.";
"SendInviteLink.TextCallsRestrictedMultipleUsers_1" = "{user_list}, and **%d** more person do not accept calls.";
"SendInviteLink.TextCallsRestrictedMultipleUsers_any" = "{user_list}, and **%d** more people do not accept calls.";
"SendInviteLink.TextCallsRestrictedSendInviteLink" = "You can try to send an invite link instead.";

View File

@ -356,8 +356,8 @@ private final class ConferenceCallE2EContextStateImpl: ConferenceCallE2EContextS
return self.call.takeOutgoingBroadcastBlocks()
}
func encrypt(message: Data, channelId: Int32) -> Data? {
return self.call.encrypt(message, channelId: channelId)
func encrypt(message: Data, channelId: Int32, plaintextPrefixLength: Int) -> Data? {
return self.call.encrypt(message, channelId: channelId, plaintextPrefixLength: plaintextPrefixLength)
}
func decrypt(message: Data, userId: Int64) -> Data? {
@ -374,9 +374,9 @@ class OngoingGroupCallEncryptionContextImpl: OngoingGroupCallEncryptionContext {
self.channelId = channelId
}
func encrypt(message: Data) -> Data? {
func encrypt(message: Data, plaintextPrefixLength: Int) -> Data? {
let channelId = self.channelId
return self.e2eCall.with({ $0.state?.encrypt(message: message, channelId: channelId) })
return self.e2eCall.with({ $0.state?.encrypt(message: message, channelId: channelId, plaintextPrefixLength: plaintextPrefixLength) })
}
func decrypt(message: Data, userId: Int64) -> Data? {

View File

@ -13,7 +13,7 @@ public protocol ConferenceCallE2EContextState: AnyObject {
func takeOutgoingBroadcastBlocks() -> [Data]
func encrypt(message: Data, channelId: Int32) -> Data?
func encrypt(message: Data, channelId: Int32, plaintextPrefixLength: Int) -> Data?
func decrypt(message: Data, userId: Int64) -> Data?
}

View File

@ -791,7 +791,7 @@ private final class SendInviteLinkScreenComponent: Component {
}
}
case .groupCall:
text = " "
text = environment.strings.SendInviteLink_TextCallsRestrictedSendInviteLink
}
let body = MarkdownAttributeSet(font: Font.regular(15.0), textColor: environment.theme.list.itemPrimaryTextColor)

View File

@ -217,7 +217,7 @@ final class OngoingGroupCallBroadcastPartTaskImpl: NSObject, OngoingGroupCallBro
}
public protocol OngoingGroupCallEncryptionContext: AnyObject {
func encrypt(message: Data) -> Data?
func encrypt(message: Data, plaintextPrefixLength: Int) -> Data?
func decrypt(message: Data, userId: Int64) -> Data?
}
@ -645,9 +645,9 @@ public final class OngoingGroupCallContext {
isConference: isConference,
isActiveByDefault: audioIsActiveByDefault,
encryptDecrypt: encryptionContext.flatMap { encryptionContext in
return { data, userId, isEncrypt in
return { data, userId, isEncrypt, plaintextPrefixLength in
if isEncrypt {
return encryptionContext.encrypt(message: data)
return encryptionContext.encrypt(message: data, plaintextPrefixLength: Int(plaintextPrefixLength))
} else {
return encryptionContext.decrypt(message: data, userId: userId)
}
@ -755,9 +755,9 @@ public final class OngoingGroupCallContext {
isConference: isConference,
isActiveByDefault: audioIsActiveByDefault,
encryptDecrypt: encryptionContext.flatMap { encryptionContext in
return { data, userId, isEncrypt in
return { data, userId, isEncrypt, plaintextPrefixLength in
if isEncrypt {
return encryptionContext.encrypt(message: data)
return encryptionContext.encrypt(message: data, plaintextPrefixLength: Int(plaintextPrefixLength))
} else {
return encryptionContext.decrypt(message: data, userId: userId)
}

View File

@ -457,7 +457,7 @@ onMutedSpeechActivityDetected:(void (^ _Nullable)(bool))onMutedSpeechActivityDet
audioDevice:(SharedCallAudioDevice * _Nullable)audioDevice
isConference:(bool)isConference
isActiveByDefault:(bool)isActiveByDefault
encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, bool))encryptDecrypt;
encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, bool, int32_t))encryptDecrypt;
- (void)stop:(void (^ _Nullable)())completion;

View File

@ -2389,7 +2389,7 @@ onMutedSpeechActivityDetected:(void (^ _Nullable)(bool))onMutedSpeechActivityDet
audioDevice:(SharedCallAudioDevice * _Nullable)audioDevice
isConference:(bool)isConference
isActiveByDefault:(bool)isActiveByDefault
encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, bool))encryptDecrypt {
encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, bool, int32_t))encryptDecrypt {
self = [super init];
if (self != nil) {
_queue = queue;
@ -2458,12 +2458,12 @@ encryptDecrypt:(NSData * _Nullable (^ _Nullable)(NSData * _Nonnull, int64_t, boo
std::string statsLogPathValue(statsLogPath.length == 0 ? "" : statsLogPath.UTF8String);
std::function<std::vector<uint8_t>(std::vector<uint8_t> const &, int64_t, bool)> mappedEncryptDecrypt;
std::function<std::vector<uint8_t>(std::vector<uint8_t> const &, int64_t, bool, int32_t)> mappedEncryptDecrypt;
if (encryptDecrypt) {
NSData * _Nullable (^encryptDecryptBlock)(NSData * _Nonnull, int64_t, bool) = [encryptDecrypt copy];
mappedEncryptDecrypt = [encryptDecryptBlock](std::vector<uint8_t> const &message, int64_t userId, bool isEncrypt) -> std::vector<uint8_t> {
NSData * _Nullable (^encryptDecryptBlock)(NSData * _Nonnull, int64_t, bool, int32_t) = [encryptDecrypt copy];
mappedEncryptDecrypt = [encryptDecryptBlock](std::vector<uint8_t> const &message, int64_t userId, bool isEncrypt, int32_t plaintextPrefixLength) -> std::vector<uint8_t> {
NSData *mappedMessage = [[NSData alloc] initWithBytes:message.data() length:message.size()];
NSData *result = encryptDecryptBlock(mappedMessage, userId, isEncrypt);
NSData *result = encryptDecryptBlock(mappedMessage, userId, isEncrypt, plaintextPrefixLength);
if (!result) {
return std::vector<uint8_t>();
}

@ -1 +1 @@
Subproject commit 36161286bd7fae1b9bb2e8dad817ae9af6d68055
Subproject commit e87034dbdd8c209318aca57c4ff417117398d14f

View File

@ -42,7 +42,7 @@ NS_ASSUME_NONNULL_BEGIN
- (nullable NSData *)generateRemoveParticipantsBlock:(NSArray<NSNumber *> *)participantIds;
- (nullable NSData *)encrypt:(NSData *)message channelId:(int32_t)channelId;
- (nullable NSData *)encrypt:(NSData *)message channelId:(int32_t)channelId plaintextPrefixLength:(NSInteger)plaintextPrefixLength;
- (nullable NSData *)decrypt:(NSData *)message userId:(int64_t)userId;
@end

View File

@ -287,9 +287,9 @@ static NSString *hexStringFromData(NSData *data) {
return [[NSData alloc] initWithBytes:result.value().data() length:result.value().size()];
}
- (nullable NSData *)encrypt:(NSData *)message channelId:(int32_t)channelId {
- (nullable NSData *)encrypt:(NSData *)message channelId:(int32_t)channelId plaintextPrefixLength:(NSInteger)plaintextPrefixLength {
std::string mappedMessage((uint8_t *)message.bytes, ((uint8_t *)message.bytes) + message.length);
auto result = tde2e_api::call_encrypt(_callId, channelId, mappedMessage);
auto result = tde2e_api::call_encrypt(_callId, channelId, mappedMessage, (size_t)plaintextPrefixLength);
if (!result.is_ok()) {
return nil;
}

2
third-party/td/td vendored

@ -1 +1 @@
Subproject commit 04adfc87deea4c804def118e88c89a08c388b32b
Subproject commit ec42a570737be64397632eba84b5e0916e2c8388