expo-updates 0.8.4 → 0.9.2
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 +40 -2
- package/README.md +41 -25
- package/android/build.gradle +10 -13
- package/android/proguard-rules.pro +3 -0
- package/android/src/main/java/expo/modules/updates/UpdatesController.java +2 -2
- package/android/src/main/java/expo/modules/updates/UpdatesDevLauncherController.java +7 -4
- package/android/src/main/java/expo/modules/updates/UpdatesModule.java +13 -13
- package/android/src/main/java/expo/modules/updates/UpdatesPackage.java +71 -4
- package/android/src/main/java/expo/modules/updates/UpdatesService.java +1 -1
- package/android/src/main/java/expo/modules/updates/UpdatesUtils.java +7 -2
- package/android/src/main/java/expo/modules/updates/db/entity/UpdateEntity.java +1 -5
- package/android/src/main/java/expo/modules/updates/launcher/DatabaseLauncher.java +6 -6
- package/android/src/main/java/expo/modules/updates/launcher/NoDatabaseLauncher.java +6 -6
- package/android/src/main/java/expo/modules/updates/loader/EmbeddedLoader.java +13 -12
- package/android/src/main/java/expo/modules/updates/loader/FileDownloader.java +5 -5
- package/android/src/main/java/expo/modules/updates/loader/LoaderTask.java +6 -6
- package/android/src/main/java/expo/modules/updates/loader/RemoteLoader.java +14 -14
- package/android/src/main/java/expo/modules/updates/manifest/{BareManifest.kt → BareUpdateManifest.kt} +18 -17
- package/android/src/main/java/expo/modules/updates/manifest/{LegacyManifest.kt → LegacyUpdateManifest.kt} +30 -28
- package/android/src/main/java/expo/modules/updates/manifest/ManifestFactory.kt +25 -40
- package/android/src/main/java/expo/modules/updates/manifest/ManifestMetadata.java +5 -5
- package/android/src/main/java/expo/modules/updates/manifest/{NewManifest.kt → NewUpdateManifest.kt} +30 -25
- package/android/src/main/java/expo/modules/updates/manifest/{Manifest.kt → UpdateManifest.kt} +3 -3
- package/build/ExpoUpdates.d.ts +1 -1
- package/build/ExpoUpdates.js +1 -1
- package/build/ExpoUpdates.js.map +1 -1
- package/build/ExpoUpdates.web.js +1 -1
- package/build/ExpoUpdates.web.js.map +1 -1
- package/build/Updates.d.ts +83 -2
- package/build/Updates.js +92 -1
- package/build/Updates.js.map +1 -1
- package/build/Updates.types.d.ts +54 -19
- package/build/Updates.types.js +12 -0
- package/build/Updates.types.js.map +1 -1
- package/ios/EXUpdates/AppLoader/EXUpdatesAppLoader.m +1 -1
- package/ios/EXUpdates/AppLoader/EXUpdatesAsset.m +9 -4
- package/ios/EXUpdates/AppLoader/EXUpdatesEmbeddedAppLoader.m +4 -1
- package/ios/EXUpdates/AppLoader/EXUpdatesFileDownloader.m +17 -5
- package/ios/EXUpdates/AppLoader/EXUpdatesRemoteAppLoader.m +3 -3
- package/ios/EXUpdates/Database/EXUpdatesDatabase.m +1 -1
- package/ios/EXUpdates/EXUpdatesAppController.m +1 -1
- package/ios/EXUpdates/EXUpdatesAppDelegate.h +14 -0
- package/ios/EXUpdates/EXUpdatesAppDelegate.m +157 -0
- package/ios/EXUpdates/EXUpdatesConfig.h +4 -0
- package/ios/EXUpdates/EXUpdatesConfig.m +2 -1
- package/ios/EXUpdates/EXUpdatesDevLauncherController.m +2 -2
- package/ios/EXUpdates/EXUpdatesModule.h +3 -3
- package/ios/EXUpdates/EXUpdatesModule.m +14 -14
- package/ios/EXUpdates/EXUpdatesService.h +2 -2
- package/ios/EXUpdates/EXUpdatesService.m +2 -2
- package/ios/EXUpdates/SelectionPolicy/EXUpdatesSelectionPolicies.m +2 -2
- package/ios/EXUpdates/Update/EXUpdatesBareUpdate.h +2 -2
- package/ios/EXUpdates/Update/EXUpdatesBareUpdate.m +6 -6
- package/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.h +3 -3
- package/ios/EXUpdates/Update/EXUpdatesLegacyUpdate.m +11 -11
- package/ios/EXUpdates/Update/EXUpdatesNewUpdate.h +2 -2
- package/ios/EXUpdates/Update/EXUpdatesNewUpdate.m +23 -23
- package/ios/EXUpdates/Update/EXUpdatesUpdate+Private.h +2 -2
- package/ios/EXUpdates/Update/EXUpdatesUpdate.h +3 -5
- package/ios/EXUpdates/Update/EXUpdatesUpdate.m +13 -24
- package/ios/EXUpdates.podspec +17 -2
- package/ios/EXUpdates.xcframework/ios-arm64/EXUpdates.framework/EXUpdates +0 -0
- package/ios/EXUpdates.xcframework/ios-arm64/EXUpdates.framework/Info.plist +0 -0
- package/ios/EXUpdates.xcframework/ios-arm64_x86_64-simulator/EXUpdates.framework/EXUpdates +0 -0
- package/ios/EXUpdates.xcframework/ios-arm64_x86_64-simulator/EXUpdates.framework/Info.plist +0 -0
- package/ios/Tests/EXUpdatesDatabaseTests.m +6 -6
- package/ios/Tests/EXUpdatesLegacyUpdateTests.m +22 -22
- package/ios/Tests/EXUpdatesNewUpdateTests.m +5 -5
- package/ios/Tests/EXUpdatesSelectionPolicyFilterAwareTests.m +9 -7
- package/ios/Tests/Tests.m +19 -0
- package/package.json +13 -11
- package/plugin/build/withUpdates.js +2 -4
- package/plugin/src/withUpdates.ts +3 -6
- package/scripts/create-manifest-android.gradle +29 -18
- package/scripts/create-manifest-ios.sh +31 -6
- package/scripts/createManifest.js +3 -1
- package/src/ExpoUpdates.ts +1 -1
- package/src/ExpoUpdates.web.ts +1 -1
- package/src/Updates.ts +98 -3
- package/src/Updates.types.ts +68 -9
- package/android/src/main/java/expo/modules/updates/manifest/raw/BareRawManifest.kt +0 -9
- package/android/src/main/java/expo/modules/updates/manifest/raw/BaseLegacyRawManifest.kt +0 -22
- package/android/src/main/java/expo/modules/updates/manifest/raw/LegacyRawManifest.kt +0 -32
- package/android/src/main/java/expo/modules/updates/manifest/raw/NewRawManifest.kt +0 -39
- package/android/src/main/java/expo/modules/updates/manifest/raw/RawManifest.kt +0 -192
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBareRawManifest.h +0 -16
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBareRawManifest.m +0 -19
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBaseLegacyRawManifest.h +0 -15
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBaseLegacyRawManifest.m +0 -16
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBaseRawManifest.h +0 -38
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesBaseRawManifest.m +0 -153
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesLegacyRawManifest.h +0 -19
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesLegacyRawManifest.m +0 -33
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesNewRawManifest.h +0 -17
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesNewRawManifest.m +0 -44
- package/ios/EXUpdates/Update/RawManifest/EXUpdatesRawManifest.h +0 -43
- package/ios/EXUpdates/Update/RawManifest/NSDictionary+EXUpdatesRawManifest.h +0 -20
- package/ios/EXUpdates/Update/RawManifest/NSDictionary+EXUpdatesRawManifest.m +0 -54
- package/ios/Tests/EXUpdatesNewRawManifestTests.m +0 -41
- package/ios/Tests/NSDictionary+EXUpdatesRawManifestTest.m +0 -72
- package/plugin/build/withUpdatesAndroid.d.ts +0 -29
- package/plugin/build/withUpdatesAndroid.js +0 -160
- package/plugin/build/withUpdatesIOS.d.ts +0 -36
- package/plugin/build/withUpdatesIOS.js +0 -174
- package/plugin/src/withUpdatesAndroid.ts +0 -227
- package/plugin/src/withUpdatesIOS.ts +0 -215
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,44 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.9.2 — 2021-09-16
|
|
14
|
+
|
|
15
|
+
### 🛠 Breaking changes
|
|
16
|
+
|
|
17
|
+
- Dropped support for iOS 11.0 ([#14383](https://github.com/expo/expo/pull/14383) by [@cruzach](https://github.com/cruzach))
|
|
18
|
+
|
|
19
|
+
### 🐛 Bug fixes
|
|
20
|
+
|
|
21
|
+
- Fixing app.manifest does not generated from Xcode build phase script. ([#14438](https://github.com/expo/expo/pull/14438) by [@kudo](https://github.com/kudo))
|
|
22
|
+
|
|
23
|
+
## 0.9.1 — 2021-09-09
|
|
24
|
+
|
|
25
|
+
_This version does not introduce any user-facing changes._
|
|
26
|
+
|
|
27
|
+
## 0.9.0 — 2021-09-09
|
|
28
|
+
|
|
29
|
+
### 🎉 New features
|
|
30
|
+
|
|
31
|
+
- Version expo-updates plugin by importing from @expo/config-plugins@3.0.7. This allows the update url to be defined in app.confg ([#13981](https://github.com/expo/expo/pull/13981) by [@jkhales](https://github.com/jkhales))
|
|
32
|
+
- Store assets with filename = key.fileExtension. ([#13801](https://github.com/expo/expo/pull/13801) by [@jkhales](https://github.com/jkhales))
|
|
33
|
+
- Use stable manifest ID where applicable. ([#12964](https://github.com/expo/expo/pull/12964) by [@wschurman](https://github.com/wschurman))
|
|
34
|
+
- Update NewManifest field paths for new extra field format. ([#13398](https://github.com/expo/expo/pull/13398) by [@wschurman](https://github.com/wschurman))
|
|
35
|
+
- Update location of EAS projectId in new manifest. ([#13739](https://github.com/expo/expo/pull/13739) by [@wschurman](https://github.com/wschurman))
|
|
36
|
+
- Update location of scopeKey in new manifest. ([#13817](https://github.com/expo/expo/pull/13817) by [@wschurman](https://github.com/wschurman))
|
|
37
|
+
- Introduce automatically setup where iOS AppDelegate or Android MainApplication customization is not necessary. ([#14198](https://github.com/expo/expo/pull/14198) by [@kudo](https://github.com/kudo))
|
|
38
|
+
|
|
39
|
+
### 🐛 Bug fixes
|
|
40
|
+
|
|
41
|
+
- Fix `PROJECT_ROOT` path resolution in `create-manifest-ios.sh` and in `createManifest.js` ([#13439](https://github.com/expo/expo/pull/13439) by [@ajsmth](https://github.com/ajsmth))
|
|
42
|
+
- Fix erroneous manifest JSON direct access. ([#13906](https://github.com/expo/expo/pull/13906) by [@wschurman](https://github.com/wschurman))
|
|
43
|
+
- Fixed `userInterfaceStyle` not being applied when only set in root `expo` options and not in `expo.android` options. ([#13959](https://github.com/expo/expo/pull/13959) by [@mrousavy](https://github.com/mrousavy))
|
|
44
|
+
|
|
45
|
+
## 0.8.5 — 2021-09-02
|
|
46
|
+
|
|
47
|
+
### 💡 Others
|
|
48
|
+
|
|
49
|
+
- Skip running build scripts during iOS debug builds and add support for `SKIP_BUNDLING`/`FORCE_BUNDLING` environment variables. ([#14116](https://github.com/expo/expo/pull/14116) by [@fson](https://github.com/fson))
|
|
50
|
+
|
|
13
51
|
## 0.8.4 — 2021-08-06
|
|
14
52
|
|
|
15
53
|
### 🐛 Bug fixes
|
|
@@ -114,8 +152,8 @@ _This version does not introduce any user-facing changes._
|
|
|
114
152
|
|
|
115
153
|
### 🛠 Breaking changes
|
|
116
154
|
|
|
117
|
-
- remove UPDATES_CONFIGURATION_USES_LEGACY_MANIFEST_KEY constant. ([#12181](https://github.com/expo/expo/pull/12181) by [@jkhales](https://github.com/jkhales))
|
|
118
|
-
- remove EXUpdatesUsesLegacyManifest Plist constant (
|
|
155
|
+
- (android) remove UPDATES_CONFIGURATION_USES_LEGACY_MANIFEST_KEY constant and start respecting cache-control headers for all manifest responses. Please ensure your server defined cache-control headers are configured correctly if you are self-hosted to avoid issues such as [#13872](https://github.com/expo/expo/issues/13872) ([#12181](https://github.com/expo/expo/pull/12181) by [@jkhales](https://github.com/jkhales))
|
|
156
|
+
- (ios) remove EXUpdatesUsesLegacyManifest Plist constant and start respecting cache-control headers for all manifest responses Please ensure your server defined cache-control headers are configured correctly if you are self-hosted to avoid issues such as [#13872](https://github.com/expo/expo/issues/13872) ([#12249](https://github.com/expo/expo/pull/12249) by [@jkhales](https://github.com/jkhales))
|
|
119
157
|
- crash if EXUpdatesRequestHeaders is not a dictionary (ios). ([#12457](https://github.com/expo/expo/pull/12457) by [@jkhales](https://github.com/jkhales))
|
|
120
158
|
|
|
121
159
|
### 🎉 New features
|
package/README.md
CHANGED
|
@@ -45,53 +45,61 @@ Some build-time configuration options are available to allow your app to update
|
|
|
45
45
|
|
|
46
46
|
On Android, you may also define these properties at runtime by passing a `Map` as the second parameter of `UpdatesController.initialize()`. If provided, the values in this Map will override any values specified in `AndroidManifest.xml`. On iOS, you may set these properties at runtime by calling `[UpdatesController.sharedInstance setConfiguration:]` at any point _before_ calling `start` or `startAndShowLaunchScreen`, and the values in this dictionary will override Expo.plist.
|
|
47
47
|
|
|
48
|
-
| iOS plist/dictionary key | Android Map key | Android meta-data name
|
|
49
|
-
|
|
|
50
|
-
| `EXUpdatesEnabled`
|
|
48
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
49
|
+
| ------------------------ | --------------- | ------------------------------ | ------- | --------- |
|
|
50
|
+
| `EXUpdatesEnabled` | `enabled` | `expo.modules.updates.ENABLED` | `true` | ❌ |
|
|
51
51
|
|
|
52
52
|
Whether updates are enabled. Setting this to `false` disables all update functionality, all module methods, and forces the app to load with the manifest and assets bundled into the app binary.
|
|
53
53
|
|
|
54
|
-
| iOS plist/dictionary key | Android Map key | Android meta-data name
|
|
55
|
-
|
|
|
56
|
-
| `EXUpdatesURL`
|
|
54
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
55
|
+
| ------------------------ | --------------- | -------------------------------------- | ------- | --------- |
|
|
56
|
+
| `EXUpdatesURL` | `updateUrl` | `expo.modules.updates.EXPO_UPDATE_URL` | (none) | ✅ |
|
|
57
57
|
|
|
58
58
|
The URL to the remote server where the app should check for updates. A request to this URL should return a valid manifest object for the latest available update and tells expo-updates how to fetch the JS bundle and other assets that comprise the update. (Example: for apps published with `expo publish`, this URL would be `https://exp.host/@username/slug`.)
|
|
59
59
|
|
|
60
|
-
| iOS plist/dictionary key | Android Map key | Android meta-data name
|
|
61
|
-
|
|
|
62
|
-
| `EXUpdatesSDKVersion`
|
|
60
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
61
|
+
| ------------------------ | --------------- | --------------------------------------- | ------- | ------------------------------------------------------------- |
|
|
62
|
+
| `EXUpdatesSDKVersion` | `sdkVersion` | `expo.modules.updates.EXPO_SDK_VERSION` | (none) | (exactly one of `sdkVersion` or `runtimeVersion` is required) |
|
|
63
63
|
|
|
64
64
|
The SDK version string to send under the `Expo-SDK-Version` header in the manifest request. Required for apps hosted on Expo's server.
|
|
65
65
|
|
|
66
|
-
| iOS plist/dictionary key
|
|
67
|
-
|
|
|
68
|
-
| `EXUpdatesRuntimeVersion` | `runtimeVersion` | `expo.modules.updates.EXPO_RUNTIME_VERSION` | (none)
|
|
66
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
67
|
+
| ------------------------- | ---------------- | ------------------------------------------- | ------- | ------------------------------------------------------------- |
|
|
68
|
+
| `EXUpdatesRuntimeVersion` | `runtimeVersion` | `expo.modules.updates.EXPO_RUNTIME_VERSION` | (none) | (exactly one of `sdkVersion` or `runtimeVersion` is required) |
|
|
69
69
|
|
|
70
70
|
The Runtime Version string to send under the `Expo-Runtime-Version` header in the manifest request.
|
|
71
71
|
|
|
72
|
-
| iOS plist/dictionary key
|
|
73
|
-
|
|
|
74
|
-
| `EXUpdatesReleaseChannel` | `releaseChannel` | `expo.modules.updates.EXPO_RELEASE_CHANNEL` | `default` | ❌
|
|
72
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
73
|
+
| ------------------------- | ---------------- | ------------------------------------------- | --------- | --------- |
|
|
74
|
+
| `EXUpdatesReleaseChannel` | `releaseChannel` | `expo.modules.updates.EXPO_RELEASE_CHANNEL` | `default` | ❌ |
|
|
75
75
|
|
|
76
76
|
The release channel string to send under the `Expo-Release-Channel` header in the manifest request.
|
|
77
77
|
|
|
78
|
-
| iOS plist/dictionary key | Android Map key | Android meta-data name
|
|
79
|
-
|
|
|
80
|
-
| `EXUpdatesCheckOnLaunch` | `checkOnLaunch` | `expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH` | `ALWAYS` | ❌
|
|
78
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
79
|
+
| ------------------------ | --------------- | --------------------------------------------------- | -------- | --------- |
|
|
80
|
+
| `EXUpdatesCheckOnLaunch` | `checkOnLaunch` | `expo.modules.updates.EXPO_UPDATES_CHECK_ON_LAUNCH` | `ALWAYS` | ❌ |
|
|
81
81
|
|
|
82
82
|
The condition under which `expo-updates` should automatically check for (and download, if one exists) an update upon app launch. Possible values are `ALWAYS`, `NEVER` (if you want to exclusively control updates via this module's JS API), or `WIFI_ONLY` (if you want the app to automatically download updates only if the device is on an unmetered Wi-Fi connection when it launches).
|
|
83
83
|
|
|
84
|
-
| iOS plist/dictionary key | Android Map key | Android meta-data name
|
|
85
|
-
|
|
|
86
|
-
| `EXUpdatesLaunchWaitMs`
|
|
84
|
+
| iOS plist/dictionary key | Android Map key | Android meta-data name | Default | Required? |
|
|
85
|
+
| ------------------------ | --------------- | -------------------------------------------------- | ------- | --------- |
|
|
86
|
+
| `EXUpdatesLaunchWaitMs` | `launchWaitMs` | `expo.modules.updates.EXPO_UPDATES_LAUNCH_WAIT_MS` | `0` | ❌ |
|
|
87
87
|
|
|
88
88
|
The number of milliseconds `expo-updates` should delay the app launch and stay on the splash screen while trying to download an update, before falling back to a previously downloaded version. Setting this to `0` will cause the app to always launch with a previously downloaded update and will result in the fastest app launch possible.
|
|
89
89
|
|
|
90
|
+
## Customizing automatic setup
|
|
91
|
+
|
|
92
|
+
In `expo-updates@0.9.0` and above, we support automatic installation of the module in the iOS AppDelegate.m and Android MainApplication.java classes. If you want to customize the installation, e.g. to enable updates only in some build variants, you can add custom logic in AppDelegate/MainApplication and set the following keys to `false` in order to disable the automatic setup.
|
|
93
|
+
|
|
94
|
+
| iOS Expo.plist key | Android meta-data name | Default | Required? |
|
|
95
|
+
| -------------------- | --------------------------------- | ------- | --------- |
|
|
96
|
+
| `EXUpdatesAutoSetup` | `expo.modules.updates.AUTO_SETUP` | `true` | ❌ |
|
|
97
|
+
|
|
90
98
|
# Removing pre-installed expo-updates
|
|
91
99
|
|
|
92
100
|
Projects created by `expo init` and `expo eject` come with expo-updates pre-installed, because we anticipate most users will want this functionality. However, if you do not intend to use OTA updates, you can disable or uninstall the module.
|
|
93
101
|
|
|
94
|
-
|
|
102
|
+
## Disabling expo-updates
|
|
95
103
|
|
|
96
104
|
If you disable updates, the module will stay installed in case you ever want to use it in the future, but none of the OTA-updating code paths will ever be executed in your builds. To disable OTA updates, add the `EXUpdatesEnabled` key to Expo.plist with a boolean value of `NO`, and add the following line to AndroidManifest.xml:
|
|
97
105
|
|
|
@@ -99,7 +107,15 @@ If you disable updates, the module will stay installed in case you ever want to
|
|
|
99
107
|
<meta-data android:name="expo.modules.updates.ENABLED" android:value="false"/>
|
|
100
108
|
```
|
|
101
109
|
|
|
102
|
-
|
|
110
|
+
## Uninstalling expo-updates (for expo-updates >= 0.9.0)
|
|
111
|
+
|
|
112
|
+
Uninstalling the module will entirely remove all expo-updates related code from your codebase. To do so, complete the following steps:
|
|
113
|
+
|
|
114
|
+
- Remove `expo-updates` from your package.json and reinstall your node modules.
|
|
115
|
+
- Delete Expo.plist from your Xcode project and file system.
|
|
116
|
+
- Remove all `meta-data` tags with `expo.modules.updates` in the `android:name` field from AndroidManifest.xml.
|
|
117
|
+
|
|
118
|
+
## Uninstalling expo-updates (for expo-updates < 0.9.0)
|
|
103
119
|
|
|
104
120
|
Uninstalling the module will entirely remove all expo-updates related code from your codebase. To do so, complete the following steps:
|
|
105
121
|
|
|
@@ -124,7 +140,7 @@ Remove`EXUpdatesAppControllerDelegate` as a protocol of your `AppDelegate`.
|
|
|
124
140
|
|
|
125
141
|
@property (nonatomic, strong) UMModuleRegistryAdapter *moduleRegistryAdapter;
|
|
126
142
|
@property (nonatomic, strong) UIWindow *window;
|
|
127
|
-
|
|
143
|
+
```
|
|
128
144
|
|
|
129
145
|
#### `AppDelegate.m`
|
|
130
146
|
|
|
@@ -247,7 +263,7 @@ Remove`EXUpdatesAppControllerDelegate` as a protocol of your `AppDelegate`.
|
|
|
247
263
|
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
|
|
248
264
|
}
|
|
249
265
|
}
|
|
250
|
-
|
|
266
|
+
```
|
|
251
267
|
|
|
252
268
|
#### Remove Pods Target EXUpdates (Optional)
|
|
253
269
|
|
package/android/build.gradle
CHANGED
|
@@ -3,7 +3,9 @@ apply plugin: 'kotlin-android'
|
|
|
3
3
|
apply plugin: 'maven'
|
|
4
4
|
|
|
5
5
|
group = 'host.exp.exponent'
|
|
6
|
-
version = '0.
|
|
6
|
+
version = '0.9.2'
|
|
7
|
+
|
|
8
|
+
apply from: "../scripts/create-manifest-android.gradle"
|
|
7
9
|
|
|
8
10
|
buildscript {
|
|
9
11
|
// Simple helper that allows the root project to override versions declared by this library.
|
|
@@ -57,7 +59,8 @@ android {
|
|
|
57
59
|
minSdkVersion safeExtGet("minSdkVersion", 21)
|
|
58
60
|
targetSdkVersion safeExtGet("targetSdkVersion", 30)
|
|
59
61
|
versionCode 31
|
|
60
|
-
versionName '0.
|
|
62
|
+
versionName '0.9.2'
|
|
63
|
+
consumerProguardFiles("proguard-rules.pro")
|
|
61
64
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
62
65
|
// uncomment below to export the database schema when making changes
|
|
63
66
|
/* javaCompileOptions {
|
|
@@ -78,18 +81,12 @@ android {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
|
|
81
|
-
if (new File(rootProject.projectDir.parentFile, 'package.json').exists()) {
|
|
82
|
-
apply from: project(":unimodules-core").file("../unimodules-core.gradle")
|
|
83
|
-
} else {
|
|
84
|
-
throw new GradleException(
|
|
85
|
-
'\'unimodules-core.gradle\' was not found in the usual React Native dependency location. ' +
|
|
86
|
-
'This package can only be used in such projects. Are you sure you\'ve installed the dependencies properly?')
|
|
87
|
-
}
|
|
88
|
-
|
|
89
84
|
dependencies {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
85
|
+
implementation project(':expo-modules-core')
|
|
86
|
+
implementation project(':expo-structured-headers')
|
|
87
|
+
implementation project(':expo-updates-interface')
|
|
88
|
+
implementation project(':expo-manifests')
|
|
89
|
+
implementation project(':expo-json-utils')
|
|
93
90
|
//noinspection GradleDynamicVersion
|
|
94
91
|
implementation "com.facebook.react:react-native:+"
|
|
95
92
|
|
|
@@ -27,7 +27,7 @@ import expo.modules.updates.launcher.Launcher;
|
|
|
27
27
|
import expo.modules.updates.selectionpolicy.SelectionPolicy;
|
|
28
28
|
import expo.modules.updates.loader.FileDownloader;
|
|
29
29
|
import expo.modules.updates.loader.LoaderTask;
|
|
30
|
-
import expo.modules.updates.manifest.
|
|
30
|
+
import expo.modules.updates.manifest.UpdateManifest;
|
|
31
31
|
import expo.modules.updates.selectionpolicy.SelectionPolicyFactory;
|
|
32
32
|
|
|
33
33
|
import java.io.File;
|
|
@@ -301,7 +301,7 @@ public class UpdatesController {
|
|
|
301
301
|
}
|
|
302
302
|
|
|
303
303
|
@Override
|
|
304
|
-
public void
|
|
304
|
+
public void onRemoteUpdateManifestLoaded(UpdateManifest updateManifest) { }
|
|
305
305
|
|
|
306
306
|
@Override
|
|
307
307
|
public void onSuccess(Launcher launcher, boolean isUpToDate) {
|
|
@@ -8,13 +8,15 @@ import org.json.JSONObject;
|
|
|
8
8
|
|
|
9
9
|
import java.util.HashMap;
|
|
10
10
|
|
|
11
|
+
import expo.modules.manifests.core.Manifest;
|
|
11
12
|
import expo.modules.updates.db.DatabaseHolder;
|
|
12
13
|
import expo.modules.updates.db.entity.AssetEntity;
|
|
13
14
|
import expo.modules.updates.db.entity.UpdateEntity;
|
|
14
15
|
import expo.modules.updates.launcher.DatabaseLauncher;
|
|
15
16
|
import expo.modules.updates.launcher.Launcher;
|
|
16
17
|
import expo.modules.updates.loader.RemoteLoader;
|
|
17
|
-
import expo.modules.updates.manifest.
|
|
18
|
+
import expo.modules.updates.manifest.ManifestFactory;
|
|
19
|
+
import expo.modules.updates.manifest.UpdateManifest;
|
|
18
20
|
import expo.modules.updates.selectionpolicy.ReaperSelectionPolicyDevelopmentClient;
|
|
19
21
|
import expo.modules.updates.selectionpolicy.SelectionPolicy;
|
|
20
22
|
import expo.modules.updatesinterface.UpdatesInterface;
|
|
@@ -103,8 +105,8 @@ public class UpdatesDevLauncherController implements UpdatesInterface {
|
|
|
103
105
|
}
|
|
104
106
|
|
|
105
107
|
@Override
|
|
106
|
-
public boolean
|
|
107
|
-
return callback.onManifestLoaded(
|
|
108
|
+
public boolean onUpdateManifestLoaded(UpdateManifest updateManifest) {
|
|
109
|
+
return callback.onManifestLoaded(updateManifest.getManifest().getRawJson());
|
|
108
110
|
}
|
|
109
111
|
});
|
|
110
112
|
}
|
|
@@ -129,7 +131,8 @@ public class UpdatesDevLauncherController implements UpdatesInterface {
|
|
|
129
131
|
callback.onSuccess(new Update() {
|
|
130
132
|
@Override
|
|
131
133
|
public JSONObject getManifest() {
|
|
132
|
-
|
|
134
|
+
Manifest manifest = Manifest.fromManifestJson(launcher.getLaunchedUpdate().manifest);
|
|
135
|
+
return manifest.getRawJson();
|
|
133
136
|
}
|
|
134
137
|
|
|
135
138
|
@Override
|
|
@@ -9,10 +9,10 @@ import java.util.HashMap;
|
|
|
9
9
|
import java.util.Map;
|
|
10
10
|
|
|
11
11
|
import org.json.JSONObject;
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
12
|
+
import expo.modules.core.ExportedModule;
|
|
13
|
+
import expo.modules.core.ModuleRegistry;
|
|
14
|
+
import expo.modules.core.Promise;
|
|
15
|
+
import expo.modules.core.interfaces.ExpoMethod;
|
|
16
16
|
|
|
17
17
|
import androidx.annotation.Nullable;
|
|
18
18
|
import expo.modules.updates.db.DatabaseHolder;
|
|
@@ -20,12 +20,12 @@ import expo.modules.updates.db.entity.AssetEntity;
|
|
|
20
20
|
import expo.modules.updates.db.entity.UpdateEntity;
|
|
21
21
|
import expo.modules.updates.launcher.Launcher;
|
|
22
22
|
import expo.modules.updates.loader.FileDownloader;
|
|
23
|
-
import expo.modules.updates.manifest.
|
|
23
|
+
import expo.modules.updates.manifest.UpdateManifest;
|
|
24
24
|
import expo.modules.updates.loader.RemoteLoader;
|
|
25
25
|
import expo.modules.updates.manifest.ManifestMetadata;
|
|
26
26
|
|
|
27
27
|
// this unused import must stay because of versioning
|
|
28
|
-
|
|
28
|
+
|
|
29
29
|
|
|
30
30
|
public class UpdatesModule extends ExportedModule {
|
|
31
31
|
private static final String NAME = "ExpoUpdates";
|
|
@@ -148,21 +148,21 @@ public class UpdatesModule extends ExportedModule {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
@Override
|
|
151
|
-
public void onSuccess(
|
|
151
|
+
public void onSuccess(UpdateManifest updateManifest) {
|
|
152
152
|
UpdateEntity launchedUpdate = updatesService.getLaunchedUpdate();
|
|
153
153
|
Bundle updateInfo = new Bundle();
|
|
154
154
|
if (launchedUpdate == null) {
|
|
155
155
|
// this shouldn't ever happen, but if we don't have anything to compare
|
|
156
156
|
// the new manifest to, let the user know an update is available
|
|
157
157
|
updateInfo.putBoolean("isAvailable", true);
|
|
158
|
-
updateInfo.putString("manifestString",
|
|
158
|
+
updateInfo.putString("manifestString", updateManifest.getManifest().toString());
|
|
159
159
|
promise.resolve(updateInfo);
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
|
|
163
|
-
if (updatesService.getSelectionPolicy().shouldLoadNewUpdate(
|
|
163
|
+
if (updatesService.getSelectionPolicy().shouldLoadNewUpdate(updateManifest.getUpdateEntity(), launchedUpdate, updateManifest.getManifestFilters())) {
|
|
164
164
|
updateInfo.putBoolean("isAvailable", true);
|
|
165
|
-
updateInfo.putString("manifestString",
|
|
165
|
+
updateInfo.putString("manifestString", updateManifest.getManifest().toString());
|
|
166
166
|
promise.resolve(updateInfo);
|
|
167
167
|
} else {
|
|
168
168
|
updateInfo.putBoolean("isAvailable", false);
|
|
@@ -203,11 +203,11 @@ public class UpdatesModule extends ExportedModule {
|
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
@Override
|
|
206
|
-
public boolean
|
|
206
|
+
public boolean onUpdateManifestLoaded(UpdateManifest updateManifest) {
|
|
207
207
|
return updatesService.getSelectionPolicy().shouldLoadNewUpdate(
|
|
208
|
-
|
|
208
|
+
updateManifest.getUpdateEntity(),
|
|
209
209
|
updatesService.getLaunchedUpdate(),
|
|
210
|
-
|
|
210
|
+
updateManifest.getManifestFilters());
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@Override
|
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
package expo.modules.updates;
|
|
2
2
|
|
|
3
3
|
import android.content.Context;
|
|
4
|
+
import android.content.pm.ApplicationInfo;
|
|
5
|
+
import android.content.pm.PackageManager;
|
|
6
|
+
import android.util.Log;
|
|
7
|
+
|
|
8
|
+
import com.facebook.react.ReactInstanceManager;
|
|
9
|
+
import com.facebook.react.bridge.JavaScriptContextHolder;
|
|
10
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
4
11
|
|
|
5
|
-
import java.util.Arrays;
|
|
6
12
|
import java.util.Collections;
|
|
7
13
|
import java.util.List;
|
|
8
14
|
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
15
|
+
import androidx.annotation.NonNull;
|
|
16
|
+
import androidx.annotation.Nullable;
|
|
17
|
+
import androidx.annotation.UiThread;
|
|
18
|
+
import expo.modules.core.BasePackage;
|
|
19
|
+
import expo.modules.core.ExportedModule;
|
|
20
|
+
import expo.modules.core.interfaces.InternalModule;
|
|
21
|
+
import expo.modules.core.interfaces.ReactNativeHostHandler;
|
|
12
22
|
|
|
13
23
|
public class UpdatesPackage extends BasePackage {
|
|
24
|
+
private static final String TAG = UpdatesPackage.class.getSimpleName();
|
|
25
|
+
|
|
14
26
|
@Override
|
|
15
27
|
public List<InternalModule> createInternalModules(Context context) {
|
|
16
28
|
return Collections.singletonList((InternalModule) new UpdatesService(context));
|
|
@@ -20,4 +32,59 @@ public class UpdatesPackage extends BasePackage {
|
|
|
20
32
|
public List<ExportedModule> createExportedModules(Context context) {
|
|
21
33
|
return Collections.singletonList((ExportedModule) new UpdatesModule(context));
|
|
22
34
|
}
|
|
35
|
+
|
|
36
|
+
@Override
|
|
37
|
+
public List<? extends ReactNativeHostHandler> createReactNativeHostHandlers(Context context) {
|
|
38
|
+
final ReactNativeHostHandler handler = new ReactNativeHostHandler() {
|
|
39
|
+
private Boolean mShouldAutoSetup = null;
|
|
40
|
+
|
|
41
|
+
@Nullable
|
|
42
|
+
@Override
|
|
43
|
+
public ReactInstanceManager createReactInstanceManager(boolean useDeveloperSupport) {
|
|
44
|
+
if (shouldAutoSetup(context) && !useDeveloperSupport) {
|
|
45
|
+
UpdatesController.initialize(context);
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Nullable
|
|
51
|
+
@Override
|
|
52
|
+
public String getJSBundleFile(boolean useDeveloperSupport) {
|
|
53
|
+
return shouldAutoSetup(context) && !useDeveloperSupport
|
|
54
|
+
? UpdatesController.getInstance().getLaunchAssetFile()
|
|
55
|
+
: null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@Nullable
|
|
59
|
+
@Override
|
|
60
|
+
public String getBundleAssetName(boolean useDeveloperSupport) {
|
|
61
|
+
return shouldAutoSetup(context) && !useDeveloperSupport
|
|
62
|
+
? UpdatesController.getInstance().getBundleAssetName()
|
|
63
|
+
: null;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@Override
|
|
67
|
+
public void onRegisterJSIModules(@NonNull ReactApplicationContext reactApplicationContext,
|
|
68
|
+
@NonNull JavaScriptContextHolder jsContext,
|
|
69
|
+
boolean useDeveloperSupport) {
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
@UiThread
|
|
73
|
+
private boolean shouldAutoSetup(final Context context) {
|
|
74
|
+
if (mShouldAutoSetup == null) {
|
|
75
|
+
try {
|
|
76
|
+
final PackageManager pm = context.getPackageManager();
|
|
77
|
+
final ApplicationInfo ai = pm.getApplicationInfo(context.getPackageName(), PackageManager.GET_META_DATA);
|
|
78
|
+
mShouldAutoSetup = ai.metaData.getBoolean("expo.modules.updates.AUTO_SETUP", true);
|
|
79
|
+
} catch (Exception e) {
|
|
80
|
+
Log.e(TAG, "Could not read expo-updates configuration data in AndroidManifest", e);
|
|
81
|
+
mShouldAutoSetup = true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return mShouldAutoSetup;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
return Collections.singletonList(handler);
|
|
89
|
+
}
|
|
23
90
|
}
|