mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-16 02:20:07 +00:00
Merge branch 'refs/heads/develop' into feature/improvements
This commit is contained in:
commit
73ce955f6c
@ -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`
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -178,7 +178,9 @@
|
||||
}
|
||||
|
||||
// background for deletion accessory view
|
||||
[self addSubview:accessoryViewBackground];
|
||||
if (self.style == BITFeedbackListViewCellPresentatationStyleDefault) {
|
||||
[self addSubview:accessoryViewBackground];
|
||||
}
|
||||
|
||||
// header
|
||||
NSString *dateString = @"";
|
||||
|
@ -161,7 +161,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];
|
||||
@ -170,7 +174,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;
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Scheme
|
||||
LastUpgradeVersion = "0500"
|
||||
version = "1.3">
|
||||
version = "1.7">
|
||||
<BuildAction
|
||||
parallelizeBuildables = "YES"
|
||||
buildImplicitDependencies = "YES">
|
||||
@ -20,6 +20,20 @@
|
||||
ReferencedContainer = "container:HockeySDK.xcodeproj">
|
||||
</BuildableReference>
|
||||
</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>
|
||||
</BuildAction>
|
||||
<TestAction
|
||||
@ -27,6 +41,24 @@
|
||||
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
|
||||
shouldUseLaunchSchemeArgsEnv = "YES"
|
||||
buildConfiguration = "CodeCoverage">
|
||||
<PostActions>
|
||||
<ExecutionAction
|
||||
ActionType = "Xcode.IDEStandardExecutionActionsCore.ExecutionActionType.ShellScriptAction">
|
||||
<ActionContent
|
||||
title = "Run Script"
|
||||
scriptText = "cd ${SRCROOT}/../Vendor/XcodeCoverage ./getcov ">
|
||||
<EnvironmentBuildable>
|
||||
<BuildableReference
|
||||
BuildableIdentifier = "primary"
|
||||
BlueprintIdentifier = "1E5A458F16F0DFC200B55C04"
|
||||
BuildableName = "HockeySDKTests.octest"
|
||||
BlueprintName = "HockeySDKTests"
|
||||
ReferencedContainer = "container:HockeySDK.xcodeproj">
|
||||
</BuildableReference>
|
||||
</EnvironmentBuildable>
|
||||
</ActionContent>
|
||||
</ExecutionAction>
|
||||
</PostActions>
|
||||
<Testables>
|
||||
<TestableReference
|
||||
skipped = "NO">
|
||||
|
@ -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));
|
||||
}];
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user