Renamed Assets Catalog, modernized code

This commit is contained in:
Michael Starke
2018-09-20 18:03:12 +02:00
parent 8d7bb31b7c
commit 9f35450683
33 changed files with 39 additions and 34 deletions

View File

@@ -178,7 +178,7 @@
4C7B637D1C0CB55600D7038C /* Sparkle.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; };
4C7B637F1C0CB57300D7038C /* KeePassKit.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B63791C0CB55600D7038C /* KeePassKit.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4C7B63801C0CB57300D7038C /* Sparkle.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4C7B637A1C0CB55600D7038C /* Sparkle.framework */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
4C7BD07619FE94C900C7AA5C /* MacPassImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BD07519FE94C900C7AA5C /* MacPassImages.xcassets */; };
4C7BD07619FE94C900C7AA5C /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 4C7BD07519FE94C900C7AA5C /* Assets.xcassets */; };
4C7F8B681A10B68400CCB83D /* WelcomeWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4C7F8B6A1A10B68400CCB83D /* WelcomeWindow.xib */; };
4C80304A1E2FBAA300133E4C /* MPTestKeyMapper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8030491E2FBAA300133E4C /* MPTestKeyMapper.m */; };
4C82046A1FCDC07800EB24A4 /* MPPickfieldViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4C8204681FCDC07800EB24A4 /* MPPickfieldViewController.m */; };
@@ -629,7 +629,7 @@
4C7B63701C0CB51F00D7038C /* TTTStringTransformers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TTTStringTransformers.m; sourceTree = "<group>"; };
4C7B63791C0CB55600D7038C /* KeePassKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = KeePassKit.framework; path = Carthage/Build/Mac/KeePassKit.framework; sourceTree = "<group>"; };
4C7B637A1C0CB55600D7038C /* Sparkle.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Sparkle.framework; path = Carthage/Build/Mac/Sparkle.framework; sourceTree = "<group>"; };
4C7BD07519FE94C900C7AA5C /* MacPassImages.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = MacPassImages.xcassets; sourceTree = "<group>"; };
4C7BD07519FE94C900C7AA5C /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
4C7F8B691A10B68400CCB83D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/WelcomeWindow.xib; sourceTree = "<group>"; };
4C7F8B741A10B69300CCB83D /* nl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = nl; path = nl.lproj/WelcomeWindow.strings; sourceTree = "<group>"; };
4C7F8B761A10B69400CCB83D /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/WelcomeWindow.strings"; sourceTree = "<group>"; };
@@ -1406,7 +1406,7 @@
4C37A84215B8B495005EF8EE /* Model */,
4C37A84115B8B47D005EF8EE /* Delegates */,
4C77E36D15B84A240093A587 /* Supporting Files */,
4C7BD07519FE94C900C7AA5C /* MacPassImages.xcassets */,
4C7BD07519FE94C900C7AA5C /* Assets.xcassets */,
);
path = MacPass;
sourceTree = "<group>";
@@ -1841,7 +1841,7 @@
4C6D1D25178579570014C5A5 /* 48_FolderTemplate.pdf in Resources */,
4C701CBC178618A000581B88 /* 12_RemoteTemplate.pdf in Resources */,
4CF29BF417879D0000851B60 /* 26_FileSaveTemplate.pdf in Resources */,
4C7BD07619FE94C900C7AA5C /* MacPassImages.xcassets in Resources */,
4C7BD07619FE94C900C7AA5C /* Assets.xcassets in Resources */,
4CA182781F96523600DD4A4A /* DuplicateEntryOptionsWindow.xib in Resources */,
4C52A88E1788628B00868229 /* 06_BlockDeviceTemplate.pdf in Resources */,
4C52A88F1788628B00868229 /* 13_KeysTemplate.pdf in Resources */,

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

@@ -27,10 +27,10 @@
"color" : {
"color-space" : "srgb",
"components" : {
"red" : "0.300",
"red" : "0.200",
"alpha" : "1.000",
"blue" : "0.300",
"green" : "0.300"
"blue" : "0.200",
"green" : "0.200"
}
}
}

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

Before

Width:  |  Height:  |  Size: 6.9 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

Before

Width:  |  Height:  |  Size: 116 KiB

After

Width:  |  Height:  |  Size: 116 KiB

View File

Before

Width:  |  Height:  |  Size: 257 KiB

After

Width:  |  Height:  |  Size: 257 KiB

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -424,8 +424,12 @@ static CGKeyCode kMPNumpadKeyCodes[] = {
/* Send the event */
CGEventPost(kCGHIDEventTap, pressKey);
/* TODO: Evaluate postToPid */
//CGEventPostToPid(0, pressKey);
usleep(0.05 * NSEC_PER_MSEC);
CGEventPost(kCGHIDEventTap, releaseKey);
/* TODO: Evaluate postToPid */
//CGEventPostToPid(0, releaseKey);
usleep(0.05 * NSEC_PER_MSEC);
CFRelease(pressKey);

View File

@@ -51,12 +51,11 @@
- (void)execute {
if([self.pasteData length] > 0) {
MPPasteBoardController *controller = [MPPasteBoardController defaultController];
[controller stashObjects];
[controller copyObjectsWithoutTimeout:@[self.pasteData]];
[MPPasteBoardController.defaultController stashObjects];
[MPPasteBoardController.defaultController copyObjectsWithoutTimeout:@[self.pasteData]];
[self sendPasteKeyCode];
usleep(0.1 * NSEC_PER_MSEC); // on 10.10 we need to wait a bit before restoring the pasteboard contents
[controller restoreObjects];
usleep(0.2 * NSEC_PER_MSEC); // on 10.10 we need to wait a bit before restoring the pasteboard contents
[MPPasteBoardController.defaultController restoreObjects];
}
}

View File

@@ -24,7 +24,7 @@
@interface MPOverlayWindowController : NSWindowController
+ (MPOverlayWindowController *)sharedController;
@property (nonatomic, strong, readonly, class) MPOverlayWindowController *sharedController;
/**
* Displays an overlay HUD style image with the given text, image centered at the given view.

View File

@@ -56,13 +56,14 @@
- (void)windowDidLoad {
[super windowDidLoad];
[self.window setStyleMask:NSBorderlessWindowMask];
[self.window setAlphaValue:0];
[self.window setOpaque:NO];
[self.window setHasShadow:YES];
[[self.textField cell] setBackgroundStyle:NSBackgroundStyleLowered];
[[self.imageView cell] setBackgroundStyle:NSBackgroundStyleDark];
[[self.imageView cell] setImageAlignment:NSImageAlignCenter];
self.window.styleMask = NSBorderlessWindowMask;
self.window.alphaValue = 0;
self.window.opaque = NO;
self.window.hasShadow = YES;
self.textField.cell.backgroundStyle = NSBackgroundStyleLowered;
self.imageView.cell.backgroundStyle = NSBackgroundStyleDark;
((NSImageCell *)self.imageView.cell).imageAlignment = NSImageAlignCenter;
}
- (void)displayOverlayImage:(NSImage *)imageOrNil label:(NSString *)labelOrNil atView:(NSView *)view {

View File

@@ -74,6 +74,7 @@ NSString *const MPPasteBoardControllerDidClearClipboard = @"com.hicknhack.macpas
for (NSPasteboardItem *item in NSPasteboard.generalPasteboard.pasteboardItems) {
NSPasteboardItem *newItem = [[NSPasteboardItem alloc] init];
for (NSString *type in item.types) {
/* mutable copy to ensure actual deep copy */
NSData *data = [[item dataForType:type] mutableCopy];
if (data) {
[newItem setData:data forType:type];
@@ -118,26 +119,26 @@ NSString *const MPPasteBoardControllerDidClearClipboard = @"com.hicknhack.macpas
NSString *infoText = nil;
switch(overlayInfoType) {
case MPPasteboardOverlayInfoPassword:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"00_PasswordTemplate"];
infoText = NSLocalizedString(@"COPIED_PASSWORD", @"Password was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoURL:
infoImage = [[NSBundle mainBundle] imageForResource:@"01_PackageNetworkTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"01_PackageNetworkTemplate"];
infoText = NSLocalizedString(@"COPIED_URL", @"URL was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoUsername:
infoImage = [[NSBundle mainBundle] imageForResource:@"09_IdentityTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"09_IdentityTemplate"];
infoText = NSLocalizedString(@"COPIED_USERNAME", @"Username was copied to the pasteboard");
break;
case MPPasteboardOverlayInfoCustom:
infoImage = [[NSBundle mainBundle] imageForResource:@"00_PasswordTemplate"];
infoImage = [NSBundle.mainBundle imageForResource:@"00_PasswordTemplate"];
infoText = [NSString stringWithFormat:NSLocalizedString(@"COPIED_FIELD_%@", "Field name that was copied to the pasteboard"), name];
break;
}
[[MPOverlayWindowController sharedController] displayOverlayImage:infoImage label:infoText atView:view];
[MPOverlayWindowController.sharedController displayOverlayImage:infoImage label:infoText atView:view];
}
- (void)_clearPasteboardContents {