Skip to content
This repository was archived by the owner on Feb 18, 2025. It is now read-only.

Commit 6d7fd6c

Browse files
author
Kyle Swank
committed
Merge branch 'master' into agilebits/update-add-framework-support-to-match-1.8.5-release
2 parents 04f146a + 82000ca commit 6d7fd6c

File tree

16 files changed

+207
-164
lines changed

16 files changed

+207
-164
lines changed

1PasswordExtension.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Pod::Spec.new do |spec|
22

33
spec.name = "1PasswordExtension"
44
spec.module_name = "OnePasswordExtension"
5-
spec.version = "1.8.4"
5+
spec.version = "1.8.5"
66
spec.summary = "With just a few lines of code, your app can add 1Password support."
77
spec.description = <<-DESC
88
With just a few lines of code, your app can add 1Password support, enabling your users to:

Demos/App Demo for iOS Swift/App Demo for iOS Swift.xcodeproj/project.pbxproj

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@
164164
isa = PBXProject;
165165
attributes = {
166166
LastSwiftUpdateCheck = 0700;
167-
LastUpgradeCheck = 0700;
167+
LastUpgradeCheck = 0910;
168168
ORGANIZATIONNAME = Agilebits;
169169
TargetAttributes = {
170170
F1B11CE61ACA827600BBB963 = {
@@ -263,13 +263,21 @@
263263
CLANG_CXX_LIBRARY = "libc++";
264264
CLANG_ENABLE_MODULES = YES;
265265
CLANG_ENABLE_OBJC_ARC = YES;
266+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
266267
CLANG_WARN_BOOL_CONVERSION = YES;
268+
CLANG_WARN_COMMA = YES;
267269
CLANG_WARN_CONSTANT_CONVERSION = YES;
268270
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
269271
CLANG_WARN_EMPTY_BODY = YES;
270272
CLANG_WARN_ENUM_CONVERSION = YES;
273+
CLANG_WARN_INFINITE_RECURSION = YES;
271274
CLANG_WARN_INT_CONVERSION = YES;
275+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
276+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
272277
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
278+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
279+
CLANG_WARN_STRICT_PROTOTYPES = YES;
280+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
273281
CLANG_WARN_UNREACHABLE_CODE = YES;
274282
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
275283
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -278,6 +286,7 @@
278286
ENABLE_TESTABILITY = YES;
279287
GCC_C_LANGUAGE_STANDARD = gnu99;
280288
GCC_DYNAMIC_NO_PIC = NO;
289+
GCC_NO_COMMON_BLOCKS = YES;
281290
GCC_OPTIMIZATION_LEVEL = 0;
282291
GCC_PREPROCESSOR_DEFINITIONS = (
283292
"DEBUG=1",
@@ -309,13 +318,21 @@
309318
CLANG_CXX_LIBRARY = "libc++";
310319
CLANG_ENABLE_MODULES = YES;
311320
CLANG_ENABLE_OBJC_ARC = YES;
321+
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
312322
CLANG_WARN_BOOL_CONVERSION = YES;
323+
CLANG_WARN_COMMA = YES;
313324
CLANG_WARN_CONSTANT_CONVERSION = YES;
314325
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
315326
CLANG_WARN_EMPTY_BODY = YES;
316327
CLANG_WARN_ENUM_CONVERSION = YES;
328+
CLANG_WARN_INFINITE_RECURSION = YES;
317329
CLANG_WARN_INT_CONVERSION = YES;
330+
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
331+
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
318332
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333+
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
334+
CLANG_WARN_STRICT_PROTOTYPES = YES;
335+
CLANG_WARN_SUSPICIOUS_MOVE = YES;
319336
CLANG_WARN_UNREACHABLE_CODE = YES;
320337
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
321338
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
@@ -324,6 +341,7 @@
324341
ENABLE_STRICT_OBJC_MSGSEND = YES;
325342
ENABLE_TESTABILITY = NO;
326343
GCC_C_LANGUAGE_STANDARD = gnu99;
344+
GCC_NO_COMMON_BLOCKS = YES;
327345
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
328346
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
329347
GCC_WARN_UNDECLARED_SELECTOR = YES;
@@ -333,6 +351,7 @@
333351
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
334352
MTL_ENABLE_DEBUG_INFO = NO;
335353
SDKROOT = iphoneos;
354+
SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
336355
SWIFT_VERSION = 2.3;
337356
TARGETED_DEVICE_FAMILY = "1,2";
338357
VALIDATE_PRODUCT = YES;
@@ -350,7 +369,7 @@
350369
PRODUCT_NAME = "App Demo for iOS Swift";
351370
SWIFT_OBJC_BRIDGING_HEADER = "App Demo for iOS Swift/App Demo for iOS Swift-Bridging-Header.h";
352371
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
353-
SWIFT_VERSION = 2.3;
372+
SWIFT_VERSION = 4.0;
354373
TARGETED_DEVICE_FAMILY = 1;
355374
};
356375
name = Debug;
@@ -365,7 +384,7 @@
365384
PRODUCT_BUNDLE_IDENTIFIER = "com.agilebits.$(PRODUCT_NAME:rfc1034identifier)";
366385
PRODUCT_NAME = "App Demo for iOS Swift";
367386
SWIFT_OBJC_BRIDGING_HEADER = "App Demo for iOS Swift/App Demo for iOS Swift-Bridging-Header.h";
368-
SWIFT_VERSION = 2.3;
387+
SWIFT_VERSION = 4.0;
369388
TARGETED_DEVICE_FAMILY = 1;
370389
};
371390
name = Release;

Demos/App Demo for iOS Swift/App Demo for iOS Swift/AppDelegate.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,30 +13,30 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1313

1414
var window: UIWindow?
1515

16-
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
16+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
1717
// Override point for customization after application launch.
1818
return true
1919
}
2020

21-
func applicationWillResignActive(application: UIApplication) {
21+
func applicationWillResignActive(_ application: UIApplication) {
2222
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
2323
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
2424
}
2525

26-
func applicationDidEnterBackground(application: UIApplication) {
26+
func applicationDidEnterBackground(_ application: UIApplication) {
2727
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
2828
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
2929
}
3030

31-
func applicationWillEnterForeground(application: UIApplication) {
31+
func applicationWillEnterForeground(_ application: UIApplication) {
3232
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
3333
}
3434

35-
func applicationDidBecomeActive(application: UIApplication) {
35+
func applicationDidBecomeActive(_ application: UIApplication) {
3636
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
3737
}
3838

39-
func applicationWillTerminate(application: UIApplication) {
39+
func applicationWillTerminate(_ application: UIApplication) {
4040
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
4141
// Saves changes in the application's managed object context before the application terminates.
4242
}

Demos/App Demo for iOS Swift/App Demo for iOS Swift/ChangePasswordViewController.swift

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -21,31 +21,33 @@ class ChangePasswordViewController: UIViewController {
2121
self.view.backgroundColor = UIColor(patternImage: patternImage)
2222
}
2323

24-
self.onepasswordButton.hidden = (false == OnePasswordExtension.sharedExtension().isAppExtensionAvailable())
24+
onepasswordButton.isHidden = (false == OnePasswordExtension.shared().isAppExtensionAvailable())
2525
}
2626

27-
override func preferredStatusBarStyle() -> UIStatusBarStyle {
28-
return UIStatusBarStyle.LightContent
27+
override var preferredStatusBarStyle: UIStatusBarStyle {
28+
return .lightContent
2929
}
3030

31-
@IBAction func changePasswordIn1Password(sender:AnyObject) -> Void {
32-
let changedPassword = self.freshPasswordTextField.text!
33-
let oldPassword = self.oldPasswordTextField.text!
34-
let confirmationPassword = self.confirmPasswordTextField.text!
31+
@IBAction func changePasswordIn1Password(_ sender:AnyObject) {
32+
guard let changedPassword = freshPasswordTextField.text,
33+
let oldPassword = oldPasswordTextField.text,
34+
let confirmationPassword = confirmPasswordTextField.text else {
35+
return
36+
}
3537

3638
// Validate that the new password and the old password are not the same.
37-
if (oldPassword.characters.count > 0 && oldPassword == changedPassword) {
38-
self.showChangePasswordFailedAlertWithMessage("The old and the new password must not be the same")
39+
if (oldPassword.count > 0 && oldPassword == changedPassword) {
40+
showChangePasswordFailedAlertWithMessage(message: "The old and the new password must not be the same")
3941
return
4042
}
4143

4244
// Validate that the new and confirmation passwords match.
43-
if (changedPassword.characters.count > 0 && changedPassword != confirmationPassword) {
44-
self.showChangePasswordFailedAlertWithMessage("The new passwords and the confirmation password must match")
45+
if (changedPassword.count > 0 && changedPassword != confirmationPassword) {
46+
showChangePasswordFailedAlertWithMessage(message: "The new passwords and the confirmation password must match")
4547
return
4648
}
4749

48-
let newLoginDetails:[String: AnyObject] = [
50+
let newLoginDetails:[String : Any] = [
4951
AppExtensionTitleKey: "ACME", // Optional, used for the third schenario only
5052
AppExtensionUsernameKey: "aUsername", // Optional, used for the third schenario only
5153
AppExtensionPasswordKey: changedPassword,
@@ -54,50 +56,50 @@ class ChangePasswordViewController: UIViewController {
5456
]
5557

5658
// The password generation options are optional, but are very handy in case you have strict rules about password lengths, symbols and digits.
57-
let passwordGenerationOptions:[String: AnyObject] = [
59+
let passwordGenerationOptions:[String : AnyObject] = [
5860
// The minimum password length can be 4 or more.
59-
AppExtensionGeneratedPasswordMinLengthKey: (8),
61+
AppExtensionGeneratedPasswordMinLengthKey: (8 as NSNumber),
6062

6163
// The maximum password length can be 50 or less.
62-
AppExtensionGeneratedPasswordMaxLengthKey: (30),
64+
AppExtensionGeneratedPasswordMaxLengthKey: (30 as NSNumber),
6365

6466
// If YES, the 1Password will guarantee that the generated password will contain at least one digit (number between 0 and 9). Passing NO will not exclude digits from the generated password.
65-
AppExtensionGeneratedPasswordRequireDigitsKey: (true),
67+
AppExtensionGeneratedPasswordRequireDigitsKey: (true as NSNumber),
6668

6769
// If YES, the 1Password will guarantee that the generated password will contain at least one symbol (See the list below). Passing NO will not exclude symbols from the generated password.
68-
AppExtensionGeneratedPasswordRequireSymbolsKey: (true),
70+
AppExtensionGeneratedPasswordRequireSymbolsKey: (true as NSNumber),
6971

7072
// Here are all the symbols available in the the 1Password Password Generator:
7173
// !@#$%^&*()_-+=|[]{}'\";.,>?/~`
7274
// The string for AppExtensionGeneratedPasswordForbiddenCharactersKey should contain the symbols and characters that you wish 1Password to exclude from the generated password.
73-
AppExtensionGeneratedPasswordForbiddenCharactersKey: "!@#$%/0lIO"
75+
AppExtensionGeneratedPasswordForbiddenCharactersKey: "!@#$%/0lIO" as NSString
7476
]
7577

76-
OnePasswordExtension.sharedExtension().changePasswordForLoginForURLString("https://www.acme.com", loginDetails: newLoginDetails, passwordGenerationOptions: passwordGenerationOptions, forViewController: self, sender: sender) { (loginDictionary, error) -> Void in
77-
if loginDictionary == nil {
78-
if error!.code != Int(AppExtensionErrorCodeCancelledByUser) {
79-
print("Error invoking 1Password App Extension for find login: \(error)")
78+
OnePasswordExtension.shared().changePasswordForLogin(forURLString: "https://www.acme.com", loginDetails: newLoginDetails, passwordGenerationOptions: passwordGenerationOptions, for: self, sender: sender) { (loginDictionary, error) in
79+
guard let loginDictionary = loginDictionary else {
80+
if let error = error as NSError?, error.code != AppExtensionErrorCodeCancelledByUser {
81+
print("Error invoking 1Password App Extension for find login: \(String(describing: error))")
8082
}
8183
return
8284
}
8385

84-
self.oldPasswordTextField.text = loginDictionary?[AppExtensionOldPasswordKey] as? String
85-
self.freshPasswordTextField.text = loginDictionary?[AppExtensionPasswordKey] as? String
86-
self.confirmPasswordTextField.text = loginDictionary?[AppExtensionPasswordKey] as? String
86+
self.oldPasswordTextField.text = loginDictionary[AppExtensionOldPasswordKey] as? String
87+
self.freshPasswordTextField.text = loginDictionary[AppExtensionPasswordKey] as? String
88+
self.confirmPasswordTextField.text = loginDictionary[AppExtensionPasswordKey] as? String
8789
}
8890
}
8991

9092
// Convenience function
91-
func showChangePasswordFailedAlertWithMessage(message:String) -> Void {
92-
let alertController = UIAlertController(title: "Change Password Error", message: message, preferredStyle: UIAlertControllerStyle.Alert)
93+
func showChangePasswordFailedAlertWithMessage(message:String) {
94+
let alertController = UIAlertController(title: "Change Password Error", message: message, preferredStyle: .alert)
9395

94-
let dismissAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel) { (action) -> Void in
96+
let dismissAction = UIAlertAction(title: "Cancel", style: .cancel) { action in
9597
self.freshPasswordTextField.text = ""
9698
self.confirmPasswordTextField.text = ""
9799
self.freshPasswordTextField.becomeFirstResponder()
98100
}
99101

100102
alertController.addAction(dismissAction)
101-
self.presentViewController(alertController, animated: true, completion: nil)
103+
self.present(alertController, animated: true, completion: nil)
102104
}
103105
}

Demos/App Demo for iOS Swift/App Demo for iOS Swift/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<key>CFBundlePackageType</key>
1616
<string>APPL</string>
1717
<key>CFBundleShortVersionString</key>
18-
<string>1.8.4</string>
18+
<string>1.8.5</string>
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>

Demos/App Demo for iOS Swift/App Demo for iOS Swift/LoginViewController.swift

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,49 @@ class LoginViewController: UIViewController {
2222
self.view.backgroundColor = UIColor(patternImage: patternImage)
2323
}
2424

25-
self.onepasswordButton.hidden = (false == OnePasswordExtension.sharedExtension().isAppExtensionAvailable())
25+
onepasswordButton.isHidden = (false == OnePasswordExtension.shared().isAppExtensionAvailable())
2626
}
2727

28-
override func viewDidAppear(animated: Bool) {
28+
override func viewDidAppear(_ animated: Bool) {
2929
super.viewDidAppear(animated)
30-
if OnePasswordExtension.sharedExtension().isAppExtensionAvailable() == false {
31-
let alertController = UIAlertController(title: "1Password is not installed", message: "Get 1Password from the App Store", preferredStyle: UIAlertControllerStyle.Alert)
30+
if OnePasswordExtension.shared().isAppExtensionAvailable() == false {
31+
let alertController = UIAlertController(title: "1Password is not installed", message: "Get 1Password from the App Store", preferredStyle: UIAlertControllerStyle.alert)
3232

33-
let cancelAction = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)
33+
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel, handler: nil)
3434
alertController.addAction(cancelAction)
3535

36-
let OKAction = UIAlertAction(title: "Get 1Password", style: .Default) { (action) in UIApplication.sharedApplication().openURL(NSURL(string: "https://itunes.apple.com/app/1password-password-manager/id568903335")!)
36+
let OKAction = UIAlertAction(title: "Get 1Password", style: .default) { (action) in UIApplication.shared.openURL(URL(string: "https://itunes.apple.com/app/1password-password-manager/id568903335")!)
3737
}
3838

3939
alertController.addAction(OKAction)
40-
self.presentViewController(alertController, animated: true, completion: nil)
40+
self.present(alertController, animated: true, completion: nil)
4141
}
4242
}
4343

44-
override func preferredStatusBarStyle() -> UIStatusBarStyle {
45-
return UIStatusBarStyle.LightContent
44+
override var preferredStatusBarStyle: UIStatusBarStyle {
45+
return .lightContent
4646
}
4747

48-
@IBAction func findLoginFrom1Password(sender:AnyObject) -> Void {
49-
OnePasswordExtension.sharedExtension().findLoginForURLString("https://www.acme.com", forViewController: self, sender: sender, completion: { (loginDictionary, error) -> Void in
50-
if loginDictionary == nil {
51-
if error!.code != Int(AppExtensionErrorCodeCancelledByUser) {
52-
print("Error invoking 1Password App Extension for find login: \(error)")
48+
@IBAction func findLoginFrom1Password(_ sender:AnyObject) {
49+
OnePasswordExtension.shared().findLogin(forURLString: "https://www.acme.com", for: self, sender: sender, completion: { (loginDictionary, error) in
50+
guard let loginDictionary = loginDictionary else {
51+
if let error = error as NSError?, error.code != AppExtensionErrorCodeCancelledByUser {
52+
print("Error invoking 1Password App Extension for find login: \(String(describing: error))")
5353
}
5454
return
5555
}
5656

57-
self.usernameTextField.text = loginDictionary?[AppExtensionUsernameKey] as? String
58-
self.passwordTextField.text = loginDictionary?[AppExtensionPasswordKey] as? String
57+
self.usernameTextField.text = loginDictionary[AppExtensionUsernameKey] as? String
58+
self.passwordTextField.text = loginDictionary[AppExtensionPasswordKey] as? String
5959

60-
if let generatedOneTimePassword = loginDictionary?[AppExtensionTOTPKey] as? String {
61-
self.oneTimePasswordTextField.hidden = false
60+
if let generatedOneTimePassword = loginDictionary[AppExtensionTOTPKey] as? String {
61+
self.oneTimePasswordTextField.isHidden = false
6262
self.oneTimePasswordTextField.text = generatedOneTimePassword
6363

6464
// Important: It is recommended that you submit the OTP/TOTP to your validation server as soon as you receive it, otherwise it may expire.
65-
let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(0.5 * Double(NSEC_PER_SEC)))
66-
dispatch_after(delayTime, dispatch_get_main_queue(), { () -> Void in
67-
self.performSegueWithIdentifier("showThankYouViewController", sender: self)
68-
})
65+
let delayTime: DispatchTime = .now() + DispatchTimeInterval.milliseconds(500)
66+
DispatchQueue.main.asyncAfter(deadline: delayTime) { self.performSegue(withIdentifier: "showThankYouViewController", sender: self)
67+
}
6968
}
7069

7170
})

0 commit comments

Comments
 (0)