Refactor and merge code of extensions
This commit is contained in:
parent
87d1dd5be1
commit
776884e894
13 changed files with 391 additions and 446 deletions
|
|
@ -47,8 +47,7 @@
|
|||
30697C4721F63CAB0064FCAC /* PasscodeLock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4221F63CAB0064FCAC /* PasscodeLock.swift */; };
|
||||
30697C4821F63CAB0064FCAC /* PasswordStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4321F63CAB0064FCAC /* PasswordStore.swift */; };
|
||||
30697C4B21F63D460064FCAC /* ExtensionViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4921F63D460064FCAC /* ExtensionViewController.swift */; };
|
||||
30697C4C21F63D460064FCAC /* PasscodeExtensionDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4A21F63D460064FCAC /* PasscodeExtensionDisplay.swift */; };
|
||||
30697C5021F63D7F0064FCAC /* OnePasswordExtensionConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4F21F63D7F0064FCAC /* OnePasswordExtensionConstants.swift */; };
|
||||
30697C5021F63D7F0064FCAC /* ExtensionConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C4F21F63D7F0064FCAC /* ExtensionConstants.swift */; };
|
||||
30697C5321F63E0B0064FCAC /* PasscodeExtensionDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */; };
|
||||
30697C5421F63E0B0064FCAC /* CredentialProviderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */; };
|
||||
30697C5F21F674800064FCAC /* String+UtilitiesTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */; };
|
||||
|
|
@ -104,6 +103,14 @@
|
|||
9A55C158259E785600FA8FD9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; };
|
||||
9A55C15F259E785700FA8FD9 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC917BDD1E2E8231000FDF54 /* Assets.xcassets */; };
|
||||
9A55C185259E8C5600FA8FD9 /* PasswordsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A55C184259E8C5600FA8FD9 /* PasswordsViewController.swift */; };
|
||||
9A5865F025AA944B006719C2 /* SearchPassword.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A5865EF25AA944B006719C2 /* SearchPassword.storyboard */; };
|
||||
9A58661425AAA4C1006719C2 /* PasscodeExtensionDisplay.swift in Sources */ = {isa = PBXBuildFile; fileRef = 30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */; };
|
||||
9A58661B25AAA946006719C2 /* PasswordsTableDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9EBC259EA4C50027CE15 /* PasswordsTableDataSource.swift */; };
|
||||
9A58662225AAAA3A006719C2 /* PasswordsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A55C184259E8C5600FA8FD9 /* PasswordsViewController.swift */; };
|
||||
9A58662925AAAA79006719C2 /* PasswordSelectionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9ECB259ECB410027CE15 /* PasswordSelectionDelegate.swift */; };
|
||||
9A58664825AAAB7E006719C2 /* SearchPassword.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9A5865EF25AA944B006719C2 /* SearchPassword.storyboard */; };
|
||||
9A58665125AADB76006719C2 /* CredentialProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A58665025AADB76006719C2 /* CredentialProvider.swift */; };
|
||||
9A58665825AADC49006719C2 /* PasswordDecryptor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9EEF259EE01A0027CE15 /* PasswordDecryptor.swift */; };
|
||||
9A5D06EE25A56F0800FA59D4 /* PasswordTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */; };
|
||||
9A5D06F525A56F0E00FA59D4 /* PasswordTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */; };
|
||||
9A5D070225A5769A00FA59D4 /* PasswordTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9A8F9EE1259EDD520027CE15 /* PasswordTableViewCell.swift */; };
|
||||
|
|
@ -314,8 +321,7 @@
|
|||
30697C4221F63CAB0064FCAC /* PasscodeLock.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeLock.swift; sourceTree = "<group>"; };
|
||||
30697C4321F63CAB0064FCAC /* PasswordStore.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasswordStore.swift; sourceTree = "<group>"; };
|
||||
30697C4921F63D460064FCAC /* ExtensionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionViewController.swift; sourceTree = "<group>"; };
|
||||
30697C4A21F63D460064FCAC /* PasscodeExtensionDisplay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeExtensionDisplay.swift; sourceTree = "<group>"; };
|
||||
30697C4F21F63D7F0064FCAC /* OnePasswordExtensionConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnePasswordExtensionConstants.swift; sourceTree = "<group>"; };
|
||||
30697C4F21F63D7F0064FCAC /* ExtensionConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ExtensionConstants.swift; sourceTree = "<group>"; };
|
||||
30697C5121F63E0B0064FCAC /* PasscodeExtensionDisplay.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PasscodeExtensionDisplay.swift; sourceTree = "<group>"; };
|
||||
30697C5221F63E0B0064FCAC /* CredentialProviderViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CredentialProviderViewController.swift; sourceTree = "<group>"; };
|
||||
30697C5E21F674800064FCAC /* String+UtilitiesTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+UtilitiesTest.swift"; sourceTree = "<group>"; };
|
||||
|
|
@ -374,6 +380,8 @@
|
|||
9A1EF0B524C50EE00074FEAC /* passBetaExtension.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = passBetaExtension.entitlements; sourceTree = "<group>"; };
|
||||
9A1EF0B624C50FEA0074FEAC /* passBetaShortcuts.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = passBetaShortcuts.entitlements; sourceTree = "<group>"; };
|
||||
9A55C184259E8C5600FA8FD9 /* PasswordsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordsViewController.swift; sourceTree = "<group>"; };
|
||||
9A5865EF25AA944B006719C2 /* SearchPassword.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = SearchPassword.storyboard; sourceTree = "<group>"; };
|
||||
9A58665025AADB76006719C2 /* CredentialProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CredentialProvider.swift; sourceTree = "<group>"; };
|
||||
9A652413244BB33300DA0A41 /* UIAlertActionExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIAlertActionExtension.swift; sourceTree = "<group>"; };
|
||||
9A8F9EBC259EA4C50027CE15 /* PasswordsTableDataSource.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordsTableDataSource.swift; sourceTree = "<group>"; };
|
||||
9A8F9ECB259ECB410027CE15 /* PasswordSelectionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PasswordSelectionDelegate.swift; sourceTree = "<group>"; };
|
||||
|
|
@ -705,6 +713,14 @@
|
|||
path = Crypto;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9A58664F25AADB66006719C2 /* Services */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A58665025AADB76006719C2 /* CredentialProvider.swift */,
|
||||
);
|
||||
path = Services;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
9A8F9EBB259EA4A80027CE15 /* Services */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
|
|
@ -727,7 +743,6 @@
|
|||
isa = PBXGroup;
|
||||
children = (
|
||||
30697C4921F63D460064FCAC /* ExtensionViewController.swift */,
|
||||
30697C4A21F63D460064FCAC /* PasscodeExtensionDisplay.swift */,
|
||||
);
|
||||
path = Controllers;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -735,7 +750,7 @@
|
|||
A2168A811EFD4322005EA873 /* Helpers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
30697C4F21F63D7F0064FCAC /* OnePasswordExtensionConstants.swift */,
|
||||
30697C4F21F63D7F0064FCAC /* ExtensionConstants.swift */,
|
||||
);
|
||||
path = Helpers;
|
||||
sourceTree = "<group>";
|
||||
|
|
@ -749,6 +764,7 @@
|
|||
A239F59E2158C08C00576CBF /* passAutoFillExtension.entitlements */,
|
||||
9A1EF0B424C50E780074FEAC /* passBetaAutoFillExtension.entitlements */,
|
||||
A239F59A2158C08C00576CBF /* MainInterface.storyboard */,
|
||||
9A5865EF25AA944B006719C2 /* SearchPassword.storyboard */,
|
||||
A239F59D2158C08C00576CBF /* Info.plist */,
|
||||
);
|
||||
path = passAutoFillExtension;
|
||||
|
|
@ -800,6 +816,7 @@
|
|||
A26700251EEC466A00176B8A /* passExtension */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
9A58664F25AADB66006719C2 /* Services */,
|
||||
A2168A801EFD431A005EA873 /* Controllers */,
|
||||
A2168A811EFD4322005EA873 /* Helpers */,
|
||||
A2367B9F1EF0387000C8FE8B /* Assets.xcassets */,
|
||||
|
|
@ -1282,6 +1299,7 @@
|
|||
556EC3D422335C5F00934F9C /* Localizable.stringsdict in Resources */,
|
||||
A239F59C2158C08C00576CBF /* MainInterface.storyboard in Resources */,
|
||||
9A55C158259E785600FA8FD9 /* Assets.xcassets in Resources */,
|
||||
9A5865F025AA944B006719C2 /* SearchPassword.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -1313,6 +1331,7 @@
|
|||
A26700371EEC475600176B8A /* passProcessor.js in Resources */,
|
||||
A2367BA01EF0387000C8FE8B /* Assets.xcassets in Resources */,
|
||||
A267002A1EEC466A00176B8A /* MainInterface.storyboard in Resources */,
|
||||
9A58664825AAAB7E006719C2 /* SearchPassword.storyboard in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -1638,9 +1657,14 @@
|
|||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
9A5D070225A5769A00FA59D4 /* PasswordTableViewCell.swift in Sources */,
|
||||
30697C4C21F63D460064FCAC /* PasscodeExtensionDisplay.swift in Sources */,
|
||||
30697C5021F63D7F0064FCAC /* OnePasswordExtensionConstants.swift in Sources */,
|
||||
9A58665825AADC49006719C2 /* PasswordDecryptor.swift in Sources */,
|
||||
9A58665125AADB76006719C2 /* CredentialProvider.swift in Sources */,
|
||||
9A58662225AAAA3A006719C2 /* PasswordsViewController.swift in Sources */,
|
||||
9A58662925AAAA79006719C2 /* PasswordSelectionDelegate.swift in Sources */,
|
||||
30697C5021F63D7F0064FCAC /* ExtensionConstants.swift in Sources */,
|
||||
9A58661425AAA4C1006719C2 /* PasscodeExtensionDisplay.swift in Sources */,
|
||||
30697C4B21F63D460064FCAC /* ExtensionViewController.swift in Sources */,
|
||||
9A58661B25AAA946006719C2 /* PasswordsTableDataSource.swift in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
@ -1967,7 +1991,7 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = pass/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
@ -1993,7 +2017,7 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2008,6 +2032,7 @@
|
|||
baseConfigurationReference = C4C702DBCBA2374D32295603 /* Pods-passExtension.beta.xcconfig */;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = NO;
|
||||
APP_DISPLAY_NAME = "Pass Beta";
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
|
|
@ -2018,13 +2043,13 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
OTHER_CFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).find-login-action-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passExtension;
|
||||
PROVISIONING_PROFILE = "cbd86628-6f3e-40f3-b518-20d2330db545";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforiosbeta.find-login-action-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -2057,7 +2082,7 @@
|
|||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passKit/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
@ -2090,7 +2115,7 @@
|
|||
"$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework/Headers/",
|
||||
);
|
||||
INFOPLIST_FILE = passKitTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2120,7 +2145,7 @@
|
|||
MARKETING_VERSION = 0.11.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "me.mssun.passforiosbeta.auto-fill-credential-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passAutoFillExtension;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforiosbeta.auto-fill-credential-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
|
|
@ -2178,7 +2203,7 @@
|
|||
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "me.mssun.passforios.auto-fill-credential-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passAutoFillExtension;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.auto-fill-credential-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
|
|
@ -2207,7 +2232,7 @@
|
|||
MARKETING_VERSION = 0.11.0;
|
||||
MTL_FAST_MATH = YES;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "me.mssun.passforios.auto-fill-credential-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passAutoFillExtension;
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.auto-fill-credential-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
STRIP_INSTALLED_PRODUCT = NO;
|
||||
|
|
@ -2239,7 +2264,7 @@
|
|||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passKit/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
@ -2284,7 +2309,7 @@
|
|||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passKit/Info.plist;
|
||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited)";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
@ -2317,7 +2342,7 @@
|
|||
"$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework/Headers/",
|
||||
);
|
||||
INFOPLIST_FILE = passKitTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2339,7 +2364,7 @@
|
|||
"$(SRCROOT)/Carthage/Build/iOS/ObjectiveGit.framework/Headers/",
|
||||
);
|
||||
INFOPLIST_FILE = passKitTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passKitTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2354,6 +2379,7 @@
|
|||
baseConfigurationReference = DD224E7F8C867E6CD0BFE9D5 /* Pods-passExtension.debug.xcconfig */;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = NO;
|
||||
APP_DISPLAY_NAME = Pass;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
|
|
@ -2364,13 +2390,13 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
OTHER_CFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).find-login-action-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passExtension;
|
||||
PROVISIONING_PROFILE = "d25c9029-bca6-4b2d-b04e-4abc9d232740";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match Development me.mssun.passforios.find-login-action-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -2385,6 +2411,7 @@
|
|||
baseConfigurationReference = 62DEE9943E0F2B8C79E3FC5B /* Pods-passExtension.release.xcconfig */;
|
||||
buildSettings = {
|
||||
APPLICATION_EXTENSION_API_ONLY = NO;
|
||||
APP_DISPLAY_NAME = Pass;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO;
|
||||
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
|
||||
|
|
@ -2395,13 +2422,13 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passExtension/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @executable_path/../../Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
OTHER_CFLAGS = "$(inherited)";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).find-login-action-extension";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PRODUCT_NAME = passExtension;
|
||||
PROVISIONING_PROFILE = "cbd86628-6f3e-40f3-b518-20d2330db545";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "match AppStore me.mssun.passforios.find-login-action-extension";
|
||||
SKIP_INSTALL = YES;
|
||||
|
|
@ -2420,7 +2447,7 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2439,7 +2466,7 @@
|
|||
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = passTests/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.3;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||
PRODUCT_BUNDLE_IDENTIFIER = "$(PRODUCT_BUNDLE_IDENTIFIER).passTests";
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
|
|
@ -2604,7 +2631,7 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = pass/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
@ -2641,7 +2668,7 @@
|
|||
);
|
||||
HEADER_SEARCH_PATHS = "$(inherited)";
|
||||
INFOPLIST_FILE = pass/Info.plist;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 10.2;
|
||||
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
|
||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||
MARKETING_VERSION = 0.11.0;
|
||||
|
|
|
|||
|
|
@ -9,63 +9,6 @@
|
|||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Password Store-->
|
||||
<scene sceneID="Uma-9u-xWV">
|
||||
<objects>
|
||||
<viewController id="Xki-Si-B7m" customClass="PasswordsViewController" customModule="passAutoFillExtension" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="BuU-Ak-iZz">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="XmI-l4-SgT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="passwordTableViewCell" textLabel="U0x-8f-AET" detailTextLabel="kY1-Ac-C3d" style="IBUITableViewCellStyleValue1" id="fXA-SG-IOe" customClass="PasswordTableViewCell" customModule="passAutoFillExtension" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="55.5" width="375" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="fXA-SG-IOe" id="KPa-Az-i6V">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="U0x-8f-AET">
|
||||
<rect key="frame" x="16" y="12" width="33" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="kY1-Ac-C3d">
|
||||
<rect key="frame" x="315" y="12" width="44" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<color key="textColor" red="0.66666666666666663" green="0.66666666666666663" blue="0.66666666666666663" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Password Store" prompt="url" id="apM-bN-eca">
|
||||
<barButtonItem key="leftBarButtonItem" style="plain" systemItem="cancel" id="zCC-lm-1xr">
|
||||
<connections>
|
||||
<action selector="cancel:" destination="Xki-Si-B7m" id="CgJ-49-QwT"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="tableView" destination="XmI-l4-SgT" id="9k1-t7-Xnc"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="RwB-HB-TSk" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="992.79999999999995" y="26.53673163418291"/>
|
||||
</scene>
|
||||
<!--Credential Provider View Controller-->
|
||||
<scene sceneID="Ebu-3J-rOU">
|
||||
<objects>
|
||||
|
|
@ -90,9 +33,20 @@
|
|||
</objects>
|
||||
<point key="canvasLocation" x="-946.39999999999998" y="26.53673163418291"/>
|
||||
</scene>
|
||||
<!--SearchPassword-->
|
||||
<scene sceneID="sDa-xb-78h">
|
||||
<objects>
|
||||
<viewControllerPlaceholder storyboardName="SearchPassword" id="SvX-bP-rbb" sceneMemberID="viewController">
|
||||
<navigationItem key="navigationItem" id="SpE-87-sGe"/>
|
||||
</viewControllerPlaceholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="00W-OZ-EmF" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="788" y="26"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="mg9-JA-x9T">
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="ydk-0z-dUy" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
<navigationController automaticallyAdjustsScrollViewInsets="NO" id="Aeb-0C-dDR" sceneMemberID="viewController">
|
||||
<toolbarItems/>
|
||||
<navigationItem key="navigationItem" id="d0b-i7-rXf"/>
|
||||
|
|
@ -102,10 +56,9 @@
|
|||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="Xki-Si-B7m" kind="relationship" relationship="rootViewController" id="Jjj-k4-Bbd"/>
|
||||
<segue destination="SvX-bP-rbb" kind="relationship" relationship="rootViewController" id="MFO-5M-l7I"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="ydk-0z-dUy" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="53.600000000000001" y="26.53673163418291"/>
|
||||
</scene>
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||
let dataSource = PasswordsTableDataSource(entries: passwordsTableEntries)
|
||||
passwordsViewController.dataSource = dataSource
|
||||
passwordsViewController.selectionDelegate = self
|
||||
passwordsViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel))
|
||||
}
|
||||
|
||||
override func prepareCredentialList(for serviceIdentifiers: [ASCredentialServiceIdentifier]) {
|
||||
|
|
@ -58,6 +59,11 @@ class CredentialProviderViewController: ASCredentialProviderViewController {
|
|||
passwordsViewController.navigationItem.prompt = identifier
|
||||
passwordsViewController.showPasswordsWithSuggstion(matching: identifier)
|
||||
}
|
||||
|
||||
@objc
|
||||
private func cancel(_: AnyObject?) {
|
||||
self.extensionContext.cancelRequest(withError: NSError(domain: "PassExtension", code: 0))
|
||||
}
|
||||
}
|
||||
|
||||
extension CredentialProviderViewController: PasswordSelectionDelegate {
|
||||
|
|
|
|||
|
|
@ -12,9 +12,9 @@ import passKit
|
|||
|
||||
// cancel means cancel the extension
|
||||
class PasscodeLockViewControllerForExtension: PasscodeLockViewController {
|
||||
var originalExtensionContext: ASCredentialProviderExtensionContext!
|
||||
var originalExtensionContext: NSExtensionContext!
|
||||
|
||||
convenience init(extensionContext: ASCredentialProviderExtensionContext) {
|
||||
convenience init(extensionContext: NSExtensionContext) {
|
||||
self.init()
|
||||
self.originalExtensionContext = extensionContext
|
||||
}
|
||||
|
|
@ -27,15 +27,15 @@ class PasscodeLockViewControllerForExtension: PasscodeLockViewController {
|
|||
|
||||
@objc
|
||||
func cancelExtension() {
|
||||
originalExtensionContext.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
|
||||
originalExtensionContext.cancelRequest(withError: NSError(domain: "PassExtension", code: 0))
|
||||
}
|
||||
}
|
||||
|
||||
class PasscodeExtensionDisplay {
|
||||
private let passcodeLockVC: PasscodeLockViewControllerForExtension
|
||||
private let extensionContext: ASCredentialProviderExtensionContext?
|
||||
private let extensionContext: NSExtensionContext?
|
||||
|
||||
init(extensionContext: ASCredentialProviderExtensionContext) {
|
||||
init(extensionContext: NSExtensionContext) {
|
||||
self.extensionContext = extensionContext
|
||||
self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext)
|
||||
passcodeLockVC.setCancellable(true)
|
||||
|
|
|
|||
|
|
@ -47,12 +47,6 @@ class PasswordsViewController: UIViewController {
|
|||
dataSource.showTableEntriesWithSuggestion(matching: text)
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
@IBAction
|
||||
private func cancel(_: AnyObject?) {
|
||||
self.extensionContext?.cancelRequest(withError: NSError(domain: ASExtensionErrorDomain, code: ASExtensionError.userCanceled.rawValue))
|
||||
self.dismiss(animated: true)
|
||||
}
|
||||
}
|
||||
|
||||
extension PasswordsViewController: UISearchBarDelegate {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>$(PRODUCT_NAME)</string>
|
||||
<string>Pass</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
|
|
|||
70
passAutoFillExtension/SearchPassword.storyboard
Normal file
70
passAutoFillExtension/SearchPassword.storyboard
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="WVw-Ck-H1t">
|
||||
<device id="retina6_1" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Password Store-->
|
||||
<scene sceneID="Q0D-bP-v18">
|
||||
<objects>
|
||||
<viewController id="WVw-Ck-H1t" customClass="PasswordsViewController" customModule="passAutoFillExtension" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="owN-l8-xf3">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="grouped" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="18" sectionFooterHeight="18" id="4ye-B2-IJQ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="passwordTableViewCell" textLabel="EBG-Ig-X29" detailTextLabel="cy6-w7-gwt" style="IBUITableViewCellStyleValue1" id="VQv-m5-GNR" customClass="PasswordTableViewCell" customModule="passAutoFillExtension" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="55.5" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="VQv-m5-GNR" id="Ypj-Vf-x6H">
|
||||
<rect key="frame" x="0.0" y="0.0" width="414" height="43.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="EBG-Ig-X29">
|
||||
<rect key="frame" x="20" y="12" width="33" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="cy6-w7-gwt">
|
||||
<rect key="frame" x="350" y="12" width="44" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" style="UICTFontTextStyleBody"/>
|
||||
<color key="textColor" red="0.66666666669999997" green="0.66666666669999997" blue="0.66666666669999997" alpha="1" colorSpace="calibratedRGB"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="Zkt-0U-evx"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Password Store" prompt="Select Password" id="qdN-Ea-jGZ"/>
|
||||
<connections>
|
||||
<outlet property="tableView" destination="4ye-B2-IJQ" id="cen-WZ-u7e"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="Byi-Tx-CZe" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="992.79999999999995" y="26.53673163418291"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
@ -1,85 +1,14 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="QHc-XA-1MZ">
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="17701" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" colorMatched="YES" initialViewController="Xzf-qb-wq7">
|
||||
<device id="retina4_7" orientation="portrait" appearance="light"/>
|
||||
<dependencies>
|
||||
<deployment identifier="iOS"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="17703"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="System colors in document resources" minToolsVersion="11.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<scenes>
|
||||
<!--Password Store-->
|
||||
<scene sceneID="NlT-0d-7x9">
|
||||
<objects>
|
||||
<viewController id="DnC-Ka-AYb" customClass="ExtensionViewController" customModule="passExtension" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<layoutGuides>
|
||||
<viewControllerLayoutGuide type="top" id="kSO-tI-r1g"/>
|
||||
<viewControllerLayoutGuide type="bottom" id="TYK-kT-vkH"/>
|
||||
</layoutGuides>
|
||||
<view key="view" contentMode="scaleToFill" id="g9r-Vt-nbj">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="KNT-Mp-tgV">
|
||||
<rect key="frame" x="0.0" y="44" width="375" height="623"/>
|
||||
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<searchBar key="tableHeaderView" contentMode="redraw" translucent="NO" id="xuO-jY-YRU">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="56"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxY="YES"/>
|
||||
<color key="barTintColor" systemColor="secondarySystemBackgroundColor"/>
|
||||
<textInputTraits key="textInputTraits"/>
|
||||
</searchBar>
|
||||
<prototypes>
|
||||
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="passwordTableViewCell" textLabel="LUo-8T-I4j" detailTextLabel="9ik-sy-sTS" style="IBUITableViewCellStyleValue1" id="T2b-vj-fza" customClass="PasswordTableViewCell" customModule="passExtension" customModuleProvider="target">
|
||||
<rect key="frame" x="0.0" y="84" width="375" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="T2b-vj-fza" id="aVb-V4-hqg">
|
||||
<rect key="frame" x="0.0" y="0.0" width="348" height="44"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="LUo-8T-I4j">
|
||||
<rect key="frame" x="16" y="12" width="33" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<nil key="textColor"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" text="" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="9ik-sy-sTS">
|
||||
<rect key="frame" x="296" y="12" width="44" height="20.5"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<fontDescription key="fontDescription" type="system" pointSize="17"/>
|
||||
<color key="textColor" white="0.66666666666666663" alpha="1" colorSpace="calibratedWhite"/>
|
||||
<nil key="highlightedColor"/>
|
||||
</label>
|
||||
</subviews>
|
||||
</tableViewCellContentView>
|
||||
</tableViewCell>
|
||||
</prototypes>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<constraints>
|
||||
<constraint firstItem="KNT-Mp-tgV" firstAttribute="top" secondItem="kSO-tI-r1g" secondAttribute="bottom" id="1Mo-as-yNc"/>
|
||||
<constraint firstItem="TYK-kT-vkH" firstAttribute="top" secondItem="KNT-Mp-tgV" secondAttribute="bottom" id="RUo-Zw-D5C"/>
|
||||
<constraint firstItem="KNT-Mp-tgV" firstAttribute="leading" secondItem="g9r-Vt-nbj" secondAttribute="leading" id="Tre-Kp-RiI"/>
|
||||
<constraint firstAttribute="trailing" secondItem="KNT-Mp-tgV" secondAttribute="trailing" id="YPI-WX-ffM"/>
|
||||
</constraints>
|
||||
</view>
|
||||
<navigationItem key="navigationItem" title="Password Store" id="MEN-Kg-v16">
|
||||
<barButtonItem key="leftBarButtonItem" systemItem="cancel" id="CH4-D6-aFB">
|
||||
<connections>
|
||||
<action selector="cancelExtension:" destination="DnC-Ka-AYb" id="In1-WB-K8r"/>
|
||||
</connections>
|
||||
</barButtonItem>
|
||||
</navigationItem>
|
||||
<connections>
|
||||
<outlet property="searchBar" destination="xuO-jY-YRU" id="5Gk-EN-nKb"/>
|
||||
<outlet property="tableView" destination="KNT-Mp-tgV" id="XdF-42-lk8"/>
|
||||
</connections>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="RYa-GM-dIn" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1712.8" y="10.344827586206897"/>
|
||||
</scene>
|
||||
<!--Navigation Controller-->
|
||||
<scene sceneID="oy9-wd-tIc">
|
||||
<objects>
|
||||
|
|
@ -91,17 +20,51 @@
|
|||
</navigationBar>
|
||||
<nil name="viewControllers"/>
|
||||
<connections>
|
||||
<segue destination="DnC-Ka-AYb" kind="relationship" relationship="rootViewController" id="Yes-tn-lzA"/>
|
||||
<segue destination="IaK-yg-fFt" kind="relationship" relationship="rootViewController" id="3T0-Cv-Bfg"/>
|
||||
</connections>
|
||||
</navigationController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="cpm-jG-Meg" userLabel="First Responder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="772" y="9.4452773613193415"/>
|
||||
</scene>
|
||||
<!--Extension View Controller-->
|
||||
<scene sceneID="Xbh-hw-0pj">
|
||||
<objects>
|
||||
<viewController id="Xzf-qb-wq7" customClass="ExtensionViewController" customModule="passExtension" customModuleProvider="target" sceneMemberID="viewController">
|
||||
<view key="view" contentMode="scaleToFill" id="JIb-8X-ysu">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<containerView opaque="NO" contentMode="scaleToFill" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="hzP-Y0-FLR">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<connections>
|
||||
<segue destination="QHc-XA-1MZ" kind="embed" id="46u-rW-D7k"/>
|
||||
</connections>
|
||||
</containerView>
|
||||
</subviews>
|
||||
<viewLayoutGuide key="safeArea" id="6iy-0F-jx6"/>
|
||||
<color key="backgroundColor" systemColor="systemBackgroundColor"/>
|
||||
</view>
|
||||
</viewController>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="vBS-EH-ZFM" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="-28" y="9"/>
|
||||
</scene>
|
||||
<!--SearchPassword-->
|
||||
<scene sceneID="bv5-bN-jAX">
|
||||
<objects>
|
||||
<viewControllerPlaceholder storyboardName="SearchPassword" id="IaK-yg-fFt" sceneMemberID="viewController">
|
||||
<navigationItem key="navigationItem" id="ZjU-eF-yp6"/>
|
||||
</viewControllerPlaceholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="FKe-r2-5pi" userLabel="First Responder" customClass="UIResponder" sceneMemberID="firstResponder"/>
|
||||
</objects>
|
||||
<point key="canvasLocation" x="1590" y="9"/>
|
||||
</scene>
|
||||
</scenes>
|
||||
<resources>
|
||||
<systemColor name="secondarySystemBackgroundColor">
|
||||
<color red="0.94901960784313721" green="0.94901960784313721" blue="0.96862745098039216" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<systemColor name="systemBackgroundColor">
|
||||
<color white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
|
||||
</systemColor>
|
||||
</resources>
|
||||
</document>
|
||||
|
|
|
|||
|
|
@ -10,220 +10,158 @@ import Foundation
|
|||
import MobileCoreServices
|
||||
import passKit
|
||||
|
||||
class ExtensionViewController: UIViewController, UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate, UINavigationBarDelegate {
|
||||
@IBOutlet var searchBar: UISearchBar!
|
||||
@IBOutlet var tableView: UITableView!
|
||||
class ExtensionViewController: UIViewController {
|
||||
var passcodelock: PasscodeExtensionDisplay {
|
||||
PasscodeExtensionDisplay(extensionContext: self.extensionContext!)
|
||||
}
|
||||
|
||||
private let passwordStore = PasswordStore.shared
|
||||
private let keychain = AppKeychain.shared
|
||||
var embeddedNavigationController: UINavigationController {
|
||||
children.first as! UINavigationController
|
||||
}
|
||||
|
||||
private var searchActive = false
|
||||
private var passwordsTableEntries: [PasswordTableEntry] = []
|
||||
private var filteredPasswordsTableEntries: [PasswordTableEntry] = []
|
||||
var passwordsViewController: PasswordsViewController {
|
||||
embeddedNavigationController.viewControllers.first as! PasswordsViewController
|
||||
}
|
||||
|
||||
enum Action {
|
||||
case findLogin, fillBrowser, unknown
|
||||
}
|
||||
|
||||
private var extensionAction = Action.unknown
|
||||
private var action = Action.unknown
|
||||
|
||||
private lazy var passcodelock: PasscodeExtensionDisplay = {
|
||||
let passcodelock = PasscodeExtensionDisplay(extensionContext: self.extensionContext)
|
||||
return passcodelock
|
||||
}()
|
||||
lazy var credentialProvider = CredentialProvider(viewController: self, extensionContext: self.extensionContext!)
|
||||
|
||||
private func initPasswordsTableEntries() {
|
||||
filteredPasswordsTableEntries.removeAll()
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
passcodelock.presentPasscodeLockIfNeeded(self)
|
||||
|
||||
let passwordEntities = passwordStore.fetchPasswordEntityCoreData(withDir: false)
|
||||
passwordsTableEntries = passwordEntities.map {
|
||||
PasswordTableEntry($0)
|
||||
}
|
||||
let passwordsTableEntries = PasswordStore.shared.fetchPasswordEntityCoreData(withDir: false).compactMap { PasswordTableEntry($0) }
|
||||
let dataSource = PasswordsTableDataSource(entries: passwordsTableEntries)
|
||||
passwordsViewController.dataSource = dataSource
|
||||
passwordsViewController.selectionDelegate = self
|
||||
passwordsViewController.navigationItem.leftBarButtonItem = UIBarButtonItem(barButtonSystemItem: .cancel, target: self, action: #selector(cancel))
|
||||
}
|
||||
|
||||
override func viewWillAppear(_ animated: Bool) {
|
||||
super.viewWillAppear(animated)
|
||||
passcodelock.presentPasscodeLockIfNeeded(self)
|
||||
prepareCredentialList()
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
// prepare
|
||||
searchBar.delegate = self
|
||||
tableView.delegate = self
|
||||
tableView.dataSource = self
|
||||
tableView.register(PasswordTableViewCell.self, forCellReuseIdentifier: "passwordTableViewCell")
|
||||
@objc
|
||||
private func cancel(_: AnyObject?) {
|
||||
self.extensionContext?.completeRequest(returningItems: nil)
|
||||
}
|
||||
|
||||
// initialize table entries
|
||||
initPasswordsTableEntries()
|
||||
|
||||
// get the provider
|
||||
guard let extensionItems = extensionContext?.inputItems as? [NSExtensionItem] else {
|
||||
func prepareCredentialList() {
|
||||
guard let attachments = self.extensionContext?.attachments else {
|
||||
return
|
||||
}
|
||||
|
||||
for extensionItem in extensionItems {
|
||||
guard let itemProviders = extensionItem.attachments else {
|
||||
continue
|
||||
}
|
||||
for provider in itemProviders {
|
||||
// search using the extensionContext inputs
|
||||
if provider.hasItemConformingToTypeIdentifier(OnePasswordExtensionActions.findLogin) {
|
||||
provider.loadItem(forTypeIdentifier: OnePasswordExtensionActions.findLogin, options: nil) { item, _ in
|
||||
self.updateExtension(with: self.getUrl(from: item as! NSDictionary), action: .findLogin)
|
||||
}
|
||||
} else if provider.hasItemConformingToTypeIdentifier(kUTTypePropertyList as String) {
|
||||
provider.loadItem(forTypeIdentifier: kUTTypePropertyList as String, options: nil) { item, _ in
|
||||
if let dictionary = item as? NSDictionary, let results = dictionary[NSExtensionJavaScriptPreprocessingResultsKey] as? NSDictionary {
|
||||
self.updateExtension(with: self.getUrl(from: results))
|
||||
}
|
||||
}
|
||||
} else if provider.hasItemConformingToTypeIdentifier(kUTTypeURL as String) {
|
||||
provider.loadItem(forTypeIdentifier: kUTTypeURL as String, options: nil) { item, _ in
|
||||
self.updateExtension(with: (item as? NSURL)!.host)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private func getUrl(from dictionary: NSDictionary) -> String? {
|
||||
if var urlString = dictionary[OnePasswordExtensionKey.URLStringKey] as? String {
|
||||
if !urlString.hasPrefix("http://"), !urlString.hasPrefix("https://") {
|
||||
urlString = "http://" + urlString
|
||||
}
|
||||
return URL(string: urlString)?.host
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
private func updateExtension(with url: String?, action: Action = .fillBrowser) {
|
||||
// Set text, set active, and force search.
|
||||
DispatchQueue.main.async { [weak self] in
|
||||
self?.extensionAction = action
|
||||
self?.searchBar.text = url
|
||||
self?.searchBar.becomeFirstResponder()
|
||||
self?.searchBarSearchButtonClicked((self?.searchBar)!)
|
||||
}
|
||||
}
|
||||
|
||||
// define cell contents, and set long press action
|
||||
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
||||
let cell = tableView.dequeueReusableCell(withIdentifier: "passwordTableViewCell", for: indexPath) as! PasswordTableViewCell
|
||||
let entry = getPasswordEntry(by: indexPath)
|
||||
cell.configure(with: entry)
|
||||
|
||||
return cell
|
||||
}
|
||||
|
||||
// select row -> extension returns (with username and password)
|
||||
func tableView(_: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
let entry = getPasswordEntry(by: indexPath)
|
||||
|
||||
guard PGPAgent.shared.isPrepared else {
|
||||
Utils.alert(title: "CannotCopyPassword".localize(), message: "PgpKeyNotSet.".localize(), controller: self, completion: nil)
|
||||
return
|
||||
}
|
||||
|
||||
let passwordEntity = entry.passwordEntity
|
||||
UIImpactFeedbackGenerator(style: .medium).impactOccurred()
|
||||
decryptPassword(passwordEntity: passwordEntity)
|
||||
}
|
||||
|
||||
private func decryptPassword(passwordEntity: PasswordEntity, keyID: String? = nil) {
|
||||
DispatchQueue.global(qos: .userInteractive).async {
|
||||
do {
|
||||
let requestPGPKeyPassphrase = Utils.createRequestPGPKeyPassphraseHandler(controller: self)
|
||||
let decryptedPassword = try self.passwordStore.decrypt(passwordEntity: passwordEntity, keyID: keyID, requestPGPKeyPassphrase: requestPGPKeyPassphrase)
|
||||
|
||||
let username = decryptedPassword.getUsernameForCompletion()
|
||||
let password = decryptedPassword.password
|
||||
func completeTask(_ text: String?) {
|
||||
DispatchQueue.main.async {
|
||||
// prepare a dictionary to return
|
||||
switch self.extensionAction {
|
||||
case .findLogin:
|
||||
let extensionItem = NSExtensionItem()
|
||||
var returnDictionary = [
|
||||
OnePasswordExtensionKey.usernameKey: username,
|
||||
OnePasswordExtensionKey.passwordKey: password,
|
||||
]
|
||||
if let totpPassword = decryptedPassword.currentOtp {
|
||||
returnDictionary[OnePasswordExtensionKey.totpKey] = totpPassword
|
||||
self.passwordsViewController.showPasswordsWithSuggstion(matching: text ?? "")
|
||||
self.passwordsViewController.navigationItem.prompt = text
|
||||
}
|
||||
extensionItem.attachments = [NSItemProvider(item: returnDictionary as NSSecureCoding, typeIdentifier: String(kUTTypePropertyList))]
|
||||
self.extensionContext!.completeRequest(returningItems: [extensionItem], completionHandler: nil)
|
||||
}
|
||||
DispatchQueue.global(qos: .userInitiated).async {
|
||||
for attachment in attachments {
|
||||
if attachment.hasURL {
|
||||
self.action = .fillBrowser
|
||||
attachment.extractSearchText { completeTask($0) }
|
||||
} else if attachment.hasFindLoginAction {
|
||||
self.action = .findLogin
|
||||
attachment.extractSearchText { completeTask($0) }
|
||||
} else if attachment.hasPropertyList {
|
||||
self.action = .fillBrowser
|
||||
attachment.extractSearchText { completeTask($0) }
|
||||
} else {
|
||||
self.action = .unknown
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extension ExtensionViewController: PasswordSelectionDelegate {
|
||||
func selected(password: PasswordTableEntry) {
|
||||
switch action {
|
||||
case .findLogin:
|
||||
credentialProvider.provideCredentialsFindLogin(with: password.passwordEntity.getPath())
|
||||
case .fillBrowser:
|
||||
Utils.copyToPasteboard(textToCopy: decryptedPassword.password)
|
||||
// return a dictionary for JavaScript for best-effor fill in
|
||||
let extensionItem = NSExtensionItem()
|
||||
let returnDictionary = [NSExtensionJavaScriptFinalizeArgumentKey: ["username": username, "password": password]]
|
||||
extensionItem.attachments = [NSItemProvider(item: returnDictionary as NSSecureCoding, typeIdentifier: String(kUTTypePropertyList))]
|
||||
self.extensionContext?.completeRequest(returningItems: [extensionItem], completionHandler: nil)
|
||||
credentialProvider.provideCredentialsBrowser(with: password.passwordEntity.getPath())
|
||||
default:
|
||||
self.extensionContext?.completeRequest(returningItems: nil, completionHandler: nil)
|
||||
}
|
||||
}
|
||||
} catch let AppError.pgpPrivateKeyNotFound(keyID: key) {
|
||||
DispatchQueue.main.async {
|
||||
// alert: cancel or try again
|
||||
let alert = UIAlertController(title: "CannotShowPassword".localize(), message: AppError.pgpPrivateKeyNotFound(keyID: key).localizedDescription, preferredStyle: .alert)
|
||||
alert.addAction(UIAlertAction.cancelAndPopView(controller: self))
|
||||
let selectKey = UIAlertAction.selectKey(controller: self) { action in
|
||||
self.decryptPassword(passwordEntity: passwordEntity, keyID: action.title)
|
||||
}
|
||||
alert.addAction(selectKey)
|
||||
}
|
||||
|
||||
self.present(alert, animated: true, completion: nil)
|
||||
}
|
||||
} catch {
|
||||
DispatchQueue.main.async {
|
||||
Utils.alert(title: "CannotCopyPassword".localize(), message: error.localizedDescription, controller: self, completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func numberOfSectionsInTableView(tableView _: UITableView) -> Int {
|
||||
1
|
||||
}
|
||||
|
||||
func tableView(_: UITableView, numberOfRowsInSection _: Int) -> Int {
|
||||
if searchActive {
|
||||
return filteredPasswordsTableEntries.count
|
||||
}
|
||||
return passwordsTableEntries.count
|
||||
}
|
||||
|
||||
@IBAction
|
||||
private func cancelExtension(_: Any) {
|
||||
extensionContext!.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
|
||||
func searchBarCancelButtonClicked(_ searchBar: UISearchBar) {
|
||||
searchBar.text = ""
|
||||
searchActive = false
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
func searchBarSearchButtonClicked(_ searchBar: UISearchBar) {
|
||||
if let searchText = searchBar.text, searchText.isEmpty == false {
|
||||
filteredPasswordsTableEntries = passwordsTableEntries.filter { $0.match(searchText) }
|
||||
searchActive = true
|
||||
extension NSDictionary {
|
||||
func extractSearchText() -> String? {
|
||||
if let value = self[PassExtensionKey.URLStringKey] as? String {
|
||||
if let host = URL(string: value)?.host {
|
||||
return host
|
||||
} else {
|
||||
searchActive = false
|
||||
return value
|
||||
}
|
||||
tableView.reloadData()
|
||||
}
|
||||
|
||||
func searchBar(_ searchBar: UISearchBar, textDidChange _: String) {
|
||||
searchBarSearchButtonClicked(searchBar)
|
||||
}
|
||||
|
||||
private func getPasswordEntry(by indexPath: IndexPath) -> PasswordTableEntry {
|
||||
if searchActive {
|
||||
return filteredPasswordsTableEntries[indexPath.row]
|
||||
} else if let value = self[NSExtensionJavaScriptPreprocessingResultsKey] as? String {
|
||||
if let host = URL(string: value)?.host {
|
||||
return host
|
||||
} else {
|
||||
return passwordsTableEntries[indexPath.row]
|
||||
return value
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
extension NSItemProvider {
|
||||
var hasFindLoginAction: Bool {
|
||||
hasItemConformingToTypeIdentifier(PassExtensionActions.findLogin)
|
||||
}
|
||||
|
||||
var hasURL: Bool {
|
||||
hasItemConformingToTypeIdentifier(kUTTypeURL as String) && registeredTypeIdentifiers.count == 1
|
||||
}
|
||||
|
||||
var hasPropertyList: Bool {
|
||||
hasItemConformingToTypeIdentifier(kUTTypePropertyList as String)
|
||||
}
|
||||
}
|
||||
|
||||
extension NSExtensionContext {
|
||||
/// Get all the attachments to this post.
|
||||
var attachments: [NSItemProvider] {
|
||||
guard let items = inputItems as? [NSExtensionItem] else {
|
||||
return []
|
||||
}
|
||||
return items.flatMap { $0.attachments ?? [] }
|
||||
}
|
||||
}
|
||||
|
||||
extension NSItemProvider {
|
||||
/// Extracts the URL from the item provider
|
||||
func extractSearchText(completion: @escaping (String?) -> Void) {
|
||||
self.loadItem(forTypeIdentifier: kUTTypeURL as String) { item, _ in
|
||||
if let url = item as? NSURL {
|
||||
completion(url.host)
|
||||
} else {
|
||||
completion(nil)
|
||||
}
|
||||
}
|
||||
|
||||
self.loadItem(forTypeIdentifier: kUTTypePropertyList as String) { item, _ in
|
||||
if let dict = item as? NSDictionary {
|
||||
if let result = dict[NSExtensionJavaScriptPreprocessingResultsKey] as? NSDictionary {
|
||||
completion(result.extractSearchText())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.loadItem(forTypeIdentifier: PassExtensionActions.findLogin) { item, _ in
|
||||
if let dict = item as? NSDictionary {
|
||||
let text = dict.extractSearchText()
|
||||
completion(text)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,59 +0,0 @@
|
|||
//
|
||||
// PasscodeLockDisplay.swift
|
||||
// pass
|
||||
//
|
||||
// Created by Yishi Lin on 14/6/17.
|
||||
// Copyright © 2017 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import passKit
|
||||
|
||||
// cancel means cancel the extension
|
||||
class PasscodeLockViewControllerForExtension: PasscodeLockViewController {
|
||||
var originalExtensionContest: NSExtensionContext?
|
||||
|
||||
convenience init(extensionContext: NSExtensionContext?) {
|
||||
self.init()
|
||||
self.originalExtensionContest = extensionContext
|
||||
}
|
||||
|
||||
override func viewDidLoad() {
|
||||
super.viewDidLoad()
|
||||
cancelButton?.removeTarget(nil, action: nil, for: .allEvents)
|
||||
cancelButton?.addTarget(self, action: #selector(cancelExtension), for: .touchUpInside)
|
||||
}
|
||||
|
||||
@objc
|
||||
func cancelExtension() {
|
||||
originalExtensionContest?.completeRequest(returningItems: [], completionHandler: nil)
|
||||
}
|
||||
}
|
||||
|
||||
class PasscodeExtensionDisplay {
|
||||
private var isPasscodePresented = false
|
||||
private let passcodeLockVC: PasscodeLockViewControllerForExtension
|
||||
private let extensionContext: NSExtensionContext?
|
||||
|
||||
init(extensionContext: NSExtensionContext?) {
|
||||
self.extensionContext = extensionContext
|
||||
self.passcodeLockVC = PasscodeLockViewControllerForExtension(extensionContext: extensionContext)
|
||||
passcodeLockVC.dismissCompletionCallback = { [weak self] in
|
||||
self?.dismiss()
|
||||
}
|
||||
passcodeLockVC.setCancellable(true)
|
||||
}
|
||||
|
||||
// present the passcode lock view if passcode is set and the view controller is not presented
|
||||
func presentPasscodeLockIfNeeded(_ extensionVC: UIViewController) {
|
||||
guard PasscodeLock.shared.hasPasscode, !isPasscodePresented == true else {
|
||||
return
|
||||
}
|
||||
isPasscodePresented = true
|
||||
extensionVC.present(passcodeLockVC, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
func dismiss(animated _: Bool = true) {
|
||||
isPasscodePresented = false
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
//
|
||||
// This file contains constants from https://github.com/agilebits/onepassword-app-extension/
|
||||
|
||||
enum OnePasswordExtensionActions {
|
||||
enum PassExtensionActions {
|
||||
static let findLogin = "org.appextension.find-login-action"
|
||||
static let saveLogin = "org.appextension.save-login-action"
|
||||
static let changePassword = "org.appextension.change-password-action"
|
||||
|
|
@ -15,8 +15,8 @@ enum OnePasswordExtensionActions {
|
|||
static let fillBrowser = "org.appextension.fill-browser-action"
|
||||
}
|
||||
|
||||
enum OnePasswordExtensionKey {
|
||||
// Login Dictionary keys - Used to get or set the properties of a 1Password Login
|
||||
enum PassExtensionKey {
|
||||
// Login Dictionary keys
|
||||
static let URLStringKey = "url_string"
|
||||
static let usernameKey = "username"
|
||||
static let passwordKey = "password"
|
||||
|
|
@ -29,23 +29,10 @@ enum OnePasswordExtensionKey {
|
|||
static let oldPasswordKey = "old_password"
|
||||
static let passwordGeneratorOptionsKey = "password_generator_options"
|
||||
|
||||
// Password Generator options - Used to set the 1Password Password Generator options when saving a new Login or when changing the password for for an existing Login
|
||||
// Password Generator options
|
||||
static let generatedPasswordMinLengthKey = "password_min_length"
|
||||
static let generatedPasswordMaxLengthKey = "password_max_length"
|
||||
static let generatedPasswordRequireDigitsKey = "password_require_digits"
|
||||
static let generatedPasswordRequireSymbolsKey = "password_require_symbols"
|
||||
static let generatedPasswordForbiddenCharactersKey = "password_forbidden_characters"
|
||||
}
|
||||
|
||||
// Errors codes
|
||||
enum OnePasswordExtensionError {
|
||||
static let errorDomain = "OnePasswordExtension"
|
||||
static let errorCodeCancelledByUser = 0
|
||||
static let errorCodeAPINotAvailable = 1
|
||||
static let errorCodeFailedToContactExtension = 2
|
||||
static let errorCodeFailedToLoadItemProviderData = 3
|
||||
static let errorCodeCollectFieldsScriptFailed = 4
|
||||
static let errorCodeFillFieldsScriptFailed = 5
|
||||
static let errorCodeUnexpectedData = 6
|
||||
static let errorCodeFailedToObtainURLStringFromWebView = 7 // swiftlint:disable:this identifier_name
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Pass</string>
|
||||
<string>$(APP_DISPLAY_NAME)</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>$(EXECUTABLE_NAME)</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
|
|
@ -31,9 +31,9 @@
|
|||
SUBQUERY (
|
||||
$extensionItem.attachments,
|
||||
$attachment,
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.find-login-action" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "org.appextension.find-login-action" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.url" ||
|
||||
ANY $attachment.registeredTypeIdentifiers UTI-CONFORMS-TO "public.plain-text"
|
||||
).@count == $extensionItem.attachments.@count
|
||||
).@count == 1</string>
|
||||
<key>NSExtensionJavaScriptPreprocessingFile</key>
|
||||
|
|
|
|||
66
passExtension/Services/CredentialProvider.swift
Normal file
66
passExtension/Services/CredentialProvider.swift
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
//
|
||||
// CredentialProvider.swift
|
||||
// passExtension
|
||||
//
|
||||
// Created by Sun, Mingshen on 1/9/21.
|
||||
// Copyright © 2021 Bob Sun. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
import MobileCoreServices
|
||||
import passKit
|
||||
|
||||
class CredentialProvider {
|
||||
weak var extensionContext: NSExtensionContext?
|
||||
weak var viewController: UIViewController?
|
||||
|
||||
init(viewController: UIViewController, extensionContext: NSExtensionContext) {
|
||||
self.viewController = viewController
|
||||
self.extensionContext = extensionContext
|
||||
}
|
||||
|
||||
func provideCredentialsFindLogin(with passwordPath: String) {
|
||||
guard let viewController = viewController else {
|
||||
return
|
||||
}
|
||||
guard let extensionContext = extensionContext else {
|
||||
return
|
||||
}
|
||||
|
||||
decryptPassword(in: viewController, with: passwordPath) { password in
|
||||
let extensionItem = NSExtensionItem()
|
||||
var returnDictionary = [
|
||||
PassExtensionKey.usernameKey: password.getUsernameForCompletion(),
|
||||
PassExtensionKey.passwordKey: password.password,
|
||||
]
|
||||
if let totpPassword = password.currentOtp {
|
||||
returnDictionary[PassExtensionKey.totpKey] = totpPassword
|
||||
}
|
||||
extensionItem.attachments = [NSItemProvider(item: returnDictionary as NSSecureCoding, typeIdentifier: String(kUTTypePropertyList))]
|
||||
extensionContext.completeRequest(returningItems: [extensionItem])
|
||||
}
|
||||
}
|
||||
|
||||
func provideCredentialsBrowser(with passwordPath: String) {
|
||||
guard let viewController = viewController else {
|
||||
return
|
||||
}
|
||||
guard let extensionContext = extensionContext else {
|
||||
return
|
||||
}
|
||||
|
||||
decryptPassword(in: viewController, with: passwordPath) { password in
|
||||
Utils.copyToPasteboard(textToCopy: password.password)
|
||||
// return a dictionary for JavaScript for best-effor fill in
|
||||
let extensionItem = NSExtensionItem()
|
||||
let returnDictionary = [
|
||||
NSExtensionJavaScriptFinalizeArgumentKey: [
|
||||
"username": password.getUsernameForCompletion(),
|
||||
"password": password.password,
|
||||
],
|
||||
]
|
||||
extensionItem.attachments = [NSItemProvider(item: returnDictionary as NSSecureCoding, typeIdentifier: String(kUTTypePropertyList))]
|
||||
extensionContext.completeRequest(returningItems: [extensionItem])
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue