tooot/patches/expo-updates+0.11.3.patch

106 lines
4.9 KiB
Diff

diff --git a/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/Crypto.kt b/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/Crypto.kt
index 69d5957..ec9858c 100644
--- a/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/Crypto.kt
+++ b/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/Crypto.kt
@@ -47,7 +47,7 @@ object Crypto {
override fun onResponse(call: Call, response: Response) {
val exception: Exception = try {
val isValid = verifyPublicRSASignature(
- response.body()!!.string(), plainText, cipherText
+ response.body!!.string(), plainText, cipherText
)
listener.onCompleted(isValid)
return
diff --git a/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt b/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt
index 530a259..3c70674 100644
--- a/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt
+++ b/node_modules/expo-updates/android/src/main/java/expo/modules/updates/loader/FileDownloader.kt
@@ -14,6 +14,7 @@ import expo.modules.updates.manifest.ManifestHeaderData
import expo.modules.updates.manifest.UpdateManifest
import expo.modules.updates.selectionpolicy.SelectionPolicies
import okhttp3.*
+import okhttp3.Headers.Companion.toHeaders
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
@@ -65,14 +66,14 @@ open class FileDownloader(context: Context) {
if (!response.isSuccessful) {
callback.onFailure(
Exception(
- "Network request failed: " + response.body()!!
+ "Network request failed: " + response.body!!
.string()
)
)
return
}
try {
- response.body()!!.byteStream().use { inputStream ->
+ response.body!!.byteStream().use { inputStream ->
val hash = UpdatesUtils.sha256AndWriteToFile(inputStream, destination)
callback.onSuccess(destination, hash)
}
@@ -100,7 +101,7 @@ open class FileDownloader(context: Context) {
parseMultipartManifestResponse(response, boundaryParameter, configuration, callback)
} else {
- val responseHeaders = response.headers()
+ val responseHeaders = response.headers
val manifestHeaderData = ManifestHeaderData(
protocolVersion = responseHeaders["expo-protocol-version"],
manifestFilters = responseHeaders["expo-manifest-filters"],
@@ -108,7 +109,7 @@ open class FileDownloader(context: Context) {
manifestSignature = responseHeaders["expo-manifest-signature"],
)
- parseManifest(response.body()!!.string(), manifestHeaderData, null, configuration, callback)
+ parseManifest(response.body!!.string(), manifestHeaderData, null, configuration, callback)
}
}
@@ -124,14 +125,14 @@ open class FileDownloader(context: Context) {
val value = line.substring(indexOfSeparator + 1).trim()
headers[key] = value
}
- return Headers.of(headers)
+ return headers.toHeaders()
}
private fun parseMultipartManifestResponse(response: Response, boundary: String, configuration: UpdatesConfiguration, callback: ManifestDownloadCallback) {
var manifestPartBodyAndHeaders: Pair<String, Headers>? = null
var extensionsBody: String? = null
- val multipartStream = MultipartStream(response.body()!!.byteStream(), boundary.toByteArray())
+ val multipartStream = MultipartStream(response.body!!.byteStream(), boundary.toByteArray())
try {
var nextPart = multipartStream.skipPreamble()
@@ -178,7 +179,7 @@ open class FileDownloader(context: Context) {
return
}
- val responseHeaders = response.headers()
+ val responseHeaders = response.headers
val manifestHeaderData = ManifestHeaderData(
protocolVersion = responseHeaders["expo-protocol-version"],
manifestFilters = responseHeaders["expo-manifest-filters"],
@@ -275,7 +276,7 @@ open class FileDownloader(context: Context) {
callback.onFailure(
"Failed to download manifest from URL: " + configuration.updateUrl,
Exception(
- response.body()!!.string()
+ response.body!!.string()
)
)
return
@@ -464,7 +465,9 @@ open class FileDownloader(context: Context) {
if (runtimeVersion != null && runtimeVersion.isNotEmpty()) {
header("Expo-Runtime-Version", runtimeVersion)
} else {
- header("Expo-SDK-Version", sdkVersion)
+ if (sdkVersion != null) {
+ header("Expo-SDK-Version", sdkVersion)
+ }
}
}
.header("Expo-Release-Channel", configuration.releaseChannel)