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

Unified Diff: remoting/ios/app/remoting_view_controller.mm

Issue 2966243003: Fixing signed in message and disconnect/reconnect case. (Closed)
Patch Set: Merged. Created 3 years, 5 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/ios/app/pin_entry_view.mm ('k') | remoting/ios/session/remoting_client.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/ios/app/remoting_view_controller.mm
diff --git a/remoting/ios/app/remoting_view_controller.mm b/remoting/ios/app/remoting_view_controller.mm
index 637febc90a084113e10f0fdee78a32743a016c96..ea9666ea87c17952d9aa0f24b948724828298d92 100644
--- a/remoting/ios/app/remoting_view_controller.mm
+++ b/remoting/ios/app/remoting_view_controller.mm
@@ -36,7 +36,8 @@ static CGFloat kHostInset = 5.f;
@interface RemotingViewController ()<HostCollectionViewControllerDelegate,
UIViewControllerAnimatedTransitioning,
UIViewControllerTransitioningDelegate> {
- bool _isAuthenticated;
+ BOOL _isAuthenticated;
+ BOOL _showSignedInAccount;
MDCDialogTransitionController* _dialogTransitionController;
MDCAppBar* _appBar;
HostCollectionViewController* _collectionViewController;
@@ -54,6 +55,7 @@ static CGFloat kHostInset = 5.f;
- (instancetype)init {
_isAuthenticated = NO;
+ _showSignedInAccount = YES;
UICollectionViewFlowLayout* layout =
[[MDCCollectionViewFlowLayout alloc] init];
layout.minimumInteritemSpacing = 0;
@@ -147,19 +149,9 @@ static CGFloat kHostInset = 5.f;
object:nil];
}
-- (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
-
- [self nowAuthenticated:_remotingService.authentication.user.isAuthenticated];
- if (_isAuthenticated) {
- [_remotingService requestHostListFetch];
- }
- [self presentStatus];
-}
-
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
- if (!_isAuthenticated) {
+ if (!_remotingService.authentication.user.isAuthenticated) {
[AppDelegate.instance presentSignInFlow];
MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
message.text = @"Please login.";
@@ -178,22 +170,24 @@ static CGFloat kHostInset = 5.f;
}
- (void)userDidUpdateNotification:(NSNotification*)notification {
- [self nowAuthenticated:_remotingService.authentication.user.isAuthenticated];
+ [[NSOperationQueue mainQueue] addOperationWithBlock:^{
+ [self
+ nowAuthenticated:_remotingService.authentication.user.isAuthenticated];
+ }];
}
#pragma mark - RemotingAuthenticationDelegate
- (void)nowAuthenticated:(BOOL)authenticated {
+ _isAuthenticated = authenticated;
if (authenticated) {
- MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
- message.text = @"Logged In!";
- [MDCSnackbarManager showMessage:message];
+ _showSignedInAccount = YES;
+ [self presentStatus];
} else {
MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
- message.text = @"Not logged in.";
+ message.text = @"Please sign-in.";
[MDCSnackbarManager showMessage:message];
}
- _isAuthenticated = authenticated;
[self refreshContent];
}
@@ -268,7 +262,8 @@ animationControllerForDismissedController:(UIViewController*)dismissed {
- (void)presentStatus {
MDCSnackbarMessage* message = [[MDCSnackbarMessage alloc] init];
- if (_isAuthenticated) {
+ if (_isAuthenticated && _showSignedInAccount) {
+ _showSignedInAccount = NO;
message.text = [NSString
stringWithFormat:@"Currently signed in as %@.",
_remotingService.authentication.user.userEmail];
« no previous file with comments | « remoting/ios/app/pin_entry_view.mm ('k') | remoting/ios/session/remoting_client.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698