aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firebase/Core/third_party/FIRAppEnvironmentUtil.m
diff options
context:
space:
mode:
Diffstat (limited to 'Firebase/Core/third_party/FIRAppEnvironmentUtil.m')
-rw-r--r--Firebase/Core/third_party/FIRAppEnvironmentUtil.m14
1 files changed, 14 insertions, 0 deletions
diff --git a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m
index 3a08cfa..337f082 100644
--- a/Firebase/Core/third_party/FIRAppEnvironmentUtil.m
+++ b/Firebase/Core/third_party/FIRAppEnvironmentUtil.m
@@ -36,6 +36,10 @@ struct encryption_info_command {
@implementation FIRAppEnvironmentUtil
+/// A key for the Info.plist to enable or disable checking if the App Store is running in a sandbox,
+/// which would be true while running on TestFlight.
+static NSString *const kFIRAppStoreSandboxCheckEnabledKey = @"FirebaseAppStoreSandboxCheckEnabled";
+
/// The file name of the sandbox receipt. This is available on iOS >= 8.0
static NSString *const kFIRAIdentitySandboxReceiptFileName = @"sandboxReceipt";
@@ -152,6 +156,16 @@ static BOOL isAppEncrypted() {
}
+ (BOOL)isAppStoreReceiptSandbox {
+ // Since checking the App Store's receipt URL can be memory intensive, check the option in the
+ // Info.plist if developers opted out of this check.
+ id enableSandboxCheck =
+ [[NSBundle mainBundle] objectForInfoDictionaryKey:kFIRAppStoreSandboxCheckEnabledKey];
+ if (enableSandboxCheck &&
+ [enableSandboxCheck isKindOfClass:[NSNumber class]] &&
+ ![enableSandboxCheck boolValue]) {
+ return NO;
+ }
+
NSURL *appStoreReceiptURL = [NSBundle mainBundle].appStoreReceiptURL;
NSString *appStoreReceiptFileName = appStoreReceiptURL.lastPathComponent;
return [appStoreReceiptFileName isEqualToString:kFIRAIdentitySandboxReceiptFileName];