From 977f9281a9d25f4340355e902f02201800487058 Mon Sep 17 00:00:00 2001 From: Patryk Klatka Date: Mon, 8 Apr 2024 17:20:42 +0200 Subject: [PATCH] feat: bump turbo-android --- .../com/reactnativeturbowebview/RNSession.kt | 4 ++ .../RNVisitableView.kt | 6 ++ packages/turbo/package.json | 2 +- .../turbo-android-react-native-support.patch | 18 ++--- yarn.lock | 68 +++++++++---------- 5 files changed, 54 insertions(+), 44 deletions(-) diff --git a/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNSession.kt b/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNSession.kt index 23d4ad59..815e9a75 100644 --- a/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNSession.kt +++ b/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNSession.kt @@ -156,6 +156,10 @@ class RNSession( visitableView?.visitLocationStarted(location) } + override fun visitProposedToCrossOriginRedirect(location: String) { + visitableView?.visitProposedToCrossOriginRedirect(location) + } + override fun visitProposedToLocation(location: String, options: TurboVisitOptions) { visitableView?.visitProposedToLocation(location, options) } diff --git a/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNVisitableView.kt b/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNVisitableView.kt index 8c2bed42..6bb0a025 100644 --- a/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNVisitableView.kt +++ b/packages/turbo/android/src/main/java/com/reactnativeturbowebview/RNVisitableView.kt @@ -333,6 +333,12 @@ class RNVisitableView(context: Context) : LinearLayout(context), SessionSubscrib } } + override fun visitProposedToCrossOriginRedirect(location: String) { + sendEvent(RNVisitableViewEvent.OPEN_EXTERNAL_URL, Arguments.createMap().apply { + putString("url", location) + }) + } + override fun handleAlert(message: String, callback: () -> Unit) { sendEvent(RNVisitableViewEvent.WEB_ALERT, Arguments.createMap().apply { putString("message", message) diff --git a/packages/turbo/package.json b/packages/turbo/package.json index a16eb58a..4e8126bf 100644 --- a/packages/turbo/package.json +++ b/packages/turbo/package.json @@ -23,7 +23,7 @@ "react-native": "src/index.tsx", "hotwiredTurbo": { "ios": "7.1.0", - "android": "7.1.0" + "android": "7.1.2" }, "scripts": { "build": "bob build && sh ./scripts/build.sh $npm_package_hotwiredTurbo_ios $npm_package_hotwiredTurbo_android && yarn link", diff --git a/packages/turbo/patches/turbo-android-react-native-support.patch b/packages/turbo/patches/turbo-android-react-native-support.patch index b3cd1d75..c5fe3aec 100644 --- a/packages/turbo/patches/turbo-android-react-native-support.patch +++ b/packages/turbo/patches/turbo-android-react-native-support.patch @@ -1,8 +1,8 @@ diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt -index 77a8b3c..c873aef 100644 +index 4214499..188dc49 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt -@@ -39,12 +39,13 @@ import java.util.* +@@ -42,12 +42,13 @@ import java.util.* * @property webView An instance of a [TurboWebView] to be shared/managed. */ @Suppress("unused") @@ -18,7 +18,7 @@ index 77a8b3c..c873aef 100644 internal var coldBootVisitIdentifier = "" internal var previousOverrideUrlTime = 0L internal var isColdBooting = false -@@ -55,6 +56,7 @@ class TurboSession internal constructor( +@@ -58,6 +59,7 @@ class TurboSession internal constructor( internal val httpRepository = TurboHttpRepository(activity.lifecycleScope) internal val requestInterceptor = TurboWebViewRequestInterceptor(this) internal val fileChooserDelegate = TurboFileChooserDelegate(this) @@ -26,7 +26,7 @@ index 77a8b3c..c873aef 100644 // User accessible -@@ -129,7 +131,7 @@ class TurboSession internal constructor( +@@ -132,7 +134,7 @@ class TurboSession internal constructor( // Internal @@ -35,7 +35,7 @@ index 77a8b3c..c873aef 100644 this.currentVisit = visit callback { it.visitLocationStarted(visit.location) } -@@ -149,7 +151,7 @@ class TurboSession internal constructor( +@@ -152,7 +154,7 @@ class TurboSession internal constructor( * visit request. This is used when restoring a Fragment destination from the backstack, * but the WebView's current location hasn't changed from the destination's location. */ @@ -44,7 +44,7 @@ index 77a8b3c..c873aef 100644 val visit = currentVisit ?: return false val restorationIdentifier = restorationIdentifiers[visit.destinationIdentifier] -@@ -627,7 +629,7 @@ class TurboSession internal constructor( +@@ -656,7 +658,7 @@ class TurboSession internal constructor( private fun callback(action: (TurboSessionCallback) -> Unit) { context.runOnUiThread { currentVisit?.callback?.let { callback -> @@ -54,11 +54,11 @@ index 77a8b3c..c873aef 100644 } } diff --git a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSessionCallback.kt b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSessionCallback.kt -index 0bbaa01..7d8cc6c 100644 +index cb8c905..101fad9 100644 --- a/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSessionCallback.kt +++ b/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSessionCallback.kt -@@ -5,7 +5,7 @@ import dev.hotwire.turbo.nav.TurboNavDestination - import dev.hotwire.turbo.errors.TurboVisitError +@@ -5,7 +5,7 @@ import dev.hotwire.turbo.errors.TurboVisitError + import dev.hotwire.turbo.nav.TurboNavDestination import dev.hotwire.turbo.visit.TurboVisitOptions -internal interface TurboSessionCallback { diff --git a/yarn.lock b/yarn.lock index 53a0289e..59b3a014 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8634,7 +8634,7 @@ react-native-turbo@*: integrity sha512-l7WcDaVTQD6S611MmFwvdgQawAACs43SVDKUs92pqBCQw3j7xXfW4bc5OoiIG6c/5qSsb3DNQj5XC6MnlkLPqQ== "react-native-turbo@file:packages/turbo": - version "1.0.0-beta.2" + version "1.0.0-beta.5" "react-native-web-screen@file:packages/navigation": version "1.0.0-beta.3" @@ -9912,47 +9912,47 @@ tslib@^2.0.1, tslib@^2.1.0, tslib@^2.4.0, tslib@^2.6.2: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.2.tgz#703ac29425e7b37cd6fd456e92404d46d1f3e4ae" integrity sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q== -turbo-darwin-64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.12.5.tgz#bcc2833b4c9e9a02085088cc72f9db04bf45d48e" - integrity sha512-0GZ8reftwNQgIQLHkHjHEXTc/Z1NJm+YjsrBP+qhM/7yIZ3TEy9gJhuogDt2U0xIWwFgisTyzbtU7xNaQydtoA== +turbo-darwin-64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-darwin-64/-/turbo-darwin-64-1.13.2.tgz#34c8c8a06e9c38ed9cbd219b2ade6e83f02bc7b3" + integrity sha512-CCSuD8CfmtncpohCuIgq7eAzUas0IwSbHfI8/Q3vKObTdXyN8vAo01gwqXjDGpzG9bTEVedD0GmLbD23dR0MLA== -turbo-darwin-arm64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.12.5.tgz#42ccd0e0a188780351fa76b7bc243f7a3dadb8e0" - integrity sha512-8WpOLNNzvH6kohQOjihD+gaWL+ZFNfjvBwhOF0rjEzvW+YR3Pa7KjhulrjWyeN2yMFqAPubTbZIGOz1EVXLuQA== +turbo-darwin-arm64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-darwin-arm64/-/turbo-darwin-arm64-1.13.2.tgz#2fd380e13b8cd75d1514c433d196ea4be097230c" + integrity sha512-0HySm06/D2N91rJJ89FbiI/AodmY8B3WDSFTVEpu2+8spUw7hOJ8okWOT0e5iGlyayUP9gr31eOeL3VFZkpfCw== -turbo-linux-64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.12.5.tgz#77cd4aa4fd8a911178924a3d2866e841a61545a1" - integrity sha512-INit73+bNUpwqGZCxgXCR3I+cQsdkQ3/LkfkgSOibkpg+oGqxJRzeXw3sp990d7SCoE8QOcs3iw+PtiFX/LDAA== +turbo-linux-64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-linux-64/-/turbo-linux-64-1.13.2.tgz#a861fb4180e0a601459b79837b4e2ded27c7ffa7" + integrity sha512-7HnibgbqZrjn4lcfIouzlPu8ZHSBtURG4c7Bedu7WJUDeZo+RE1crlrQm8wuwO54S0siYqUqo7GNHxu4IXbioQ== -turbo-linux-arm64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.12.5.tgz#d576cb2fbaecfc086e20cccd276f89ace1ebc889" - integrity sha512-6lkRBvxtI/GQdGtaAec9LvVQUoRw6nXFp0kM+Eu+5PbZqq7yn6cMkgDJLI08zdeui36yXhone8XGI8pHg8bpUQ== +turbo-linux-arm64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-linux-arm64/-/turbo-linux-arm64-1.13.2.tgz#e0d290ea338eb8e5fb8905547954d36f81d8d7fa" + integrity sha512-sUq4dbpk6SNKg/Hkwn256Vj2AEYSQdG96repio894h5/LEfauIK2QYiC/xxAeW3WBMc6BngmvNyURIg7ltrePg== -turbo-windows-64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.12.5.tgz#2c44f177b4a9b9bc0ae0975caca139895d222313" - integrity sha512-gQYbOhZg5Ww0bQ/bC0w/4W6yQRwBumUUnkB+QPo15VznwxZe2a7bo6JM+9Xy9dKLa/kn+p7zTqme4OEp6M3/Yg== +turbo-windows-64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-windows-64/-/turbo-windows-64-1.13.2.tgz#c9821ea0d34204d3bed28ccfb096c520dbe3c209" + integrity sha512-DqzhcrciWq3dpzllJR2VVIyOhSlXYCo4mNEWl98DJ3FZ08PEzcI3ceudlH6F0t/nIcfSItK1bDP39cs7YoZHEA== -turbo-windows-arm64@1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.12.5.tgz#3ee01dc956477d306591a8fbe24ef6c9b7dff470" - integrity sha512-auvhZ9FrhnvQ4mgBlY9O68MT4dIfprYGvd2uPICba/mHUZZvVy5SGgbHJ0KbMwaJfnnFoPgLJO6M+3N2gDprKw== +turbo-windows-arm64@1.13.2: + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo-windows-arm64/-/turbo-windows-arm64-1.13.2.tgz#07d6a01a1bfc6293ee8365cf3639914244f6f0b9" + integrity sha512-WnPMrwfCXxK69CdDfS1/j2DlzcKxSmycgDAqV0XCYpK/812KB0KlvsVAt5PjEbZGXkY88pCJ1BLZHAjF5FcbqA== turbo@^1.12.5: - version "1.12.5" - resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.12.5.tgz#63b390ce4df14315d6c72a46379d6ee29556f5d4" - integrity sha512-FATU5EnhrYG8RvQJYFJnDd18DpccDjyvd53hggw9T9JEg9BhWtIEoeaKtBjYbpXwOVrJQMDdXcIB4f2nD3QPPg== + version "1.13.2" + resolved "https://registry.yarnpkg.com/turbo/-/turbo-1.13.2.tgz#c45919cb1cebc86390516184396247eedf65e232" + integrity sha512-rX/d9f4MgRT3yK6cERPAkfavIxbpBZowDQpgvkYwGMGDQ0Nvw1nc0NVjruE76GrzXQqoxR1UpnmEP54vBARFHQ== optionalDependencies: - turbo-darwin-64 "1.12.5" - turbo-darwin-arm64 "1.12.5" - turbo-linux-64 "1.12.5" - turbo-linux-arm64 "1.12.5" - turbo-windows-64 "1.12.5" - turbo-windows-arm64 "1.12.5" + turbo-darwin-64 "1.13.2" + turbo-darwin-arm64 "1.13.2" + turbo-linux-64 "1.13.2" + turbo-linux-arm64 "1.13.2" + turbo-windows-64 "1.13.2" + turbo-windows-arm64 "1.13.2" type-check@^0.4.0, type-check@~0.4.0: version "0.4.0"