Index: remoting/client/ios/app/remoting_settings_view_controller.mm |
diff --git a/remoting/client/ios/app/remoting_settings_view_controller.mm b/remoting/client/ios/app/remoting_settings_view_controller.mm |
index da3c0cd8bd4795abdeafc087cb5a8b5af0f71213..1db1db01c8c9dd0b913326d761e7b9d438107c1c 100644 |
--- a/remoting/client/ios/app/remoting_settings_view_controller.mm |
+++ b/remoting/client/ios/app/remoting_settings_view_controller.mm |
@@ -10,6 +10,8 @@ |
#import "ios/third_party/material_components_ios/src/components/AppBar/src/MaterialAppBar.h" |
#import "ios/third_party/material_components_ios/src/components/Buttons/src/MaterialButtons.h" |
+#import "remoting/client/ios/facade/remoting_authentication.h" |
+#import "remoting/client/ios/facade/remoting_service.h" |
#include "base/strings/stringprintf.h" |
#include "google_apis/google_api_keys.h" |
@@ -113,7 +115,7 @@ std::string GetAuthorizationCodeUri() { |
self.styler.cellStyle = MDCCollectionViewCellStyleCard; |
_content = [NSMutableArray array]; |
- [_content addObject:@[ @"Login" ]]; |
+ [_content addObject:@[ @"Login", @"Logout" ]]; |
} |
#pragma mark - UICollectionViewDataSource |
@@ -146,10 +148,17 @@ std::string GetAuthorizationCodeUri() { |
forControlEvents:UIControlEventTouchUpInside]; |
accessCodeButton.translatesAutoresizingMaskIntoConstraints = NO; |
cell.accessoryView = accessCodeButton; |
- } else { |
- UISwitch* editingSwitch = [[UISwitch alloc] initWithFrame:CGRectZero]; |
- cell.accessoryView = editingSwitch; |
+ } else if (indexPath.section == 0 && indexPath.item == 1) { |
+ MDCRaisedButton* logoutButton = [[MDCRaisedButton alloc] init]; |
+ [logoutButton setTitle:@"Logout" forState:UIControlStateNormal]; |
+ [logoutButton sizeToFit]; |
+ [logoutButton addTarget:self |
+ action:@selector(didTapLogout:) |
+ forControlEvents:UIControlEventTouchUpInside]; |
+ logoutButton.translatesAutoresizingMaskIntoConstraints = NO; |
+ cell.accessoryView = logoutButton; |
} |
+ |
return cell; |
} |
@@ -192,4 +201,8 @@ std::string GetAuthorizationCodeUri() { |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:authUri]]; |
} |
+- (void)didTapLogout:(id)sender { |
+ [[RemotingService SharedInstance].authentication logout]; |
+} |
+ |
@end |