mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-07 12:12:39 +02:00
extra logging
This commit is contained in:
parent
12357e5ced
commit
c0250275a1
2 changed files with 21 additions and 5 deletions
|
@ -1,7 +1,8 @@
|
|||
#import "LatestBuildRequest.h"
|
||||
#import "Launcher.h"
|
||||
#import "Settings.h"
|
||||
|
||||
// https://thunder.highfidelity.com/builds/api/tags/latest?format=json
|
||||
// https://httpbin.org/status/500
|
||||
@implementation LatestBuildRequest
|
||||
|
||||
- (void) requestLatestBuildInfo {
|
||||
|
@ -14,16 +15,26 @@
|
|||
NSURLSession* session = [NSURLSession sharedSession];
|
||||
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];
|
||||
NSLog(@"credentials request finished");
|
||||
NSMutableData* webData = [NSMutableData data];
|
||||
[webData appendData:data];
|
||||
NSString* jsonString = [[NSString alloc] initWithBytes: [webData mutableBytes] length:[data length] encoding:NSUTF8StringEncoding];
|
||||
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
NSLog(@"Latest Build Request -> json string: %@", jsonString);
|
||||
NSError *jsonError = nil;
|
||||
id json = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError];
|
||||
|
||||
if (jsonError) {
|
||||
NSLog(@"Latest Build request: Failed to convert Json to data");
|
||||
}
|
||||
|
||||
NSFileManager* fileManager = [NSFileManager defaultManager];
|
||||
NSArray *values = [json valueForKey:@"results"];
|
||||
NSArray *values = [json valueForKey:@"results"];
|
||||
NSDictionary *value = [values objectAtIndex:0];
|
||||
|
||||
|
||||
|
@ -37,10 +48,15 @@
|
|||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
Settings* settings = [Settings sharedSettings];
|
||||
NSInteger currentVersion = [settings latestBuildVersion];
|
||||
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);
|
||||
[[Settings sharedSettings] buildVersion:buildNumber.integerValue];
|
||||
|
||||
BOOL shouldDownloadInterface = (latestVersionAvailable || !appDirectoryExist);
|
||||
NSLog(@"Latest Build Request -> SHOULD DOWNLOAD: %@", shouldDownloadInterface ? @"TRUE" : @"FALSE");
|
||||
[sharedLauncher shouldDownloadLatestBuild:shouldDownloadInterface :macInstallerUrl];
|
||||
});
|
||||
}];
|
||||
|
|
|
@ -17,7 +17,7 @@ void redirectLogToDocuments()
|
|||
|
||||
int main(int argc, const char* argv[]) {
|
||||
//NSApp.appearance = [NSAppearance appearanceNamed: NSAppearanceNameAqua];
|
||||
redirectLogToDocuments();
|
||||
//redirectLogToDocuments();
|
||||
NSArray* apps = [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.highfidelity.launcher"];
|
||||
if ([apps count] > 1) {
|
||||
NSLog(@"launcher is already running");
|
||||
|
|
Loading…
Reference in a new issue