1// 2// KBInstallStatusAppView.m 3// Keybase 4// 5// Created by Gabriel on 5/10/15. 6// Copyright (c) 2015 Gabriel Handford. All rights reserved. 7// 8 9#import "KBInstallStatusAppView.h" 10 11#import "KBHeaderLabelView.h" 12#import "KBInstaller.h" 13#import "KBApp.h" 14 15@implementation KBInstallStatusAppView 16 17- (void)viewInit { 18 [super viewInit]; 19 [self kb_setBackgroundColor:KBAppearance.currentAppearance.backgroundColor]; 20 GHWeakSelf gself = self; 21 22 KBButton *closeButton = [KBButton buttonWithText:@"Quit" style:KBButtonStyleDefault]; 23 closeButton.targetBlock = ^{ self.onSelect(KBInstallStatusSelectQuit); }; 24 KBButton *skipButton = [KBButton buttonWithText:@"Skip" style:KBButtonStyleDefault]; 25 skipButton.targetBlock = ^{ self.onSelect(KBInstallStatusSelectSkip); }; 26 // KBButton *refreshButton = [KBButton buttonWithText:@"Refresh" style:KBButtonStyleDefault]; 27 // refreshButton.targetBlock = ^{ self.onSelect(KBInstallStatusSelectRefresh); }; 28 KBButton *nextButton = [KBButton buttonWithText:@"Re-Install" style:KBButtonStylePrimary]; 29 nextButton.targetBlock = ^{ self.onSelect(KBInstallStatusSelectReinstall); }; 30 31 [self setButtons:@[closeButton, skipButton, nextButton]]; 32 33 self.onSelect = ^(KBInstallStatusSelect select) { 34 switch (select) { 35 case KBInstallStatusSelectQuit: [gself.window close]; break; // TODO: Only close window? 36 case KBInstallStatusSelectSkip: [gself skip]; break; 37 case KBInstallStatusSelectControlPanel: [gself controlPanel]; break; 38 case KBInstallStatusSelectRefresh: [gself refresh]; break; 39 case KBInstallStatusSelectReinstall: [gself install]; break; 40 } 41 }; 42} 43 44- (void)skip { 45 self.completion(); 46} 47 48- (void)controlPanel { 49 [KBApp.app openControlPanel]; 50} 51 52@end 53