Merge branch 'refs/heads/develop' into feature/improvements

This commit is contained in:
Andreas Linde 2013-12-16 18:31:08 +01:00
commit 73ce955f6c
8 changed files with 73 additions and 38 deletions

View File

@ -160,9 +160,9 @@ typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency)
* If enabled, the Authenticator checks depending on `restrictionEnforcementFrequency` * If enabled, the Authenticator checks depending on `restrictionEnforcementFrequency`
* if the user is allowed to use this application. * if the user is allowed to use this application.
* *
* Enabling this property and setting `identificationType` to `BITAuthenticatorIdentificationTypeHockeyAppEmail` * Enabling this property and setting `identificationType` to `BITAuthenticatorIdentificationTypeHockeyAppEmail`,
* or `BITAuthenticatorIdentificationTypeHockeyAppUser` also allows to remove access for users * `BITAuthenticatorIdentificationTypeHockeyAppUser` or `BITAuthenticatorIdentificationTypeWebAuth` also allows
* by removing them from the app's users list on HockeyApp. * to remove access for users by removing them from the app's users list on HockeyApp.
* *
* _Default_: `NO` * _Default_: `NO`
* *

View File

@ -48,7 +48,7 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
@implementation BITAuthenticator { @implementation BITAuthenticator {
id _appDidBecomeActiveObserver; id _appDidBecomeActiveObserver;
id _appWillResignActiveObserver; id _appDidEnterBackgroundOberser;
UIViewController *_authenticationController; UIViewController *_authenticationController;
BOOL _isSetup; BOOL _isSetup;
@ -651,13 +651,13 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
[strongSelf applicationDidBecomeActive:note]; [strongSelf applicationDidBecomeActive:note];
}]; }];
} }
if(nil == _appWillResignActiveObserver) { if(nil == _appDidEnterBackgroundOberser) {
_appWillResignActiveObserver = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationWillResignActiveNotification _appDidEnterBackgroundOberser = [[NSNotificationCenter defaultCenter] addObserverForName:UIApplicationDidEnterBackgroundNotification
object:nil object:nil
queue:NSOperationQueue.mainQueue queue:NSOperationQueue.mainQueue
usingBlock:^(NSNotification *note) { usingBlock:^(NSNotification *note) {
typeof(self) strongSelf = weakSelf; typeof(self) strongSelf = weakSelf;
[strongSelf applicationWillResignActive:note]; [strongSelf applicationDidEnterBackground:note];
}]; }];
} }
} }
@ -667,9 +667,9 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
[[NSNotificationCenter defaultCenter] removeObserver:_appDidBecomeActiveObserver]; [[NSNotificationCenter defaultCenter] removeObserver:_appDidBecomeActiveObserver];
_appDidBecomeActiveObserver = nil; _appDidBecomeActiveObserver = nil;
} }
if(_appWillResignActiveObserver) { if(_appDidEnterBackgroundOberser) {
[[NSNotificationCenter defaultCenter] removeObserver:_appWillResignActiveObserver]; [[NSNotificationCenter defaultCenter] removeObserver:_appDidEnterBackgroundOberser];
_appWillResignActiveObserver = nil; _appDidEnterBackgroundOberser = nil;
} }
} }
@ -755,11 +755,8 @@ static NSString* const kBITAuthenticatorAuthTokenTypeKey = @"BITAuthenticatorAut
[self authenticate]; [self authenticate];
} }
- (void)applicationWillResignActive:(NSNotification *)note { - (void)applicationDidEnterBackground:(NSNotification *)note {
//only reset if app is really going into the background, e.g not when pulling down if(BITAuthenticatorAppRestrictionEnforcementOnAppActive == self.restrictionEnforcementFrequency) {
//the notification center
if(BITAuthenticatorAppRestrictionEnforcementOnAppActive == self.restrictionEnforcementFrequency &&
[[UIApplication sharedApplication] applicationState] == UIApplicationStateBackground) {
self.validated = NO; self.validated = NO;
} }
} }

View File

@ -60,11 +60,11 @@
@property (nonatomic, copy, readonly) NSString *installationIdentifier; @property (nonatomic, copy, readonly) NSString *installationIdentifier;
/** /**
* method registered as observer for applicationWillBecomeInactive events * method registered as observer for applicationDidEnterBackground events
* *
* @param note NSNotification * @param note NSNotification
*/ */
- (void) applicationWillResignActive:(NSNotification*) note; - (void) applicationDidEnterBackground:(NSNotification*) note;
/** /**
* method registered as observer for applicationsDidBecomeActive events * method registered as observer for applicationsDidBecomeActive events

View File

@ -178,7 +178,9 @@
} }
// background for deletion accessory view // background for deletion accessory view
[self addSubview:accessoryViewBackground]; if (self.style == BITFeedbackListViewCellPresentatationStyleDefault) {
[self addSubview:accessoryViewBackground];
}
// header // header
NSString *dateString = @""; NSString *dateString = @"";

View File

@ -161,7 +161,11 @@
} }
- (UIWindow *)findVisibleWindow { - (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 // 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]; NSArray *windows = [[UIApplication sharedApplication] windows];
@ -170,7 +174,7 @@
visibleWindow = window; visibleWindow = window;
} }
if ([UIWindow instancesRespondToSelector:@selector(rootViewController)]) { if ([UIWindow instancesRespondToSelector:@selector(rootViewController)]) {
if ([window rootViewController]) { if (!(window.hidden) && ([window rootViewController])) {
visibleWindow = window; visibleWindow = window;
BITHockeyLog(@"INFO: UIWindow with rootViewController found: %@", visibleWindow); BITHockeyLog(@"INFO: UIWindow with rootViewController found: %@", visibleWindow);
break; break;

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "0500" LastUpgradeVersion = "0500"
version = "1.3"> version = "1.7">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"> buildImplicitDependencies = "YES">
@ -20,6 +20,20 @@
ReferencedContainer = "container:HockeySDK.xcodeproj"> ReferencedContainer = "container:HockeySDK.xcodeproj">
</BuildableReference> </BuildableReference>
</BuildActionEntry> </BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1E5A458F16F0DFC200B55C04"
BuildableName = "HockeySDKTests.octest"
BlueprintName = "HockeySDKTests"
ReferencedContainer = "container:HockeySDK.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries> </BuildActionEntries>
</BuildAction> </BuildAction>
<TestAction <TestAction
@ -27,6 +41,24 @@
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES" shouldUseLaunchSchemeArgsEnv = "YES"
buildConfiguration = "CodeCoverage"> buildConfiguration = "CodeCoverage">
<PostActions>
<ExecutionAction
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
<ActionContent
title = "Run Script"
scriptText = "cd ${SRCROOT}/../Vendor/XcodeCoverage&#10;./getcov&#10;">
<EnvironmentBuildable>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "1E5A458F16F0DFC200B55C04"
BuildableName = "HockeySDKTests.octest"
BlueprintName = "HockeySDKTests"
ReferencedContainer = "container:HockeySDK.xcodeproj">
</BuildableReference>
</EnvironmentBuildable>
</ActionContent>
</ExecutionAction>
</PostActions>
<Testables> <Testables>
<TestableReference <TestableReference
skipped = "NO"> skipped = "NO">

View File

@ -258,7 +258,7 @@ static void *kInstallationIdentification = &kInstallationIdentification;
_sut.identificationType = BITAuthenticatorIdentificationTypeHockeyAppUser; _sut.identificationType = BITAuthenticatorIdentificationTypeHockeyAppUser;
[_sut validateWithCompletion:^(BOOL validated, NSError *error) { [_sut validateWithCompletion:^(BOOL validated, NSError *error) {
assertThatBool(validated, equalToBool(NO)); assertThatBool(validated, equalToBool(NO));
assertThatInt(error.code, equalToInt(BITAuthenticatorNotIdentified)); assertThatLong(error.code, equalToLong(BITAuthenticatorNotIdentified));
}]; }];
} }

View File

@ -115,25 +115,25 @@
#pragma mark - Convenience methods #pragma mark - Convenience methods
- (void) testThatGetPathCreatesAndEnquesAnOperation { - (void) testThatGetPathCreatesAndEnquesAnOperation {
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0));
[given([_sut operationWithURLRequest:(id)anything() [given([_sut operationWithURLRequest:(id)anything()
completion:nil]) willReturn:[NSOperation new]]; completion:nil]) willReturn:[NSOperation new]];
[_sut getPath:@"endpoint" [_sut getPath:@"endpoint"
parameters:nil parameters:nil
completion:nil]; completion:nil];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1));
} }
- (void) testThatPostPathCreatesAndEnquesAnOperation { - (void) testThatPostPathCreatesAndEnquesAnOperation {
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0));
[given([_sut operationWithURLRequest:nil [given([_sut operationWithURLRequest:nil
completion:nil]) willReturn:[NSOperation new]]; completion:nil]) willReturn:[NSOperation new]];
[_sut postPath:@"endpoint" [_sut postPath:@"endpoint"
parameters:nil parameters:nil
completion:nil]; completion:nil];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1));
} }
#pragma mark - Completion Tests #pragma mark - Completion Tests
@ -143,12 +143,12 @@
#pragma mark - HTTPOperation enqueuing / cancellation #pragma mark - HTTPOperation enqueuing / cancellation
- (void) testThatOperationIsQueued { - (void) testThatOperationIsQueued {
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(0)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(0));
[_sut.operationQueue setSuspended:YES]; [_sut.operationQueue setSuspended:YES];
BITHTTPOperation *op = [BITHTTPOperation new]; BITHTTPOperation *op = [BITHTTPOperation new];
[_sut enqeueHTTPOperation:op]; [_sut enqeueHTTPOperation:op];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(1)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(1));
} }
- (void) testThatOperationCancellingMatchesAllOperationsWithNilMethod { - (void) testThatOperationCancellingMatchesAllOperationsWithNilMethod {
@ -162,9 +162,9 @@
completion:nil]]; completion:nil]];
[_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost
completion:nil]]; completion:nil]];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3));
NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil]; NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil];
assertThatUnsignedInt(numCancelled, equalToUnsignedInt(3)); assertThatUnsignedLong(numCancelled, equalToUnsignedLong(3));
} }
- (void) testThatOperationCancellingMatchesAllOperationsWithNilPath { - (void) testThatOperationCancellingMatchesAllOperationsWithNilPath {
@ -178,9 +178,9 @@
completion:nil]]; completion:nil]];
[_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost
completion:nil]]; completion:nil]];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3));
NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil]; NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:nil];
assertThatUnsignedInt(numCancelled, equalToUnsignedInt(3)); assertThatUnsignedLong(numCancelled, equalToUnsignedLong(3));
} }
@ -196,9 +196,9 @@
completion:nil]]; completion:nil]];
[_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost
completion:nil]]; completion:nil]];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3));
NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:nil]; NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:nil];
assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1));
} }
- (void) testThatOperationCancellingMatchesAllOperationsWithSetMethod { - (void) testThatOperationCancellingMatchesAllOperationsWithSetMethod {
@ -211,9 +211,9 @@
completion:nil]]; completion:nil]];
[_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost
completion:nil]]; completion:nil]];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3));
NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:@"POST"]; NSUInteger numCancelled = [_sut cancelOperationsWithPath:nil method:@"POST"];
assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1));
} }
- (void) testThatOperationCancellingMatchesAllOperationsWithSetMethodAndPath { - (void) testThatOperationCancellingMatchesAllOperationsWithSetMethodAndPath {
@ -226,9 +226,9 @@
completion:nil]]; completion:nil]];
[_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost [_sut enqeueHTTPOperation:[_sut operationWithURLRequest:requestPost
completion:nil]]; completion:nil]];
assertThatUnsignedInt(_sut.operationQueue.operationCount, equalToUnsignedInt(3)); assertThatUnsignedLong(_sut.operationQueue.operationCount, equalToUnsignedLong(3));
NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:@"PUT"]; NSUInteger numCancelled = [_sut cancelOperationsWithPath:@"Another/acas" method:@"PUT"];
assertThatUnsignedInt(numCancelled, equalToUnsignedInt(1)); assertThatUnsignedLong(numCancelled, equalToUnsignedLong(1));
} }
#pragma mark - Operation Testing #pragma mark - Operation Testing