Skip to content

Commit

Permalink
Merge pull request #5893 from vector-im/andy/5883_search_crash
Browse files Browse the repository at this point in the history
Prevent crash when searching for rooms
  • Loading branch information
Anderas authored Mar 22, 2022
2 parents ea44865 + 413a1eb commit 70d39ef
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 17 deletions.
8 changes: 0 additions & 8 deletions Riot/Modules/Application/LegacyAppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,14 +227,6 @@ UINavigationControllerDelegate
// Reopen an existing direct room with this userId or creates a new one (if it doesn't exist)
- (void)startDirectChatWithUserId:(NSString*)userId completion:(void (^)(void))completion;

/**
Process the fragment part of a vector.im link.
@param fragment the fragment part of the universal link.
@return YES in case of processing success.
*/
- (BOOL)handleUniversalLinkFragment:(NSString*)fragment;

/**
Process the fragment part of a vector.im link.
Expand Down
6 changes: 0 additions & 6 deletions Riot/Modules/Application/LegacyAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -1263,12 +1263,6 @@ - (BOOL)handleUniversalLink:(NSUserActivity*)userActivity
return [self handleUniversalLinkFragment:webURL.fragment fromURL:webURL];
}

- (BOOL)handleUniversalLinkFragment:(NSString*)fragment
{
return [self handleUniversalLinkFragment:fragment fromURL:nil];
}


- (BOOL)handleUniversalLinkFragment:(NSString*)fragment fromURL:(NSURL*)universalLinkURL

{
Expand Down
3 changes: 2 additions & 1 deletion Riot/Modules/Common/Recents/RecentsViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,8 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
{
// Open the room or preview it
NSString *fragment = [NSString stringWithFormat:@"/room/%@", [MXTools encodeURIComponent:roomIdOrAlias]];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment];
NSURL *url = [NSURL URLWithString:[MXTools permalinkToRoom:fragment]];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment fromURL:url];
}
[tableView deselectRowAtIndexPath:indexPath animated:NO];
}
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/Communities/Home/GroupHomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ - (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRan
// Open the group or preview it
NSString *fragment = [NSString stringWithFormat:@"/group/%@",
[MXTools encodeURIComponent:absoluteURLString]];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment];
[[AppDelegate theDelegate] handleUniversalLinkFragment:fragment fromURL:URL];
}

return shouldInteractWithURL;
Expand Down
2 changes: 1 addition & 1 deletion Riot/Modules/DeepLink/UniversalLinkParameters.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class UniversalLinkParameters: NSObject {

// MARK: - Properties

/// The unprocessed the universal link URL
/// The unprocessed universal link URL
let universalLinkURL: URL

/// The fragment part of the universal link
Expand Down
2 changes: 2 additions & 0 deletions changelog.d/5883.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Search: prevent crash when searching for rooms

0 comments on commit 70d39ef

Please sign in to comment.