cleanup Objective-C code from C++

This commit is contained in:
2019-07-13 19:00:25 +02:00
parent 2e5ea079c8
commit 80b78ac0af
4 changed files with 203 additions and 192 deletions

View File

@@ -8,7 +8,7 @@
#ifdef __APPLE__
#include <Foundation/Foundation.h>
#import <Photos/Photos.h>
#import "objc_utils.h"
#endif
@@ -1863,18 +1863,7 @@ void Canvas::export_equirectangular_thread(std::string file_path)
//int ret = stbi_write_png(name, m_latlong.getWidth(), m_latlong.getHeight(), 4, latlong_data.get(), m_latlong.stride());
#ifdef __IOS__
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
NSURL* url = [NSURL fileURLWithPath:[NSString stringWithUTF8String:file_path.c_str()]];
PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL:url];
changeRequest.creationDate = [NSDate date];
} completionHandler:^(BOOL success, NSError *error) {
if (success) {
NSLog(@"successfully saved");
}
else {
NSLog(@"error saving to photos: %@", error);
}
}];
save_image_library(file_path);
#endif
App::I->render_task_async([id=cube_id]
@@ -2261,18 +2250,7 @@ void Canvas::export_cubes()
#ifdef __IOS__
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
NSURL* url = [NSURL fileURLWithPath : [NSString stringWithUTF8String : name]];
PHAssetChangeRequest *changeRequest = [PHAssetChangeRequest creationRequestForAssetFromImageAtFileURL : url];
changeRequest.creationDate = [NSDate date];
} completionHandler: ^ (BOOL success, NSError *error) {
if (success) {
NSLog(@"successfully saved");
}
else {
NSLog(@"error saving to photos : %@", error);
}
}];
save_image_library(name);
#endif
#ifdef __OBJC__
[files addObject:[NSString stringWithUTF8String : name]];