expo-modules-core 1.5.2 → 1.5.3
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
|
+
## 1.5.3 — 2023-06-24
|
|
14
|
+
|
|
15
|
+
### 🎉 New features
|
|
16
|
+
|
|
17
|
+
- Supported other network CDP types like `Image` and `Media` rather than `Fetch`. ([#23058](https://github.com/expo/expo/pull/23058) by [@kudo](https://github.com/kudo))
|
|
18
|
+
|
|
13
19
|
## 1.5.2 — 2023-06-24
|
|
14
20
|
|
|
15
21
|
_This version does not introduce any user-facing changes._
|
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.3'
|
|
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.3"
|
|
164
164
|
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled.toString()
|
|
165
165
|
|
|
166
166
|
testInstrumentationRunner "expo.modules.TestRunner"
|
|
@@ -21,7 +21,16 @@ enum class ResourceType(val value: String) {
|
|
|
21
21
|
FONT("Font"),
|
|
22
22
|
SCRIPT("Script"),
|
|
23
23
|
FETCH("Fetch"),
|
|
24
|
-
OTHER("Other")
|
|
24
|
+
OTHER("Other");
|
|
25
|
+
|
|
26
|
+
companion object {
|
|
27
|
+
fun fromMimeType(mimeType: String): ResourceType = when {
|
|
28
|
+
mimeType.startsWith("image/") -> IMAGE
|
|
29
|
+
mimeType.startsWith("audio") || mimeType.startsWith("video") -> MEDIA
|
|
30
|
+
mimeType.startsWith("font") -> FONT
|
|
31
|
+
else -> OTHER
|
|
32
|
+
}
|
|
33
|
+
}
|
|
25
34
|
}
|
|
26
35
|
|
|
27
36
|
interface JsonSerializable {
|
|
@@ -120,7 +129,7 @@ data class RequestWillBeSentParams(
|
|
|
120
129
|
wallTime = now,
|
|
121
130
|
redirectHasExtraInfo = redirectResponse != null,
|
|
122
131
|
redirectResponse = redirectResponse?.let { Response(it) },
|
|
123
|
-
type = ResourceType.
|
|
132
|
+
type = ResourceType.OTHER,
|
|
124
133
|
)
|
|
125
134
|
|
|
126
135
|
override fun toJSONObject(): JSONObject {
|
|
@@ -172,11 +181,11 @@ data class ResponseReceivedParams(
|
|
|
172
181
|
val response: Response,
|
|
173
182
|
val hasExtraInfo: Boolean = false,
|
|
174
183
|
) : JsonSerializable {
|
|
175
|
-
constructor(now: BigDecimal, requestId: RequestId, request: okhttp3.Request,
|
|
184
|
+
constructor(now: BigDecimal, requestId: RequestId, request: okhttp3.Request, okhttpResponse: okhttp3.Response) : this(
|
|
176
185
|
requestId = requestId,
|
|
177
186
|
timestamp = now,
|
|
178
|
-
type = ResourceType.
|
|
179
|
-
response = Response(
|
|
187
|
+
type = ResourceType.fromMimeType(okhttpResponse.header("Content-Type", "") ?: ""),
|
|
188
|
+
response = Response(okhttpResponse),
|
|
180
189
|
)
|
|
181
190
|
|
|
182
191
|
override fun toJSONObject(): JSONObject {
|
|
@@ -17,6 +17,19 @@ struct CdpNetwork {
|
|
|
17
17
|
case script = "Script"
|
|
18
18
|
case fetch = "Fetch"
|
|
19
19
|
case other = "Other"
|
|
20
|
+
|
|
21
|
+
static func fromMimeType(_ mimeType: String) -> ResourceType {
|
|
22
|
+
if mimeType.starts(with: "image/") {
|
|
23
|
+
return image
|
|
24
|
+
}
|
|
25
|
+
if mimeType.starts(with: "audio/") || mimeType.starts(with: "video/") {
|
|
26
|
+
return media
|
|
27
|
+
}
|
|
28
|
+
if mimeType.starts(with: "font/") {
|
|
29
|
+
return font
|
|
30
|
+
}
|
|
31
|
+
return other
|
|
32
|
+
}
|
|
20
33
|
}
|
|
21
34
|
|
|
22
35
|
struct ConnectTiming: Encodable {
|
|
@@ -91,7 +104,7 @@ struct CdpNetwork {
|
|
|
91
104
|
} else {
|
|
92
105
|
self.redirectResponse = nil
|
|
93
106
|
}
|
|
94
|
-
self.type = ResourceType.
|
|
107
|
+
self.type = ResourceType.other
|
|
95
108
|
}
|
|
96
109
|
}
|
|
97
110
|
|
|
@@ -119,8 +132,8 @@ struct CdpNetwork {
|
|
|
119
132
|
init(now: TimeInterval, requestId: RequestId, request: URLRequest, response: HTTPURLResponse) {
|
|
120
133
|
self.requestId = requestId
|
|
121
134
|
self.timestamp = now
|
|
122
|
-
self.type = ResourceType.fetch
|
|
123
135
|
self.response = Response(response)
|
|
136
|
+
self.type = ResourceType.fromMimeType(self.response.mimeType)
|
|
124
137
|
}
|
|
125
138
|
}
|
|
126
139
|
|
|
@@ -161,5 +161,31 @@ final class ExpoRequestCdpInterceptorSpec: ExpoSpec {
|
|
|
161
161
|
}.resume()
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
it("respect image mimeType to CDP event") {
|
|
167
|
+
waitUntil(timeout: .seconds(2)) { done in
|
|
168
|
+
self.session.dataTask(with: URL(string: "https://avatars.githubusercontent.com/u/12504344")!) { (data, response, error) in
|
|
169
|
+
DispatchQueue.main.async {
|
|
170
|
+
expect(self.mockDelegate.events.count).to(equal(5))
|
|
171
|
+
|
|
172
|
+
// Network.requestWillBeSent
|
|
173
|
+
// Network.requestWillBeSentExtraInfo
|
|
174
|
+
|
|
175
|
+
// Network.responseReceived
|
|
176
|
+
let json = self.parseJSON(data: self.mockDelegate.events[2])
|
|
177
|
+
let method = json["method"] as! String
|
|
178
|
+
let params = json["params"] as! [String: Any]
|
|
179
|
+
let response = params["response"] as! [String: Any]
|
|
180
|
+
expect(method).to(equal("Network.responseReceived"))
|
|
181
|
+
expect(response["status"] as? Int).to(equal(200))
|
|
182
|
+
expect(response["mimeType"] as? String).to(equal("image/png"))
|
|
183
|
+
expect(params["type"] as? String).to(equal("Image"))
|
|
184
|
+
|
|
185
|
+
done()
|
|
186
|
+
}
|
|
187
|
+
}.resume()
|
|
188
|
+
}
|
|
189
|
+
}
|
|
164
190
|
}
|
|
165
191
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-core",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
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": "19e6561830e33168b1c963ec50b7248baafbb758"
|
|
46
46
|
}
|