mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-05-30 19:01:43 +02:00
removing warnings
This commit is contained in:
parent
b5dd099093
commit
581c5fe554
5 changed files with 68 additions and 130 deletions
|
@ -1,6 +1,6 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface DownloadDomainContent : NSObject<NSURLDownloadDelegate> {
|
@interface DownloadDomainContent : NSObject<NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLDownloadDelegate> {
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) downloadDomainContent:(NSString*) domainContentUrl;
|
- (void) downloadDomainContent:(NSString*) domainContentUrl;
|
||||||
|
|
|
@ -6,79 +6,55 @@
|
||||||
- (void) downloadDomainContent:(NSString *)domainContentUrl
|
- (void) downloadDomainContent:(NSString *)domainContentUrl
|
||||||
{
|
{
|
||||||
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:domainContentUrl]
|
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:domainContentUrl]
|
||||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||||
timeoutInterval:60.0];
|
timeoutInterval:60.0];
|
||||||
NSURLDownload* theDownload = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
|
||||||
|
|
||||||
/*NSURLSession *session = [NSURLSession sharedSession];
|
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||||
NSURLSessionDownloadTask *downloadTask = [session downloadTaskWithRequest:request
|
NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];
|
||||||
completionHandler:
|
NSURLSessionDownloadTask *downloadTask = [defaultSession downloadTaskWithRequest:request];
|
||||||
^(NSURL *location, NSURLResponse *response,NSError *error) {
|
[downloadTask resume];
|
||||||
NSString* finalFilePath = [[[Launcher sharedLauncher] getDownloadPathForContentAndScripts] stringByAppendingPathComponent:[response suggestedFilename]];
|
}
|
||||||
[[NSFileManager defaultManager] moveItemAtURL:location
|
|
||||||
toURL:[NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
|
||||||
error:nil];
|
CGFloat prog = (float)totalBytesWritten/totalBytesExpectedToWrite;
|
||||||
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
NSLog(@"domain content downloaded %d%%", (int)(100.0*prog));
|
||||||
[sharedLauncher setDownloadContextFilename:[response suggestedFilename]];
|
|
||||||
NSLog(@"extracting domain content file");
|
|
||||||
[sharedLauncher extractZipFileAtDestination:[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:@"content"] :[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:[sharedLauncher getDownloadContentFilename]]];
|
|
||||||
|
|
||||||
NSLog(@"finished extracting content file");
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[sharedLauncher domainContentDownloadFinished];
|
|
||||||
});
|
|
||||||
|
|
||||||
}];*/
|
}
|
||||||
|
|
||||||
//[downloadTask resume];
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didResumeAtOffset:(int64_t)fileOffset expectedTotalBytes:(int64_t)expectedTotalBytes {
|
||||||
|
// unused in this example
|
||||||
if (!theDownload) {
|
}
|
||||||
NSLog(@"Download Failed");
|
|
||||||
[[Launcher sharedLauncher] displayErrorPage];
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {
|
||||||
|
NSLog(@"Did finish downloading to url");
|
||||||
|
NSError *error;
|
||||||
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
|
NSString *destinationFileName = downloadTask.originalRequest.URL.lastPathComponent;
|
||||||
|
NSString* finalFilePath = [[[Launcher sharedLauncher] getDownloadPathForContentAndScripts] stringByAppendingPathComponent:destinationFileName];
|
||||||
|
NSURL *destinationURL = [NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
|
||||||
|
if([fileManager fileExistsAtPath:[destinationURL path]])
|
||||||
|
{
|
||||||
|
[fileManager removeItemAtURL:destinationURL error:nil];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
|
|
||||||
NSLog(@"download domain content: data received");
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
|
|
||||||
NSHTTPURLResponse *ne = (NSHTTPURLResponse *)response;
|
|
||||||
if([ne statusCode] == 200) {
|
|
||||||
NSLog(@"connection state is 200 - all okay");
|
|
||||||
} else {
|
|
||||||
NSLog(@"connection state is NOT 200");
|
|
||||||
[[Launcher sharedLauncher] displayErrorPage];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
|
|
||||||
NSLog(@"download domain content - Conn Err: %@", [error localizedDescription]);
|
|
||||||
[[Launcher sharedLauncher] displayErrorPage];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
|
|
||||||
{
|
|
||||||
NSString* finalFilePath = [[[Launcher sharedLauncher] getDownloadPathForContentAndScripts] stringByAppendingPathComponent:filename];
|
|
||||||
[download setDestination:finalFilePath allowOverwrite:YES];
|
|
||||||
|
|
||||||
[[Launcher sharedLauncher] setDownloadContextFilename:filename];
|
NSLog(@"%@", location.path);
|
||||||
}
|
NSLog(@"%@", destinationURL);
|
||||||
|
BOOL success = [fileManager moveItemAtURL:location toURL:destinationURL error:&error];
|
||||||
- (void)downloadDidFinish:(NSURLDownload*)download
|
|
||||||
{
|
|
||||||
|
NSLog(success ? @"TRUE" : @"FALSE");
|
||||||
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
||||||
|
[sharedLauncher setDownloadContextFilename:destinationFileName];
|
||||||
NSLog(@"extracting domain content file");
|
NSLog(@"extracting domain content file");
|
||||||
[sharedLauncher extractZipFileAtDestination:[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:@"content"] :[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:[sharedLauncher getDownloadContentFilename]]];
|
[sharedLauncher extractZipFileAtDestination:[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:@"content"] :[[sharedLauncher getDownloadPathForContentAndScripts] stringByAppendingString:[sharedLauncher getDownloadContentFilename]]];
|
||||||
|
|
||||||
NSLog(@"finished extracting content file");
|
NSLog(@"finished extracting content file");
|
||||||
|
|
||||||
[sharedLauncher domainContentDownloadFinished];
|
[sharedLauncher domainContentDownloadFinished];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)download:(NSURLDownload*)download didReceiveResponse:(NSURLResponse*)response
|
-(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
|
||||||
{
|
NSLog(@"completed; error: %@", error);
|
||||||
NSLog(@"Download content set response");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
@interface DownloadInterface : NSObject <NSURLDownloadDelegate> {
|
@interface DownloadInterface : NSObject<NSURLSessionDataDelegate, NSURLSessionDelegate, NSURLSessionTaskDelegate, NSURLDownloadDelegate> {
|
||||||
}
|
}
|
||||||
@property (nonatomic, assign) NSString* finalFilePath;
|
@property (nonatomic, assign) NSString* finalFilePath;
|
||||||
|
|
||||||
|
|
|
@ -7,78 +7,39 @@
|
||||||
- (void) downloadInterface:(NSString*) downloadUrl
|
- (void) downloadInterface:(NSString*) downloadUrl
|
||||||
{
|
{
|
||||||
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:downloadUrl]
|
NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:downloadUrl]
|
||||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||||
timeoutInterval:60.0];
|
timeoutInterval:60.0];
|
||||||
|
|
||||||
NSURLDownload* theDownload = [[NSURLDownload alloc] initWithRequest:request delegate:self];
|
NSURLSessionConfiguration *defaultConfigObject = [NSURLSessionConfiguration defaultSessionConfiguration];
|
||||||
|
NSURLSession *defaultSession = [NSURLSession sessionWithConfiguration: defaultConfigObject delegate: self delegateQueue: [NSOperationQueue mainQueue]];
|
||||||
|
NSURLSessionDownloadTask *downloadTask = [defaultSession downloadTaskWithRequest:request];
|
||||||
|
|
||||||
/*NSURLSession *session = [NSURLSession sharedSession];
|
[downloadTask resume];
|
||||||
NSURLSessionDownloadTask *downloadTask = [session downloadTaskWithRequest:request
|
|
||||||
completionHandler:
|
|
||||||
^(NSURL *location, NSURLResponse *response,NSError *error) {
|
|
||||||
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
|
||||||
NSString* finalFilePath = [[sharedLauncher getAppPath] stringByAppendingPathComponent:[response suggestedFilename]];
|
|
||||||
[[Launcher sharedLauncher] setDownloadFilename:[response suggestedFilename]];
|
|
||||||
|
|
||||||
NSLog(@"----------->%@", location);
|
|
||||||
[[NSFileManager defaultManager] moveItemAtURL:location
|
|
||||||
toURL:[NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]]]
|
|
||||||
error:nil];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
|
|
||||||
NSString* appPath = [sharedLauncher getAppPath];
|
|
||||||
NSString* downloadFileName = [sharedLauncher getDownloadFilename];
|
|
||||||
NSLog(@"!!!!!!%@", downloadFileName);
|
|
||||||
NSLog(@"extract interface zip");
|
|
||||||
[sharedLauncher extractZipFileAtDestination:appPath :[appPath stringByAppendingString:downloadFileName]];
|
|
||||||
NSLog(@"finished extracting interface zip");
|
|
||||||
|
|
||||||
NSLog(@"starting xattr");
|
|
||||||
NSTask* quaratineTask = [[NSTask alloc] init];
|
|
||||||
quaratineTask.launchPath = @"/usr/bin/xattr";
|
|
||||||
quaratineTask.arguments = @[@"-d", @"com.apple.quarantine", [appPath stringByAppendingString:@"interface.app"]];
|
|
||||||
|
|
||||||
[quaratineTask launch];
|
|
||||||
[quaratineTask waitUntilExit];
|
|
||||||
NSLog(@"finished xattr");
|
|
||||||
|
|
||||||
NSString* launcherPath = [appPath stringByAppendingString:@"Launcher"];
|
|
||||||
|
|
||||||
[[Settings sharedSettings] setLauncherPath:launcherPath];
|
|
||||||
[sharedLauncher interfaceFinishedDownloading];
|
|
||||||
|
|
||||||
});
|
|
||||||
}];
|
|
||||||
|
|
||||||
[downloadTask resume];*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite {
|
||||||
{
|
CGFloat prog = (float)totalBytesWritten/totalBytesExpectedToWrite;
|
||||||
self.finalFilePath = [[[Launcher sharedLauncher] getAppPath] stringByAppendingPathComponent:filename];
|
NSLog(@"interface downloaded %d%%", (int)(100.0*prog));
|
||||||
[download setDestination:self.finalFilePath allowOverwrite:YES];
|
|
||||||
|
|
||||||
[[Launcher sharedLauncher] setDownloadFilename:filename];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didResumeAtOffset:(int64_t)fileOffset expectedTotalBytes:(int64_t)expectedTotalBytes {
|
||||||
|
// unused in this example
|
||||||
|
}
|
||||||
|
|
||||||
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
|
-(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location {
|
||||||
NSHTTPURLResponse *ne = (NSHTTPURLResponse *)response;
|
NSLog(@"Did finish downloading to url");
|
||||||
if([ne statusCode] == 200) {
|
NSError *error;
|
||||||
NSLog(@"download interface connection state is 200 - all okay");
|
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||||
} else {
|
NSString *destinationFileName = downloadTask.originalRequest.URL.lastPathComponent;
|
||||||
NSLog(@"download interface connection state is NOT 200");
|
NSString* finalFilePath = [[[Launcher sharedLauncher] getAppPath] stringByAppendingPathComponent:destinationFileName];
|
||||||
[[Launcher sharedLauncher] displayErrorPage];
|
NSURL *destinationURL = [NSURL URLWithString: [finalFilePath stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLFragmentAllowedCharacterSet]] relativeToURL: [NSURL URLWithString:@"file://"]];
|
||||||
|
if([fileManager fileExistsAtPath:[destinationURL path]])
|
||||||
|
{
|
||||||
|
[fileManager removeItemAtURL:destinationURL error:nil];
|
||||||
}
|
}
|
||||||
}
|
[fileManager moveItemAtURL:location toURL:destinationURL error:&error];
|
||||||
|
|
||||||
-(void) connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
|
|
||||||
NSLog(@"download interface content - Conn Err: %@", [error localizedDescription]);
|
|
||||||
[[Launcher sharedLauncher] displayErrorPage];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)downloadDidFinish:(NSURLDownload*)download
|
|
||||||
{
|
|
||||||
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
Launcher* sharedLauncher = [Launcher sharedLauncher];
|
||||||
NSString* appPath = [sharedLauncher getAppPath];
|
NSString* appPath = [sharedLauncher getAppPath];
|
||||||
NSString* downloadFileName = [sharedLauncher getDownloadFilename];
|
NSString* downloadFileName = [sharedLauncher getDownloadFilename];
|
||||||
|
@ -102,8 +63,9 @@
|
||||||
[sharedLauncher interfaceFinishedDownloading];
|
[sharedLauncher interfaceFinishedDownloading];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)download:(NSURLDownload*)download didReceiveResponse:(NSURLResponse*)response
|
-(void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error {
|
||||||
{
|
NSLog(@"completed; error: %@", error);
|
||||||
NSLog(@"Download interface response");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -49,7 +49,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) rotateView:(NSTimer *)timer{
|
- (void) rotateView:(NSTimer *)timer{
|
||||||
self.imageRotation += 1;
|
self.imageRotation -= 1;
|
||||||
[self.voxelImage setFrameCenterRotation:self.imageRotation];
|
[self.voxelImage setFrameCenterRotation:self.imageRotation];
|
||||||
}
|
}
|
||||||
@end
|
@end
|
||||||
|
|
Loading…
Reference in a new issue