Move macOS code out of cross-platform files

This commit is contained in:
Mark Jerde 2022-01-15 06:37:35 -06:00
parent c41711599e
commit 733897230d
2 changed files with 4 additions and 4 deletions

View file

@ -858,7 +858,7 @@
if (largeCopyRisk) if (largeCopyRisk)
[self toggleMenuIconDisabled]; [self toggleMenuIconDisabled];
if ( contents == nil || [flycutOperator shouldSkip:contents ofType:[jcPasteboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]]] ) { if ( contents == nil || [flycutOperator shouldSkip:contents ofType:[jcPasteboard availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]] fromAvailableTypes:[jcPasteboard types]] ) {
DLog(@"Contents: Empty or skipped"); DLog(@"Contents: Empty or skipped");
} else if ( ! [pbCount isEqualTo:pbBlockCount] ) { } else if ( ! [pbCount isEqualTo:pbBlockCount] ) {
[flycutOperator addClipping:contents ofType:type fromApp:[currRunningApp localizedName] withAppBundleURL:currRunningApp.bundleURL.path target:self clippingAddedSelector:@selector(updateMenu)]; [flycutOperator addClipping:contents ofType:type fromApp:[currRunningApp localizedName] withAppBundleURL:currRunningApp.bundleURL.path target:self clippingAddedSelector:@selector(updateMenu)];

View file

@ -303,7 +303,7 @@
return [self clippingStringWithCount:indexInt]; return [self clippingStringWithCount:indexInt];
} }
-(BOOL)shouldSkip:(NSString *)contents ofType:(NSString *)type -(BOOL)shouldSkip:(NSString *)contents ofType:(NSString *)type fromAvailableTypes:(NSArray<NSString *> *)availableTypes
{ {
// Check to see if we are skipping passwords based on length and characters. // Check to see if we are skipping passwords based on length and characters.
if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"skipPasswordFields"] ) if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"skipPasswordFields"] )
@ -316,10 +316,10 @@
__block bool skipClipping = NO; __block bool skipClipping = NO;
// Check the array of types to skip. // Check the array of types to skip.
if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"skipPboardTypes"] ) if ( availableTypes && [[NSUserDefaults standardUserDefaults] boolForKey:@"skipPboardTypes"] )
{ {
NSSet *typesToSkip = [NSSet setWithArray: [[[[NSUserDefaults standardUserDefaults] stringForKey:@"skipPboardTypesList"] stringByReplacingOccurrencesOfString:@" " withString:@""] componentsSeparatedByString: @","]]; NSSet *typesToSkip = [NSSet setWithArray: [[[[NSUserDefaults standardUserDefaults] stringForKey:@"skipPboardTypesList"] stringByReplacingOccurrencesOfString:@" " withString:@""] componentsSeparatedByString: @","]];
NSSet *pasteBoardTypes = [NSSet setWithArray: [[NSPasteboard generalPasteboard] types]]; NSSet *pasteBoardTypes = [NSSet setWithArray: availableTypes];
if ( [pasteBoardTypes intersectsSet: typesToSkip] ) if ( [pasteBoardTypes intersectsSet: typesToSkip] )
{ {