expo-updates 0.13.1 → 0.13.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 CHANGED
@@ -10,6 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.13.2 — 2022-06-03
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Android: Allow null asset hash in new manifests. ([#17466](https://github.com/expo/expo/pull/17466) by [@wschurman](https://github.com/wschurman))
18
+ - Android: Fix asset hash storage. ([#17732](https://github.com/expo/expo/pull/17732) by [@wschurman](https://github.com/wschurman))
19
+
13
20
  ## 0.13.1 — 2022-05-05
14
21
 
15
22
  ### 🐛 Bug fixes
@@ -4,7 +4,7 @@ apply plugin: 'kotlin-kapt'
4
4
  apply plugin: 'maven-publish'
5
5
 
6
6
  group = 'host.exp.exponent'
7
- version = '0.13.1'
7
+ version = '0.13.2'
8
8
 
9
9
  apply from: "../scripts/create-manifest-android.gradle"
10
10
 
@@ -77,7 +77,7 @@ android {
77
77
  minSdkVersion safeExtGet("minSdkVersion", 21)
78
78
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
79
79
  versionCode 31
80
- versionName '0.13.1'
80
+ versionName '0.13.2'
81
81
  consumerProguardFiles("proguard-rules.pro")
82
82
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
83
83
  // uncomment below to export the database schema when making changes
@@ -19,7 +19,7 @@ import java.util.*
19
19
  @Database(
20
20
  entities = [UpdateEntity::class, UpdateAssetEntity::class, AssetEntity::class, JSONDataEntity::class],
21
21
  exportSchema = false,
22
- version = 10
22
+ version = 11
23
23
  )
24
24
  @TypeConverters(Converters::class)
25
25
  abstract class UpdatesDatabase : RoomDatabase() {
@@ -43,6 +43,7 @@ abstract class UpdatesDatabase : RoomDatabase() {
43
43
  .addMigrations(MIGRATION_7_8)
44
44
  .addMigrations(MIGRATION_8_9)
45
45
  .addMigrations(MIGRATION_9_10)
46
+ .addMigrations(MIGRATION_10_11)
46
47
  .fallbackToDestructiveMigration()
47
48
  .allowMainThreadQueries()
48
49
  .build()
@@ -50,6 +51,16 @@ abstract class UpdatesDatabase : RoomDatabase() {
50
51
  return instance!!
51
52
  }
52
53
 
54
+ private fun SupportSQLiteDatabase.runInTransaction(block: SupportSQLiteDatabase.() -> Unit) {
55
+ beginTransaction()
56
+ try {
57
+ block()
58
+ setTransactionSuccessful()
59
+ } finally {
60
+ endTransaction()
61
+ }
62
+ }
63
+
53
64
  private fun SupportSQLiteDatabase.runInTransactionWithForeignKeysOff(block: SupportSQLiteDatabase.() -> Unit) {
54
65
  // https://www.sqlite.org/lang_altertable.html#otheralter
55
66
  try {
@@ -150,18 +161,16 @@ abstract class UpdatesDatabase : RoomDatabase() {
150
161
 
151
162
  val MIGRATION_9_10: Migration = object : Migration(9, 10) {
152
163
  override fun migrate(database: SupportSQLiteDatabase) {
153
- // https://www.sqlite.org/lang_altertable.html#otheralter
154
- try {
155
- database.execSQL("PRAGMA foreign_keys=OFF")
156
- database.beginTransaction()
157
- try {
158
- database.execSQL("ALTER TABLE `assets` ADD COLUMN `expected_hash` TEXT")
159
- database.setTransactionSuccessful()
160
- } finally {
161
- database.endTransaction()
162
- }
163
- } finally {
164
- database.execSQL("PRAGMA foreign_keys=ON")
164
+ database.runInTransactionWithForeignKeysOff {
165
+ execSQL("ALTER TABLE `assets` ADD COLUMN `expected_hash` TEXT")
166
+ }
167
+ }
168
+ }
169
+
170
+ val MIGRATION_10_11: Migration = object : Migration(10, 11) {
171
+ override fun migrate(database: SupportSQLiteDatabase) {
172
+ database.runInTransaction {
173
+ execSQL("UPDATE `assets` SET `expected_hash` = NULL")
165
174
  }
166
175
  }
167
176
  }
@@ -68,7 +68,7 @@ class NewUpdateManifest private constructor(
68
68
  extraRequestHeaders = assetHeaders[mLaunchAsset.getString("key")]
69
69
  isLaunchAsset = true
70
70
  embeddedAssetFilename = EmbeddedLoader.BUNDLE_FILENAME
71
- expectedHash = mLaunchAsset.getString("hash")
71
+ expectedHash = mLaunchAsset.getNullable("hash")
72
72
  }
73
73
  )
74
74
  } catch (e: JSONException) {
@@ -86,7 +86,7 @@ class NewUpdateManifest private constructor(
86
86
  url = Uri.parse(assetObject.getString("url"))
87
87
  extraRequestHeaders = assetHeaders[assetObject.getString("key")]
88
88
  embeddedAssetFilename = assetObject.getNullable("embeddedAssetFilename")
89
- expectedHash = mLaunchAsset.getString("hash")
89
+ expectedHash = assetObject.getNullable("hash")
90
90
  }
91
91
  )
92
92
  } catch (e: JSONException) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.13.1",
3
+ "version": "0.13.2",
4
4
  "description": "Fetches and manages remotely-hosted assets and updates to your app's JS bundle.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -64,5 +64,5 @@
64
64
  "peerDependencies": {
65
65
  "expo": "*"
66
66
  },
67
- "gitHead": "b9d655c1bed682ad8919e071dd923968773f05b5"
67
+ "gitHead": "8c27606412dae179402107417aa11a88530c2251"
68
68
  }