completed

This commit is contained in:
Mauro Romito
2023-08-28 12:20:26 +02:00
parent 30c91a27a2
commit be289a3790
4 changed files with 81 additions and 16 deletions
+2
View File
@@ -967,6 +967,8 @@ Tap the + to start adding people.";
"manage_session_trusted" = "Trusted by you";
"manage_session_not_trusted" = "Not trusted";
"manage_session_sign_out" = "Sign out of this session";
"manage_session_redirect" = "You will be redirected to your server's authentication provider to complete sign out.";
"manage_session_redirect_error" = "Functionality currently unavailable. Please contact your homeserver admin";
"manage_session_rename" = "Rename session";
"manage_session_sign_out_other_sessions" = "Sign out of all other sessions";
// User sessions management
+8
View File
@@ -3667,6 +3667,14 @@ public class VectorL10n: NSObject {
public static var manageSessionNotTrusted: String {
return VectorL10n.tr("Vector", "manage_session_not_trusted")
}
/// You will be redirected to your server's authentication provider to complete sign out.
public static var manageSessionRedirect: String {
return VectorL10n.tr("Vector", "manage_session_redirect")
}
/// Functionality currently unavailable. Please contact your homeserver admin
public static var manageSessionRedirectError: String {
return VectorL10n.tr("Vector", "manage_session_redirect_error")
}
/// Rename session
public static var manageSessionRename: String {
return VectorL10n.tr("Vector", "manage_session_rename")
@@ -656,11 +656,18 @@ enum {
- (void)removeDevice
{
NSURL *logoutURL = [self.mainSession.homeserverWellknown.authentication getLogoutDeviceURLFromID:device.deviceId];
if (logoutURL)
MXWellKnownAuthentication *authentication = self.mainSession.homeserverWellknown.authentication;
if (authentication)
{
[UIApplication.sharedApplication openURL:logoutURL options:@{} completionHandler:nil];
[self withdrawViewControllerAnimated:YES completion:nil];
NSURL *logoutURL = [authentication getLogoutDeviceURLFromID:device.deviceId];
if (logoutURL)
{
[self removeDeviceRedirectWithURL:logoutURL];
}
else
{
[self showRemoveDeviceRedirectError];
}
}
else
{
@@ -668,6 +675,31 @@ enum {
}
}
-(void) removeDeviceRedirectWithURL: (NSURL * _Nonnull) url
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle: [VectorL10n manageSessionRedirect] message: nil preferredStyle:UIAlertControllerStyleAlert];
__weak typeof(self) weakSelf = self;
UIAlertAction *action = [UIAlertAction actionWithTitle:[VectorL10n ok]
style:UIAlertActionStyleDefault
handler: ^(UIAlertAction * action) {
[UIApplication.sharedApplication openURL:url options:@{} completionHandler:^(BOOL success) {
if (success && weakSelf)
{
[weakSelf withdrawViewControllerAnimated:YES completion:nil];
}
}];
}];
[alert addAction: action];
[self presentViewController:alert animated:YES completion:nil];
}
-(void) showRemoveDeviceRedirectError
{
UIAlertController *alert = [UIAlertController alertControllerWithTitle: [VectorL10n manageSessionRedirectError] message: nil preferredStyle:UIAlertControllerStyleAlert];
[self presentViewController:alert animated:YES completion:nil];
}
-(void) removeDeviceThroughAPI
{
[self startActivityIndicator];