Prepare app for MAS submission (app sandboxing)

This commit is contained in:
Gennadii Potapov 2020-01-21 15:35:58 +08:00
parent 149f969e3f
commit cac2bdc2b5
5 changed files with 22 additions and 3 deletions

View file

@ -45,6 +45,9 @@
NSString *statusItemText; NSString *statusItemText;
NSImage *statusItemImage; NSImage *statusItemImage;
IBOutlet NSTextField *forgottenItemLabel;
IBOutlet NSButton *forgottenFavoritesCheckbox;
IBOutlet NSButton *forgottenClippingsCheckbox;
// The menu attatched to same // The menu attatched to same
IBOutlet NSMenu *jcMenu; IBOutlet NSMenu *jcMenu;
int jcMenuBaseItemsCount; int jcMenuBaseItemsCount;
@ -55,6 +58,7 @@
NSEvent *menuOpenEvent; NSEvent *menuOpenEvent;
IBOutlet NSSlider * heightSlider; IBOutlet NSSlider * heightSlider;
IBOutlet NSSlider * widthSlider; IBOutlet NSSlider * widthSlider;
// A timer which will let us check the pasteboard; // A timer which will let us check the pasteboard;
// this should default to every .5 seconds but be user-configurable // this should default to every .5 seconds but be user-configurable
NSTimer *pollPBTimer; NSTimer *pollPBTimer;

View file

@ -57,7 +57,11 @@
@"displayClippingSource", @"displayClippingSource",
[NSNumber numberWithBool:NO], [NSNumber numberWithBool:NO],
@"saveForgottenClippings", @"saveForgottenClippings",
#ifdef SANDBOXING
[NSNumber numberWithBool:NO],
#else
[NSNumber numberWithBool:YES], [NSNumber numberWithBool:YES],
#endif
@"saveForgottenFavorites", @"saveForgottenFavorites",
[NSNumber numberWithBool:NO], [NSNumber numberWithBool:NO],
@"suppressAccessibilityAlert", @"suppressAccessibilityAlert",
@ -100,7 +104,7 @@
// Not registering for conflict notifications, since we just sync settings, and if the settings are conflictingly adjusted simultaneously on two systems there is nothing to say which setting is better. // Not registering for conflict notifications, since we just sync settings, and if the settings are conflictingly adjusted simultaneously on two systems there is nothing to say which setting is better.
[[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:settingsSyncList [[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:settingsSyncList
withContainerIdentifier:@"iCloud.com.mark-a-jerde.Flycut"]; withContainerIdentifier:kiCloudId];
} }
else { else {
[[MJCloudKitUserDefaultsSync sharedSync] stopForKeyMatchList:settingsSyncList]; [[MJCloudKitUserDefaultsSync sharedSync] stopForKeyMatchList:settingsSyncList];
@ -624,6 +628,11 @@
action:@selector(setupBezel:)]; action:@selector(setupBezel:)];
[appearancePanel addSubview:row]; [appearancePanel addSubview:row];
nextYMax = row.frame.origin.y; nextYMax = row.frame.origin.y;
#ifdef SANDBOXING
forgottenItemLabel.hidden = YES;
forgottenClippingsCheckbox.hidden = YES;
forgottenFavoritesCheckbox.hidden = YES;
#endif
} }
-(IBAction) showPreferencePanel:(id)sender -(IBAction) showPreferencePanel:(id)sender

View file

@ -233,6 +233,9 @@
- (bool)saveFromStore:(FlycutStore*)store atIndex:(int)index withPrefix:(NSString*) prefix - (bool)saveFromStore:(FlycutStore*)store atIndex:(int)index withPrefix:(NSString*) prefix
{ {
#ifdef SANDBOXING
return NO;
# else
if ( [store jcListCount] > index ) { if ( [store jcListCount] > index ) {
// Get text from clipping store. // Get text from clipping store.
NSString *pbFullText = [self clippingStringWithCount:index inStore:store]; NSString *pbFullText = [self clippingStringWithCount:index inStore:store];
@ -261,6 +264,7 @@
return YES; return YES;
} }
return NO; return NO;
#endif
} }
- (bool)saveFromStackToFavorites - (bool)saveFromStackToFavorites
@ -560,7 +564,7 @@
{ {
if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"syncSettingsViaICloud"] ) { if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"syncSettingsViaICloud"] ) {
[[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:settingsSyncList [[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:settingsSyncList
withContainerIdentifier:@"iCloud.com.mark-a-jerde.Flycut"]; withContainerIdentifier:kiCloudId];
} }
else { else {
[[MJCloudKitUserDefaultsSync sharedSync] stopForKeyMatchList:settingsSyncList]; [[MJCloudKitUserDefaultsSync sharedSync] stopForKeyMatchList:settingsSyncList];
@ -589,7 +593,7 @@
[[MJCloudKitUserDefaultsSync sharedSync] addNotificationFor:MJSyncNotificationSaveSuccess withSelector:@selector(checkPreferencesSaveSuccess:) withTarget: self]; [[MJCloudKitUserDefaultsSync sharedSync] addNotificationFor:MJSyncNotificationSaveSuccess withSelector:@selector(checkPreferencesSaveSuccess:) withTarget: self];
[[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:@[@"store"] [[MJCloudKitUserDefaultsSync sharedSync] startWithKeyMatchList:@[@"store"]
withContainerIdentifier:@"iCloud.com.mark-a-jerde.Flycut"]; withContainerIdentifier:kiCloudId];
} }
else { else {
[[MJCloudKitUserDefaultsSync sharedSync] removeNotificationsFor:MJSyncNotificationChanges forTarget:self]; [[MJCloudKitUserDefaultsSync sharedSync] removeNotificationsFor:MJSyncNotificationChanges forTarget:self];

View file

@ -5,6 +5,8 @@
#ifdef __OBJC__ #ifdef __OBJC__
#import <Cocoa/Cocoa.h> #import <Cocoa/Cocoa.h>
#define kiCloudId @"iCloud.com.generalarcade.flycut"
#ifdef DEBUG #ifdef DEBUG
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); # define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
#else #else

Binary file not shown.