expo-modules-core 1.5.4 → 1.5.5
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 +7 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt +16 -10
- package/ios/Swift/Arguments/Convertibles.swift +5 -6
- package/ios/Swift/Utilities.swift +10 -0
- package/ios/Tests/ConvertiblesSpec.swift +0 -7
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,13 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 1.5.5 — 2023-07-07
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- Improved the OkHttp network inspector stability on Android. ([#23350](https://github.com/expo/expo/pull/23350) by [@kudo](https://github.com/kudo))
|
|
18
|
+
- [iOS] Fix conversion to `URL` type that failed despite receiving a string that contained a valid URL. ([#23331](https://github.com/expo/expo/pull/23331) by [@alanhughes](https://github.com/alanjhughes))
|
|
19
|
+
|
|
13
20
|
## 1.5.4 — 2023-07-04
|
|
14
21
|
|
|
15
22
|
### 🐛 Bug fixes
|
package/android/build.gradle
CHANGED
|
@@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
|
|
|
6
6
|
apply plugin: "de.undercouch.download"
|
|
7
7
|
|
|
8
8
|
group = 'host.exp.exponent'
|
|
9
|
-
version = '1.5.
|
|
9
|
+
version = '1.5.5'
|
|
10
10
|
|
|
11
11
|
buildscript {
|
|
12
12
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
@@ -160,7 +160,7 @@ android {
|
|
|
160
160
|
targetSdkVersion safeExtGet("targetSdkVersion", 33)
|
|
161
161
|
consumerProguardFiles 'proguard-rules.pro'
|
|
162
162
|
versionCode 1
|
|
163
|
-
versionName "1.5.
|
|
163
|
+
versionName "1.5.5"
|
|
164
164
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
|
|
165
165
|
|
|
166
166
|
testInstrumentationRunner "expo.modules.TestRunner"
|
package/android/src/main/java/expo/modules/kotlin/devtools/ExpoNetworkInspectOkHttpInterceptors.kt
CHANGED
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
package expo.modules.kotlin.devtools
|
|
4
4
|
|
|
5
|
+
import android.util.Log
|
|
5
6
|
import okhttp3.Interceptor
|
|
6
7
|
import okhttp3.Request
|
|
7
8
|
import okhttp3.Response
|
|
8
9
|
|
|
10
|
+
private const val TAG = "ExpoNetworkInspector"
|
|
11
|
+
|
|
9
12
|
// Currently keeps the delegate fixed for ExpoRequestCdpInterceptor and be thread-safe
|
|
10
13
|
internal val delegate: ExpoNetworkInspectOkHttpInterceptorsDelegate = ExpoRequestCdpInterceptor
|
|
11
14
|
|
|
@@ -16,19 +19,22 @@ internal val delegate: ExpoNetworkInspectOkHttpInterceptorsDelegate = ExpoReques
|
|
|
16
19
|
class ExpoNetworkInspectOkHttpNetworkInterceptor : Interceptor {
|
|
17
20
|
override fun intercept(chain: Interceptor.Chain): Response {
|
|
18
21
|
val request = chain.request()
|
|
19
|
-
val redirectResponse = request.tag(RedirectResponse::class.java)
|
|
20
|
-
val requestId = redirectResponse?.requestId ?: request.hashCode().toString()
|
|
21
|
-
delegate.willSendRequest(requestId, request, redirectResponse?.priorResponse)
|
|
22
|
-
|
|
23
22
|
val response = chain.proceed(request)
|
|
23
|
+
try {
|
|
24
|
+
val redirectResponse = request.tag(RedirectResponse::class.java)
|
|
25
|
+
val requestId = redirectResponse?.requestId ?: request.hashCode().toString()
|
|
26
|
+
delegate.willSendRequest(requestId, request, redirectResponse?.priorResponse)
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
28
|
+
if (response.isRedirect) {
|
|
29
|
+
response.request.tag(RedirectResponse::class.java)?.let {
|
|
30
|
+
it.requestId = requestId
|
|
31
|
+
it.priorResponse = response
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
delegate.didReceiveResponse(requestId, request, response)
|
|
29
35
|
}
|
|
30
|
-
}
|
|
31
|
-
|
|
36
|
+
} catch (e: Exception) {
|
|
37
|
+
Log.e(TAG, "Failed to send network request CDP event", e)
|
|
32
38
|
}
|
|
33
39
|
return response
|
|
34
40
|
}
|
|
@@ -17,10 +17,9 @@ extension URL: Convertible {
|
|
|
17
17
|
throw Conversions.ConvertingException<URL>(value)
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
//
|
|
21
|
-
if let url =
|
|
22
|
-
|
|
23
|
-
return url.scheme != nil ? url : URL(fileURLWithPath: value)
|
|
20
|
+
// First we try to create a URL without extra encoding, as it came.
|
|
21
|
+
if let url = convertToUrl(string: value) {
|
|
22
|
+
return url
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
// File path doesn't need to be percent-encoded.
|
|
@@ -29,8 +28,8 @@ extension URL: Convertible {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
// If we get here, the string is not the file url and may require percent-encoding characters that are not URL-safe according to RFC 3986.
|
|
32
|
-
if let encodedValue = percentEncodeUrlString(value), let url =
|
|
33
|
-
return url
|
|
31
|
+
if let encodedValue = percentEncodeUrlString(value), let url = convertToUrl(string: encodedValue) {
|
|
32
|
+
return url
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
// If it still fails to create the URL object, the string possibly contains characters that must be explicitly percent-encoded beforehand.
|
|
@@ -58,3 +58,13 @@ internal func isFileUrlPath(_ path: String) -> Bool {
|
|
|
58
58
|
}
|
|
59
59
|
return URL(string: encodedPath)?.scheme == nil
|
|
60
60
|
}
|
|
61
|
+
|
|
62
|
+
internal func convertToUrl(string value: String) -> URL? {
|
|
63
|
+
// URLComponents parses and constructs URLs according to RFC 3986.
|
|
64
|
+
// For some unusual urls URL(string:) will fail incorrectly
|
|
65
|
+
guard let url = URLComponents(string: value)?.url ?? URL(string: value) else {
|
|
66
|
+
return nil
|
|
67
|
+
}
|
|
68
|
+
// If it has no scheme, we assume it was the file path which needs to be recreated to be recognized as the file url.
|
|
69
|
+
return url.scheme != nil ? url : URL(fileURLWithPath: value)
|
|
70
|
+
}
|
|
@@ -71,13 +71,6 @@ class ConvertiblesSpec: ExpoSpec {
|
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
it("throws when url contains percent alone") {
|
|
75
|
-
// The percent character alone must be percent-encoded to `%25` beforehand, otherwise it should throw an exception.
|
|
76
|
-
let urlString = "https://expo.dev/?param=%"
|
|
77
|
-
|
|
78
|
-
expect({ try URL.convert(from: urlString, appContext: appContext) }).to(throwError(errorType: UrlContainsInvalidCharactersException.self))
|
|
79
|
-
}
|
|
80
|
-
|
|
81
74
|
it("converts from url containing the anchor") {
|
|
82
75
|
// The hash is not allowed in the query (requires percent-encoding),
|
|
83
76
|
// but we want it to be recognized as the beginning of the fragment,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.5",
|
|
4
4
|
"description": "The core of Expo Modules architecture",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -42,5 +42,5 @@
|
|
|
42
42
|
"@testing-library/react-hooks": "^7.0.1",
|
|
43
43
|
"expo-module-scripts": "^3.0.0"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "877ace22b823159ff94d02bacfb27e523263967c"
|
|
46
46
|
}
|