Skip to content

Commit

Permalink
One more legacy crypto use
Browse files Browse the repository at this point in the history
  • Loading branch information
Anderas committed Apr 19, 2023
1 parent 0b9001f commit 485490e
Showing 1 changed file with 0 additions and 28 deletions.
28 changes: 0 additions & 28 deletions MatrixSDK/Data/MXRoom.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ The list of room operations (sending of text, images...) that must be sent
FIFO queue of failure blocks waiting for [self members:].
*/
NSMutableArray<void (^)(NSError *)> *pendingMembersFailureBlocks;

/**
The manager for sharing keys of messages with invited users
*/
MXSharedHistoryKeyManager *sharedHistoryKeyManager;
}
@end

Expand Down Expand Up @@ -123,14 +118,6 @@ - (id)initWithRoomId:(NSString *)roomId matrixSession:(MXSession *)mxSession2 an
{
_roomId = roomId;
mxSession = mxSession2;

if ([mxSession.crypto isKindOfClass:[MXLegacyCrypto class]])
{
MXMegolmDecryption *decryption = [[MXMegolmDecryption alloc] initWithCrypto:mxSession.crypto];
sharedHistoryKeyManager = [[MXSharedHistoryKeyManager alloc] initWithRoomId:roomId
crypto:mxSession.crypto
service:decryption];
}

if (store)
{
Expand Down Expand Up @@ -1977,24 +1964,9 @@ - (MXHTTPOperation*)inviteUser:(NSString*)userId
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
{
if (MXSDKOptions.sharedInstance.enableRoomSharedHistoryOnInvite)
{
[self shareRoomKeysWith:userId];
}
return [mxSession.matrixRestClient inviteUser:userId toRoom:self.roomId success:success failure:failure];
}

- (void)shareRoomKeysWith:(NSString *)userId
{
// The value of 20 is arbitrary and imprecise, we merely want to ensure that when a user is invited to a room
// they are able to read any immediately preciding messages that may be relevant to the invite.
NSInteger numberOfSharedMessage = 20;
id<MXEventsEnumerator> enumerator = [self enumeratorForStoredMessagesWithTypeIn:@[kMXEventTypeStringRoomMessage]];
[sharedHistoryKeyManager shareMessageKeysWithUserId:userId
messageEnumerator:enumerator
limit:numberOfSharedMessage];
}

- (MXHTTPOperation*)inviteUserByEmail:(NSString*)email
success:(void (^)(void))success
failure:(void (^)(NSError *error))failure
Expand Down

0 comments on commit 485490e

Please sign in to comment.