Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/expo-dev-launcher/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
- [iOS] Fix `DevLauncherWrapperView` in SwiftUI brownfield apps ([#41431](https://github.com/expo/expo/pull/41431) by [@gabrieldonadel](https://github.com/gabrieldonadel))
- [iOS] Fix dev server discovery cancellation. ([#41555](https://github.com/expo/expo/pull/41555) by [@alanjhughes](https://github.com/alanjhughes))
- [iOS] Fixes an issue where a `nil` projectUrl could be passed to Expo Updates. ([#42126](https://github.com/expo/expo/pull/42126) by [@alanjhughes](https://github.com/alanjhughes))
- [iOS] Fix launching deeplink with dev launcher. ([#42212](https://github.com/expo/expo/pull/42212) by [@jakex7](https://github.com/jakex7))

### 💡 Others

Expand Down
2 changes: 1 addition & 1 deletion packages/expo-dev-launcher/ios/EXDevLauncherController.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ - (void)start:(id<EXDevLauncherControllerDelegate>)delegate launchOptions:(NSDic

NSNumber *devClientTryToLaunchLastBundleValue = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"DEV_CLIENT_TRY_TO_LAUNCH_LAST_BUNDLE"];
BOOL shouldTryToLaunchLastOpenedBundle = (devClientTryToLaunchLastBundleValue != nil) ? [devClientTryToLaunchLastBundleValue boolValue] : YES;
if (_lastOpenedAppUrl != nil && shouldTryToLaunchLastOpenedBundle) {
if (_lastOpenedAppUrl != nil && shouldTryToLaunchLastOpenedBundle && [launchOptions objectForKey:@"UIApplicationLaunchOptionsURLKey"] == nil) {
// When launch to the last opened url, the previous url could be unreachable because of LAN IP changed.
// We use a shorter timeout to prevent black screen when loading for an unreachable server.
NSTimeInterval requestTimeout = 10.0;
Expand Down
1 change: 1 addition & 0 deletions packages/expo/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
- Bump `react-server-dom-webpack` ([#41574](https://github.com/expo/expo/pull/41574) by [@kitten](https://github.com/kitten)) ([#41589](https://github.com/expo/expo/pull/41589) by [@kitten](https://github.com/kitten))
- Bump to `@expo/metro@54.2.0` and `metro@0.83.3` ([#41142](https://github.com/expo/expo/pull/41142) by [@kitten](https://github.com/kitten))
- Update `metro-source-map` import source in `expo/scripts/compose-source-maps` ([#41458](https://github.com/expo/expo/pull/41458) by [@kitten](https://github.com/kitten))
- [Android] Optimized `response.arrayBuffer` implementation. ([#42086](https://github.com/expo/expo/pull/42086) by [@barthap](https://github.com/barthap))
- change `global` for `globalThis` to fix failing `auth-session` js tests ([#42083](https://github.com/expo/expo/pull/42083) by [@vonovak](https://github.com/vonovak))

### ⚠️ Notices
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import expo.modules.core.errors.ModuleDestroyedException
import expo.modules.kotlin.Promise
import expo.modules.kotlin.exception.Exceptions
import expo.modules.kotlin.exception.toCodedException
import expo.modules.kotlin.jni.NativeArrayBuffer
import expo.modules.kotlin.modules.Module
import expo.modules.kotlin.modules.ModuleDefinition
import kotlinx.coroutines.CoroutineName
Expand Down Expand Up @@ -97,14 +98,14 @@ class ExpoFetchModule : Module() {

AsyncFunction("arrayBuffer") { response: NativeResponse, promise: Promise ->
response.waitForStates(listOf(ResponseState.BODY_COMPLETED)) {
val data = response.sink.finalize()
promise.resolve(data)
val data = response.sink.finalize(directBuffer = true)
promise.resolve(NativeArrayBuffer(data))
}
}

AsyncFunction("text") { response: NativeResponse, promise: Promise ->
response.waitForStates(listOf(ResponseState.BODY_COMPLETED)) {
val data = response.sink.finalize()
val data = response.sink.finalize(directBuffer = false).array()
val text = data.toString(Charsets.UTF_8)
promise.resolve(text)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ internal class NativeResponse(appContext: AppContext, private val coroutineScope
get() = this.sink.bodyUsed

override fun deallocate() {
this.sink.finalize()
this.sink.finalize(directBuffer = false)
super.deallocate()
}

Expand All @@ -57,10 +57,10 @@ internal class NativeResponse(appContext: AppContext, private val coroutineScope
}
if (state == ResponseState.RESPONSE_RECEIVED) {
state = ResponseState.BODY_STREAMING_STARTED
val queuedData = this.sink.finalize()
val queuedData = this.sink.finalize(directBuffer = false).array()
emit("didReceiveResponseData", queuedData)
} else if (state == ResponseState.BODY_COMPLETED) {
val queuedData = this.sink.finalize()
val queuedData = this.sink.finalize(directBuffer = false).array()
return queuedData
}
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,19 @@ internal class ResponseSink {
bodyQueue.add(data)
}

fun finalize(): ByteArray {
fun finalize(directBuffer: Boolean): ByteBuffer {
val size = bodyQueue.sumOf { it.size }
val byteBuffer = ByteBuffer.allocate(size)
val byteBuffer = if (directBuffer) {
ByteBuffer.allocateDirect(size)
} else {
ByteBuffer.allocate(size)
}
for (byteArray in bodyQueue) {
byteBuffer.put(byteArray)
}
bodyQueue.clear()
bodyUsed = true
isFinalized = true
return byteBuffer.array()
return byteBuffer
}
}
Loading