Skip to content

Commit

Permalink
Merge pull request #55 from AgileBits/improvement/parameter-validation
Browse files Browse the repository at this point in the history
[IMPROVEMENT] We now make sure that all parameneters are non nil.
  • Loading branch information
roustem committed Aug 13, 2014
2 parents a504590 + 6abce0e commit 749c578
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions OnePasswordExtension.m
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ - (BOOL)isAppExtensionAvailable {

- (void)findLoginForURLString:(NSString *)URLString forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDictionary, NSError *error))completion
{
NSAssert(URLString != nil, @"URLString must not be nil");
NSAssert(viewController != nil, @"viewController must not be nil");

if (![self isSystemAppExtensionAPIAvailable]) {
NSLog(@"Failed to findLoginForURLString, system API is not available");
if (completion) {
Expand Down Expand Up @@ -125,6 +128,10 @@ - (void)findLoginForURLString:(NSString *)URLString forViewController:(UIViewCon

- (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary *)loginDetailsDict passwordGenerationOptions:(NSDictionary *)passwordGenerationOptions forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDictionary, NSError *error))completion;
{
NSAssert(URLString != nil, @"URLString must not be nil");
NSAssert(loginDetailsDict != nil, @"loginDetailsDict must not be nil");
NSAssert(viewController != nil, @"viewController must not be nil");

if (![self isSystemAppExtensionAPIAvailable]) {
NSLog(@"Failed to storeLoginForURLString, system API is not available");
if (completion) {
Expand Down Expand Up @@ -178,6 +185,10 @@ - (void)storeLoginForURLString:(NSString *)URLString loginDetails:(NSDictionary

- (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NSString *)URLString passwordGenerationOptions:(NSDictionary *)passwordGenerationOptions forViewController:(UIViewController *)viewController completion:(void (^)(NSDictionary *loginDict, NSError *error))completion
{
NSAssert(username != nil, @"username must not be nil");
NSAssert(URLString != nil, @"URLString must not be nil");
NSAssert(viewController != nil, @"viewController must not be nil");

if (![self isSystemAppExtensionAPIAvailable]) {
NSLog(@"Failed to changePasswordForLoginWithUsername, system API is not available");
if (completion) {
Expand Down Expand Up @@ -230,6 +241,9 @@ - (void)changePasswordForLoginWithUsername:(NSString *)username andURLString:(NS

- (void)fillLoginIntoWebView:(id)webView forViewController:(UIViewController *)viewController completion:(void (^)(BOOL success, NSError *error))completion
{
NSAssert(webView != nil, @"webView must not be nil");
NSAssert(viewController != nil, @"viewController must not be nil");

#ifdef __IPHONE_8_0
if ([webView isKindOfClass:[UIWebView class]]) {
[self fillLoginIntoUIWebView:webView webViewController:viewController completion:^(BOOL success, NSError *error) {
Expand Down

0 comments on commit 749c578

Please sign in to comment.