mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-28 15:22:39 +00:00
parent
5a30474f4d
commit
2e86379b2a
5 changed files with 106 additions and 0 deletions
|
@ -1,3 +1,9 @@
|
|||
Changes in 0.9.3 (2019-09-10)
|
||||
===============================================
|
||||
|
||||
Improvements:
|
||||
* Support Riot configuration link to customise HS and IS (#2703).
|
||||
|
||||
Changes in 0.9.2 (2019-08-08)
|
||||
===============================================
|
||||
|
||||
|
|
|
@ -2100,6 +2100,11 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
|||
|
||||
// iOS Patch: fix vector.im urls before using it
|
||||
webURL = [Tools fixURLWithSeveralHashKeys:webURL];
|
||||
|
||||
if ([webURL.path hasPrefix:@"/config"])
|
||||
{
|
||||
return [self handleServerProvionningLink:webURL];
|
||||
}
|
||||
|
||||
// Manage email validation link
|
||||
if ([webURL.path isEqualToString:@"/_matrix/identity/api/v1/validate/email/submitToken"])
|
||||
|
@ -2547,6 +2552,93 @@ NSString *const kAppDelegateNetworkStatusDidChangeNotification = @"kAppDelegateN
|
|||
*outQueryParams = queryParams;
|
||||
}
|
||||
|
||||
|
||||
- (BOOL)handleServerProvionningLink:(NSURL*)link
|
||||
{
|
||||
NSLog(@"[AppDelegate] handleServerProvionningLink: %@", link);
|
||||
|
||||
NSString *homeserver, *identityServer;
|
||||
[self parseServerProvionningLink:link homeserver:&homeserver identityServer:&identityServer];
|
||||
|
||||
if (homeserver)
|
||||
{
|
||||
if ([MXKAccountManager sharedManager].activeAccounts.count)
|
||||
{
|
||||
[self displayServerProvionningLinkBuyAlreadyLoggedInAlertWithCompletion:^(BOOL logout) {
|
||||
|
||||
NSLog(@"[AppDelegate] handleServerProvionningLink: logoutWithConfirmation: logout: %@", @(logout));
|
||||
if (logout)
|
||||
{
|
||||
[self logoutWithConfirmation:NO completion:^(BOOL isLoggedOut) {
|
||||
[self handleServerProvionningLink:link];
|
||||
}];
|
||||
}
|
||||
}];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_masterTabBarController showAuthenticationScreen];
|
||||
[_masterTabBarController.authViewController showCustomHomeserver:homeserver andIdentityServer:identityServer];
|
||||
}
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)parseServerProvionningLink:(NSURL*)link homeserver:(NSString**)homeserver identityServer:(NSString**)identityServer
|
||||
{
|
||||
if ([link.path isEqualToString:@"/config/config"])
|
||||
{
|
||||
NSURLComponents *linkURLComponents = [NSURLComponents componentsWithURL:link resolvingAgainstBaseURL:NO];
|
||||
for (NSURLQueryItem *item in linkURLComponents.queryItems)
|
||||
{
|
||||
if ([item.name isEqualToString:@"hs_url"])
|
||||
{
|
||||
*homeserver = item.value;
|
||||
}
|
||||
else if ([item.name isEqualToString:@"is_url"])
|
||||
{
|
||||
*identityServer = item.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"[AppDelegate] parseServerProvionningLink: Error: Unknown path: %@", link.path);
|
||||
}
|
||||
|
||||
|
||||
NSLog(@"[AppDelegate] parseServerProvionningLink: homeserver: %@ - identityServer: %@", *homeserver, *identityServer);
|
||||
}
|
||||
|
||||
- (void)displayServerProvionningLinkBuyAlreadyLoggedInAlertWithCompletion:(void (^)(BOOL logout))completion
|
||||
{
|
||||
// Ask confirmation
|
||||
self.logoutConfirmation = [UIAlertController alertControllerWithTitle:NSLocalizedStringFromTable(@"error_user_already_logged_in", @"Vector", nil) message:nil preferredStyle:UIAlertControllerStyleAlert];
|
||||
|
||||
[self.logoutConfirmation addAction:[UIAlertAction actionWithTitle:NSLocalizedStringFromTable(@"settings_sign_out", @"Vector", nil)
|
||||
style:UIAlertActionStyleDefault
|
||||
handler:^(UIAlertAction * action)
|
||||
{
|
||||
self.logoutConfirmation = nil;
|
||||
completion(YES);
|
||||
}]];
|
||||
|
||||
[self.logoutConfirmation addAction:[UIAlertAction actionWithTitle:[NSBundle mxk_localizedStringForKey:@"cancel"]
|
||||
style:UIAlertActionStyleCancel
|
||||
handler:^(UIAlertAction * action)
|
||||
{
|
||||
self.logoutConfirmation = nil;
|
||||
completion(NO);
|
||||
}]];
|
||||
|
||||
[self.logoutConfirmation mxk_setAccessibilityIdentifier: @"AppDelegateLogoutConfirmationAlert"];
|
||||
[self showNotificationAlert:self.logoutConfirmation];
|
||||
}
|
||||
|
||||
#pragma mark - Matrix sessions handling
|
||||
|
||||
- (void)initMatrixSessions
|
||||
|
|
|
@ -127,6 +127,8 @@
|
|||
"auth_softlogout_clear_data_sign_out_msg" = "Are you sure you want to clear all data currently stored on this device? Sign in again to access your account data and messages.";
|
||||
"auth_softlogout_clear_data_sign_out" = "Sign out";
|
||||
|
||||
// Errors
|
||||
"error_user_already_logged_in" = "It looks like you’re trying to connect to another homeserver. Do you want to sign out?";
|
||||
|
||||
// Chat creation
|
||||
"room_creation_title" = "New Chat";
|
||||
|
|
|
@ -962,6 +962,10 @@ internal enum VectorL10n {
|
|||
internal static var encryptedRoomMessageReplyToPlaceholder: String {
|
||||
return VectorL10n.tr("Vector", "encrypted_room_message_reply_to_placeholder")
|
||||
}
|
||||
/// It looks like you’re trying to connect to another homeserver. Do you want to sign out?
|
||||
internal static var errorUserAlreadyLoggedIn: String {
|
||||
return VectorL10n.tr("Vector", "error_user_already_logged_in")
|
||||
}
|
||||
/// VoIP conference added by %@
|
||||
internal static func eventFormatterJitsiWidgetAdded(_ p1: String) -> String {
|
||||
return VectorL10n.tr("Vector", "event_formatter_jitsi_widget_added", p1)
|
||||
|
|
|
@ -45,5 +45,7 @@
|
|||
@property (weak, nonatomic) IBOutlet UILabel *softLogoutClearDataLabel;
|
||||
@property (weak, nonatomic) IBOutlet UIButton *softLogoutClearDataButton;
|
||||
|
||||
- (void)showCustomHomeserver:(NSString*)homeserver andIdentityServer:(NSString*)identityServer;
|
||||
|
||||
@end
|
||||
|
||||
|
|
Loading…
Reference in a new issue