AppDelegate: Added fixURLWithSeveralHashKeys method in order to fix iOS NSURLs with several hash keys in it. vector.im has plenty of such URLs.

Use this method on in-app and from outside links.
This commit is contained in:
manuroe
2016-04-20 09:21:46 +02:00
parent 8021482056
commit 6218c44f57
3 changed files with 45 additions and 10 deletions
+2 -10
View File
@@ -1275,18 +1275,10 @@
// Try to catch universal link supported by the app
NSURL *url = userInfo[kMXKRoomBubbleCellUrl];
// Patch: iOS handles URL badly when there are several hash keys ('%23') in the link
// And vector.im links have often several hash keys...
// iOS Patch: fix vector.im urls before using it
if ([url.host isEqualToString:@"vector.im"])
{
// Replacing the first '%23' occurence into a '#' makes NSURL works correctly
NSString *urlString = url.absoluteString;
NSRange range = [urlString rangeOfString:@"%23"];
if (NSNotFound != range.location)
{
urlString = [urlString stringByReplacingCharactersInRange:range withString:@"#"];
url = [NSURL URLWithString:urlString];
}
url = [AppDelegate fixURLWithSeveralHashKeys:url];
// If the link can be open it by the app, let it do
if ([[AppDelegate theDelegate] isUniversalLink:url])