Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[dev-launcher] Fix port -1 error when no port in bundle url (#19136)
# Why when load js bundle from a URL without an explicit port, e.g. http://www.example.com/ , the app will crash. the root cause is that `android.net.Uri.getPort()` will return -1 when there's no port. related facebook/react-native#34705 and ENG-5932 # How use `okhttp3.HttpUrl.defaultPort(scheme)` as fallback when port is -1. since the parameter in `injectReactInterceptor` is already android.net.Uri, i don't want to use HttpUrl to parse it again. only change the default port would be lower risk. # Test Plan test on bare-expo 1. [enable dev-launcher](https://github.com/expo/expo/blob/7331e13192c5b798ec67ec180949e1ef4e4da228/apps/bare-expo/android/app/src/main/java/dev/expo/payments/MainApplication.java#L25) 2. `EXPO_NO_DEFAULT_PORT=1 npx expo start --tunnel` 3. in dev-launcher, load the bundle url, e.g. `exp://nquwmbi.kudochien.19000.exp.direct`
- Loading branch information