mirror of
https://github.com/MacPass/MacPass.git
synced 2025-12-13 08:52:20 +00:00
Fixed missing breaks in key storage.
Added popup to set touchId in favour of checkbox
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="17701" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17701"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
|
||||
<capability name="Image references" minToolsVersion="12.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
@@ -16,6 +17,8 @@
|
||||
<outlet property="messageInfoTextField" destination="268" id="ahE-sq-QzR"/>
|
||||
<outlet property="passwordTextField" destination="338" id="495"/>
|
||||
<outlet property="togglePasswordButton" destination="408" id="493"/>
|
||||
<outlet property="touchIdButton" destination="ZpI-L9-oFW" id="82R-Ir-aCk"/>
|
||||
<outlet property="touchIdModeButton" destination="ojg-6v-74n" id="WOD-fT-1Jp"/>
|
||||
<outlet property="unlockButton" destination="2" id="ZRr-Ui-ExP"/>
|
||||
<outlet property="view" destination="1" id="143"/>
|
||||
</connections>
|
||||
@@ -130,9 +133,33 @@ Gw
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ZpI-L9-oFW">
|
||||
<rect key="frame" x="153" y="130" width="247" height="40"/>
|
||||
<buttonCell key="cell" type="push" bezelStyle="rounded" imagePosition="overlaps" alignment="center" controlSize="large" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="H68-pk-x95">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<imageReference key="image" image="touchid" catalog="system" symbolScale="large"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="unlockWithTouchID:" target="-2" id="78g-Zp-kfP"/>
|
||||
</connections>
|
||||
</button>
|
||||
<popUpButton verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="ojg-6v-74n">
|
||||
<rect key="frame" x="414" y="16" width="78" height="25"/>
|
||||
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" imageScaling="proportionallyDown" inset="2" selectedItem="4zU-tu-WtN" id="ZsC-BU-S2L">
|
||||
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="menu"/>
|
||||
<menu key="menu" id="Obl-SJ-PWj">
|
||||
<items>
|
||||
<menuItem title="Item 1" state="on" id="4zU-tu-WtN"/>
|
||||
<menuItem title="Item 2" id="yoj-8p-tLa"/>
|
||||
<menuItem title="Item 3" id="hqz-rH-gah"/>
|
||||
</items>
|
||||
</menu>
|
||||
</popUpButtonCell>
|
||||
</popUpButton>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="2" secondAttribute="bottom" constant="20" symbolic="YES" id="122"/>
|
||||
<constraint firstItem="262" firstAttribute="top" relation="greaterThanOrEqual" secondItem="1" secondAttribute="top" constant="20" symbolic="YES" id="276"/>
|
||||
<constraint firstAttribute="centerX" secondItem="262" secondAttribute="centerX" id="286"/>
|
||||
<constraint firstAttribute="centerY" secondItem="338" secondAttribute="centerY" id="386"/>
|
||||
@@ -151,24 +178,33 @@ Gw
|
||||
<constraint firstItem="486" firstAttribute="leading" secondItem="408" secondAttribute="leading" id="490"/>
|
||||
<constraint firstItem="408" firstAttribute="trailing" secondItem="486" secondAttribute="trailing" id="492"/>
|
||||
<constraint firstItem="2" firstAttribute="trailing" secondItem="486" secondAttribute="trailing" id="496"/>
|
||||
<constraint firstItem="ZpI-L9-oFW" firstAttribute="leading" secondItem="338" secondAttribute="leading" id="586-AF-14D"/>
|
||||
<constraint firstItem="ZpI-L9-oFW" firstAttribute="trailing" secondItem="2" secondAttribute="trailing" id="66E-ud-APw"/>
|
||||
<constraint firstItem="ZpI-L9-oFW" firstAttribute="top" secondItem="2" secondAttribute="bottom" constant="12" symbolic="YES" id="8Cr-iC-tRa"/>
|
||||
<constraint firstItem="2pb-ZG-spA" firstAttribute="baseline" secondItem="2" secondAttribute="baseline" id="9nK-MH-Ozs"/>
|
||||
<constraint firstItem="txI-yI-5nE" firstAttribute="trailing" secondItem="241" secondAttribute="trailing" id="AVL-HO-SMq"/>
|
||||
<constraint firstItem="17" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="EOa-K4-v7J"/>
|
||||
<constraint firstItem="338" firstAttribute="leading" secondItem="d8O-Ha-rrS" secondAttribute="trailing" constant="8" symbolic="YES" id="KYs-Ia-SVl"/>
|
||||
<constraint firstAttribute="trailing" secondItem="ojg-6v-74n" secondAttribute="trailing" constant="20" symbolic="YES" id="Qi9-tI-1es"/>
|
||||
<constraint firstItem="2pb-ZG-spA" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="SUS-76-os4"/>
|
||||
<constraint firstItem="ojg-6v-74n" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="U0a-74-fft"/>
|
||||
<constraint firstItem="2" firstAttribute="top" secondItem="txI-yI-5nE" secondAttribute="bottom" constant="8" symbolic="YES" id="jJs-hc-O2O"/>
|
||||
<constraint firstItem="d8O-Ha-rrS" firstAttribute="centerY" secondItem="338" secondAttribute="centerY" id="kgB-jV-OGy"/>
|
||||
<constraint firstItem="txI-yI-5nE" firstAttribute="top" secondItem="241" secondAttribute="bottom" constant="8" symbolic="YES" id="lfg-eB-T2O"/>
|
||||
<constraint firstAttribute="bottom" secondItem="ojg-6v-74n" secondAttribute="bottom" constant="20" symbolic="YES" id="lsJ-TP-Ypo"/>
|
||||
<constraint firstItem="txI-yI-5nE" firstAttribute="leading" secondItem="241" secondAttribute="leading" id="nGY-6Q-Vwy"/>
|
||||
<constraint firstItem="ojg-6v-74n" firstAttribute="top" relation="greaterThanOrEqual" secondItem="ZpI-L9-oFW" secondAttribute="bottom" constant="20" symbolic="YES" id="vKg-zv-agP"/>
|
||||
<constraint firstItem="d8O-Ha-rrS" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="vxq-YP-UhR"/>
|
||||
<constraint firstItem="2" firstAttribute="leading" secondItem="2pb-ZG-spA" secondAttribute="trailing" constant="12" id="ytJ-5Z-5rT"/>
|
||||
<constraint firstAttribute="bottom" relation="greaterThanOrEqual" secondItem="ZpI-L9-oFW" secondAttribute="bottom" constant="1" id="zhU-C3-jab"/>
|
||||
</constraints>
|
||||
<point key="canvasLocation" x="-127" y="-46"/>
|
||||
<point key="canvasLocation" x="-25" y="11"/>
|
||||
</customView>
|
||||
</objects>
|
||||
<resources>
|
||||
<image name="02_MessageBoxWarningTemplate" width="16" height="16"/>
|
||||
<image name="NSQuickLookTemplate" width="21" height="13"/>
|
||||
<image name="NSStopProgressTemplate" width="14" height="13"/>
|
||||
<image name="touchid" catalog="system" width="21" height="21"/>
|
||||
</resources>
|
||||
</document>
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
@property (weak) IBOutlet NSButton *cancelButton;
|
||||
@property (weak) IBOutlet NSButton *touchIdButton;
|
||||
@property (weak) IBOutlet NSButton *touchIdEnabledButton;
|
||||
@property (strong) IBOutlet NSPopUpButton *touchIdModeButton;
|
||||
|
||||
@property (copy) NSString *message;
|
||||
@property (copy) NSString *cancelLabel;
|
||||
@@ -87,8 +88,32 @@
|
||||
[self.enablePasswordCheckBox bind:NSValueBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
[self.togglePasswordButton bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
[self.passwordTextField bind:NSEnabledBinding toObject:self withKeyPath:NSStringFromSelector(@selector(enablePassword)) options:nil];
|
||||
NSUserDefaultsController *defaultsController = [NSUserDefaultsController sharedUserDefaultsController];
|
||||
[self.touchIdEnabledButton bind:NSValueBinding toObject:defaultsController withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEntryTouchIdEnabled] options:nil];
|
||||
|
||||
NSMenu* touchIDMenu = [[NSMenu alloc] init];
|
||||
NSMenuItem *disabledItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"TOUCHID_DISABLED", @"menu item to disable touchid key storage")
|
||||
action:NULL
|
||||
keyEquivalent:@""];
|
||||
NSMenuItem *transitentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"TOUCHID_TRANSIENT_KEY_STORAGE", @"menu item to enable transient touchid key storage")
|
||||
action:NULL
|
||||
keyEquivalent:@""];
|
||||
NSMenuItem *persistentItem = [[NSMenuItem alloc] initWithTitle:NSLocalizedString(@"TOUCHID_PERSISTENT_KEY_STORAGE", @"menu item to enable persisntent touchid key storage")
|
||||
action:NULL
|
||||
keyEquivalent:@""];
|
||||
|
||||
disabledItem.tag = MPTouchIDKeyStorageDisabled;
|
||||
transitentItem.tag = MPTouchIDKeyStorageTransient;
|
||||
persistentItem.tag = MPTouchIDKeyStoragePersistent;
|
||||
|
||||
touchIDMenu.itemArray = @[disabledItem, transitentItem, persistentItem];
|
||||
self.touchIdModeButton.menu = touchIDMenu;
|
||||
[self.touchIdModeButton bind:NSSelectedTagBinding
|
||||
toObject:NSUserDefaultsController.sharedUserDefaultsController
|
||||
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEntryTouchIdEnabled]
|
||||
options:nil];
|
||||
[self.touchIdEnabledButton bind:NSValueBinding
|
||||
toObject:NSUserDefaultsController.sharedUserDefaultsController
|
||||
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEntryTouchIdEnabled]
|
||||
options:nil];
|
||||
self.touchIdEnabledButton.hidden = YES;
|
||||
if (@available(macOS 10.13.4, *)) {
|
||||
self.touchIdEnabledButton.hidden = NO;
|
||||
|
||||
@@ -129,6 +129,14 @@ typedef NS_ENUM(NSUInteger, MPFaviconDownloadMethod) {
|
||||
MPFaviconDownloadMethodGoogle,
|
||||
};
|
||||
|
||||
// the values are mapped to NSControlStateValue for backwards compatibilty
|
||||
// older implementations did use a checkbox to store this setting
|
||||
typedef NS_ENUM(NSInteger, MPTouchIDKeyStorage) {
|
||||
MPTouchIDKeyStorageTransient = NSControlStateValueMixed,
|
||||
MPTouchIDKeyStorageDisabled = NSControlStateValueOff,
|
||||
MPTouchIDKeyStoragePersistent = NSControlStateValueOn
|
||||
};
|
||||
|
||||
/* Password Generation */
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyCopyGeneratedPasswordToClipboard;
|
||||
APPKIT_EXTERN NSString *const kMPSettingsKeyDefaultPasswordLength;
|
||||
|
||||
@@ -49,11 +49,13 @@
|
||||
if(nil != encryptedCompositeKey) {
|
||||
self.keys[documentKey] = encryptedCompositeKey;
|
||||
}
|
||||
break;
|
||||
case NSControlStateValueOn:
|
||||
self.keys[documentKey] = nil;
|
||||
if(nil != encryptedCompositeKey) {
|
||||
[NSUserDefaults.standardUserDefaults setObject:encryptedCompositeKey forKey:documentKey];
|
||||
}
|
||||
break;
|
||||
default:
|
||||
[NSUserDefaults.standardUserDefaults removeObjectForKey:documentKey];
|
||||
self.keys[documentKey] = nil;
|
||||
|
||||
Reference in New Issue
Block a user