diff options
author | Ryan Wilson <wilsonryan@google.com> | 2017-12-08 14:51:49 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-08 14:51:49 -0500 |
commit | e5b2146326b673b2037a73a839f4a70bf6c8c40e (patch) | |
tree | bec69fbc92bf78e3be5d60f65095c42489a9c946 /Firebase | |
parent | 31917f566c0e5d5e1e2f4361cbc2a9f280c6aa5d (diff) |
Add an Info.plist flag to disable App Store Sandbox check. (#547)
* Add an Info.plist flag to disable TestFlight check.
This can save a small amount of memory during startup time.
* Change the flag name to the intended usage.
* Explicitly check for NSNumber.
Diffstat (limited to 'Firebase')
-rw-r--r-- | Firebase/Core/third_party/FIRAppEnvironmentUtil.m | 14 |
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]; |