diff options
Diffstat (limited to 'Firebase/Core/third_party/FIRAppEnvironmentUtil.m')
-rw-r--r-- | Firebase/Core/third_party/FIRAppEnvironmentUtil.m | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m index fe4e23d..90e66f0 100644 --- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m +++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m @@ -13,6 +13,9 @@ // limitations under the License. #import <Foundation/Foundation.h> +#if TARGET_OS_IOS || TARGET_OS_TV +#import <UIKit/UIKit.h> +#endif #import "FIRAppEnvironmentUtil.h" @@ -174,7 +177,7 @@ static BOOL isAppEncrypted() { } + (BOOL)hasEmbeddedMobileProvision { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV return [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"].length > 0; #elif TARGET_OS_OSX return NO; @@ -182,7 +185,7 @@ static BOOL isAppEncrypted() { } + (BOOL)isSimulator { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV NSString *platform = [FIRAppEnvironmentUtil deviceModel]; return [platform isEqual:@"x86_64"] || [platform isEqual:@"i386"]; #elif TARGET_OS_OSX @@ -204,7 +207,7 @@ static BOOL isAppEncrypted() { } + (NSString *)systemVersion { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV return [UIDevice currentDevice].systemVersion; #elif TARGET_OS_OSX return [NSProcessInfo processInfo].operatingSystemVersionString; @@ -212,7 +215,7 @@ static BOOL isAppEncrypted() { } + (BOOL)isAppExtension { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV // Documented by <a href="https://goo.gl/RRB2Up">Apple</a> BOOL appExtension = [[[NSBundle mainBundle] bundlePath] hasSuffix:@".appex"]; return appExtension; @@ -221,29 +224,10 @@ static BOOL isAppEncrypted() { #endif } -#if TARGET_OS_IOS -+ (UIApplication *)sharedApplication { - if ([FIRAppEnvironmentUtil isAppExtension]) { - return nil; - } - id sharedApplication = nil; - Class uiApplicationClass = NSClassFromString(@"UIApplication"); - if (uiApplicationClass && - [uiApplicationClass respondsToSelector:(NSSelectorFromString(@"sharedApplication"))]) { - sharedApplication = [uiApplicationClass sharedApplication]; - } - return sharedApplication; -} -#elif TARGET_OS_OSX -+ (NSApplication *)sharedApplication { - return [NSApplication sharedApplication]; -} -#endif - #pragma mark - Helper methods + (BOOL)hasSCInfoFolder { - #if TARGET_OS_IOS + #if TARGET_OS_IOS || TARGET_OS_TV NSString *bundlePath = [NSBundle mainBundle].bundlePath; NSString *scInfoPath = [bundlePath stringByAppendingPathComponent:@"SC_Info"]; return [[NSFileManager defaultManager] fileExistsAtPath:scInfoPath]; |