diff --git a/launchers/darwin/nib/ProcessScreen.xib b/launchers/darwin/nib/ProcessScreen.xib index cb65f8ea7e..d16d71e5fa 100644 --- a/launchers/darwin/nib/ProcessScreen.xib +++ b/launchers/darwin/nib/ProcessScreen.xib @@ -60,7 +60,7 @@ - + diff --git a/launchers/darwin/src/CustomUI.h b/launchers/darwin/src/CustomUI.h index a9d93d03c7..a5e27f5c1b 100644 --- a/launchers/darwin/src/CustomUI.h +++ b/launchers/darwin/src/CustomUI.h @@ -25,6 +25,6 @@ extern NSString* hifiBackgroundFilename; @end @interface Hyperlink : NSTextField { - + } @end diff --git a/launchers/darwin/src/CustomUI.m b/launchers/darwin/src/CustomUI.m index 156efe04d5..61f92fe51f 100644 --- a/launchers/darwin/src/CustomUI.m +++ b/launchers/darwin/src/CustomUI.m @@ -24,19 +24,19 @@ NSString* hifiBackgroundFilename = @"hifi_window"; [NSApp sendAction:(NSSelectorFromString(@"paste:")) to:nil from:self]; return TRUE; } - + if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) { [NSApp sendAction:(NSSelectorFromString(@"copy:")) to:nil from:self]; return TRUE; } - + if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) { [NSApp sendAction:(NSSelectorFromString(@"selectAll:")) to:nil from:self]; return TRUE; } } } - + return [super performKeyEquivalent:event]; } @@ -46,7 +46,7 @@ NSString* hifiBackgroundFilename = @"hifi_window"; NSTextView *fieldEditor = (NSTextView*)[self.window fieldEditor:YES forObject:self]; fieldEditor.insertionPointColor = insertionPointColor; - + } -(BOOL)becomeFirstResponder @@ -75,7 +75,7 @@ NSString* hifiBackgroundFilename = @"hifi_window"; NSTextView *fieldEditor = (NSTextView*)[self.window fieldEditor:YES forObject:self]; fieldEditor.insertionPointColor = insertionPointColor; - + } @@ -97,19 +97,19 @@ NSString* hifiBackgroundFilename = @"hifi_window"; [NSApp sendAction:(NSSelectorFromString(@"paste:")) to:nil from:self]; return TRUE; } - + if ([[event charactersIgnoringModifiers] isEqualToString:@"c"]) { [NSApp sendAction:(NSSelectorFromString(@"copy:")) to:nil from:self]; return TRUE; } - + if ([[event charactersIgnoringModifiers] isEqualToString:@"a"]) { [NSApp sendAction:(NSSelectorFromString(@"selectAll:")) to:nil from:self]; return TRUE; } } } - + return [super performKeyEquivalent:event]; } @end @@ -126,7 +126,7 @@ NSString* hifiBackgroundFilename = @"hifi_window"; - (void)awakeFromNib { [super awakeFromNib]; - + self.wantsLayer = YES; self.layer.backgroundColor = [NSColor blackColor].CGColor; self.layer.borderColor = [NSColor whiteColor].CGColor; @@ -134,16 +134,16 @@ NSString* hifiBackgroundFilename = @"hifi_window"; self.layer.masksToBounds = YES; _titleLayer = [[CATextLayer alloc] init]; - + CGSize buttonSize = self.frame.size; CGSize titleSize = [self.title sizeWithAttributes:@{NSFontAttributeName: self.font}]; CGFloat x = (buttonSize.width - titleSize.width) / 2.0; // Title's origin x CGFloat y = (buttonSize.height - titleSize.height) / 2.0; // Title's origin y - + self.titleLayer.frame = NSMakeRect(round(x), round(y), ceil(titleSize.width), ceil(titleSize.height)); self.titleLayer.string = self.title; self.titleLayer.foregroundColor = [NSColor whiteColor].CGColor; - + // TODO(huffman) Fix this to be dynamic based on screen? self.titleLayer.contentsScale = 2.0; @@ -151,7 +151,7 @@ NSString* hifiBackgroundFilename = @"hifi_window"; self.titleLayer.fontSize = self.font.pointSize; //self.titleLayer.allowsEdgeAntialiasing = YES; //self.titleLayer.allowsFontSubpixelQuantization = YES; - + [self.layer addSublayer:self.titleLayer]; } diff --git a/launchers/darwin/src/ErrorViewController.m b/launchers/darwin/src/ErrorViewController.m index 0ae321763f..84dee95678 100644 --- a/launchers/darwin/src/ErrorViewController.m +++ b/launchers/darwin/src/ErrorViewController.m @@ -20,7 +20,7 @@ -(IBAction)resartLauncher:(id)sender { - [[Launcher sharedLauncher] showLoginScreen]; + [[Launcher sharedLauncher] restart]; } @end diff --git a/launchers/darwin/src/LatestBuildRequest.m b/launchers/darwin/src/LatestBuildRequest.m index 6ae8bfeba5..deb6d9795b 100644 --- a/launchers/darwin/src/LatestBuildRequest.m +++ b/launchers/darwin/src/LatestBuildRequest.m @@ -6,7 +6,7 @@ @implementation LatestBuildRequest - (NSInteger) getCurrentVersion { - /*NSInteger currentVersion; + NSInteger currentVersion; @try { NSString* interfaceAppPath = [[Launcher.sharedLauncher getAppPath] stringByAppendingString:@"interface.app"]; NSError * error = nil; @@ -19,8 +19,8 @@ } @catch (NSException *exception) { NSLog(@"an exception was thrown: %@", exception); currentVersion = [Settings.sharedSettings latestBuildVersion]; - }*/ - return [Settings.sharedSettings latestBuildVersion];//currentVersion; + } + return currentVersion; } - (void) requestLatestBuildInfo { @@ -32,13 +32,18 @@ // We're using an ephermeral session here to ensure the tags api response is never cached. NSURLSession * session = [NSURLSession sessionWithConfiguration:NSURLSessionConfiguration.ephemeralSessionConfiguration]; NSURLSessionDataTask* dataTask = [session dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { - - NSLog(@"Latest Build Request error: %@", error); NSLog(@"Latest Build Request Data: %@", data); NSHTTPURLResponse *ne = (NSHTTPURLResponse *)response; NSLog(@"Latest Build Request Response: %ld", [ne statusCode]); Launcher* sharedLauncher = [Launcher sharedLauncher]; + + if ([ne statusCode] == 500) { + dispatch_async(dispatch_get_main_queue(), ^{ + [sharedLauncher displayErrorPage]; + }); + return; + } NSMutableData* webData = [NSMutableData data]; [webData appendData:data]; NSString* jsonString = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[data length] encoding:NSUTF8StringEncoding]; diff --git a/launchers/darwin/src/Launcher.h b/launchers/darwin/src/Launcher.h index d82824b50e..de67850bfe 100644 --- a/launchers/darwin/src/Launcher.h +++ b/launchers/darwin/src/Launcher.h @@ -72,6 +72,7 @@ struct LatestBuildInfo { - (BOOL) loginShouldSetErrorState; - (void) displayErrorPage; - (void) showLoginScreen; +- (void) restart; - (NSString*) getLauncherPath; - (ProcessState) currentProccessState; - (void) setCurrentProcessState:(ProcessState) aProcessState; diff --git a/launchers/darwin/src/Launcher.m b/launchers/darwin/src/Launcher.m index 9658d8641e..4661bd7ad6 100644 --- a/launchers/darwin/src/Launcher.m +++ b/launchers/darwin/src/Launcher.m @@ -89,8 +89,6 @@ static BOOL const DELETE_ZIP_FILES = TRUE; - (void) updateProgressIndicator { - NSProgressIndicator* progressIndicator = [self getProgressView]; - double oldValue = progressIndicator.doubleValue; double contentPercentage = [self.downloadDomainContent getProgressPercentage]; double interfacePercentage = [self.downloadInterface getProgressPercentage]; double currentTotalPercentage = self.progressTarget; @@ -136,16 +134,22 @@ static BOOL const DELETE_ZIP_FILES = TRUE; -(void) setProgressView:(NSProgressIndicator*) aProgressIndicator { - NSLog(@"Setting progressIndicator %@", aProgressIndicator); self.progressIndicator = aProgressIndicator; } -(NSProgressIndicator*) getProgressView { - //NSLog(@"Getting progressIndicator %@", self.progressIndicator); return self.progressIndicator; } +- (void) restart +{ + SplashScreen* splashScreen = [[SplashScreen alloc] initWithNibName:@"SplashScreen" bundle:nil]; + [[[[NSApplication sharedApplication] windows] objectAtIndex:0] setContentViewController: splashScreen]; + + [self checkLoginStatus]; +} + - (void) displayErrorPage { ErrorViewController* errorPage = [[ErrorViewController alloc] initWithNibName:@"ErrorScreen" bundle:nil]; @@ -154,7 +158,7 @@ static BOOL const DELETE_ZIP_FILES = TRUE; - (void) checkLoginStatus { - [NSTimer scheduledTimerWithTimeInterval:2.0 + [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(onSplashScreenTimerFinished:) userInfo:nil diff --git a/launchers/darwin/src/LoginScreen.m b/launchers/darwin/src/LoginScreen.m index 4c83558160..d654a14f1b 100644 --- a/launchers/darwin/src/LoginScreen.m +++ b/launchers/darwin/src/LoginScreen.m @@ -38,25 +38,25 @@ [self.backgroundImage setImage:[NSImage imageNamed:hifiBackgroundFilename]]; [self.smallLogo setImage:[NSImage imageNamed:hifiSmallLogoFilename]]; - + NSMutableAttributedString* usernameString = [[NSMutableAttributedString alloc] initWithString:@"Username"]; - + [usernameString addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(0,8)]; [usernameString addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:18] range:NSMakeRange(0,8)]; - + NSMutableAttributedString* orgName = [[NSMutableAttributedString alloc] initWithString:@"Organization Name"]; [orgName addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(0,17)]; [orgName addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:18] range:NSMakeRange(0,17)]; - + NSMutableAttributedString* passwordString = [[NSMutableAttributedString alloc] initWithString:@"Password"]; - + [passwordString addAttribute:NSForegroundColorAttributeName value:[NSColor grayColor] range:NSMakeRange(0,8)]; [passwordString addAttribute:NSFontAttributeName value:[NSFont systemFontOfSize:18] range:NSMakeRange(0,8)]; - + [self.username setPlaceholderAttributedString:usernameString]; [self.orginization setPlaceholderAttributedString:orgName]; [self.password setPlaceholderAttributedString:passwordString]; - + [self.password setTarget:self]; [self.password setAction:@selector(goToLogin:)]; } diff --git a/launchers/darwin/src/ProcessScreen.m b/launchers/darwin/src/ProcessScreen.m index 68a8ae8c7e..85ec5c8d5b 100644 --- a/launchers/darwin/src/ProcessScreen.m +++ b/launchers/darwin/src/ProcessScreen.m @@ -40,12 +40,10 @@ [self.background setImage: [NSImage imageNamed:hifiBackgroundFilename]]; [self.smallLogo setImage: [NSImage imageNamed:hifiSmallLogoFilename]]; [self.voxelImage setImage: [NSImage imageNamed:hifiVoxelFilename]]; - //[sharedLauncher setProgressIndicator: self.progressView]; - //sharedLauncher.progressIndicator = self.progressView; if (self.progressView != nil) { - NSLog(@"Progress view: %@", self.progressView); [sharedLauncher setProgressView: self.progressView]; } + self.imageRotation = 0; [NSTimer scheduledTimerWithTimeInterval:0.016 target:self