mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +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];
|
||||
if(self) {
|
||||
_binary = binary;
|
||||
_loadScheduled = NO;
|
||||
[MPTemporaryFileStorageCenter.defaultCenter registerStorage:self];
|
||||
}
|
||||
return self;
|
||||
@@ -64,17 +63,8 @@
|
||||
#pragma mark QLPreviewPanelDataSource
|
||||
|
||||
- (id<QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index {
|
||||
if(!self.temporaryFileURL && !self.loadScheduled) {
|
||||
self.loadScheduled = YES;
|
||||
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];
|
||||
});
|
||||
}
|
||||
});
|
||||
if(!self.temporaryFileURL) {
|
||||
[self _saveBinary:self.binary];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
@@ -98,7 +88,7 @@
|
||||
#pragma mark Private
|
||||
|
||||
- (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;
|
||||
}
|
||||
NSString *fileName = [NSString stringWithFormat:@"%@_%@", NSProcessInfo.processInfo.globallyUniqueString, binary.name];
|
||||
@@ -142,7 +132,9 @@
|
||||
}
|
||||
|
||||
+ (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 *rmURL = [NSURL fileURLWithPath:@"/bin/rm"];
|
||||
|
||||
Reference in New Issue
Block a user