Skip to content

Commit d5bc799

Browse files
committed
Update Yarn to v4.11.0 and modify Android files
Added Yarn 4.11.0 release file and updated .yarnrc.yml configuration. Modified Android source files HybridInappbrowserNitro.kt and BrowserFallback.kt. Updated dependencies in package.json and example/package.json.
1 parent c6a5505 commit d5bc799

7 files changed

Lines changed: 5768 additions & 4520 deletions

File tree

.yarn/releases/yarn-4.11.0.cjs

Lines changed: 942 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
nodeLinker: node-modules
2+
3+
yarnPath: .yarn/releases/yarn-4.11.0.cjs

android/src/main/java/com/inappbrowsernitro/HybridInappbrowserNitro.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.inappbrowsernitro
22

3-
import android.app.Activity
43
import android.content.ActivityNotFoundException
54
import android.content.Context
65
import android.content.Intent
@@ -70,7 +69,7 @@ class HybridInappbrowserNitro : HybridInappbrowserNitroSpec() {
7069
return InAppBrowserResult(BrowserResultType.SUCCESS, parsedUri.toString(), null)
7170
}
7271

73-
val fallbackLaunched = (launchContext as? Activity)?.let { launchFallback(it, url) } ?: false
72+
val fallbackLaunched = launchFallback(launchContext, url)
7473
return if (fallbackLaunched) {
7574
InAppBrowserResult(BrowserResultType.SUCCESS, parsedUri.toString(), null)
7675
} else {
@@ -92,8 +91,8 @@ class HybridInappbrowserNitro : HybridInappbrowserNitroSpec() {
9291
}
9392
}
9493

95-
private fun launchFallback(activity: Activity, url: String): Boolean {
96-
val fallback = BrowserFallback(activity)
94+
private fun launchFallback(context: Context, url: String): Boolean {
95+
val fallback = BrowserFallback(context)
9796
if (fallback.openSystemBrowser(url)) return true
9897
if (fallback.openChooser(url)) return true
9998
return fallback.redirectToStore()

android/src/main/java/com/inappbrowsernitro/browser/BrowserFallback.kt

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,42 +2,37 @@ package com.inappbrowsernitro.browser
22

33
import android.app.Activity
44
import android.content.ActivityNotFoundException
5+
import android.content.Context
56
import android.content.Intent
67
import android.net.Uri
78
import androidx.core.net.toUri
89

9-
internal class BrowserFallback(private val activity: Activity) {
10+
internal class BrowserFallback(private val context: Context) {
1011
fun openSystemBrowser(url: String): Boolean {
1112
val uri = url.toUri()
12-
13-
return try {
14-
val fallbackIntent = Intent(Intent.ACTION_VIEW, uri)
15-
activity.startActivity(fallbackIntent)
16-
true
17-
} catch (_: ActivityNotFoundException) {
18-
false
19-
}
13+
val fallbackIntent = Intent(Intent.ACTION_VIEW, uri)
14+
return launchSafely(fallbackIntent)
2015
}
2116

2217
fun openChooser(url: String): Boolean {
2318
val uri = url.toUri()
2419
val intent = Intent(Intent.ACTION_VIEW, uri)
2520
val chooser = Intent.createChooser(intent, "Choose browser")
26-
27-
return try {
28-
activity.startActivity(chooser)
29-
true
30-
} catch (_: ActivityNotFoundException) {
31-
false
32-
}
21+
return launchSafely(chooser)
3322
}
3423

3524
fun redirectToStore(): Boolean {
3625
val intent = Intent(Intent.ACTION_VIEW, Uri.parse("market://search?q=browser"))
37-
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
26+
return launchSafely(intent)
27+
}
28+
29+
private fun launchSafely(intent: Intent): Boolean {
30+
if (context !is Activity) {
31+
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
32+
}
3833

3934
return try {
40-
activity.startActivity(intent)
35+
context.startActivity(intent)
4136
true
4237
} catch (_: ActivityNotFoundException) {
4338
false

example/package.json

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,25 +11,27 @@
1111
"pod": "bundle install && bundle exec pod install --project-directory=ios"
1212
},
1313
"dependencies": {
14-
"@react-native/new-app-screen": "0.82.0",
14+
"@react-native/new-app-screen": "0.82.1",
1515
"react": "19.1.1",
16-
"react-native": "0.82.0",
17-
"react-native-nitro-modules": "0.31.0",
18-
"react-native-safe-area-context": "^5.5.2"
16+
"react-native": "0.82.1",
17+
"react-native-nitro-modules": "0.31.4",
18+
"react-native-safe-area-context": "^5.6.2"
1919
},
2020
"devDependencies": {
21-
"@babel/core": "^7.25.2",
22-
"@babel/preset-env": "^7.25.3",
23-
"@babel/runtime": "^7.25.0",
21+
"@babel/core": "^7.28.5",
22+
"@babel/preset-env": "^7.28.5",
23+
"@babel/runtime": "^7.28.4",
2424
"@react-native-community/cli": "20.0.2",
2525
"@react-native-community/cli-platform-android": "20.0.2",
2626
"@react-native-community/cli-platform-ios": "20.0.2",
27-
"@react-native/babel-preset": "0.82.0",
28-
"@react-native/eslint-config": "0.82.0",
29-
"@react-native/metro-config": "0.82.0",
30-
"@react-native/typescript-config": "0.82.0",
31-
"@types/jest": "^29.5.13",
32-
"babel-plugin-module-resolver": "^5.0.2"
27+
"@react-native/babel-preset": "0.82.1",
28+
"@react-native/eslint-config": "0.82.1",
29+
"@react-native/metro-config": "0.82.1",
30+
"@react-native/typescript-config": "0.82.1",
31+
"@types/jest": "^30.0.0",
32+
"babel-plugin-module-resolver": "^5.0.2",
33+
"eslint": "^9.39.1",
34+
"prettier": "^3.6.2"
3335
},
3436
"engines": {
3537
"node": ">=20"

package.json

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@
5656
"@jamesacarr/eslint-formatter-github-actions": "^0.2.0",
5757
"@semantic-release/changelog": "^6.0.3",
5858
"@semantic-release/git": "^10.0.1",
59-
"@types/jest": "^29.5.12",
60-
"@types/react": "19.1.1",
59+
"@types/jest": "^30.0.0",
60+
"@types/react": "19.2.2",
6161
"conventional-changelog-conventionalcommits": "^9.1.0",
62-
"nitrogen": "0.31.0",
63-
"react": "19.1.1",
62+
"nitrogen": "0.31.4",
63+
"react": "19.2.0",
6464
"react-native": "0.82",
65-
"react-native-builder-bob": "^0.37.0",
66-
"react-native-nitro-modules": "0.31.0",
67-
"semantic-release": "^24.2.9",
68-
"typescript": "^5.8.3"
65+
"react-native-builder-bob": "^0.40.14",
66+
"react-native-nitro-modules": "0.31.4",
67+
"semantic-release": "^25.0.1",
68+
"typescript": "^5.9.3"
6969
},
7070
"peerDependencies": {
7171
"react": "*",
@@ -119,5 +119,6 @@
119119
}
120120
]
121121
]
122-
}
122+
},
123+
"packageManager": "yarn@4.11.0"
123124
}

0 commit comments

Comments
 (0)