From 4f6ff2ee6ea6c0c4032057d877a8649aac073ed5 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 3 Dec 2013 17:01:02 +0100 Subject: [PATCH 1/6] Documentation fix for `restrictApplicationUsage` in `BITAuthenticator` --- Classes/BITAuthenticator.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Classes/BITAuthenticator.h b/Classes/BITAuthenticator.h index c14cf9bd7c..784ba5e7ac 100644 --- a/Classes/BITAuthenticator.h +++ b/Classes/BITAuthenticator.h @@ -160,9 +160,9 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency) * If enabled, the Authenticator checks depending on `restrictionEnforcementFrequency` * if the user is allowed to use this application. * - * Enabling this property and setting `identificationType` to `BITAuthenticatorIdentificationTypeHockeyAppEmail` - * or `BITAuthenticatorIdentificationTypeHockeyAppUser` also allows to remove access for users - * by removing them from the app's users list on HockeyApp. + * Enabling this property and setting `identificationType` to `BITAuthenticatorIdentificationTypeHockeyAppEmail`, + * `BITAuthenticatorIdentificationTypeHockeyAppUser` or `BITAuthenticatorIdentificationTypeWebAuth` also allows + * to remove access for users by removing them from the app's users list on HockeyApp. * * _Default_: `NO` * From 0619ac9169db2bf7f4ff2b7ea535c83e070b2cba Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 4 Dec 2013 02:13:50 +0100 Subject: [PATCH 2/6] Add unit test post action for code coverage HTML generation --- .../xcshareddata/xcschemes/HockeySDK.xcscheme | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/Support/HockeySDK.xcodeproj/xcshareddata/xcschemes/HockeySDK.xcscheme b/Support/HockeySDK.xcodeproj/xcshareddata/xcschemes/HockeySDK.xcscheme index aea8ba42ee..1170466773 100644 --- a/Support/HockeySDK.xcodeproj/xcshareddata/xcschemes/HockeySDK.xcscheme +++ b/Support/HockeySDK.xcodeproj/xcshareddata/xcschemes/HockeySDK.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -20,6 +20,20 @@ ReferencedContainer = "container:HockeySDK.xcodeproj"> + + + + + + + + + + + + + + From 785f654060b59a66fc9f611da69345c7199acae9 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 4 Dec 2013 02:19:37 +0100 Subject: [PATCH 3/6] Fixed static analyzer warnings for unit tests when running against 64 bit target --- .../HockeySDKTests/BITAuthenticatorTests.m | 2 +- .../HockeySDKTests/BITHockeyAppClientTests.m | 32 +++++++++---------- 2 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Support/HockeySDKTests/BITAuthenticatorTests.m b/Support/HockeySDKTests/BITAuthenticatorTests.m index 5e3fab0ae5..96ea679369 100644 --- a/Support/HockeySDKTests/BITAuthenticatorTests.m +++ b/Support/HockeySDKTests/BITAuthenticatorTests.m @@ -258,7 +258,7 @@ static void *kInstallationIdentification = &kInstallationIdentification; _sut.identificationType = BITAuthenticatorIdentificationTypeHockeyAppUser; [_sut validateWithCompletion:^(BOOL validated, NSError *error) { assertThatBool(validated, equalToBool(NO)); - assertThatInt(error.code, equalToInt(BITAuthenticatorNotIdentified)); + assertThatLong(error.code, equalToLong(BITAuthenticatorNotIdentified)); }]; } diff --git a/Support/HockeySDKTests/BITHockeyAppClientTests.m b/Support/HockeySDKTests/BITHockeyAppClientTests.m index e9502e095b..d009de2c00 100644 --- a/Support/HockeySDKTests/BITHockeyAppClientTests.m +++ b/Support/HockeySDKTests/BITHockeyAppClientTests.m @@ -115,25 +115,25 @@ #pragma mark - Convenience methods - (void) testThatGetPathCreatesAndEnquesAnOperation { - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0)); [given([_sut operationWithURLRequest:(id)anything() completion:nil]) willReturn:[NSOperation new]]; [_sut getPath:@"endpoint" parameters:nil completion:nil]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1)); } - (void) testThatPostPathCreatesAndEnquesAnOperation { - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0)); [given([_sut operationWithURLRequest:nil completion:nil]) willReturn:[NSOperation new]]; [_sut postPath:@"endpoint" parameters:nil completion:nil]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1)); } #pragma mark - Completion Tests @@ -143,12 +143,12 @@ #pragma mark - HTTPOperation enqueuing / cancellation - (void) testThatOperationIsQueued { - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0)); [_sut.operationQueue setSuspended:YES]; BITHTTPOperation *op = [BITHTTPOperation new]; [_sut enqeueHTTPOperation:op]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1)); } - (void) testThatOperationCancellingMatchesAllOperationsWithNilMethod { @@ -162,9 +162,9 @@ completion:nil]]; [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost completion:nil]]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3)); NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil]; - assertThatUnsignedInt(numCancelled, equalToUnsignedInt(3)); + assertThatUnsignedLong(numCancelled, equalToUnsignedLong(3)); } - (void) testThatOperationCancellingMatchesAllOperationsWithNilPath { @@ -178,9 +178,9 @@ completion:nil]]; [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost completion:nil]]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3)); NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil]; - assertThatUnsignedInt(numCancelled, equalToUnsignedInt(3)); + assertThatUnsignedLong(numCancelled, equalToUnsignedLong(3)); } @@ -196,9 +196,9 @@ completion:nil]]; [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost completion:nil]]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3)); NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:nil]; - assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); + assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1)); } - (void) testThatOperationCancellingMatchesAllOperationsWithSetMethod { @@ -211,9 +211,9 @@ completion:nil]]; [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost completion:nil]]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3)); NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:@"POST"]; - assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); + assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1)); } - (void) testThatOperationCancellingMatchesAllOperationsWithSetMethodAndPath { @@ -226,9 +226,9 @@ completion:nil]]; [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost completion:nil]]; - assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); + assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3)); NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:@"PUT"]; - assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); + assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1)); } #pragma mark - Operation Testing From 6d6012b0f65a43b006f2ad44b7a9062262a8a65d Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Wed, 4 Dec 2013 14:08:08 +0100 Subject: [PATCH 4/6] Fixed self.validated not always being set to NO if restrictionEnforcementFrequency is set to BITAuthenticatorAppRestrictionEnforcementOnAppActive --- Classes/BITAuthenticator.m | 21 +++++++++------------ Classes/BITAuthenticator_Private.h | 4 ++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Classes/BITAuthenticator.m b/Classes/BITAuthenticator.m index c4e4d24c57..3da5a383cf 100644 --- a/Classes/BITAuthenticator.m +++ b/Classes/BITAuthenticator.m @@ -48,7 +48,7 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut @implementation BITAuthenticator { id _appDidBecomeActiveObserver; - id _appWillResignActiveObserver; + id _appDidEnterBackgroundOberser; UIViewController *_authenticationController; BOOL _isSetup; @@ -651,13 +651,13 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut [strongSelf applicationDidBecomeActive:note]; }]; } - if(nil == _appWillResignActiveObserver) { - _appWillResignActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification + if(nil == _appDidEnterBackgroundOberser) { + _appDidEnterBackgroundOberser = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification object:nil queue:NSOperationQueue.mainQueue usingBlock:^(NSNotification *note) { typeof(self) strongSelf = weakSelf; - [strongSelf applicationWillResignActive:note]; + [strongSelf applicationDidEnterBackground:note]; }]; } } @@ -667,9 +667,9 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut [[NSNotificationCenter defaultCenter] removeObserver:_appDidBecomeActiveObserver]; _appDidBecomeActiveObserver = nil; } - if(_appWillResignActiveObserver) { - [[NSNotificationCenter defaultCenter] removeObserver:_appWillResignActiveObserver]; - _appWillResignActiveObserver = nil; + if(_appDidEnterBackgroundOberser) { + [[NSNotificationCenter defaultCenter] removeObserver:_appDidEnterBackgroundOberser]; + _appDidEnterBackgroundOberser = nil; } } @@ -755,11 +755,8 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut [self authenticate]; } -- (void)applicationWillResignActive:(NSNotification *)note { - //only reset if app is really going into the background, e.g not when pulling down - //the notification center - if(BITAuthenticatorAppRestrictionEnforcementOnAppActive == self.restrictionEnforcementFrequency && - [[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) { +- (void)applicationDidEnterBackground:(NSNotification *)note { + if(BITAuthenticatorAppRestrictionEnforcementOnAppActive == self.restrictionEnforcementFrequency) { self.validated = NO; } } diff --git a/Classes/BITAuthenticator_Private.h b/Classes/BITAuthenticator_Private.h index c41134600a..86064cc836 100644 --- a/Classes/BITAuthenticator_Private.h +++ b/Classes/BITAuthenticator_Private.h @@ -60,11 +60,11 @@ @property (nonatomic, copy, readonly) NSString *installationIdentifier; /** - * method registered as observer for applicationWillBecomeInactive events + * method registered as observer for applicationDidEnterBackground events * * @param note NSNotification */ -- (void) applicationWillResignActive:(NSNotification*) note; +- (void) applicationDidEnterBackground:(NSNotification*) note; /** * method registered as observer for applicationsDidBecomeActive events From 8a17777c7e325429154e0e883bd6f91f1769fdd7 Mon Sep 17 00:00:00 2001 From: Stefan Haubold Date: Wed, 4 Dec 2013 21:12:59 +0100 Subject: [PATCH 5/6] improved logic to choose right window to show dialogs in --- Classes/BITHockeyBaseManager.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Classes/BITHockeyBaseManager.m b/Classes/BITHockeyBaseManager.m index 9614ecefa8..e3899c79ce 100644 --- a/Classes/BITHockeyBaseManager.m +++ b/Classes/BITHockeyBaseManager.m @@ -162,7 +162,11 @@ } - (UIWindow *)findVisibleWindow { - UIWindow *visibleWindow = nil; + UIWindow *visibleWindow = [UIApplication sharedApplication].keyWindow; + + if (!(visibleWindow.hidden)) { + return visibleWindow; + } // if the rootViewController property (available >= iOS 4.0) of the main window is set, we present the modal view controller on top of the rootViewController NSArray *windows = [[UIApplication sharedApplication] windows]; @@ -171,7 +175,7 @@ visibleWindow = window; } if ([UIWindow instancesRespondToSelector:@selector(rootViewController)]) { - if ([window rootViewController]) { + if (!(window.hidden) && ([window rootViewController])) { visibleWindow = window; BITHockeyLog(@"INFO: UIWindow with rootViewController found: %@", visibleWindow); break; From 14a5a0f32252637180c6802f66848a3fe4d2dc63 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Mon, 16 Dec 2013 03:27:11 +0100 Subject: [PATCH 6/6] Fix delete button appearance in feedback list view on iOS 7 when swiping a feedback message --- Classes/BITFeedbackListViewCell.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/BITFeedbackListViewCell.m b/Classes/BITFeedbackListViewCell.m index 22a7ceeded..759128926d 100644 --- a/Classes/BITFeedbackListViewCell.m +++ b/Classes/BITFeedbackListViewCell.m @@ -178,7 +178,9 @@ } // background for deletion accessory view - [self addSubview:accessoryViewBackground]; + if (self.style == BITFeedbackListViewCellPresentatationStyleDefault) { + [self addSubview:accessoryViewBackground]; + } // header NSString *dateString = @"";