1// Copyright 2015-present 650 Industries. All rights reserved.
2
3#import "EXClientReleaseType.h"
4#if __has_include(<EXApplication/EXProvisioningProfile.h>)
5#import <EXApplication/EXProvisioningProfile.h>
6#endif
7
8@implementation EXClientReleaseType
9
10+ (NSString *)clientReleaseType
11{
12  // The only scenario in which we care about the app release type is when the App Store release of
13  // the Expo development client is run on a real device so the development client knows to restrict
14  // projects it can run. We always include expo-application in the App Store release of the
15  // development client, so we correctly return "APPLE_APP_STORE" in the aforementioned scenario.
16  //
17  // In all other scenarios, we don't restrict the projects the client can run and can return either
18  // the actual release type or "UNKNOWN" for the same behavior, so it doesn't matter whether
19  // expo-application is linked.
20#if __has_include(<EXApplication/EXProvisioningProfile.h>)
21  EXAppReleaseType releaseType = [[EXProvisioningProfile mainProvisioningProfile] appReleaseType];
22  switch (releaseType) {
23    case EXAppReleaseTypeUnknown:
24      return @"UNKNOWN";
25    case EXAppReleaseSimulator:
26      return @"SIMULATOR";
27    case EXAppReleaseEnterprise:
28      return @"ENTERPRISE";
29    case EXAppReleaseDev:
30      return @"DEVELOPMENT";
31    case EXAppReleaseAdHoc:
32      return @"ADHOC";
33    case EXAppReleaseAppStore:
34      return @"APPLE_APP_STORE";
35  }
36#else
37  return @"UNKNOWN";
38#endif
39}
40
41@end
42