This repository has been archived by the owner on Feb 19, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #485 from bitstadium/release/5.1.0
Release/5.1.0
- Loading branch information
Showing
51 changed files
with
598 additions
and
163 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
#import "BITHockeyHelper.h" | ||
/* | ||
* Workaround for exporting symbols from category object files. | ||
*/ | ||
extern NSString *BITHockeyHelperApplicationCategory; | ||
|
||
/** | ||
* App states | ||
*/ | ||
typedef NS_ENUM(NSInteger, BITApplicationState) { | ||
|
||
/** | ||
* Application is active. | ||
*/ | ||
BITApplicationStateActive = UIApplicationStateActive, | ||
|
||
/** | ||
* Application is inactive. | ||
*/ | ||
BITApplicationStateInactive = UIApplicationStateInactive, | ||
|
||
/** | ||
* Application is in background. | ||
*/ | ||
BITApplicationStateBackground = UIApplicationStateBackground, | ||
|
||
/** | ||
* Application state can't be determined. | ||
*/ | ||
BITApplicationStateUnknown | ||
}; | ||
|
||
@interface BITHockeyHelper (Application) | ||
|
||
/** | ||
* Get current application state. | ||
* | ||
* @return Current state of the application or BITApplicationStateUnknown while the state can't be determined. | ||
* | ||
* @discussion The application state may not be available everywhere. Application extensions doesn't have it for instance, | ||
* in that case the BITApplicationStateUnknown value is returned. | ||
*/ | ||
+ (BITApplicationState)applicationState; | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#import "BITHockeyHelper+Application.h" | ||
|
||
/* | ||
* Workaround for exporting symbols from category object files. | ||
*/ | ||
NSString *BITHockeyHelperApplicationCategory; | ||
|
||
@implementation BITHockeyHelper (Application) | ||
|
||
+ (BITApplicationState)applicationState { | ||
|
||
// App extensions must not access sharedApplication. | ||
if (!bit_isRunningInAppExtension()) { | ||
|
||
__block BITApplicationState state; | ||
dispatch_block_t block = ^{ | ||
state = (BITApplicationState)[[self class] sharedAppState]; | ||
}; | ||
|
||
if ([NSThread isMainThread]) { | ||
block(); | ||
} else { | ||
dispatch_sync(dispatch_get_main_queue(), block); | ||
} | ||
|
||
return state; | ||
} | ||
return BITApplicationStateUnknown; | ||
} | ||
|
||
+ (UIApplication *)sharedApplication { | ||
|
||
// Compute selector at runtime for more discretion. | ||
SEL sharedAppSel = NSSelectorFromString(@"sharedApplication"); | ||
return ((UIApplication * (*)(id, SEL))[[UIApplication class] methodForSelector:sharedAppSel])([UIApplication class], | ||
sharedAppSel); | ||
} | ||
|
||
+ (UIApplicationState)sharedAppState { | ||
return [[[[self class] sharedApplication] valueForKey:@"applicationState"] longValue]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.