From 1e65908e439c66655fd2515becb4d0b11fd601ea Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 8 Aug 2019 16:25:52 -0700 Subject: [PATCH 1/7] Add build tags to Mac launcher --- launchers/darwin/src/LatestBuildRequest.m | 41 +------ launchers/darwin/src/Launcher.h | 11 +- launchers/darwin/src/Launcher.m | 121 ++++++++++++++++----- launchers/darwin/src/OrganizationRequest.m | 6 + launchers/darwin/src/Settings.h | 3 + launchers/darwin/src/Settings.m | 21 +++- 6 files changed, 132 insertions(+), 71 deletions(-) diff --git a/launchers/darwin/src/LatestBuildRequest.m b/launchers/darwin/src/LatestBuildRequest.m index a663200089..bd59341644 100644 --- a/launchers/darwin/src/LatestBuildRequest.m +++ b/launchers/darwin/src/LatestBuildRequest.m @@ -1,28 +1,9 @@ #import "LatestBuildRequest.h" #import "Launcher.h" #import "Settings.h" -#import "Interface.h" @implementation LatestBuildRequest -- (NSInteger) getCurrentVersion { - NSInteger currentVersion; - @try { - NSString* interfaceAppPath = [[Launcher.sharedLauncher getAppPath] stringByAppendingString:@"interface.app"]; - NSError* error = nil; - Interface* interface = [[Interface alloc] initWith:interfaceAppPath]; - currentVersion = [interface getVersion:&error]; - if (currentVersion == 0 && error != nil) { - NSLog(@"can't get version from interface, falling back to settings: %@", error); - currentVersion = [Settings.sharedSettings latestBuildVersion]; - } - } @catch (NSException *exception) { - NSLog(@"an exception was thrown: %@", exception); - currentVersion = [Settings.sharedSettings latestBuildVersion]; - } - return currentVersion; -} - - (void) requestLatestBuildInfo { NSMutableURLRequest* request = [NSMutableURLRequest new]; [request setURL:[NSURL URLWithString:@"https://thunder.highfidelity.com/builds/api/tags/latest?format=json"]]; @@ -59,36 +40,26 @@ NSFileManager* fileManager = [NSFileManager defaultManager]; NSArray* values = [json valueForKey:@"results"]; NSDictionary* launcherValues = [json valueForKey:@"launcher"]; - NSDictionary* value = [values objectAtIndex:0]; + + NSString* defaultBuildTag = [json valueForKey:@"default_tag"]; NSString* launcherVersion = [launcherValues valueForKey:@"version"]; NSString* launcherUrl = [[launcherValues valueForKey:@"mac"] valueForKey:@"url"]; - NSString* buildNumber = [value valueForKey:@"latest_version"]; - NSDictionary* installers = [value objectForKey:@"installers"]; - NSDictionary* macInstallerObject = [installers objectForKey:@"mac"]; - NSString* macInstallerUrl = [macInstallerObject valueForKey:@"zip_url"]; BOOL appDirectoryExist = [fileManager fileExistsAtPath:[[sharedLauncher getAppPath] stringByAppendingString:@"interface.app"]]; dispatch_async(dispatch_get_main_queue(), ^{ - - NSInteger currentVersion = [self getCurrentVersion]; NSInteger currentLauncherVersion = atoi(LAUNCHER_BUILD_VERSION); NSLog(@"Latest Build Request -> current launcher version %ld", currentLauncherVersion); NSLog(@"Latest Build Request -> latest launcher version %ld", launcherVersion.integerValue); NSLog(@"Latest Build Request -> launcher url %@", launcherUrl); NSLog(@"Latest Build Request -> does build directory exist: %@", appDirectoryExist ? @"TRUE" : @"FALSE"); - NSLog(@"Latest Build Request -> current version: %ld", currentVersion); - NSLog(@"Latest Build Request -> latest version: %ld", buildNumber.integerValue); - NSLog(@"Latest Build Request -> mac url: %@", macInstallerUrl); - BOOL latestVersionAvailable = (currentVersion != buildNumber.integerValue); BOOL latestLauncherVersionAvailable = (currentLauncherVersion != launcherVersion.integerValue); - [[Settings sharedSettings] buildVersion:buildNumber.integerValue]; - BOOL shouldDownloadInterface = (latestVersionAvailable || !appDirectoryExist); - NSLog(@"Latest Build Request -> SHOULD DOWNLOAD: %@", shouldDownloadInterface ? @"TRUE" : @"FALSE"); - [sharedLauncher shouldDownloadLatestBuild:shouldDownloadInterface :macInstallerUrl - :latestLauncherVersionAvailable :launcherUrl]; + [sharedLauncher shouldDownloadLatestBuild:values + :defaultBuildTag + :latestLauncherVersionAvailable + :launcherUrl]; }); }]; diff --git a/launchers/darwin/src/Launcher.h b/launchers/darwin/src/Launcher.h index d20f58dee7..b6f89fac49 100644 --- a/launchers/darwin/src/Launcher.h +++ b/launchers/darwin/src/Launcher.h @@ -55,6 +55,8 @@ struct LatestBuildInfo { @property (nonatomic) BOOL waitingForInterfaceToTerminate; @property (nonatomic) BOOL shouldDownloadInterface; @property (nonatomic) BOOL latestBuildRequestFinished; +@property (nonatomic, assign) NSArray* latestBuilds; +@property (nonatomic, assign) NSString* defaultBuildTag; @property (nonatomic, assign) NSTimer* updateProgressIndicatorTimer; @property (nonatomic, assign, readwrite) ProcessState processState; @property (nonatomic, assign, readwrite) LoginError loginError; @@ -70,6 +72,7 @@ struct LatestBuildInfo { - (void) domainContentDownloadFinished; - (void) domainScriptsDownloadFinished; - (void) setDomainURLInfo:(NSString*) aDomainURL :(NSString*) aDomainContentUrl :(NSString*) aDomainScriptsUrl; +- (void) setOrganizationBuildTag:(NSString*) organizationBuildTag; - (void) organizationRequestFinished:(BOOL) aOriginzationAccepted; - (BOOL) loginShouldSetErrorState; - (void) displayErrorPage; @@ -81,7 +84,9 @@ struct LatestBuildInfo { - (void) setCurrentProcessState:(ProcessState) aProcessState; - (void) setLoginErrorState:(LoginError) aLoginError; - (LoginError) getLoginErrorState; -- (void) shouldDownloadLatestBuild:(BOOL) shouldDownload :(NSString*) downloadUrl :(BOOL) newLauncherAvailable :(NSString*) launcherUrl; +- (void) updateLatestBuildInfo; +- (void) shouldDownloadLatestBuild:(NSArray*) latestBuilds :(NSString*) defaultBuildTag :(BOOL) newLauncherAvailable :(NSString*) launcherUrl; +- (void) tryDownloadLatestBuild:(BOOL)progressScreenAlreadyDisplayed; - (void) interfaceFinishedDownloading; - (NSString*) getDownloadPathForContentAndScripts; - (void) launchInterface; @@ -97,11 +102,9 @@ struct LatestBuildInfo { - (NSString*) getDownloadFilename; - (void) startUpdateProgressIndicatorTimer; - (void) endUpdateProgressIndicatorTimer; -- (BOOL) isLoadedIn; +- (BOOL) isLoggedIn; - (NSString*) getAppPath; - (void) updateProgressIndicator; -- (void) setLatestBuildInfo:(struct LatestBuildInfo) latestBuildInfo; -- (struct LatestBuildInfo) getLatestBuildInfo; + (id) sharedLauncher; @end diff --git a/launchers/darwin/src/Launcher.m b/launchers/darwin/src/Launcher.m index 8fb501db55..111359370e 100644 --- a/launchers/darwin/src/Launcher.m +++ b/launchers/darwin/src/Launcher.m @@ -8,6 +8,7 @@ #import "ErrorViewController.h" #import "Settings.h" #import "NSTask+NSTaskExecveAdditions.h" +#import "Interface.h" @interface Launcher () @@ -241,7 +242,7 @@ static BOOL const DELETE_ZIP_FILES = TRUE; return self.waitingForInterfaceToTerminate; } -- (BOOL) isLoadedIn +- (BOOL) isLoggedIn { return [[Settings sharedSettings] isLoggedIn]; } @@ -255,6 +256,11 @@ static BOOL const DELETE_ZIP_FILES = TRUE; [[Settings sharedSettings] setDomainUrl:aDomainURL]; } +- (void) setOrganizationBuildTag:(NSString*) organizationBuildTag; +{ + [[Settings sharedSettings] setOrganizationBuildTag:organizationBuildTag]; +} + - (NSString*) getAppPath { return [self getDownloadPathForContentAndScripts]; @@ -275,13 +281,27 @@ static BOOL const DELETE_ZIP_FILES = TRUE; self.displayName = aDiplayName; } +- (NSInteger) getCurrentVersion { + NSInteger currentVersion; + @try { + NSString* interfaceAppPath = [[self getAppPath] stringByAppendingString:@"interface.app"]; + NSError* error = nil; + Interface* interface = [[Interface alloc] initWith:interfaceAppPath]; + currentVersion = [interface getVersion:&error]; + if (currentVersion == 0 && error != nil) { + NSLog(@"can't get version from interface, falling back to settings: %@", error); + currentVersion = [Settings.sharedSettings latestBuildVersion]; + } + } @catch (NSException *exception) { + NSLog(@"an exception was thrown: %@", exception); + currentVersion = [Settings.sharedSettings latestBuildVersion]; + } + return currentVersion; +} + - (void) domainContentDownloadFinished { - if (self.shouldDownloadInterface) { - [self.downloadInterface downloadInterface: self.interfaceDownloadUrl]; - return; - } - [self interfaceFinishedDownloading]; + [self tryDownloadLatestBuild:TRUE]; } - (void) domainScriptsDownloadFinished @@ -337,6 +357,7 @@ static BOOL const DELETE_ZIP_FILES = TRUE; { self.credentialsAccepted = aOriginzationAccepted; if (aOriginzationAccepted) { + [self updateLatestBuildInfo]; [self.credentialsRequest confirmCredentials:self.username : self.password]; } else { LoginScreen* loginScreen = [[LoginScreen alloc] initWithNibName:@"LoginScreen" bundle:nil]; @@ -349,42 +370,26 @@ static BOOL const DELETE_ZIP_FILES = TRUE; return YES; } -- (struct LatestBuildInfo) getLatestBuildInfo -{ - return self.buildInfo; -} - -- (void) setLatestBuildInfo:(struct LatestBuildInfo) latestBuildInfo -{ - self.buildInfo = latestBuildInfo; -} - -(void) showLoginScreen { LoginScreen* loginScreen = [[LoginScreen alloc] initWithNibName:@"LoginScreen" bundle:nil]; [[[[NSApplication sharedApplication] windows] objectAtIndex:0] setContentViewController: loginScreen]; } -- (void) shouldDownloadLatestBuild:(BOOL) shouldDownload :(NSString*) downloadUrl :(BOOL) newLauncherAvailable :(NSString*) launcherUrl +- (void) shouldDownloadLatestBuild:(NSArray*) latestBuilds :(NSString*) defaultBuildTag :(BOOL) newLauncherAvailable :(NSString*) launcherUrl { + self.latestBuilds = [[NSArray alloc] initWithArray:latestBuilds copyItems:true]; + self.defaultBuildTag = defaultBuildTag; + + [self updateLatestBuildInfo]; + NSDictionary* launcherArguments = [LauncherCommandlineArgs arguments]; if (newLauncherAvailable && ![launcherArguments valueForKey: @"--noUpdate"]) { [self.downloadLauncher downloadLauncher: launcherUrl]; } else { - self.shouldDownloadInterface = shouldDownload; - self.interfaceDownloadUrl = downloadUrl; self.latestBuildRequestFinished = TRUE; - if ([self isLoadedIn]) { - Launcher* sharedLauncher = [Launcher sharedLauncher]; - [sharedLauncher setCurrentProcessState:CHECKING_UPDATE]; - if (shouldDownload) { - ProcessScreen* processScreen = [[ProcessScreen alloc] initWithNibName:@"ProcessScreen" bundle:nil]; - [[[[NSApplication sharedApplication] windows] objectAtIndex:0] setContentViewController: processScreen]; - [self startUpdateProgressIndicatorTimer]; - [self.downloadInterface downloadInterface: downloadUrl]; - return; - } - [self interfaceFinishedDownloading]; + if ([self isLoggedIn]) { + [self tryDownloadLatestBuild:FALSE]; } else { [[NSApplication sharedApplication] activateIgnoringOtherApps:TRUE]; [self showLoginScreen]; @@ -392,6 +397,62 @@ static BOOL const DELETE_ZIP_FILES = TRUE; } } +// The latest builds are always retrieved on application start because they contain not only +// the latest interface builds, but also the latest launcher builds, which are required to know if +// we need to self-update first. The interface builds are categorized by build tag, and we may +// not know at application start which build tag we should be using. There are 2 scenarios where +// we call this function to determine our build tag and the correct build: +// +// 1. If we are logged in, we will have our build tag and can immediately get the correct build +// after receiving the builds. +// 2. If we are not logged in, we need to wait until we have logged in and received the org +// metadata for the user. The latest build info also needs to be updated _before_ downloading +// the content set cache because the progress bar value depends on it. +// +- (void) updateLatestBuildInfo { + NSLog(@"Updating latest build info"); + + NSInteger currentVersion = [self getCurrentVersion]; + Launcher* sharedLauncher = [Launcher sharedLauncher]; + [sharedLauncher setCurrentProcessState:CHECKING_UPDATE]; + BOOL newVersionAvailable = false; + NSString* url = @""; + NSString* buildTag = [[Settings sharedSettings] organizationBuildTag]; + if ([buildTag length] == 0) { + buildTag = self.defaultBuildTag; + } + + for (NSDictionary* build in self.latestBuilds) { + NSString* name = [build valueForKey:@"name"]; + if ([name isEqual:buildTag]) { + url = [[[build objectForKey:@"installers"] objectForKey:@"mac"] valueForKey:@"zip_url"]; + NSString* latestVersion = [build valueForKey:@"latest_version"]; + newVersionAvailable = currentVersion != latestVersion.integerValue; + break; + } + } + + self.shouldDownloadInterface = newVersionAvailable; + self.interfaceDownloadUrl = url; + + NSLog(@"Updating latest build info %@ %@", (self.shouldDownloadInterface ? @"Yes" : @"No"), self.interfaceDownloadUrl); +} + +- (void) tryDownloadLatestBuild:(BOOL)progressScreenAlreadyDisplayed +{ + if (self.shouldDownloadInterface) { + if (!progressScreenAlreadyDisplayed) { + ProcessScreen* processScreen = [[ProcessScreen alloc] initWithNibName:@"ProcessScreen" bundle:nil]; + [[[[NSApplication sharedApplication] windows] objectAtIndex:0] setContentViewController: processScreen]; + [self startUpdateProgressIndicatorTimer]; + } + [self.downloadInterface downloadInterface: self.interfaceDownloadUrl]; + return; + } + + [self interfaceFinishedDownloading]; +} + -(void)runAutoupdater { NSTask* task = [[NSTask alloc] init]; diff --git a/launchers/darwin/src/OrganizationRequest.m b/launchers/darwin/src/OrganizationRequest.m index 1aaed2ce51..d8db0d19c3 100644 --- a/launchers/darwin/src/OrganizationRequest.m +++ b/launchers/darwin/src/OrganizationRequest.m @@ -2,6 +2,7 @@ #include #include #import "Launcher.h" +#import "Settings.h" static NSString* const organizationURL = @"https://orgs.highfidelity.com/organizations/"; @@ -75,11 +76,16 @@ static NSString* const organizationURL = @"https://orgs.highfidelity.com/organiz } NSString* domainURL = [json valueForKey:@"domain"]; NSString* contentSetURL = [json valueForKey:@"content_set_url"]; + NSString* buildTag = [json valueForKey:@"build_tag"]; + if (buildTag == nil) { + buildTag = @""; + } if (domainURL != nil && contentSetURL != nil) { NSLog(@"Organization: getting org file successful"); [sharedLauncher setDomainURLInfo:[json valueForKey:@"domain"] :[json valueForKey:@"content_set_url"] :nil]; [sharedLauncher setLoginErrorState: NONE]; + [[Settings sharedSettings] setOrganizationBuildTag:buildTag]; [sharedLauncher organizationRequestFinished:TRUE]; } else { NSLog(@"Organization: Either domainURL: %@ or contentSetURL: %@ json entries are invalid", domainURL, contentSetURL); diff --git a/launchers/darwin/src/Settings.h b/launchers/darwin/src/Settings.h index 6a036ca1b1..57225f6f52 100644 --- a/launchers/darwin/src/Settings.h +++ b/launchers/darwin/src/Settings.h @@ -7,6 +7,7 @@ @property (nonatomic, assign) BOOL loggedIn; @property (nonatomic, assign) NSString* domain; @property (nonatomic, assign) NSString* launcher; +@property (nonatomic, assign) NSString* _organizationBuildTag; - (NSInteger) latestBuildVersion; - (BOOL) isLoggedIn; - (void) login:(BOOL)aLoggedIn; @@ -15,6 +16,8 @@ - (NSString*) getLaucnherPath; - (void) setDomainUrl:(NSString*) aDomainUrl; - (NSString*) getDomainUrl; +- (void) setOrganizationBuildTag:(NSString*) aOrganizationBuildTag; +- (NSString*) organizationBuildTag; - (void) save; + (id) sharedSettings; @end diff --git a/launchers/darwin/src/Settings.m b/launchers/darwin/src/Settings.m index 407f869af9..cb9abe18b8 100644 --- a/launchers/darwin/src/Settings.m +++ b/launchers/darwin/src/Settings.m @@ -32,13 +32,18 @@ NSError * err; NSData *data =[jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSDictionary * json; - if(data!=nil){ + if (data != nil) { json = (NSDictionary *)[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:&err]; self.loggedIn = [[json valueForKey:@"loggedIn"] boolValue]; self.build = [[json valueForKey:@"build_version"] integerValue]; self.launcher = [json valueForKey:@"luancherPath"]; self.domain = [json valueForKey:@"domain"]; + self.organizationBuildTag = [json valueForKey:@"organizationBuildTag"]; + if ([self.organizationBuildTag length] == 0) { + self.organizationBuildTag = @""; + } + return; } } @@ -53,7 +58,9 @@ [NSString stringWithFormat:@"%ld", self.build], @"build_version", self.loggedIn ? @"TRUE" : @"FALSE", @"loggedIn", self.domain, @"domain", - self.launcher, @"launcherPath", nil]; + self.launcher, @"launcherPath", + self.organizationBuildTag, @"organizationBuildTag", + nil]; NSError * err; NSData * jsonData = [NSJSONSerialization dataWithJSONObject:json options:0 error:&err]; NSString * jsonString = [[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]; @@ -114,6 +121,16 @@ return self.domain; } +- (void) setOrganizationBuildTag:(NSString*) aOrganizationBuildTag +{ + self._organizationBuildTag = aOrganizationBuildTag; +} + +- (NSString*) organizationBuildTag +{ + return self._organizationBuildTag; +} + - (NSString*) getLaucnherPath { return self.launcher; From 322ba3ad557b4802f84ba3b4d669d7447325e568 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 15 Aug 2019 16:19:23 -0700 Subject: [PATCH 2/7] Add env variable to adjust builds URL in mac launcher --- launchers/darwin/src/LatestBuildRequest.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/launchers/darwin/src/LatestBuildRequest.m b/launchers/darwin/src/LatestBuildRequest.m index bd59341644..4d858d8be6 100644 --- a/launchers/darwin/src/LatestBuildRequest.m +++ b/launchers/darwin/src/LatestBuildRequest.m @@ -5,8 +5,16 @@ @implementation LatestBuildRequest - (void) requestLatestBuildInfo { + NSString* buildsURL = [[[NSProcessInfo processInfo] environment] objectForKey:@"HQ_LAUNCHER_BUILDS_URL"]; + + if ([buildsURL length] == 0) { + buildsURL = @"https://thunder.highfidelity.com/builds/api/tags/latest?format=json"; + } + + NSLog(@"Making request for builds to: %@", buildsURL); + NSMutableURLRequest* request = [NSMutableURLRequest new]; - [request setURL:[NSURL URLWithString:@"https://thunder.highfidelity.com/builds/api/tags/latest?format=json"]]; + [request setURL:[NSURL URLWithString:buildsURL]]; [request setHTTPMethod:@"GET"]; [request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; From 8642f2aaf83486a4d95e6ba12b83c9746de3db56 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 15 Aug 2019 16:20:18 -0700 Subject: [PATCH 3/7] Fix mac launcher not handling networking failures when requesting builds --- launchers/darwin/src/LatestBuildRequest.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launchers/darwin/src/LatestBuildRequest.m b/launchers/darwin/src/LatestBuildRequest.m index 4d858d8be6..6fde16689c 100644 --- a/launchers/darwin/src/LatestBuildRequest.m +++ b/launchers/darwin/src/LatestBuildRequest.m @@ -27,7 +27,7 @@ NSLog(@"Latest Build Request Response: %ld", [ne statusCode]); Launcher* sharedLauncher = [Launcher sharedLauncher]; - if ([ne statusCode] == 500) { + if (error || [ne statusCode] == 500) { dispatch_async(dispatch_get_main_queue(), ^{ [sharedLauncher displayErrorPage]; }); From 5ae6a323aceb6d6f6e9b216ca137e0a398112edc Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 19 Aug 2019 09:58:22 -0700 Subject: [PATCH 4/7] Cleanup macos launcher download spam --- launchers/darwin/src/DownloadInterface.m | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/launchers/darwin/src/DownloadInterface.m b/launchers/darwin/src/DownloadInterface.m index f0bdb645da..234d807d9f 100644 --- a/launchers/darwin/src/DownloadInterface.m +++ b/launchers/darwin/src/DownloadInterface.m @@ -21,7 +21,10 @@ -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite { CGFloat prog = (float)totalBytesWritten/totalBytesExpectedToWrite; - NSLog(@"interface downloaded %d%%", (int)(100.0*prog)); + + if ((int)(100.0 * prog) != (int)self.progressPercentage) { + NSLog(@"interface downloaded %d%%", (int)(100.0*prog)); + } self.progressPercentage = (100.0 * prog); [[Launcher sharedLauncher] updateProgressIndicator]; From 5916fb42ac0cd3161dd50d2224c2464fd5585a15 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 19 Aug 2019 09:59:16 -0700 Subject: [PATCH 5/7] Fix mac launcher not correctly reading interface version The logic to convert the interface output assumed that the output would be null terminated, but it was not. --- launchers/darwin/src/Interface.m | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/launchers/darwin/src/Interface.m b/launchers/darwin/src/Interface.m index d02b66b581..8dc5d00806 100644 --- a/launchers/darwin/src/Interface.m +++ b/launchers/darwin/src/Interface.m @@ -33,10 +33,11 @@ return 0; } - NSFileHandle * fh = [standardOut fileHandleForReading]; - NSData * data = [fh readDataToEndOfFile]; - NSString * output = [NSString stringWithUTF8String:[data bytes]]; - if (output == nil) { + NSFileHandle* fh = [standardOut fileHandleForReading]; + NSData* data = [fh readDataToEndOfFile]; + + NSString* output = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; + if (output == nil || [output length] == 0) { NSDictionary * userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(@"Couldn't start interface", nil) }; From 73c120b15464b800ee49d1cf0f7deca63b1e6950 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Mon, 19 Aug 2019 10:00:29 -0700 Subject: [PATCH 6/7] Add mac launcher logging around latest build --- launchers/darwin/src/Launcher.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/launchers/darwin/src/Launcher.m b/launchers/darwin/src/Launcher.m index 111359370e..f88005f733 100644 --- a/launchers/darwin/src/Launcher.m +++ b/launchers/darwin/src/Launcher.m @@ -413,6 +413,7 @@ static BOOL const DELETE_ZIP_FILES = TRUE; NSLog(@"Updating latest build info"); NSInteger currentVersion = [self getCurrentVersion]; + NSInteger latestVersion = 0; Launcher* sharedLauncher = [Launcher sharedLauncher]; [sharedLauncher setCurrentProcessState:CHECKING_UPDATE]; BOOL newVersionAvailable = false; @@ -424,10 +425,13 @@ static BOOL const DELETE_ZIP_FILES = TRUE; for (NSDictionary* build in self.latestBuilds) { NSString* name = [build valueForKey:@"name"]; + NSLog(@"Checking %@", name); if ([name isEqual:buildTag]) { url = [[[build objectForKey:@"installers"] objectForKey:@"mac"] valueForKey:@"zip_url"]; - NSString* latestVersion = [build valueForKey:@"latest_version"]; - newVersionAvailable = currentVersion != latestVersion.integerValue; + NSString* thisLatestVersion = [build valueForKey:@"latest_version"]; + latestVersion = thisLatestVersion.integerValue; + newVersionAvailable = currentVersion != latestVersion; + NSLog(@"Using %@, %ld", name, latestVersion); break; } } @@ -435,7 +439,8 @@ static BOOL const DELETE_ZIP_FILES = TRUE; self.shouldDownloadInterface = newVersionAvailable; self.interfaceDownloadUrl = url; - NSLog(@"Updating latest build info %@ %@", (self.shouldDownloadInterface ? @"Yes" : @"No"), self.interfaceDownloadUrl); + NSLog(@"Updating latest build info, currentVersion=%ld, latestVersion=%ld, %@ %@", + currentVersion, latestVersion, (self.shouldDownloadInterface ? @"Yes" : @"No"), self.interfaceDownloadUrl); } - (void) tryDownloadLatestBuild:(BOOL)progressScreenAlreadyDisplayed From 1eaba67f67adb009d8e78d54c0cdd55ebde53590 Mon Sep 17 00:00:00 2001 From: Ryan Huffman Date: Thu, 22 Aug 2019 15:07:12 -0700 Subject: [PATCH 7/7] Remove use of build version in mac launcher settings --- launchers/darwin/src/Launcher.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/launchers/darwin/src/Launcher.m b/launchers/darwin/src/Launcher.m index f88005f733..9a70ddf0e7 100644 --- a/launchers/darwin/src/Launcher.m +++ b/launchers/darwin/src/Launcher.m @@ -289,12 +289,11 @@ static BOOL const DELETE_ZIP_FILES = TRUE; Interface* interface = [[Interface alloc] initWith:interfaceAppPath]; currentVersion = [interface getVersion:&error]; if (currentVersion == 0 && error != nil) { - NSLog(@"can't get version from interface, falling back to settings: %@", error); - currentVersion = [Settings.sharedSettings latestBuildVersion]; + NSLog(@"can't get version from interface: %@", error); } } @catch (NSException *exception) { - NSLog(@"an exception was thrown: %@", exception); - currentVersion = [Settings.sharedSettings latestBuildVersion]; + NSLog(@"an exception was thrown while getting current interface version: %@", exception); + currentVersion = 0; } return currentVersion; }