Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert verification request and transaction to protocols #6444

Merged
merged 1 commit into from
Jul 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Riot/Modules/Application/LegacyAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ UINavigationControllerDelegate
@param session The matrix session.
@return Indicate NO if the key verification screen could not be presented.
*/
- (BOOL)presentIncomingKeyVerificationRequest:(MXKeyVerificationRequest*)incomingKeyVerificationRequest
- (BOOL)presentIncomingKeyVerificationRequest:(id<MXKeyVerificationRequest>)incomingKeyVerificationRequest
inSession:(MXSession*)session;

- (BOOL)presentUserVerificationForRoomMember:(MXRoomMember*)roomMember session:(MXSession*)mxSession;
Expand Down
10 changes: 5 additions & 5 deletions Riot/Modules/Application/LegacyAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -3636,11 +3636,11 @@ - (void)checkPendingIncomingKeyVerificationsInSession:(MXSession*)mxSession
return;
}

[mxSession.crypto.keyVerificationManager transactions:^(NSArray<MXKeyVerificationTransaction *> * _Nonnull transactions) {
[mxSession.crypto.keyVerificationManager transactions:^(NSArray<id<MXKeyVerificationTransaction>> * _Nonnull transactions) {

MXLogDebug(@"[AppDelegate][MXKeyVerification] checkPendingIncomingKeyVerificationsInSession: transactions: %@", transactions);

for (MXKeyVerificationTransaction *transaction in transactions)
for (id<MXKeyVerificationTransaction> transaction in transactions)
{
if (transaction.isIncoming)
{
Expand All @@ -3664,7 +3664,7 @@ - (void)checkPendingIncomingKeyVerifications
}
}

- (BOOL)presentIncomingKeyVerificationRequest:(MXKeyVerificationRequest*)incomingKeyVerificationRequest
- (BOOL)presentIncomingKeyVerificationRequest:(id<MXKeyVerificationRequest>)incomingKeyVerificationRequest
inSession:(MXSession*)session
{
BOOL presented = NO;
Expand Down Expand Up @@ -3810,7 +3810,7 @@ - (void)keyVerificationNewRequestNotification:(NSNotification *)notification

NSDictionary *userInfo = notification.userInfo;

MXKeyVerificationRequest *keyVerificationRequest = userInfo[MXKeyVerificationManagerNotificationRequestKey];
id<MXKeyVerificationRequest> keyVerificationRequest = userInfo[MXKeyVerificationManagerNotificationRequestKey];

if ([keyVerificationRequest isKindOfClass:MXKeyVerificationByDMRequest.class])
{
Expand Down Expand Up @@ -3893,7 +3893,7 @@ - (void)keyVerificationNewRequestNotification:(NSNotification *)notification
- (void)presentNewKeyVerificationRequestAlertForSession:(MXSession*)session
senderName:(NSString*)senderName
senderId:(NSString*)senderId
request:(MXKeyVerificationRequest*)keyVerificationRequest
request:(id<MXKeyVerificationRequest>)keyVerificationRequest
{
if (keyVerificationRequest.state != MXKeyVerificationRequestStatePending)
{
Expand Down
8 changes: 4 additions & 4 deletions Riot/Modules/Room/DataSources/RoomDataSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ - (RoomBubbleCellData*)roomBubbleCellDataForEventId:(NSString*)eventId
return roomBubbleCellData;
}

- (MXKeyVerificationRequest*)keyVerificationRequestFromEventId:(NSString*)eventId
- (id<MXKeyVerificationRequest>)keyVerificationRequestFromEventId:(NSString*)eventId
{
RoomBubbleCellData *roomBubbleCellData = [self roomBubbleCellDataForEventId:eventId];

Expand Down Expand Up @@ -745,7 +745,7 @@ - (void)registerKeyVerificationTransactionNotification
queue:[NSOperationQueue mainQueue]
usingBlock:^(NSNotification *notification)
{
MXKeyVerificationTransaction *keyVerificationTransaction = (MXKeyVerificationTransaction*)notification.object;
id<MXKeyVerificationTransaction> keyVerificationTransaction = (id<MXKeyVerificationTransaction>)notification.object;

if ([keyVerificationTransaction.dmRoomId isEqualToString:self.roomId])
{
Expand Down Expand Up @@ -927,7 +927,7 @@ - (void)sendVideo:(NSURL *)videoLocalURL

- (void)acceptVerificationRequestForEventId:(NSString*)eventId success:(void(^)(void))success failure:(void(^)(NSError*))failure
{
MXKeyVerificationRequest *keyVerificationRequest = [self keyVerificationRequestFromEventId:eventId];
id<MXKeyVerificationRequest> keyVerificationRequest = [self keyVerificationRequestFromEventId:eventId];

if (!keyVerificationRequest)
{
Expand All @@ -950,7 +950,7 @@ - (void)acceptVerificationRequestForEventId:(NSString*)eventId success:(void(^)(

- (void)declineVerificationRequestForEventId:(NSString*)eventId success:(void(^)(void))success failure:(void(^)(NSError*))failure
{
MXKeyVerificationRequest *keyVerificationRequest = [self keyVerificationRequestFromEventId:eventId];
id<MXKeyVerificationRequest> keyVerificationRequest = [self keyVerificationRequestFromEventId:eventId];

if (!keyVerificationRequest)
{
Expand Down
1 change: 1 addition & 0 deletions changelog.d/pr-6444.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Crypto: Convert verification request and transaction to protocols