Skip to content

Commit

Permalink
added touch id button -constraints need to be fixed...
Browse files Browse the repository at this point in the history
  • Loading branch information
georgesnow committed Oct 8, 2019
1 parent 96fec71 commit 63b016f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 17 deletions.
46 changes: 30 additions & 16 deletions MacPass/Base.lproj/PasswordInputView.xib
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14868" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14868"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -16,16 +16,17 @@
<outlet property="passwordTextField" destination="338" id="495"/>
<outlet property="togglePasswordButton" destination="408" id="493"/>
<outlet property="unlockButton" destination="2" id="ZRr-Ui-ExP"/>
<outlet property="useTouchIdButton" destination="yiJ-jb-FPV" id="ba2-8d-hCU"/>
<outlet property="view" destination="1" id="143"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView horizontalCompressionResistancePriority="751" translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="508" height="392"/>
<rect key="frame" x="0.0" y="0.0" width="527" height="390"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2">
<rect key="frame" x="310" y="105" width="83" height="32"/>
<rect key="frame" x="319" y="105" width="83" height="32"/>
<buttonCell key="cell" type="push" title="Unlock" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="3">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -38,37 +39,37 @@ DQ
</connections>
</button>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="17">
<rect key="frame" x="108" y="157" width="45" height="17"/>
<rect key="frame" x="117" y="158" width="45" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Keyfile" id="18">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<pathControl verticalHuggingPriority="750" allowsExpansionToolTips="YES" translatesAutoresizingMaskIntoConstraints="NO" id="241" customClass="MPPathControl">
<rect key="frame" x="156" y="153" width="197" height="25"/>
<rect key="frame" x="165" y="154" width="197" height="25"/>
<pathCell key="cell" selectable="YES" editable="YES" alignment="left" pathStyle="popUp" id="242">
<font key="font" metaFont="system"/>
</pathCell>
</pathControl>
<imageView translatesAutoresizingMaskIntoConstraints="NO" id="262">
<rect key="frame" x="230" y="241" width="48" height="48"/>
<rect key="frame" x="240" y="237" width="48" height="48"/>
<constraints>
<constraint firstAttribute="height" constant="48" id="273"/>
<constraint firstAttribute="width" constant="48" id="456"/>
</constraints>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyUpOrDown" image="02_MessageBoxWarningTemplate" id="263"/>
</imageView>
<textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="268">
<rect key="frame" x="199" y="216" width="110" height="17"/>
<rect key="frame" x="209" y="213" width="110" height="16"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Wrong password!" id="269">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<secureTextField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="338" customClass="HNHUISecureTextField">
<rect key="frame" x="159" y="184" width="191" height="24"/>
<rect key="frame" x="168" y="185" width="191" height="20"/>
<constraints>
<constraint firstAttribute="width" constant="191" id="389"/>
</constraints>
Expand All @@ -85,14 +86,14 @@ DQ
</connections>
</secureTextField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="408">
<rect key="frame" x="358" y="185" width="29" height="23"/>
<rect key="frame" x="367" y="182" width="29" height="23"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSQuickLookTemplate" imagePosition="only" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="409">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="486">
<rect key="frame" x="358" y="152" width="29" height="23"/>
<rect key="frame" x="367" y="152" width="29" height="23"/>
<buttonCell key="cell" type="roundTextured" bezelStyle="texturedRounded" image="NSStopProgressTemplate" imagePosition="only" alignment="center" state="on" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="487">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -102,14 +103,14 @@ DQ
</connections>
</button>
<button translatesAutoresizingMaskIntoConstraints="NO" id="d8O-Ha-rrS">
<rect key="frame" x="72" y="187" width="81" height="18"/>
<rect key="frame" x="81" y="186" width="81" height="18"/>
<buttonCell key="cell" type="check" title="Password" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="IU9-5u-jn9">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
</button>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="2pb-ZG-spA">
<rect key="frame" x="228" y="105" width="82" height="32"/>
<rect key="frame" x="237" y="105" width="82" height="32"/>
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="erj-mR-UyO">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
Expand All @@ -121,10 +122,20 @@ Gw
<action selector="_submit:" target="-2" id="aVF-1d-1Hq"/>
</connections>
</button>
<button verticalHuggingPriority="750" misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="yiJ-jb-FPV">
<rect key="frame" x="319" y="72" width="83" height="32"/>
<buttonCell key="cell" type="push" title="Touch ID" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="q5e-8s-SGL">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="showTouchIdDialog:" target="-2" id="tJA-VM-Ci1"/>
</connections>
</button>
</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="bottom" relation="greaterThanOrEqual" secondItem="2" secondAttribute="bottom" constant="112" id="122"/>
<constraint firstItem="262" firstAttribute="top" relation="greaterThanOrEqual" secondItem="1" secondAttribute="top" constant="105" id="276"/>
<constraint firstAttribute="centerX" secondItem="262" secondAttribute="centerX" id="286"/>
<constraint firstAttribute="centerY" secondItem="338" secondAttribute="centerY" id="386"/>
<constraint firstItem="338" firstAttribute="top" secondItem="268" secondAttribute="bottom" constant="8" symbolic="YES" id="400"/>
Expand All @@ -145,14 +156,17 @@ Gw
<constraint firstItem="408" firstAttribute="leading" secondItem="338" secondAttribute="trailing" constant="8" symbolic="YES" id="7qE-8F-QgB"/>
<constraint firstItem="2pb-ZG-spA" firstAttribute="baseline" secondItem="2" secondAttribute="baseline" id="9nK-MH-Ozs"/>
<constraint firstItem="17" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="EOa-K4-v7J"/>
<constraint firstItem="yiJ-jb-FPV" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="GiX-mL-g2P"/>
<constraint firstItem="yiJ-jb-FPV" firstAttribute="baseline" secondItem="2" secondAttribute="baseline" constant="33" id="Iqw-Qy-7fg"/>
<constraint firstItem="338" firstAttribute="leading" secondItem="d8O-Ha-rrS" secondAttribute="trailing" constant="8" symbolic="YES" id="KYs-Ia-SVl"/>
<constraint firstItem="2pb-ZG-spA" firstAttribute="leading" relation="greaterThanOrEqual" secondItem="1" secondAttribute="leading" constant="20" symbolic="YES" id="SUS-76-os4"/>
<constraint firstItem="d8O-Ha-rrS" firstAttribute="centerY" secondItem="338" secondAttribute="centerY" id="kgB-jV-OGy"/>
<constraint firstItem="2" firstAttribute="trailing" secondItem="yiJ-jb-FPV" secondAttribute="trailing" id="p5w-P7-A22"/>
<constraint firstItem="2" firstAttribute="top" secondItem="486" secondAttribute="bottom" constant="20" symbolic="YES" id="v1K-wm-EeB"/>
<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"/>
</constraints>
<point key="canvasLocation" x="147" y="-80"/>
<point key="canvasLocation" x="146.5" y="-81"/>
</customView>
</objects>
<resources>
Expand Down
5 changes: 4 additions & 1 deletion MacPass/MPPasswordInputController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ @interface MPPasswordInputController ()
@property (nonatomic, assign) BOOL enablePassword;
@property (copy) passwordInputCompletionBlock completionHandler;
@property (nonatomic, readonly) NSString *databaseName;
@property (weak) IBOutlet NSButton *useTouchIdButton;
@end

@implementation MPPasswordInputController
Expand Down Expand Up @@ -195,7 +196,9 @@ - (void)_showError:(NSError *)error {
self.messageImageView.image = [NSImage imageNamed:NSImageNameCaution];
self.messageInfoTextField.hidden = NO;
}

- (IBAction)showTouchIdDialog:(id)sender {
[self _enableTouchID];
}

- (NSTouchBar *)makeTouchBar {
NSTouchBar *touchBar = [[NSTouchBar alloc] init];
Expand Down

0 comments on commit 63b016f

Please sign in to comment.