mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-17 14:49:29 +00:00
Removed delayed write of preview files to fix missing preview in macOs 10.15 Catalina (fix #1016)
This commit is contained in:
@@ -41,7 +41,6 @@
|
|||||||
self = [super init];
|
self = [super init];
|
||||||
if(self) {
|
if(self) {
|
||||||
_binary = binary;
|
_binary = binary;
|
||||||
_loadScheduled = NO;
|
|
||||||
[MPTemporaryFileStorageCenter.defaultCenter registerStorage:self];
|
[MPTemporaryFileStorageCenter.defaultCenter registerStorage:self];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -64,17 +63,8 @@
|
|||||||
#pragma mark QLPreviewPanelDataSource
|
#pragma mark QLPreviewPanelDataSource
|
||||||
|
|
||||||
- (id<QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
|
- (id<QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
|
||||||
if(!self.temporaryFileURL && !self.loadScheduled) {
|
if(!self.temporaryFileURL) {
|
||||||
self.loadScheduled = YES;
|
[self _saveBinary:self.binary];
|
||||||
dispatch_queue_t defaultQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
|
||||||
dispatch_async(defaultQueue, ^{
|
|
||||||
BOOL success = [self _saveBinary:self.binary];
|
|
||||||
if(success){
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[panel refreshCurrentPreviewItem];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -98,7 +88,7 @@
|
|||||||
#pragma mark Private
|
#pragma mark Private
|
||||||
|
|
||||||
- (BOOL)_saveBinary:(KPKBinary *)binary {
|
- (BOOL)_saveBinary:(KPKBinary *)binary {
|
||||||
if(!binary || !binary.data || !binary.name || [binary.name length] == 0) {
|
if(!binary || !binary.data || !binary.name || binary.name.length == 0) {
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
NSString *fileName = [NSString stringWithFormat:@"%@_%@", NSProcessInfo.processInfo.globallyUniqueString, binary.name];
|
NSString *fileName = [NSString stringWithFormat:@"%@_%@", NSProcessInfo.processInfo.globallyUniqueString, binary.name];
|
||||||
@@ -142,7 +132,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
+ (void)_runCleanupForPath:(NSString *)path {
|
+ (void)_runCleanupForPath:(NSString *)path {
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
|
|
||||||
|
// FIXME: Remove when moving to 10.12 as deploy target
|
||||||
|
|
||||||
NSURL *srmURL = [NSURL fileURLWithPath:@"/usr/bin/srm"];
|
NSURL *srmURL = [NSURL fileURLWithPath:@"/usr/bin/srm"];
|
||||||
NSURL *rmURL = [NSURL fileURLWithPath:@"/bin/rm"];
|
NSURL *rmURL = [NSURL fileURLWithPath:@"/bin/rm"];
|
||||||
|
|||||||
Reference in New Issue
Block a user