Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Unified Diff: remoting/client/ios/app/remoting_settings_view_controller.mm

Issue 2854273002: [CRD iOS] Implementing save to keychain and user defaults for login info. Refactor remoting service. (Closed)
Patch Set: Removing authenticate with refresh token from pub api. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/ios/app/app_delegate.mm ('k') | remoting/client/ios/app/remoting_view_controller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « remoting/client/ios/app/app_delegate.mm ('k') | remoting/client/ios/app/remoting_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698