Skip to content

Commit

Permalink
Handle logout button state in better way
Browse files Browse the repository at this point in the history
  • Loading branch information
vineetchoudhary committed Jan 2, 2017
1 parent fd978e3 commit 2652b23
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions AppBox/AppDelegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
+(AppDelegate *)appDelegate;
-(void)addSessionLog:(NSString *)sessionLog;

@property (nonatomic) BOOL processing;
@property (nonatomic, weak) IBOutlet NSMenuItem *gmailLogoutButton;
@property (nonatomic, weak) IBOutlet NSMenuItem *dropboxLogoutButton;

Expand Down
1 change: 1 addition & 0 deletions AppBox/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender{
return YES;
}


#pragma mark - AppDelegate Helper

+(AppDelegate *)appDelegate{
Expand Down
11 changes: 9 additions & 2 deletions AppBox/ViewController/HomeViewController/HomeViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ - (IBAction)textFieldDevMessageValueChanged:(NSTextField *)sender {
//Build Button Action
- (IBAction)actionButtonTapped:(NSButton *)sender {
if (![sender.title.lowercaseString isEqualToString:@"stop"]){
[[textFieldEmail window] makeFirstResponder:self.view];
if (project.fullPath){
[project setIsBuildOnly:NO];
[self runBuildScript];
Expand Down Expand Up @@ -644,6 +645,8 @@ -(void)createManifestShortSharableUrl{
#pragma mark - Controller Helpers -

-(void)viewStateForProgressFinish:(BOOL)finish{
[[AppDelegate appDelegate] setProcessing:!finish];

//reset project
if (finish){
project = [[XCProject alloc] init];
Expand Down Expand Up @@ -703,6 +706,9 @@ -(void)viewStateForProgressFinish:(BOOL)finish{

//action button
[self updateViewState];

//logout buttons
[self updateMenuButtons];
}

-(void)resetBuildOptions{
Expand Down Expand Up @@ -748,8 +754,9 @@ -(void)updateViewState{

-(void)updateMenuButtons{
//Menu Buttons
[[[AppDelegate appDelegate] gmailLogoutButton] setEnabled:([UserData isGmailLoggedIn] && [[DBSession sharedSession] isLinked])];
[[[AppDelegate appDelegate] dropboxLogoutButton] setEnabled:[[DBSession sharedSession] isLinked]];
BOOL enable = ([[DBSession sharedSession] isLinked] && pathProject.enabled && pathIPAFile.enabled);
[[[AppDelegate appDelegate] gmailLogoutButton] setEnabled:([UserData isGmailLoggedIn] && enable)];
[[[AppDelegate appDelegate] dropboxLogoutButton] setEnabled:enable];
}

#pragma mark - MailDelegate -
Expand Down

0 comments on commit 2652b23

Please sign in to comment.