Skip to content

Commit

Permalink
Merge pull request #101 from hansemannn/fix/refactor
Browse files Browse the repository at this point in the history
refactor(ios): resolve deprecations and Xcode warnings, attempt to fix weak-self leaks
  • Loading branch information
vijaysingh-axway authored Dec 8, 2020
2 parents e2703c9 + 582781e commit 4b2c90a
Show file tree
Hide file tree
Showing 8 changed files with 314 additions and 279 deletions.
53 changes: 26 additions & 27 deletions ios/Classes/KeychainItemWrapper/APSKeychainWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,63 +26,63 @@ typedef NSString *APSErrorDomain;
@param keychainWrapper The keychain wrapper that triggered this action.
@param result The result of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didSaveValueWithResult:(NSDictionary*)result;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didSaveValueWithResult:(NSDictionary *)result;

/**
Triggered when a value could not be saved to the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param error The occurred error of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didSaveValueWithError:(NSError*)error;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didSaveValueWithError:(NSError *)error;

/**
Triggered when a value was successfully updated to the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param result The result of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didUpdateValueWithResult:(NSDictionary*)result;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didUpdateValueWithResult:(NSDictionary *)result;

/**
Triggered when a value could not be updated to the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param error The occurred error of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didUpdateValueWithError:(NSError*)error;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didUpdateValueWithError:(NSError *)error;

/**
Triggered when a value was successfully received from the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param result The result of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didReadValueWithResult:(NSDictionary*)result;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didReadValueWithResult:(NSDictionary *)result;

/**
Triggered when a value could not be read from the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param error The occurred error of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didReadValueWithError:(NSError*)error;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didReadValueWithError:(NSError *)error;

/**
Triggered when a value was successfully deleted from the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param result The result of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didDeleteValueWithResult:(NSDictionary*)result;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didDeleteValueWithResult:(NSDictionary *)result;

/**
Triggered when a value could not be deleted from the keychain.
@param keychainWrapper The keychain wrapper that triggered this action.
@param error The occurred error of the operation.
*/
- (void)APSKeychainWrapper:(APSKeychainWrapper*)keychainWrapper didDeleteValueWithError:(NSError*)error;
- (void)APSKeychainWrapper:(APSKeychainWrapper *)keychainWrapper didDeleteValueWithError:(NSError *)error;

@end

Expand All @@ -91,21 +91,21 @@ typedef NSString *APSErrorDomain;
based on their configured options.
*/
@interface APSKeychainWrapper : NSObject {
@private
NSMutableDictionary *baseAttributes;
NSString *_identifier;
NSString *_service;
NSString *_accessGroup;
NSDictionary *_options;
CFStringRef _accessibilityMode;
SecAccessControlCreateFlags _accessControlMode;
@private
NSMutableDictionary *baseAttributes;
NSString *_identifier;
NSString *_service;
NSString *_accessGroup;
NSDictionary *_options;
CFStringRef _accessibilityMode;
SecAccessControlCreateFlags _accessControlMode;
}

/**
The delegate to be used with the `APSKeychainWrapper` to get notified
about keychain events.
*/
@property(unsafe_unretained) id<APSKeychainWrapperDelegate> delegate;
@property (unsafe_unretained) id<APSKeychainWrapperDelegate> delegate;

/**
Initializes an `APSKeychainWrapper` object with the specified options.
Expand All @@ -118,9 +118,9 @@ typedef NSString *APSErrorDomain;
@return The newly-initialized keychain item
*/
- (id)initWithIdentifier:(NSString*)identifier
service:(NSString*)service
accessGroup:(NSString*)accessGroup;
- (id)initWithIdentifier:(NSString *)identifier
service:(NSString *)service
accessGroup:(NSString *)accessGroup;

/**
Initializes an `APSKeychainWrapper` object with the specified options.
Expand All @@ -135,12 +135,12 @@ typedef NSString *APSErrorDomain;
@return The newly-initialized keychain item
*/
- (id)initWithIdentifier:(NSString*)identifier
service:(NSString*)service
accessGroup:(NSString*)accessGroup
- (id)initWithIdentifier:(NSString *)identifier
service:(NSString *)service
accessGroup:(NSString *)accessGroup
accessibilityMode:(CFStringRef)accessibilityMode
accessControlMode:(SecAccessControlCreateFlags)accessControlMode
options:(NSDictionary*)options;
options:(NSDictionary *)options;

/**
Checks if an item exists already.
Expand All @@ -155,7 +155,7 @@ typedef NSString *APSErrorDomain;
@param value The value to save in the iOS keychain.
*/
- (void)save:(NSString*)value;
- (void)save:(NSString *)value;

/**
Reads an existing value from the keychain. The value is identified by it's
Expand All @@ -169,13 +169,12 @@ typedef NSString *APSErrorDomain;
@param value The value to save in the iOS keychain.
*/
- (void)update:(NSString*)value;
- (void)update:(NSString *)value;

/**
Deletes a value from the keychain. The value is identified by it's
keychain item identifier and an optional access-group.
*/
- (void)reset;


@end
Loading

0 comments on commit 4b2c90a

Please sign in to comment.