mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-07 14:53:35 +00:00
Add support for App Extensions
- Added simple detection method to check wether the SDK runs in an extension - BITCrashManager will send crash reports without UI (UIAlertViews aren't allowed in extensions anyway) - Don't start BITUpdateManager, BITStoreUpdateManager, BITFeedbackManager and BITAuthenticator in app extensions
This commit is contained in:
parent
03767a63ef
commit
2040206101
@ -919,7 +919,10 @@ static PLCrashReporterCallbacks plCrashCallbacks = {
|
|||||||
* - Send pending approved crash reports
|
* - Send pending approved crash reports
|
||||||
*/
|
*/
|
||||||
- (void)invokeDelayedProcessing {
|
- (void)invokeDelayedProcessing {
|
||||||
if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) return;
|
if (!bit_isRunningInAppExtension() &&
|
||||||
|
[[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
BITHockeyLog(@"INFO: Start delayed CrashManager processing");
|
BITHockeyLog(@"INFO: Start delayed CrashManager processing");
|
||||||
|
|
||||||
@ -945,7 +948,7 @@ static PLCrashReporterCallbacks plCrashCallbacks = {
|
|||||||
_lastCrashFilename = [notApprovedReportFilename lastPathComponent];
|
_lastCrashFilename = [notApprovedReportFilename lastPathComponent];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!BITHockeyBundle()) {
|
if (!BITHockeyBundle() || bit_isRunningInAppExtension()) {
|
||||||
[self sendNextCrashReport];
|
[self sendNextCrashReport];
|
||||||
} else if (_crashManagerStatus != BITCrashManagerStatusAutoSend && notApprovedReportFilename) {
|
} else if (_crashManagerStatus != BITCrashManagerStatusAutoSend && notApprovedReportFilename) {
|
||||||
|
|
||||||
|
|||||||
@ -48,6 +48,7 @@ NSString *bit_UUID(void);
|
|||||||
NSString *bit_appAnonID(void);
|
NSString *bit_appAnonID(void);
|
||||||
BOOL bit_isPreiOS7Environment(void);
|
BOOL bit_isPreiOS7Environment(void);
|
||||||
BOOL bit_isPreiOS8Environment(void);
|
BOOL bit_isPreiOS8Environment(void);
|
||||||
|
BOOL bit_isRunningInAppExtension(void);
|
||||||
|
|
||||||
NSString *bit_validAppIconStringFromIcons(NSBundle *resourceBundle, NSArray *icons);
|
NSString *bit_validAppIconStringFromIcons(NSBundle *resourceBundle, NSArray *icons);
|
||||||
NSString *bit_validAppIconFilename(NSBundle *bundle, NSBundle *resourceBundle);
|
NSString *bit_validAppIconFilename(NSBundle *bundle, NSBundle *resourceBundle);
|
||||||
|
|||||||
@ -260,6 +260,17 @@ BOOL bit_isPreiOS8Environment(void) {
|
|||||||
return isPreiOS8Environment;
|
return isPreiOS8Environment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL bit_isRunningInAppExtension(void) {
|
||||||
|
static BOOL isRunningInAppExtension = NO;
|
||||||
|
static dispatch_once_t checkAppExtension;
|
||||||
|
|
||||||
|
dispatch_once(&checkAppExtension, ^{
|
||||||
|
isRunningInAppExtension = [[[NSBundle mainBundle] executablePath] containsString:@".appex/"];
|
||||||
|
});
|
||||||
|
|
||||||
|
return isRunningInAppExtension;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Find a valid app icon filename that points to a proper app icon image
|
Find a valid app icon filename that points to a proper app icon image
|
||||||
|
|
||||||
|
|||||||
@ -242,6 +242,11 @@ bitstadium_info_t bitstadium_library_info __attribute__((section("__TEXT,__bit_h
|
|||||||
}
|
}
|
||||||
#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */
|
#endif /* HOCKEYSDK_FEATURE_CRASH_REPORTER */
|
||||||
|
|
||||||
|
// App Extensions can only use BITCrashManager, so ignore all others automatically
|
||||||
|
if (bit_isRunningInAppExtension()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#if HOCKEYSDK_FEATURE_STORE_UPDATES
|
#if HOCKEYSDK_FEATURE_STORE_UPDATES
|
||||||
// start StoreUpdateManager
|
// start StoreUpdateManager
|
||||||
if ([self isStoreUpdateManagerEnabled]) {
|
if ([self isStoreUpdateManagerEnabled]) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user