Introduced Autotype doctor in preparation for macOS 10.15.

This change removes the test for autotype on startup and will only check for permissoins when the pereferences are shown or when (gloabal)autotype is performed.
This commit is contained in:
Michael Starke
2019-07-09 15:39:23 +02:00
parent b1cb776e14
commit 32899cb707
23 changed files with 429 additions and 138 deletions

View File

@@ -226,6 +226,8 @@
4CAD338F205169D30068587E /* MPPluginRepositoryItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD338E205169D30068587E /* MPPluginRepositoryItem.m */; };
4CAD748C15B889B700104512 /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748B15B889B700104512 /* Security.framework */; };
4CAD748E15B88AC100104512 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 4CAD748D15B88AC100104512 /* libz.dylib */; };
4CAD8AA622CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CAD8AA422CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m */; };
4CAD8AA722CF397B0090B2DD /* AutotypeDoctorReportViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4CAD8AA522CF397B0090B2DD /* AutotypeDoctorReportViewController.xib */; };
4CB33F861EAF54A000C9341E /* KPKNode+MPIsHistory.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CB33F851EAF54A000C9341E /* KPKNode+MPIsHistory.m */; };
4CB9339916D3A0DD00A13B5D /* Credits.rtf in Resources */ = {isa = PBXBuildFile; fileRef = 4CB9339716D3A0DD00A13B5D /* Credits.rtf */; };
4CBA2ABA17074C07006D8139 /* MPSettingsHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CBA2AB917074C07006D8139 /* MPSettingsHelper.m */; };
@@ -776,6 +778,9 @@
4CAD338E205169D30068587E /* MPPluginRepositoryItem.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPPluginRepositoryItem.m; sourceTree = "<group>"; };
4CAD748B15B889B700104512 /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; };
4CAD748D15B88AC100104512 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
4CAD8AA322CF397B0090B2DD /* MPAutotypeDoctorReportViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPAutotypeDoctorReportViewController.h; sourceTree = "<group>"; };
4CAD8AA422CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPAutotypeDoctorReportViewController.m; sourceTree = "<group>"; };
4CAD8AA522CF397B0090B2DD /* AutotypeDoctorReportViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = AutotypeDoctorReportViewController.xib; sourceTree = "<group>"; };
4CB33F841EAF54A000C9341E /* KPKNode+MPIsHistory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "KPKNode+MPIsHistory.h"; sourceTree = "<group>"; };
4CB33F851EAF54A000C9341E /* KPKNode+MPIsHistory.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "KPKNode+MPIsHistory.m"; sourceTree = "<group>"; };
4CB63A6018986530002DEC4C /* MPFlagsHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPFlagsHelper.h; sourceTree = "<group>"; };
@@ -1615,6 +1620,9 @@
4C73B6EE215E64A7009787F7 /* MPWelcomeViewController.h */,
4C73B6EF215E64A7009787F7 /* MPWelcomeViewController.m */,
4C7F8B6A1A10B68400CCB83D /* WelcomeView.xib */,
4CAD8AA322CF397B0090B2DD /* MPAutotypeDoctorReportViewController.h */,
4CAD8AA422CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m */,
4CAD8AA522CF397B0090B2DD /* AutotypeDoctorReportViewController.xib */,
);
name = "View Controller";
sourceTree = "<group>";
@@ -1847,6 +1855,7 @@
4C3826B41AD04D8E007D7D67 /* 39_HistoryTemplate.pdf in Resources */,
4C77E37D15B84A240093A587 /* MainMenu.xib in Resources */,
4C3826CD1AD04D8E007D7D67 /* 66_MoneyTemplate.pdf in Resources */,
4CAD8AA722CF397B0090B2DD /* AutotypeDoctorReportViewController.xib in Resources */,
4CA0B2ED15BCADAC00654E32 /* PreferencesWindow.xib in Resources */,
4C76155C1764C04C0015A1A6 /* GeneralPreferences.xib in Resources */,
4CD884B715BD47080042BBF8 /* DocumentWindow.xib in Resources */,
@@ -2090,6 +2099,7 @@
4CEE46DD181C301D006BF1E5 /* MPAutotypeDaemon.m in Sources */,
4C50CC041F6C18830095629D /* MPCollectionViewItem.m in Sources */,
4CA78C001FD58C92003C8560 /* MPPluginRepository.m in Sources */,
4CAD8AA622CF397B0090B2DD /* MPAutotypeDoctorReportViewController.m in Sources */,
4C8990F71EE978EB0043B48D /* MPDuplicateEntryOptionsWindowController.m in Sources */,
4CA3530B18A53CB800839B0F /* MPKeyMapper.m in Sources */,
4CE298EB1795FC2A00DF7BDB /* MPEntryContextMenuDelegate.m in Sources */,

View File

@@ -0,0 +1,138 @@
<?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" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="MPAutotypeDoctorReportViewController">
<connections>
<outlet property="accessibiltyStatusImageView" destination="Xzw-kJ-WoH" id="jEb-0z-dNB"/>
<outlet property="accessibiltyStatusTextField" destination="Pqa-Ff-7cc" id="h5M-ZN-GhR"/>
<outlet property="screenRecordingStatusImageView" destination="vvZ-Lj-v22" id="7h0-cF-Mxt"/>
<outlet property="screenRecordingStatusTextField" destination="IP0-CP-tlA" id="AfL-XZ-KRk"/>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
<rect key="frame" x="0.0" y="0.0" width="400" height="375"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<stackView orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" translatesAutoresizingMaskIntoConstraints="NO" id="T2c-ZD-ioV">
<rect key="frame" x="20" y="20" width="360" height="0.0"/>
<beginningViews>
<stackView orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="ErP-eL-yKu"/>
</beginningViews>
<visibilityPriorities>
<integer value="1000"/>
</visibilityPriorities>
<customSpacing>
<real value="3.4028234663852886e+38"/>
</customSpacing>
</stackView>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="Xzw-kJ-WoH">
<rect key="frame" x="20" y="339" width="16" height="16"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSStatusAvailable" id="DWu-HI-z3k"/>
</imageView>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Pqa-Ff-7cc">
<rect key="frame" x="42" y="338" width="80" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Accessibility" id="aIL-8W-63g">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="751" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hY9-T0-hke">
<rect key="frame" x="42" y="274" width="340" height="56"/>
<textFieldCell key="cell" controlSize="small" selectable="YES" id="6GI-KJ-Xue">
<font key="font" metaFont="smallSystem"/>
<string key="title">MacPass will send key press events to the system when Autotype or Global Autotype is executed. Since macOS 10.14 Mojave this is only possible, if Accessibility permissions are granted to the application.</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="x9d-0h-hyJ">
<rect key="frame" x="38" y="226" width="236" height="32"/>
<buttonCell key="cell" type="push" title="Open Accessibilty Preferences…" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="8m1-vs-pd5">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openAccessibiltyPreferences:" target="-2" id="aZf-xi-w73"/>
</connections>
</button>
<imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="vvZ-Lj-v22">
<rect key="frame" x="20" y="188" width="16" height="16"/>
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSStatusAvailable" id="kCX-CB-5vQ"/>
</imageView>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" verticalCompressionResistancePriority="751" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="6vq-iM-inn">
<rect key="frame" x="42" y="81" width="340" height="98"/>
<textFieldCell key="cell" controlSize="small" selectable="YES" id="7of-1z-Nfk">
<font key="font" metaFont="smallSystem"/>
<string key="title">MacPass will read every window title when Global Autotype is executed to find a match. Since macOS 10.15 Catalina it is not possible to read any window title, if the user has not granted permissions to record the screen. If you are running macOS 10.15 or higher, MacPass will try to capture the left top most pixel on your screen to initate a request to record the screen. This pixel will not be stored and processed in any way.</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="dek-ho-dPm">
<rect key="frame" x="38" y="33" width="256" height="32"/>
<buttonCell key="cell" type="push" title="Open Screen Sharing Preferences…" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="lgB-Ys-L9R">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openScreenRecordingPreferences:" target="-2" id="rvE-ff-sR2"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="IP0-CP-tlA">
<rect key="frame" x="42" y="187" width="112" height="17"/>
<textFieldCell key="cell" lineBreakMode="clipping" title="Screen Recording" id="9gr-mz-2I4">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="BHb-cd-Q0r">
<rect key="frame" x="20" y="210" width="360" height="5"/>
</box>
</subviews>
<constraints>
<constraint firstItem="IP0-CP-tlA" firstAttribute="top" secondItem="BHb-cd-Q0r" secondAttribute="bottom" constant="8" symbolic="YES" id="0sS-li-mx4"/>
<constraint firstAttribute="trailing" secondItem="hY9-T0-hke" secondAttribute="trailing" constant="20" symbolic="YES" id="1lC-Hg-bzq"/>
<constraint firstItem="vvZ-Lj-v22" firstAttribute="leading" secondItem="Xzw-kJ-WoH" secondAttribute="leading" id="2ZC-Uf-Pe3"/>
<constraint firstItem="vvZ-Lj-v22" firstAttribute="centerY" secondItem="IP0-CP-tlA" secondAttribute="centerY" id="2t3-9h-RIf"/>
<constraint firstItem="Pqa-Ff-7cc" firstAttribute="leading" secondItem="Xzw-kJ-WoH" secondAttribute="trailing" constant="8" symbolic="YES" id="57a-U7-goz"/>
<constraint firstItem="6vq-iM-inn" firstAttribute="top" secondItem="IP0-CP-tlA" secondAttribute="bottom" constant="8" symbolic="YES" id="5ag-ah-YEW"/>
<constraint firstItem="x9d-0h-hyJ" firstAttribute="top" secondItem="hY9-T0-hke" secondAttribute="bottom" constant="20" symbolic="YES" id="Avt-sj-8GL"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="Pqa-Ff-7cc" secondAttribute="trailing" constant="20" symbolic="YES" id="Bmg-tH-M7Q"/>
<constraint firstAttribute="trailing" secondItem="6vq-iM-inn" secondAttribute="trailing" constant="20" symbolic="YES" id="Cga-EU-fSf"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="x9d-0h-hyJ" secondAttribute="trailing" constant="20" symbolic="YES" id="D8o-Gu-s2Y"/>
<constraint firstItem="T2c-ZD-ioV" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="G27-G3-ORS"/>
<constraint firstItem="T2c-ZD-ioV" firstAttribute="top" relation="greaterThanOrEqual" secondItem="dek-ho-dPm" secondAttribute="bottom" constant="20" symbolic="YES" id="GL8-gK-2fL"/>
<constraint firstItem="x9d-0h-hyJ" firstAttribute="leading" secondItem="Pqa-Ff-7cc" secondAttribute="leading" id="J4Y-VM-MZt"/>
<constraint firstAttribute="trailing" secondItem="T2c-ZD-ioV" secondAttribute="trailing" constant="20" symbolic="YES" id="M4d-KM-mLN"/>
<constraint firstItem="dek-ho-dPm" firstAttribute="leading" secondItem="6vq-iM-inn" secondAttribute="leading" id="TaR-vo-kBx"/>
<constraint firstItem="BHb-cd-Q0r" firstAttribute="top" secondItem="x9d-0h-hyJ" secondAttribute="bottom" constant="20" symbolic="YES" id="TlD-dn-LEm"/>
<constraint firstItem="BHb-cd-Q0r" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="YdV-6E-JaO"/>
<constraint firstItem="IP0-CP-tlA" firstAttribute="leading" secondItem="Pqa-Ff-7cc" secondAttribute="leading" id="c76-Ak-WXw"/>
<constraint firstItem="Xzw-kJ-WoH" firstAttribute="centerY" secondItem="Pqa-Ff-7cc" secondAttribute="centerY" id="dF3-uj-K2q"/>
<constraint firstItem="Pqa-Ff-7cc" firstAttribute="top" secondItem="Hz6-mo-xeY" secondAttribute="top" constant="20" symbolic="YES" id="eyJ-B0-kI3"/>
<constraint firstItem="dek-ho-dPm" firstAttribute="top" secondItem="6vq-iM-inn" secondAttribute="bottom" constant="20" symbolic="YES" id="i0R-gb-coZ"/>
<constraint firstItem="hY9-T0-hke" firstAttribute="leading" secondItem="Pqa-Ff-7cc" secondAttribute="leading" id="kLD-8A-d1Y"/>
<constraint firstItem="6vq-iM-inn" firstAttribute="leading" secondItem="IP0-CP-tlA" secondAttribute="leading" id="nby-S7-orD"/>
<constraint firstItem="Xzw-kJ-WoH" firstAttribute="leading" secondItem="Hz6-mo-xeY" secondAttribute="leading" constant="20" symbolic="YES" id="oAi-Zl-LCI"/>
<constraint firstItem="hY9-T0-hke" firstAttribute="top" secondItem="Pqa-Ff-7cc" secondAttribute="bottom" constant="8" symbolic="YES" id="oK3-FK-r0S"/>
<constraint firstAttribute="bottom" secondItem="T2c-ZD-ioV" secondAttribute="bottom" constant="20" symbolic="YES" id="pm7-eL-q1F"/>
<constraint firstAttribute="trailing" secondItem="BHb-cd-Q0r" secondAttribute="trailing" constant="20" symbolic="YES" id="ryW-3O-g6b"/>
<constraint firstAttribute="trailing" relation="greaterThanOrEqual" secondItem="dek-ho-dPm" secondAttribute="trailing" constant="20" symbolic="YES" id="xcq-hp-Ay9"/>
</constraints>
<point key="canvasLocation" x="-409" y="-124"/>
</customView>
</objects>
<resources>
<image name="NSStatusAvailable" width="16" height="16"/>
</resources>
</document>

View File

@@ -26,21 +26,22 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView translatesAutoresizingMaskIntoConstraints="NO" id="1">
<rect key="frame" x="0.0" y="0.0" width="400" height="421"/>
<rect key="frame" x="0.0" y="0.0" width="400" height="449"/>
<subviews>
<box autoresizesSubviews="NO" verticalHuggingPriority="500" borderType="line" title="Autotype" translatesAutoresizingMaskIntoConstraints="NO" id="P9N-HM-wER">
<rect key="frame" x="17" y="115" width="366" height="286"/>
<rect key="frame" x="17" y="115" width="366" height="314"/>
<view key="contentView" id="faU-Ok-HJ3">
<rect key="frame" x="3" y="3" width="360" height="268"/>
<rect key="frame" x="3" y="3" width="360" height="296"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<stackView orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" translatesAutoresizingMaskIntoConstraints="NO" id="j52-9L-k7c">
<rect key="frame" x="16" y="17" width="328" height="241"/>
<rect key="frame" x="16" y="17" width="328" height="269"/>
<beginningViews>
<textField verticalHuggingPriority="750" fixedFrame="YES" preferredMaxLayoutWidth="328" translatesAutoresizingMaskIntoConstraints="NO" id="hMJ-Mo-xOM">
<rect key="frame" x="-2" y="227" width="150" height="14"/>
<textFieldCell key="cell" controlSize="small" title="ReportFromAutotypeDoctor" id="H37-ku-aTc">
<rect key="frame" x="-2" y="227" width="332" height="42"/>
<textFieldCell key="cell" controlSize="small" id="H37-ku-aTc">
<font key="font" metaFont="smallSystem"/>
<string key="title">Autotype might not work properly. Some issues where found that prevent Autotype or Global Autotype to work. Please run the Autotype Doctor to fix those issues.</string>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
@@ -52,7 +53,7 @@
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<action selector="openAccessibiltyPreferences:" target="-2" id="GTg-6Z-6nd"/>
<action selector="runAutotypeDoctor:" target="-2" id="u2q-ab-rQY"/>
</connections>
</button>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="tik-Ar-FJg">
@@ -228,7 +229,7 @@
<constraint firstItem="P9N-HM-wER" firstAttribute="leading" secondItem="1" secondAttribute="leading" constant="20" id="ulV-xL-ldJ"/>
<constraint firstItem="VVs-b5-cX9" firstAttribute="leading" secondItem="P9N-HM-wER" secondAttribute="leading" id="z4a-9C-78h"/>
</constraints>
<point key="canvasLocation" x="-357" y="-1007.5"/>
<point key="canvasLocation" x="-558" y="-1123"/>
</customView>
</objects>
</document>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14313.18" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14490.70" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14313.18"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14490.70"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -317,12 +317,18 @@ CA
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="1176"/>
<menuItem title="Show Password Generator" keyEquivalent="p" id="1200">
<menuItem title="Password Generator" keyEquivalent="p" id="1200">
<modifierMask key="keyEquivalentModifierMask" option="YES" command="YES"/>
<connections>
<action selector="showPasswordCreator:" target="494" id="1202"/>
</connections>
</menuItem>
<menuItem title="Autotype Doctor" id="zWx-Re-iuJ">
<modifierMask key="keyEquivalentModifierMask"/>
<connections>
<action selector="showAutotypeDoctor:" target="494" id="fsq-lt-9gZ"/>
</connections>
</menuItem>
<menuItem isSeparatorItem="YES" id="92">
<modifierMask key="keyEquivalentModifierMask" command="YES"/>
</menuItem>

View File

@@ -42,6 +42,7 @@ APPKIT_EXTERN NSString *const MPDidChangeStoredKeyFilesSettings;
- (IBAction)showPreferences:(id)sender;
- (IBAction)showPluginPrefences:(id)sender;
- (IBAction)showPasswordCreator:(id)sender;
- (IBAction)showAutotypeDoctor:(id)sender;
- (IBAction)createNewDatabase:(id)sender;
- (IBAction)openDatabase:(id)sender;
- (IBAction)showHelp:(id)sender;

View File

@@ -42,6 +42,7 @@
#import "MPWelcomeViewController.h"
#import "MPPlugin.h"
#import "MPEntryContextMenuDelegate.h"
#import "MPAutotypeDoctor.h"
#import "NSApplication+MPAdditions.h"
@@ -334,6 +335,10 @@ typedef NS_OPTIONS(NSInteger, MPAppStartupState) {
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:urlString]];
}
- (void)showAutotypeDoctor:(id)sender {
[MPAutotypeDoctor.defaultDoctor runChecksAndPresentResults];
}
- (void)checkForUpdates:(id)sender {
#if defined(DEBUG) || defined(NO_SPARKLE)
NSAlert *alert = [[NSAlert alloc] init];

View File

@@ -58,7 +58,7 @@ NSString *const kMPProcessIdentifierKey = @"kMPProcessIdentifierKey";
@property (strong) NSRunningApplication *previousApplication; // The application that was active before we got invoked
@property (assign) NSTimeInterval userActionRequested;
@property (strong) id applicationActivationObserver;
@property BOOL shouldRunAutotypeDoctor;
@property (nonatomic, readonly) BOOL hasNecessaryAutotypePermissions;
@end
@implementation MPAutotypeDaemon
@@ -87,8 +87,6 @@ static MPAutotypeDaemon *_sharedInstance;
_enabled = NO;
_targetPID = -1;
_userActionRequested = NSDate.distantPast.timeIntervalSinceReferenceDate;
_shouldRunAutotypeDoctor = NO;
BOOL test = MPAutotypeDoctor.defaultDoctor.hasScreenRecordingPermissions;
[self bind:NSStringFromSelector(@selector(enabled))
toObject:NSUserDefaultsController.sharedUserDefaultsController
withKeyPath:[MPSettingsHelper defaultControllerPathForKey:kMPSettingsKeyEnableGlobalAutotype]
@@ -137,6 +135,10 @@ static MPAutotypeDaemon *_sharedInstance;
}
}
- (BOOL)hasNecessaryAutotypePermissions {
return MPAutotypeDoctor.defaultDoctor.hasNecessaryAutotypePermissions;
}
#pragma mark -
#pragma mark Autotype Invocation
- (void)performAutotypeForEntry:(KPKEntry *)entry {
@@ -174,20 +176,16 @@ static MPAutotypeDaemon *_sharedInstance;
#pragma mark Autotype Execution
- (void)_performAutotypeForEntry:(KPKEntry *)entryOrNil {
if(self.shouldRunAutotypeDoctor) {
[MPAutotypeDoctor.defaultDoctor showPermissionCheckReport];
if(!self.hasNecessaryAutotypePermissions) {
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = NSApp.applicationName;
notification.informativeText = NSLocalizedString(@"AUTOTYPE_NOTIFICATION_MACPASS_IS_MISSING_PERMISSIONS", "Notification: Autotype failed, MacPass has not enough permissions to perform autotype");
notification.actionButtonTitle = NSLocalizedString(@"SHOW_AUTOTYPE_DOCTOR", "Action button in Notification to show the Autotype Doctor");
notification.userInfo = @{ MPUserNotificationTypeKey: MPUserNotificationTypeRunAutotypeDoctor };
notification.showsButtons = YES;
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification];
return;
}
/*if(!self.autotypeSupported) {
NSUserNotification *notification = [[NSUserNotification alloc] init];
notification.title = NSApp.applicationName;
notification.informativeText = NSLocalizedString(@"AUTOTYPE_NOTIFICATION_MACPASS_HAS_NO_ACCESSIBILTY_PERMISSIONS", "Notification: Autotype failed, MacPass has no permission to send key strokes");
notification.actionButtonTitle = NSLocalizedString(@"OPEN_PREFERENCES", "Action button in Notification to show the Accessibilty preferences");
notification.userInfo = @{ MPUserNotificationTypeKey: MPUserNotificationTypeShowAccessibiltyPreferences };
notification.showsButtons = YES;
[NSUserNotificationCenter.defaultUserNotificationCenter deliverNotification:notification];
return;
}*/
NSInteger pid = NSProcessInfo.processInfo.processIdentifier;
if(self.targetPID == pid) {
return; // We do not perform Autotype on ourselves
@@ -228,7 +226,7 @@ static MPAutotypeDaemon *_sharedInstance;
}
MPAutotypeContext *context = [self _autotypeContextForDocuments:documents forWindowTitle:self.targetWindowTitle preferredEntry:entryOrNil];
/* TODO: that's popping up if the mulit selection dialog goes up! */
/* TODO: that's popping up if the multi selection dialog goes up! */
if(self.matchSelectionWindow) {
return; // we present the match selection window, just return
}

View File

@@ -10,21 +10,19 @@
NS_ASSUME_NONNULL_BEGIN
typedef NS_OPTIONS(NSUInteger, MPAutotypeIssue) {
MPAutotypeIssueNoAccessibiltyPermission,
MPAutotypeIssueNoScreenRecordingPermission
};
@interface MPAutotypeDoctor : NSObject
@property (class, readonly, strong) MPAutotypeDoctor *defaultDoctor;
@property (nonatomic, readonly) BOOL hasNecessaryAutotypePermissions; // MacPass has all the permissions it needs to run autotype on the current system
@property (nonatomic, readonly) BOOL hasAccessibiltyPermissions; // 10.14 requires accessibilty access to send key strokes to other applications
@property (nonatomic, readonly) BOOL hasScreenRecordingPermissions; // 10.15 requires screen recording permissions to get window names from other processes
@property (nonatomic, readonly, copy) NSString *localizedErrorDescription; // If any issues are present, this property holds alocalized error description
- (BOOL)hasScreenRecordingPermissions:(NSError *__autoreleasing*)error;
- (BOOL)hasAccessibiltyPermissions:(NSError *__autoreleasing*)error;
- (BOOL)checkPermissionsWithoutUserFeedback;
- (void)showPermissionCheckReport;
- (void)runChecksAndPresentResults;
- (void)openScreenRecordingPreferences;
- (void)openAccessibiltyPreferences;
- (void)openAutomationPreferences;
@end

View File

@@ -9,9 +9,35 @@
#import "MPAutotypeDoctor.h"
#import "MPSettingsHelper.h"
#import "NSApplication+MPAdditions.h"
#import "MPAutotypeDoctorReportViewController.h"
#import "NSError+Messages.h"
@interface MPAutotypeDoctor ()
@interface MPReportItem : NSObject
@property (copy) NSString *statusDescription;
@property (copy) NSString *label;
@property (copy) NSString *actionLabel;
@property BOOL isOK;
@property (weak) id target;
@end
@implementation MPReportItem
- (instancetype)init {
self = [super init];
if(self) {
_isOK = NO;
}
return self;
}
@end
@interface MPAutotypeDoctor () <NSWindowDelegate>
@property (strong) NSWindow *reportWindow;
@end
@implementation MPAutotypeDoctor
@@ -25,90 +51,83 @@
return instance;
}
- (BOOL)hasScreenRecordingPermissions {
- (BOOL)hasNecessaryAutotypePermissions {
if(![self hasAccessibiltyPermissions:NULL]) {
return NO;
}
if(![self hasScreenRecordingPermissions:NULL]) {
return NO;
}
return YES;
}
- (BOOL)hasScreenRecordingPermissions:(NSError *__autoreleasing*)error {
BOOL canRecordScreen = YES;
/* macos 10.14 and lower do not require screen recording permission to get window titles */
if(@available(macos 10.15, *)) {
/*
To minimize the intrusion just make a 1px image of the upper left corner
This way there is no possibilty to access any private data
This way there is no real possibilty to access any private data
*/
CGImageRef screenshot = CGWindowListCreateImage(
CGRectMake(0, 0, 1, 1),
kCGWindowListOptionOnScreenOnly,
kCGNullWindowID,
kCGWindowImageDefault);
if(!screenshot) {
return NO;
BOOL canRecordScreen = !screenshot;
if(!canRecordScreen && error) {
*error = [NSError errorInDomain:MPAutotypeErrorDomain withCode:MPErrorAutotypeIsMissingScreenRecordingPermissions description:NSLocalizedString(@"ERROR_NO_PERMISSION_TO_RECORD_SCREEN", "Error description for missing screen recording permissions")];
}
}
return YES;
return canRecordScreen;
}
- (BOOL)hasAccessibiltyPermissions {
if(@available(macOS 10.14, *)) {
return AXIsProcessTrusted();
}
- (BOOL)hasAccessibiltyPermissions:(NSError *__autoreleasing*)error {
BOOL isTrusted = YES;
/* macOS 10.13 and lower allows us to send key events regardless of accessibilty trust */
return YES;
}
- (NSString *)localizedErrorDescription {
return @"TODO";
}
- (void)showPermissionCheckReport {
// TODO
}
- (BOOL)checkPermissionsWithoutUserFeedback {
// TODO
return YES;
}
- (void)checkForAccessibiltyPermissions {
if(NSApplication.sharedApplication.isRunningTests) {
return; // Do not display pop-up when running tests
}
BOOL hideAlert = NO;
if(nil != [NSUserDefaults.standardUserDefaults objectForKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning]) {
hideAlert = [NSUserDefaults.standardUserDefaults boolForKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning];
}
if(hideAlert || self.hasAccessibiltyPermissions) {
return;
}
else {
NSAlert *alert = [[NSAlert alloc] init];
alert.alertStyle = NSWarningAlertStyle;
alert.messageText = NSLocalizedString(@"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_MESSAGE_TEXT", @"Alert message displayed when Autotype performs self check and lacks accessibilty permissions");
alert.informativeText = NSLocalizedString(@"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_INFORMATIVE_TEXT", @"Alert informative text displayed when Autotype performs self check and lacks accessibilty permissions");
alert.showsSuppressionButton = YES;
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OK", @"Button in dialog to leave autotype disabled and continiue!")];
[alert addButtonWithTitle:NSLocalizedString(@"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OPEN_PREFERENCES", @"Button in dialog to open accessibilty preferences pane!")];
NSModalResponse returnCode = [alert runModal];
BOOL suppressWarning = (alert.suppressionButton.state == NSOnState);
[NSUserDefaults.standardUserDefaults setBool:suppressWarning forKey:kMPSettingsKeyAutotypeHideAccessibiltyWarning];
switch(returnCode) {
case NSAlertFirstButtonReturn: {
/* ok, ignore */
break;
}
case NSAlertSecondButtonReturn:
/* open prefs */
[self openAccessibiltyPreferences];
break;
default:
break;
if(@available(macOS 10.14, *)) {
isTrusted = AXIsProcessTrusted();
if(!isTrusted && error) {
*error = [NSError errorInDomain:MPAutotypeErrorDomain withCode:MPErrorAutotypeIsMissingAccessibiltyPermissions description:NSLocalizedString(@"ERROR_NO_ACCESSIBILTY_PERMISSIONS", "Error description for missing accessibilty permissions")];
}
}
return isTrusted;
}
- (void)openAccessibiltyPreferences {
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security?Privacy_Accessibility"]];
}
- (void)checkForWindowTitlePermissions {
- (void)openScreenRecordingPreferences {
//TODO fix this in macOS 10.15 to use the correct URL
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security"]];
}
- (void)openAutomationPreferences {
[NSWorkspace.sharedWorkspace openURL:[NSURL URLWithString:@"x-apple.systempreferences:com.apple.preference.security?Privacy_Automation"]];
}
- (void)runChecksAndPresentResults {
if(!self.reportWindow) {
self.reportWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSWindowStyleMaskTitled|NSWindowStyleMaskClosable|NSWindowStyleMaskResizable
backing:NSBackingStoreBuffered
defer:NO];
self.reportWindow.releasedWhenClosed = NO;
self.reportWindow.title = NSLocalizedString(@"AUTOTYPE_DOCTOR_RESULTS_WINDOW_TITLE", @"Window title for the stand-alone password creator window");
self.reportWindow.delegate = self;
}
MPAutotypeDoctorReportViewController *vc = [[MPAutotypeDoctorReportViewController alloc] init];
self.reportWindow.contentViewController = vc;
[self.reportWindow center];
[self.reportWindow makeKeyAndOrderFront:vc];
}
- (void)windowWillClose:(NSNotification *)notification {
if(notification.object == self.reportWindow) {
self.reportWindow = nil;
}
}
@end

View File

@@ -0,0 +1,28 @@
//
// MPAutotypeDoctorReportViewController.h
// MacPass
//
// Created by Michael Starke on 05.07.19.
// Copyright © 2019 HicknHack Software GmbH. All rights reserved.
//
#import <Cocoa/Cocoa.h>
NS_ASSUME_NONNULL_BEGIN
@interface MPAutotypeDoctorReportViewController : NSViewController
@property (strong) IBOutlet NSImageView *accessibiltyStatusImageView;
@property (strong) IBOutlet NSTextField *accessibiltyStatusTextField;
@property (strong) IBOutlet NSImageView *screenRecordingStatusImageView;
@property (strong) IBOutlet NSTextField *screenRecordingStatusTextField;
- (IBAction)openAccessibiltyPreferences:(id)sender;
- (IBAction)openScreenRecordingPreferences:(id)sender;
- (IBAction)openAutomationPreferences:(id)sender;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,67 @@
//
// MPAutotypeDoctorReportViewController.m
// MacPass
//
// Created by Michael Starke on 05.07.19.
// Copyright © 2019 HicknHack Software GmbH. All rights reserved.
//
#import "MPAutotypeDoctorReportViewController.h"
#import "MPAutotypeDoctor.h"
@implementation MPAutotypeDoctorReportViewController
- (NSNibName)nibName {
return @"AutotypeDoctorReportViewController";
}
- (void)viewDidLoad {
[super viewDidLoad];
[self _updateView];
}
- (void)openAccessibiltyPreferences:(id)sender {
[MPAutotypeDoctor.defaultDoctor openAccessibiltyPreferences];
}
- (void)openScreenRecordingPreferences:(id)sender {
[MPAutotypeDoctor.defaultDoctor openScreenRecordingPreferences];
}
- (void)openAutomationPreferences:(id)sender {
[MPAutotypeDoctor.defaultDoctor openAutomationPreferences];
}
- (void)_updateView {
NSError *error;
if([MPAutotypeDoctor.defaultDoctor hasAccessibiltyPermissions:&error]) {
self.accessibiltyStatusImageView.image = [NSImage imageNamed:NSImageNameStatusAvailable];
self.accessibiltyStatusTextField.stringValue = NSLocalizedString(@"AUTOTYPE_STATUS_ACCESSIBILTY_PERMISSIONS_OK", "Status lable when no issue were found in accessibilty");
}
else {
self.accessibiltyStatusImageView.image = [NSImage imageNamed:NSImageNameStatusUnavailable];
if(error && error.localizedDescription) {
self.accessibiltyStatusTextField.stringValue = error.localizedDescription;
}
else {
self.accessibiltyStatusTextField.stringValue = NSLocalizedString(@"AUTOTYPE_STATUS_NO_ACCESSIBILTY_PERMISSIONS", "Status MacPass has no accessibilty permissions");
}
}
if([MPAutotypeDoctor.defaultDoctor hasScreenRecordingPermissions:&error]) {
self.screenRecordingStatusImageView.image = [NSImage imageNamed:NSImageNameStatusAvailable];
self.screenRecordingStatusTextField.stringValue = NSLocalizedString(@"AUTOTYPE_STATUS_SCREEN_RECORDING_PERMISSIONS_OK", "Status lable when no issue were found in screen recording permissions");
}
else {
self.screenRecordingStatusImageView.image = [NSImage imageNamed:NSImageNameStatusUnavailable];
if(error && error.localizedDescription) {
self.screenRecordingStatusTextField.stringValue = error.localizedDescription;
}
else {
self.screenRecordingStatusTextField.stringValue = NSLocalizedString(@"AUTOTYPE_STATUS_NO_SCREEN_RECORDING_PERMISSIONS", "Status MacPass has no screen recording permissions");
}
}
}
@end

View File

@@ -168,7 +168,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
NSRecoveryAttempterErrorKey : recovery
};
if(outError != NULL) {
*outError = [NSError errorWithDomain:MPErrorDomain code:MPErrorNoPasswordOrKeyFile userInfo:userInfo];
*outError = [NSError errorWithDomain:MPDefaultErrorDomain code:MPErrorNoPasswordOrKeyFile userInfo:userInfo];
}
return NO;
}
@@ -181,7 +181,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
if(!self.compositeKey.hasPasswordOrKeyFile) {
if(outError != NULL) {
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(@"WARNING_ON_SAVE_NO_PASSWORD_OR_KEY_SET", "") };
*outError = [NSError errorWithDomain:MPErrorDomain code:0 userInfo:userInfo];
*outError = [NSError errorWithDomain:MPDefaultErrorDomain code:0 userInfo:userInfo];
}
return nil; // Saving without a password/key is not possible
}
@@ -190,7 +190,7 @@ NSString *const MPDocumentGroupKey = @"MPDocumentGrou
if(format == KPKDatabaseFormatUnknown) {
if(outError != NULL) {
NSDictionary *userInfo = @{ NSLocalizedDescriptionKey: NSLocalizedString(@"UNKNOWN_FILE_VERSION", "") };
*outError = [NSError errorWithDomain:MPErrorDomain code:0 userInfo:userInfo];
*outError = [NSError errorWithDomain:MPDefaultErrorDomain code:0 userInfo:userInfo];
}
return nil; // We do not know what version to save!
}

View File

@@ -44,6 +44,6 @@
/* Preview */
@property (strong) IBOutlet NSButton *enableQuicklookCheckBox;
- (IBAction)openAccessibiltyPreferences:(id)sender;
- (IBAction)runAutotypeDoctor:(id)sender;
@end

View File

@@ -106,7 +106,7 @@
- (void)_updateAccessabilityWarning {
BOOL hasAutotypeSupport = MPAutotypeDoctor.defaultDoctor.hasAccessibiltyPermissions;
BOOL hasAutotypeSupport = MPAutotypeDoctor.defaultDoctor.hasNecessaryAutotypePermissions;
if(hasAutotypeSupport) {
[self.autotypeStackView setVisibilityPriority:NSStackViewVisibilityPriorityNotVisible forView:self.autotypeWarningTextField];
@@ -118,7 +118,7 @@
}
}
- (void)openAccessibiltyPreferences:(id)sender {
[MPAutotypeDoctor.defaultDoctor showPermissionCheckReport];
- (void)runAutotypeDoctor:(id)sender {
[MPAutotypeDoctor.defaultDoctor runChecksAndPresentResults];
}
@end

View File

@@ -68,7 +68,7 @@ APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchTitle; //
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchURL; // Autotype lookup includes entry URL
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchHost; // Autotype lookup includes host part of entry URL
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeMatchTags; // Autotype lookup includes tags for entries
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotypeHideAccessibiltyWarning; // Do not show an alert, when MacPass has no support for Autotype
APPKIT_EXTERN NSString *const kMPSettingsKeyAutotpyeHideMissingPermissionsWarning;
/* Search */
APPKIT_EXTERN NSString *const kMPSettingsKeyEntrySearchFilterContext;

View File

@@ -59,7 +59,7 @@ NSString *const kMPSettingsKeyAutotypeMatchTitle = @"Autoty
NSString *const kMPSettingsKeyAutotypeMatchURL = @"AutotypeMatchURL";
NSString *const kMPSettingsKeyAutotypeMatchHost = @"AutotypeMatchHost";
NSString *const kMPSettingsKeyAutotypeMatchTags = @"AutotypeMatchTags";
NSString *const kMPSettingsKeyAutotypeHideAccessibiltyWarning = @"AutotypeHideAccessibiltyWarning";
NSString *const kMPSettingsKeyAutotpyeHideMissingPermissionsWarning = @"AutotpyeHideMissingPermissionsWarning";
NSString *const kMPSettingsKeyEntrySearchFilterContext = @"EntrySearchFilterContext";
@@ -96,7 +96,7 @@ NSString *const kMPDeprecatedSettingsKeyEnableHttpServer = @"En
NSString *const kMPDeprecatedSettingsKeyShowMenuItem = @"ShowMenuItem";
NSString *const kMPDeprecatedSettingsKeyDefaultPasswordRounds = @"KeyDefaultPasswordRounds";
NSString *const kMPDepricatedSettingsKeyLoadUnsecurePlugins = @"MPLoadUnsecurePlugins";
NSString *const kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning = @"AutotypeHideAccessibiltyWarning";
@implementation MPSettingsHelper
@@ -181,7 +181,8 @@ NSString *const kMPDepricatedSettingsKeyLoadUnsecurePlugins = @"MP
kMPDeprecatedSettingsKeyHttpPort,
kMPDeprecatedSettingsKeyEnableHttpServer,
kMPDeprecatedSettingsKeyShowMenuItem,
kMPDepricatedSettingsKeyLoadUnsecurePlugins
kMPDepricatedSettingsKeyLoadUnsecurePlugins,
kMPDepricatedSettingsKeyAutotypeHideAccessibiltyWarning
];
});
return deprecatedSettings;

View File

@@ -25,7 +25,7 @@
FOUNDATION_EXTERN NSString *const MPUserNotificationTypeKey;
FOUNDATION_EXTERN NSString *const MPUserNotificationTypeAutotypeFeedback;
FOUNDATION_EXTERN NSString *const MPUserNotificationTypeAutotypeOpenDocumentRequest;
FOUNDATION_EXTERN NSString *const MPUserNotificationTypeShowAccessibiltyPreferences;
FOUNDATION_EXTERN NSString *const MPUserNotificationTypeRunAutotypeDoctor;
@interface MPUserNotificationCenterDelegate : NSObject <NSUserNotificationCenterDelegate>

View File

@@ -27,7 +27,7 @@
NSString *const MPUserNotificationTypeKey = @"MPUserNotificationTypeKey";
NSString *const MPUserNotificationTypeAutotypeFeedback = @"MPUserNotificationTypeAutotypeFeedback";
NSString *const MPUserNotificationTypeAutotypeOpenDocumentRequest = @"MPUserNotificationTypeAutotypeOpenDocumentRequest";
NSString *const MPUserNotificationTypeShowAccessibiltyPreferences = @"MPUserNotificationTypeShowAccessibiltyPreferences";
NSString *const MPUserNotificationTypeRunAutotypeDoctor = @"MPUserNotificationTypeRunAutotypeDoctor";
@implementation MPUserNotificationCenterDelegate
@@ -45,8 +45,8 @@ NSString *const MPUserNotificationTypeShowAccessibiltyPreferences = @"MPUserNoti
if([notificationType isEqualToString:MPUserNotificationTypeAutotypeOpenDocumentRequest]) {
[((MPDocumentController*)NSDocumentController.sharedDocumentController) reopenLastDocument];
}
else if([notificationType isEqualToString:MPUserNotificationTypeShowAccessibiltyPreferences]) {
[MPAutotypeDoctor.defaultDoctor showPermissionCheckReport];
else if([notificationType isEqualToString:MPUserNotificationTypeRunAutotypeDoctor]) {
[MPAutotypeDoctor.defaultDoctor runChecksAndPresentResults];
}
}
@@ -55,7 +55,7 @@ NSString *const MPUserNotificationTypeShowAccessibiltyPreferences = @"MPUserNoti
if([notificationType isEqualToString:MPUserNotificationTypeAutotypeFeedback]) {
return YES;
}
if([notificationType isEqualToString:MPUserNotificationTypeShowAccessibiltyPreferences]) {
if([notificationType isEqualToString:MPUserNotificationTypeRunAutotypeDoctor]) {
return YES;
}
return NO;

View File

@@ -22,16 +22,20 @@
#import <Foundation/Foundation.h>
FOUNDATION_EXPORT NSString *const MPErrorDomain;
FOUNDATION_EXPORT NSString *const MPDefaultErrorDomain;
FOUNDATION_EXPORT NSString *const MPAutotypeErrorDomain;
typedef NS_ENUM(NSInteger, MPErrorCodes) {
MPErrorNoPasswordOrKeyFile = 10000,
MPErrorInvalidPlugin
MPErrorInvalidPlugin,
MPErrorAutotypeIsMissingAccessibiltyPermissions,
MPErrorAutotypeIsMissingScreenRecordingPermissions
};
@interface NSError (Messages)
+ (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description;
+ (NSError *)errorInDomain:(NSString *)domain withCode:(NSInteger)code description:(NSString *)description;
@property (nonatomic, readonly, copy) NSString *descriptionForErrorCode;

View File

@@ -22,7 +22,8 @@
#import "NSError+Messages.h"
NSString *const MPErrorDomain = @"com.hicknhack.macpass.error";
NSString *const MPDefaultErrorDomain = @"com.hicknhack.macpass.error";
NSString *const MPAutotypeErrorDomain = @"com.hicknhack.macpass.error.autotype";
@implementation NSError (Messages)
@@ -30,7 +31,12 @@ NSString *const MPErrorDomain = @"com.hicknhack.macpass.error";
return [NSString stringWithFormat:@"%@ (%ld)", self.localizedDescription, self.code ];
}
+ (NSError *)errorInDomain:(NSString *)domain withCode:(NSInteger)code description:(NSString *)description {
return [[NSError alloc] initWithDomain:domain code:code userInfo:@{ NSLocalizedDescriptionKey: description }];
}
+ (NSError *)errorWithCode:(NSInteger)code description:(NSString *)description {
return [[NSError alloc] initWithDomain:MPErrorDomain code:code userInfo:@{ NSLocalizedDescriptionKey: description }];
return [NSError errorInDomain:MPDefaultErrorDomain withCode:code description:description];
}
@end

View File

@@ -10,14 +10,14 @@
/* Class = "NSButtonCell"; title = "Enable Quicklook Preview"; ObjectID = "ERs-ct-Eyx"; */
"ERs-ct-Eyx.title" = "Enable Quicklook Preview";
/* Class = "NSTextFieldCell"; title = "Autotype is not available, because MacPass is not allowed to control your computer. To enable Autotype, go to the Security and Privacy Preferences and add MacPass to the Accessibilty group. Changes require a restart of MacPass."; ObjectID = "H37-ku-aTc"; */
"H37-ku-aTc.title" = "Autotype is not available, because MacPass is not allowed to control your computer. To enable Autotype, go to the Security and Privacy Preferences and add MacPass to the Accessibilty group. Changes require a restart of MacPass.";
/* Class = "NSTextFieldCell"; title = "Autotype might not work properly. Some issues where found that prevent Autotype or Global Autotype to work. Please run the Autotype Doctor to fix those issues."; ObjectID = "H37-ku-aTc"; */
"H37-ku-aTc.title" = "Autotype might not work properly. Some issues where found that prevent Autotype or Global Autotype to work. Please run the Autotype Doctor to fix those issues.";
/* Class = "NSTextFieldCell"; title = "Shortcut is missing Key"; ObjectID = "Lxp-wI-yQy"; */
"Lxp-wI-yQy.title" = "Shortcut is missing Key";
/* Class = "NSButtonCell"; title = "Open Preferences…"; ObjectID = "NP0-R3-m6n"; */
"NP0-R3-m6n.title" = "Open Preferences…";
/* Class = "NSButtonCell"; title = "Run Autotype Doctor…"; ObjectID = "NP0-R3-m6n"; */
"NP0-R3-m6n.title" = "Run Autotype Doctor…";
/* Class = "NSBox"; title = "Autotype"; ObjectID = "P9N-HM-wER"; */
"P9N-HM-wER.title" = "Autotype";

View File

@@ -37,18 +37,6 @@
/* Action to add an entry via template */
"ADD_TREMPLATE_ENTRY" = "Create Template Entry";
/* Button in dialog to leave autotype disabled and continiue! */
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OK" = "Keep Autotype disabled.";
/* Button in dialog to open accessibilty preferences pane! */
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_BUTTON_OPEN_PREFERENCES" = "Open Accessibilty Preferences…";
/* Alert informative text displayed when Autotype performs self check and lacks accessibilty permissions */
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_INFORMATIVE_TEXT" = "The system prevents MacPass from sending key strokes to other Applications. To enable Autotype please grant MacPass Accessibilty rights in the privacy preferences.";
/* Alert message displayed when Autotype performs self check and lacks accessibilty permissions */
"ALERT_AUTOTYPE_MISSING_ACCESSIBILTY_PERMISSIONS_MESSAGE_TEXT" = "MacPass cannot perform Autotype";
/* Button in dialog to leave plugin ds disabled and continiue! */
"ALERT_INCOMPATIBLE_PLUGINS_ENCOUNTERED_BUTTON_OK" = "OK";
@@ -101,6 +89,9 @@
/* Menu item for automatic trash creation */
"AUTOCREATE_TRASH_FOLDER" = "Create Automatically";
/* Window title for the stand-alone password creator window */
"AUTOTYPE_DOCTOR_RESULTS_WINDOW_TITLE" = "Autotype Doctor";
/* Inherit autotype settings menu item */
"AUTOTYPE_INHERIT" = "Inherit Autotype Settings";
@@ -122,6 +113,18 @@
/* Notification: Autotype found a single match for %@ (string placeholder). */
"AUTOTYPE_OVERLAY_SINGLE_MATCH_FOR_%@" = "Found Match for %@!";
/* Status lable when no issue were found in accessibilty */
"AUTOTYPE_STATUS_ACCESSIBILTY_PERMISSIONS_OK" = "MacPass has permission to control your computer (Accessibilty)";
/* Status MacPass has no accessibilty permissions */
"AUTOTYPE_STATUS_NO_ACCESSIBILTY_PERMISSIONS" = "MacPass has no permission to control your computer (Accessibilty)";
/* Status MacPass has no screen recording permissions */
"AUTOTYPE_STATUS_NO_SCREEN_RECORDING_PERMISSIONS" = "MacPass has no permission to record your screen";
/* Status lable when no issue were found in screen recording permissions */
"AUTOTYPE_STATUS_SCREEN_RECORDING_PERMISSIONS_OK" = "MacPass has permission to record your screen";
/* Notficication: Autotype timed out */
"AUTOTYPE_TIMED_OUT" = "Autotype timed out.";
@@ -325,6 +328,12 @@
/* Error description given when adding an invalid plugin */
"ERROR_INVALID_PLUGIN" = "Invalid plugin";
/* Error description for missing accessibilty permissions */
"ERROR_NO_ACCESSIBILTY_PERMISSIONS" = "MacPass has no permission to control your computer (Accessibilty)";
/* Error description for missing screen recording permissions */
"ERROR_NO_PERMISSION_TO_RECORD_SCREEN" = "MacPass has no permission to record your screen";
/* Passwords do not match */
"ERROR_PASSWORD_MISSMATCH" = "Passwords do not match!";
@@ -486,9 +495,6 @@
/* Action button in Notification to open a document */
"OPEN_DOCUMENT" = "Open Document";
/* Action button in Notification to show the Accessibilty preferences */
"OPEN_PREFERENCES" = "Open Accessiblity Preferences…";
/* Menu item to open the URL with the default application */
"OPEN_URL" = "Open URL";
@@ -660,6 +666,9 @@
/* Checkbox in dialog to set the selection as default file change strategy! */
"SET_AS_DEFAULT_FILE_CHANGE_STRATEGY" = "Use this method as default. You can change this at any time in the preferences.";
/* Action button in Notification to show the Autotype Doctor */
"SHOW_AUTOTYPE_DOCTOR" = "SHOW_AUTOTYPE_DOCTOR";
/* Menu item to show the history of the selected entry
Toolbar item to toggle history display */
"SHOW_HISTORY" = "Show History";

Binary file not shown.