BF: Infinite loading wheel when taping on a fake room alias

#679
This commit is contained in:
manuroe 2019-01-17 17:46:49 +01:00
parent 1ed0e3b95e
commit b4724e46d2
5 changed files with 33 additions and 25 deletions

View file

@ -11,6 +11,7 @@ Bug fix:
* Use white scroll bar on dark themes (#2158).
* Registration: fix tap gesture on checkboxes in the terms screen.
* Registration: improve validation UX on the terms screen (#2164).
* Infinite loading wheel when taping on a fake room alias (#679).
Changes in 0.7.11 (2019-01-08)
===============================================

View file

@ -90,6 +90,7 @@ extern NSString *const kAppDelegateNetworkStatusDidChangeNotification;
- (void)restoreEmptyDetailsViewController;
- (UIAlertController*)showErrorAsAlert:(NSError*)error;
- (UIAlertController*)showAlertWithTitle:(NSString*)title message:(NSString*)message;
#pragma mark - Matrix Sessions handling

View file

@ -871,9 +871,7 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
return nil;
}
}
[_errorNotification dismissViewControllerAnimated:NO completion:nil];
NSString *title = [error.userInfo valueForKey:NSLocalizedFailureReasonErrorKey];
NSString *msg = [error.userInfo valueForKey:NSLocalizedDescriptionKey];
if (!title)
@ -889,13 +887,26 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
}
}
_errorNotification = [UIAlertController alertControllerWithTitle:title message:msg preferredStyle:UIAlertControllerStyleAlert];
// Switch in offline mode in case of network reachability error
if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorNotConnectedToInternet)
{
self.isOffline = YES;
}
return [self showAlertWithTitle:title message:msg];
}
- (UIAlertController*)showAlertWithTitle:(NSString*)title message:(NSString*)message
{
[_errorNotification dismissViewControllerAnimated:NO completion:nil];
_errorNotification = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
[_errorNotification addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"ok"]
style:UIAlertActionStyleDefault
handler:^(UIAlertAction * action) {
[AppDelegate theDelegate].errorNotification = nil;
}]];
// Display the error notification
if (!isErrorNotificationSuspended)
@ -903,13 +914,7 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
[_errorNotification mxk_setAccessibilityIdentifier:@"AppDelegateErrorAlert"];
[self showNotificationAlert:_errorNotification];
}
// Switch in offline mode in case of network reachability error
if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorNotConnectedToInternet)
{
self.isOffline = YES;
}
return self.errorNotification;
}
@ -1917,6 +1922,12 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
} failure:^(NSError *error) {
NSLog(@"[AppDelegate] Universal link: Error: The home server failed to resolve the room alias (%@)", roomIdOrAlias);
[homeViewController stopActivityIndicator];
NSString *errorMessage = [NSString stringWithFormat:NSLocalizedStringFromTable(@"room_does_not_exist", @"Vector", nil), roomIdOrAlias];
[self showAlertWithTitle:nil message:errorMessage];
}];
}
else if ([roomIdOrAlias hasPrefix:@"!"] && ((MXKAccount*)accountManager.activeAccounts.firstObject).mxSession.state != MXSessionStateRunning)
@ -3452,22 +3463,12 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
_jitsiViewController = nil;
NSError *theError = [NSError errorWithDomain:@""
code:0
userInfo:@{
NSLocalizedDescriptionKey: NSLocalizedStringFromTable(@"call_jitsi_error", @"Vector", nil)
}];
[self showErrorAsAlert:theError];
[self showAlertWithTitle:nil message:NSLocalizedStringFromTable(@"call_jitsi_error", @"Vector", nil)];
}];
}
else
{
NSError *error = [NSError errorWithDomain:@""
code:0
userInfo:@{
NSLocalizedDescriptionKey: NSLocalizedStringFromTable(@"call_already_displayed", @"Vector", nil)
}];
[self showErrorAsAlert:error];
[self showAlertWithTitle:nil message:NSLocalizedStringFromTable(@"call_already_displayed", @"Vector", nil)];
}
}

View file

@ -553,6 +553,7 @@
"do_not_ask_again" = "Do not ask again";
"camera_access_not_granted" = "%@ doesn't have permission to use Camera, please change privacy settings";
"large_badge_value_k_format" = "%.1fK";
"room_does_not_exist" = "%@ does not exist";
// Call
"call_incoming_voice_prompt" = "Incoming voice call from %@";

View file

@ -614,6 +614,10 @@ internal enum VectorL10n {
internal static let roomDirectoryNoPublicRoom = VectorL10n.tr("Vector", "room_directory_no_public_room")
/// You do not have permission to post to this room
internal static let roomDoNotHavePermissionToPost = VectorL10n.tr("Vector", "room_do_not_have_permission_to_post")
/// %@ does not exist
internal static func roomDoesNotExist(_ p1: String) -> String {
return VectorL10n.tr("Vector", "room_does_not_exist", p1)
}
/// Reason for banning this user
internal static let roomEventActionBanPromptReason = VectorL10n.tr("Vector", "room_event_action_ban_prompt_reason")
/// Cancel Download