expo-updates 0.18.16 → 0.18.17

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
+ ## 0.18.17 — 2023-10-25
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - [Android] Simplify UpdatesUtils.parseDateString, fix UpdatesLoggingTest. ([#24951](https://github.com/expo/expo/pull/24951) by [@douglowder](https://github.com/douglowder))
18
+
13
19
  ## 0.18.16 — 2023-10-05
14
20
 
15
21
  ### 🐛 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.18.16'
7
+ version = '0.18.17'
8
8
 
9
9
  // Utility method to derive boolean values from the environment or from Java properties,
10
10
  // and return them as strings to be used in BuildConfig fields
@@ -95,7 +95,7 @@ android {
95
95
  minSdkVersion safeExtGet("minSdkVersion", 21)
96
96
  targetSdkVersion safeExtGet("targetSdkVersion", 33)
97
97
  versionCode 31
98
- versionName '0.18.16'
98
+ versionName '0.18.17'
99
99
  consumerProguardFiles("proguard-rules.pro")
100
100
  testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
101
101
 
@@ -5,7 +5,6 @@ import expo.modules.updates.UpdatesConfiguration.CheckAutomaticallyConfiguration
5
5
  import expo.modules.updates.db.entity.AssetEntity
6
6
  import android.os.AsyncTask
7
7
  import android.net.ConnectivityManager
8
- import android.os.Build
9
8
  import android.util.Base64
10
9
  import android.util.Log
11
10
  import com.facebook.react.ReactNativeHost
@@ -21,7 +20,6 @@ import org.json.JSONObject
21
20
  import java.io.*
22
21
  import java.lang.ClassCastException
23
22
  import java.lang.Exception
24
- import java.lang.IllegalArgumentException
25
23
  import java.lang.ref.WeakReference
26
24
  import java.security.DigestInputStream
27
25
  import java.security.MessageDigest
@@ -272,26 +270,21 @@ object UpdatesUtils {
272
270
 
273
271
  @Throws(ParseException::class)
274
272
  fun parseDateString(dateString: String): Date {
275
- return try {
276
- val formatter: DateFormat = when (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
277
- true -> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'X'", Locale.US)
278
- false -> SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US).apply {
279
- timeZone = TimeZone.getTimeZone("GMT")
280
- }
273
+ try {
274
+ val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'X'", Locale.US)
275
+ return formatter.parse(dateString) as Date
276
+ } catch (e: Exception) {
277
+ // Don't throw on first attempt
278
+ }
279
+ // First attempt failed, try with 'Z' format string
280
+ try {
281
+ val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US).apply {
282
+ timeZone = TimeZone.getTimeZone("GMT")
281
283
  }
282
- formatter.parse(dateString) as Date
283
- } catch (e: ParseException) {
284
- Log.e(TAG, "Failed to parse date string on first try: $dateString", e)
285
- // some old Android versions don't support the 'X' character in SimpleDateFormat, so try without this
286
- val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US)
287
- formatter.timeZone = TimeZone.getTimeZone("GMT")
288
- // throw if this fails too
289
- formatter.parse(dateString) as Date
290
- } catch (e: IllegalArgumentException) {
291
- Log.e(TAG, "Failed to parse date string on first try: $dateString", e)
292
- val formatter: DateFormat = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", Locale.US)
293
- formatter.timeZone = TimeZone.getTimeZone("GMT")
294
- formatter.parse(dateString) as Date
284
+ return formatter.parse(dateString) as Date
285
+ } catch (e: Exception) {
286
+ // Throw if the second parse attempt fails
287
+ throw e
295
288
  }
296
289
  }
297
290
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-updates",
3
- "version": "0.18.16",
3
+ "version": "0.18.17",
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": "19fbbb907b3439da37dbe21c372fba3226594a37"
67
+ "gitHead": "63bbdf029ce2847c870649449ee593c97bbe3fb3"
68
68
  }