expo-application 5.7.0 → 5.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,12 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 5.8.0 — 2023-12-12
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - On iOS, fixed a regression that prevented expo go from determining the release type. ([#25834](https://github.com/expo/expo/pull/25834) by [@alanjhughes](https://github.com/alanjhughes))
18
+
13
19
  ## 5.7.0 — 2023-11-14
14
20
 
15
21
  ### 🛠 Breaking changes
@@ -3,7 +3,7 @@ apply plugin: 'kotlin-android'
3
3
  apply plugin: 'maven-publish'
4
4
 
5
5
  group = 'host.exp.exponent'
6
- version = '5.7.0'
6
+ version = '5.8.0'
7
7
 
8
8
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
9
9
  if (expoModulesCorePlugin.exists()) {
@@ -94,7 +94,7 @@ android {
94
94
  namespace "expo.modules.application"
95
95
  defaultConfig {
96
96
  versionCode 12
97
- versionName '5.7.0'
97
+ versionName '5.8.0'
98
98
  }
99
99
  }
100
100
 
@@ -36,12 +36,12 @@ public class ApplicationModule: Module {
36
36
  }
37
37
 
38
38
  AsyncFunction("getApplicationReleaseTypeAsync") { () -> Int in
39
- let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
39
+ let mainProvisioningProfile = EXProvisioningProfile.main()
40
40
  return mainProvisioningProfile.appReleaseType().rawValue
41
41
  }
42
42
 
43
43
  AsyncFunction("getPushNotificationServiceEnvironmentAsync") { () -> String? in
44
- let mainProvisioningProfile = ApplicationModuleProvisioningProfile.mainProvisioningProfile
44
+ let mainProvisioningProfile = EXProvisioningProfile.main()
45
45
  return mainProvisioningProfile.notificationServiceEnvironment()
46
46
  }
47
47
  }
@@ -0,0 +1,22 @@
1
+ // Copyright 2015-present 650 Industries. All rights reserved.
2
+
3
+ #import <Foundation/Foundation.h>
4
+
5
+ // Keep in sync with ApplicationReleaseType in JS
6
+ typedef NS_ENUM(NSInteger, EXAppReleaseType) {
7
+ EXAppReleaseTypeUnknown,
8
+ EXAppReleaseSimulator,
9
+ EXAppReleaseEnterprise,
10
+ EXAppReleaseDev,
11
+ EXAppReleaseAdHoc,
12
+ EXAppReleaseAppStore
13
+ };
14
+
15
+ @interface EXProvisioningProfile : NSObject
16
+
17
+ + (nonnull instancetype)mainProvisioningProfile;
18
+
19
+ - (EXAppReleaseType)appReleaseType;
20
+ - (nullable NSString *)notificationServiceEnvironment;
21
+
22
+ @end
@@ -0,0 +1,134 @@
1
+ // Copyright 2015-present 650 Industries. All rights reserved.
2
+
3
+ #import "EXProvisioningProfile.h"
4
+
5
+ @implementation EXProvisioningProfile {
6
+ NSDictionary *_plist;
7
+ }
8
+
9
+ + (nonnull instancetype)mainProvisioningProfile
10
+ {
11
+ static EXProvisioningProfile *profile;
12
+ static dispatch_once_t onceToken;
13
+ dispatch_once(&onceToken, ^{
14
+ NSDictionary *plist = [self _readProvisioningProfilePlist];
15
+ profile = [[self alloc] initWithPlist:plist];
16
+ });
17
+ return profile;
18
+ }
19
+
20
+ - (instancetype)initWithPlist:(NSDictionary *)plist
21
+ {
22
+ if (self = [super init]) {
23
+ _plist = plist;
24
+ }
25
+ return self;
26
+ }
27
+
28
+ - (nullable NSString *)notificationServiceEnvironment
29
+ {
30
+ if (!_plist) {
31
+ return nil;
32
+ }
33
+
34
+ NSDictionary *entitlements = _plist[@"Entitlements"];
35
+ NSString *apsEnvironment = entitlements[@"aps-environment"];
36
+ return apsEnvironment;
37
+ }
38
+
39
+ - (EXAppReleaseType)appReleaseType {
40
+ NSString *provisioningPath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
41
+ if (!provisioningPath) {
42
+ // provisioning profile does not exist
43
+ #if TARGET_IPHONE_SIMULATOR
44
+ return EXAppReleaseSimulator;
45
+ #else
46
+ return EXAppReleaseAppStore;
47
+ #endif
48
+ }
49
+
50
+ NSDictionary *mobileProvision = _plist;
51
+ if (!mobileProvision) {
52
+ // failure to read other than it simply not existing
53
+ return EXAppReleaseTypeUnknown;
54
+ } else if ([[mobileProvision objectForKey:@"ProvisionsAllDevices"] boolValue]) {
55
+ // enterprise distribution contains ProvisionsAllDevices - true
56
+ return EXAppReleaseEnterprise;
57
+ } else if ([mobileProvision objectForKey:@"ProvisionedDevices"] && [[mobileProvision objectForKey:@"ProvisionedDevices"] count] > 0) {
58
+ // development contains UDIDs and get-task-allow is true
59
+ // ad hoc contains UDIDs and get-task-allow is false
60
+ NSDictionary *entitlements = [mobileProvision objectForKey:@"Entitlements"];
61
+ if ([[entitlements objectForKey:@"get-task-allow"] boolValue]) {
62
+ return EXAppReleaseDev;
63
+ } else {
64
+ return EXAppReleaseAdHoc;
65
+ }
66
+ } else {
67
+ // app store contains no UDIDs (if the file exists at all?)
68
+ return EXAppReleaseAppStore;
69
+ }
70
+ }
71
+
72
+ /** embedded.mobileprovision plist format:
73
+
74
+ AppIDName, // string — TextDetective
75
+ ApplicationIdentifierPrefix[], // [ string - 66PK3K3KEV ]
76
+ CreationData, // date — 2013-01-17T14:18:05Z
77
+ DeveloperCertificates[], // [ data ]
78
+ Entitlements {
79
+ application-identifier // string - 66PK3K3KEV.com.blindsight.textdetective
80
+ get-task-allow // true or false
81
+ keychain-access-groups[] // [ string - 66PK3K3KEV.* ]
82
+ },
83
+ ExpirationDate, // date — 2014-01-17T14:18:05Z
84
+ Name, // string — Barrierefreikommunizieren (name assigned to the provisioning profile used)
85
+ ProvisionedDevices[], // [ string.... ]
86
+ TeamIdentifier[], // [string — HHBT96X2EX ]
87
+ TeamName, // string — The Blindsight Corporation
88
+ TimeToLive, // integer - 365
89
+ UUID, // string — 79F37E8E-CC8D-4819-8C13-A678479211CE
90
+ Version, // integer — 1
91
+ ProvisionsAllDevices // true or false ***NB: not sure if this is where this is
92
+
93
+ */
94
+ + (NSDictionary *)_readProvisioningProfilePlist
95
+ {
96
+ NSString *profilePath = [[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"];
97
+ if (!profilePath) {
98
+ return nil;
99
+ }
100
+
101
+ NSError *error;
102
+ NSString *profileString = [NSString stringWithContentsOfFile:profilePath encoding:NSASCIIStringEncoding error:&error];
103
+ if (!profileString) {
104
+ NSLog(@"Error reading provisioning profile: %@", error.localizedDescription);
105
+ return nil;
106
+ }
107
+
108
+ NSScanner *scanner = [NSScanner scannerWithString:profileString];
109
+ BOOL readPrelude = [scanner scanUpToString:@"<?xml version=\"1.0\" encoding=\"UTF-8\"?>" intoString:nil];
110
+ if (!readPrelude) {
111
+ return nil;
112
+ }
113
+
114
+ NSString *plistString;
115
+ BOOL readPlist = [scanner scanUpToString:@"</plist>" intoString:&plistString];
116
+ if (!readPlist) {
117
+ return nil;
118
+ }
119
+ plistString = [plistString stringByAppendingString:@"</plist>"];
120
+
121
+ NSData *plistData = [plistString dataUsingEncoding:NSUTF8StringEncoding];
122
+ NSDictionary *plistDictionary = [NSPropertyListSerialization propertyListWithData:plistData
123
+ options:NSPropertyListImmutable
124
+ format:NULL
125
+ error:&error];
126
+ if (!plistDictionary) {
127
+ NSLog(@"Error unserializing provisioning profile plist: %@", error.localizedDescription);
128
+ return nil;
129
+ }
130
+
131
+ return plistDictionary;
132
+ }
133
+
134
+ @end
@@ -3,7 +3,7 @@ require 'json'
3
3
  package = JSON.parse(File.read(File.join(__dir__, '..', 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = 'ExpoApplication'
6
+ s.name = 'EXApplication'
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.description = package['description']
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-application",
3
- "version": "5.7.0",
3
+ "version": "5.8.0",
4
4
  "description": "A universal module that gets native application information such as its ID, app name, and build version at runtime",
5
5
  "main": "build/Application.js",
6
6
  "types": "build/Application.d.ts",
@@ -36,5 +36,5 @@
36
36
  "peerDependencies": {
37
37
  "expo": "*"
38
38
  },
39
- "gitHead": "3142a086578deffd8704a8f1b6f0f661527d836c"
39
+ "gitHead": "6aca7ce098ddc667776a3d7cf612adbb985e264a"
40
40
  }
@@ -1,75 +0,0 @@
1
- // Copyright 2015-present 650 Industries. All rights reserved.
2
- import ExpoModulesCore
3
-
4
- class ApplicationModuleProvisioningProfile {
5
- private let plist = readProvisioningProfilePlist()
6
- static let mainProvisioningProfile = ApplicationModuleProvisioningProfile()
7
-
8
- func notificationServiceEnvironment() -> String? {
9
- guard let plist = plist else {
10
- return nil
11
- }
12
-
13
- let entitlements = plist["Entitlements"] as? [String: Any]
14
- return entitlements?["aps-environment"] as? String
15
- }
16
-
17
- func appReleaseType() -> AppReleaseType {
18
- guard let provisioningPath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
19
- #if targetEnvironment(simulator)
20
- return .simulator
21
- #else
22
- return .appStore
23
- #endif
24
- }
25
-
26
- guard let mobileProvision = plist else {
27
- return .unknown
28
- }
29
-
30
- if let provisionsAllDevices = mobileProvision["ProvisionsAllDevices"] as? Bool, provisionsAllDevices {
31
- return .enterprise
32
- }
33
- if let provisionedDevices = mobileProvision["ProvisionedDevices"] as? [String], !provisionedDevices.isEmpty {
34
- let entitlements = mobileProvision["Entitlements"] as? [String: Any]
35
- if let getTaskAllow = entitlements?["get-task-allow"] as? Bool, getTaskAllow {
36
- return .dev
37
- }
38
- return .adHoc
39
- }
40
- return .appStore
41
- }
42
-
43
- private static func readProvisioningProfilePlist() -> [String: Any]? {
44
- guard let profilePath = Bundle.main.path(forResource: "embedded", ofType: "mobileprovision") else {
45
- return nil
46
- }
47
-
48
- do {
49
- let profileString = try String(contentsOfFile: profilePath, encoding: .ascii)
50
- guard let plistStart = profileString.range(of: "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"),
51
- let plistEnd = profileString.range(of: "</plist>") else {
52
- return nil
53
- }
54
-
55
- let plistString = String(profileString[plistStart.lowerBound..<plistEnd.upperBound])
56
- if let plistData = plistString.data(using: .utf8) {
57
- return try PropertyListSerialization.propertyList(from: plistData, options: [], format: nil) as? [String: Any]
58
- }
59
- log.error("Failed to convert plistString to UTF-8 encoded data object.")
60
- return nil
61
- } catch {
62
- log.error("Error reading provisioning profile: \(error.localizedDescription)")
63
- return nil
64
- }
65
- }
66
- }
67
-
68
- enum AppReleaseType: Int, Enumerable {
69
- case unknown = 0
70
- case simulator = 1
71
- case enterprise = 2
72
- case dev = 3
73
- case adHoc = 4
74
- case appStore = 5
75
- }