Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge the upstream #6

Merged
merged 97 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
d6af98f
chore(ci): Update React Native to fix Android build (#2734)
TheAlmightyBob Nov 9, 2022
a5e2a9f
chore(docs): Add information that custom menu items are only availabl…
Handschrift Nov 23, 2022
4ac0d74
feat(ios): Cookie sync improvements (#2535)
matiaskorhonen Nov 23, 2022
70e84de
chore(release): 11.24.0 [skip ci]
semantic-release-bot Nov 23, 2022
2711f3a
feat(Android): Handle RESOURCE_PROTECTED_MEDIA_ID permission (#2732)
enzo-macri Nov 26, 2022
0817524
chore(release): 11.25.0 [skip ci]
semantic-release-bot Nov 26, 2022
47c05b0
fix(android): Respect "filename*" parameter in the field Content-Disp…
UNIDY2002 Dec 7, 2022
ffaef12
chore(release): 11.25.1 [skip ci]
semantic-release-bot Dec 7, 2022
9b7ce57
feat(macos): Support File Input On Macos (#2733)
17Amir17 Dec 9, 2022
2ad3ce6
chore(release): 11.26.0 [skip ci]
semantic-release-bot Dec 9, 2022
4c05077
chore: Update Getting-Started.md (#2791)
Gregory-Coelho Dec 29, 2022
f74ee7a
fix(js): messagingEnabled prop (#2666)
TheAlmightyBob Jan 16, 2023
130d64f
chore(docs): Add info/warning about injectedJavaScriptBeforeContentLo…
TheAlmightyBob Jan 16, 2023
7d605d3
chore: bump react-native-macos to 0.68 (#2828)
tido64 Jan 27, 2023
9051762
chore(release): 11.26.1 [skip ci]
semantic-release-bot Jan 27, 2023
f0aa7b9
chore(docs): Fix clearCache link in index (#2814)
Reisclef Jan 27, 2023
1707328
chore(docs): README fixes: badge, minor wording tweaks (#2880)
jamonholmgren Mar 3, 2023
a6c8d28
chore: Update Guide.md (#2906)
pa-bouly Apr 1, 2023
5558e28
feat: Fabric support (#2686)
Titozzz Apr 1, 2023
b22d25f
chore(release): 12.0.0 [skip ci]
semantic-release-bot Apr 1, 2023
a2eec17
fix(iOS): Foundation Import (#2917)
Titozzz Apr 4, 2023
64a3469
chore(release): 12.0.1 [skip ci]
semantic-release-bot Apr 4, 2023
4d0c0de
fix(ios): fix userAgent ios type comment (#2888)
TheKohan Apr 6, 2023
681aac4
chore(release): 12.0.2 [skip ci]
semantic-release-bot Apr 6, 2023
81e3aa4
fix(Android): Don't crash while downloading file with % in filename (…
valentinaporch May 22, 2023
d8442dc
chore(release): 12.0.3 [skip ci]
semantic-release-bot May 22, 2023
379fa9f
bump min version (#2955)
TatianaKapos May 22, 2023
ed00b17
chore: fix typo (#2868)
hyp3rflow May 22, 2023
39ce007
feat: make pushState changes trackable on android (#2929)
peterlazar1993 May 23, 2023
3928573
chore(release): 12.1.0 [skip ci]
semantic-release-bot May 23, 2023
75e7801
Missing android.support.FILE_PROVIDER_PATHS meta-data on some OEMs (#…
mganandraj Jun 1, 2023
1851ead
feat(windows): Support headers and cookies in source prop (#2897)
vahagnni Jun 1, 2023
fe36eff
chore(release): 12.2.0 [skip ci]
semantic-release-bot Jun 1, 2023
e17a79b
fix: Revert "Missing android.support.FILE_PROVIDER_PATHS meta-data on…
Titozzz Jun 10, 2023
224e283
chore(release): 12.2.1 [skip ci]
semantic-release-bot Jun 10, 2023
f2aef66
feat: custom action menu on android + improved iOS (#2993)
Titozzz Jun 10, 2023
c6125b0
chore(release): 12.3.0 [skip ci]
semantic-release-bot Jun 10, 2023
f9a5277
feat: debugging enabled prop (#2937)
Tom-Bury Jun 10, 2023
79a9cb6
chore(release): 12.4.0 [skip ci]
semantic-release-bot Jun 10, 2023
40c9807
feat: Allow webview to load in background tab (#2930)
peterlazar1993 Jun 10, 2023
9e86156
chore(release): 13.0.0 [skip ci]
semantic-release-bot Jun 10, 2023
6d185e6
feat(iOS): fraudulent website warning setting (previously #2801) (#2994)
Titozzz Jun 10, 2023
0a5bbe7
chore(release): 13.1.0 [skip ci]
semantic-release-bot Jun 10, 2023
966221e
feat(android): Add support for the `capture` attribute (#2954)
robxyy Jun 11, 2023
a680662
chore(release): 13.2.0 [skip ci]
semantic-release-bot Jun 11, 2023
7ceeb2f
fix: build on 0.72 new arch (#2997)
Titozzz Jun 12, 2023
4a7e7cd
chore(release): 13.2.1 [skip ci]
semantic-release-bot Jun 12, 2023
41576ca
fix(macOS): address regression due to didMoveToSuperview (#3006)
vahagnni Jun 14, 2023
891e595
chore(release): 13.2.2 [skip ci]
semantic-release-bot Jun 14, 2023
7ccf8ad
chore(docs): Add Italian translation to the docs 🇮🇹📖 (#3031)
davidepalazzo Jul 13, 2023
836f717
fix: Revert didMoveToSuperview back to didMoveToWindow (#3041)
TheAlmightyBob Jul 18, 2023
e76933f
chore(release): 13.2.3 [skip ci]
semantic-release-bot Jul 18, 2023
2060bd6
chore: Update Guide.md to link a working static server package (#3049)
qwertynik Jul 18, 2023
933fe19
feat: Add `onOpenWindow` event (#2640)
Ldoppea Jul 24, 2023
197593c
chore(release): 13.3.0 [skip ci]
semantic-release-bot Jul 24, 2023
572cec6
chore(docs): Fix typo in Reference.md (#3071)
pvinis Jul 31, 2023
fcd6050
fix(docs): Reference documentation updates for menuItems (#3046)
naveennazimudeen Jul 31, 2023
c740b41
chore(release): 13.3.1 [skip ci]
semantic-release-bot Jul 31, 2023
eb2ce07
chore(docs): Update debugging instructions (#3029)
TuurDutoit Aug 2, 2023
5676b94
chore: bump react-native-macos to 0.71 (#3103)
tido64 Aug 24, 2023
5cd324c
feat(iOS): Suppress menu items (#3082)
Arjan-Zuidema Aug 25, 2023
17d2ffb
chore(release): 13.4.0 [skip ci]
semantic-release-bot Aug 25, 2023
0868f91
feat: Add clearCache method on iOS (#3119)
robinheinze Aug 29, 2023
b836b00
chore(release): 13.5.0 [skip ci]
semantic-release-bot Aug 29, 2023
f101eaf
fix(ios): Fixes new ios clearCache method where it wasn't getting att…
jamonholmgren Aug 29, 2023
dd31719
chore(release): 13.5.1 [skip ci]
semantic-release-bot Aug 29, 2023
447f68e
feat(android): Android injectJavaScriptObject (#2960)
kevinvangelder Sep 8, 2023
10105ba
chore(release): 13.6.0 [skip ci]
semantic-release-bot Sep 8, 2023
2c44da2
chore(docs): Add InjectedJavaScriptObject link in Reference.md (#3139)
kevinvangelder Sep 13, 2023
c4c8e4c
fix: add namespace to build.gradle for gradle 8 compat (required for …
alexhernandez Oct 6, 2023
663f256
chore(release): 13.6.1 [skip ci]
semantic-release-bot Oct 6, 2023
886664d
fix(android): Prevent libhwui crash when WebView is in ScrollView (#2…
Kudo Oct 6, 2023
fd61a32
chore(release): 13.6.2 [skip ci]
semantic-release-bot Oct 6, 2023
ecc1100
fix: Adds field `"react-native"` to `package.json` (#3209)
UNIDY2002 Nov 22, 2023
9386bb7
chore(release): 13.6.3 [skip ci]
semantic-release-bot Nov 22, 2023
b4f047a
fix(iOS): update podspec to use install_modules_dependencies (#3231)
lgaches Jan 2, 2024
3d903fa
chore(readme): fix typos (#3270)
thegreatzeus Jan 2, 2024
f849077
fix(android): add buildFeatures.buildConfig true for AGP8+ compat (#3…
mikehardy Jan 2, 2024
977c18e
chore(release): 13.6.4 [skip ci]
semantic-release-bot Jan 2, 2024
5662f57
chore(docs): update cacheEnabled description (#3260)
wandersonalwes Jan 2, 2024
6960a19
chore(android): Update new architecture config (#3047)
j-piasecki Jan 2, 2024
9e2794e
feat(Windows): Add support for custom headers, POST requests and `onO…
jfkm69 Jan 31, 2024
07cebe3
chore(release): 13.7.0 [skip ci]
semantic-release-bot Jan 31, 2024
f0791d8
fix(Windows): Refactor ReactWebView2.cpp to handle optional 'method' …
jfkm69 Feb 6, 2024
d02f575
chore(release): 13.7.1 [skip ci]
semantic-release-bot Feb 6, 2024
7af398c
fix(ios, macos): Suspend media playback when destroying WebView on iO…
davidsharp Feb 13, 2024
cb9fb9c
fix(iOS): Replace UIKit with RCTUIKit on MacOS for RCT_NEW_ARCH_ENABL…
iSuslov Feb 13, 2024
8f21868
chore(release): 13.7.2 [skip ci]
semantic-release-bot Feb 13, 2024
8013944
feat(ios): ios injectJavaScriptObject (#3157)
gronxb Feb 13, 2024
4389014
chore(release): 13.8.0 [skip ci]
semantic-release-bot Feb 13, 2024
1c3d839
Fix NuGet package reference (#3242)
VMBindraban Feb 13, 2024
ae05226
chore(types): Indentation error (#3292)
dohooo Feb 13, 2024
0068588
fix(android): Fix WebViewManager can no longer be customized (#3315)
deka0106 Feb 13, 2024
4197bb4
chore(release): 13.8.1 [skip ci]
semantic-release-bot Feb 13, 2024
66f5e75
Merge remote-tracking branch 'upstream/master'
hellohublot Mar 14, 2024
15e7c96
Merge remote-tracking branch 'upstream/master'
hellohublot Mar 14, 2024
a87a89e
fix: replace the RNCWebView to RNCWebViewImpl
hellohublot Mar 14, 2024
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
defaults: &defaults
working_directory: ~/code
docker:
- image: cimg/node:14.17.6-browsers
- image: cimg/node:18.13.0-browsers

version: 2
jobs:
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/android-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,31 +9,28 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
newArchEnabled: [false, true]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v2
with:
node-version: 16
node-version: 18
cache: 'yarn'
- name: Set up JDK
uses: actions/setup-java@v2.5.0
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 11
- name: Cache /node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
shell: bash
- name: Build Android test app
uses: gradle/gradle-build-action@v2.1.3
uses: gradle/gradle-build-action@v2
with:
gradle-version: wrapper
arguments: --no-daemon clean build check test
arguments: -PnewArchEnabled=${{matrix.newArchEnabled}} --no-daemon clean build check test
build-root-directory: example/android
timeout-minutes: 60
17 changes: 8 additions & 9 deletions .github/workflows/ios-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@ on:
pull_request:
jobs:
build:
strategy:
matrix:
extraEnv: [FOO=BAR, RCT_NEW_ARCH_ENABLED=1]
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Set up Node.js
uses: actions/setup-node@v2.5.1
uses: actions/setup-node@v3
with:
node-version: 16
- name: Cache /node_modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
node-version: 18
cache: 'yarn'
- name: Install npm dependencies
run: yarn --frozen-lockfile
- name: Install Pods
run: pod install
run: ${{matrix.extraEnv}} pod install
working-directory: example/ios
- name: Build iOS test app
run: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/macos-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
- name: Install npm dependencies
run: yarn --frozen-lockfile
- name: Install macOS dependencies
if: false # Enable this if react-native-macos falls behind
run: yarn add:macos
- name: Install Pods
run: pod install
working-directory: example/macos
Expand Down
21 changes: 7 additions & 14 deletions .github/workflows/windows-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,28 @@ on: [pull_request]
jobs:
run-windows-tests:
name: Build & run tests
runs-on: windows-2019
runs-on: windows-2022

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
name: Checkout Code

- name: Setup Node.js
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '^14'
cache: 'yarn'

- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.0.2

- name: Check node modules cache
uses: actions/cache@v1
id: yarn-cache
uses: microsoft/setup-msbuild@v1.1.3
with:
path: ./node_modules
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
vs-version: '[17.0,)'
msbuild-architecture: x64

- name: Install node modules
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: yarn --pure-lockfile

- name: yarn build
if: steps.yarn-cache.outputs.cache-hit == 'true'
run: |
yarn build
yarn tsc
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

# Xcode
#
.xcode.env
build/
*.pbxuser
!default.pbxuser
Expand Down
99 changes: 36 additions & 63 deletions README.md

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion __tests__/Alert.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ describe('Alert Tests', () => {
const showAlertButton = By2.nativeName('Show alert');
await showAlertButton.click();
await By2.nativeName('Hello! I am an alert box!');
// await By2.nativeName('OK').click(); All alerts will be automatically dismissed as Windows Webview does not have support for Alerts https://github.com/MicrosoftDocs/winrt-api/blob/docs/windows.ui.xaml.controls/webview.md#use-of-alert
const okButton = By2.nativeXpath('//Button[@Name="OK"]');
await okButton.click();
const dismissMessage = By2.nativeName('Alert dismissed!');
expect(dismissMessage).not.toBeNull();
await driver.quit();
Expand Down
193 changes: 83 additions & 110 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,137 +1,110 @@
buildscript {
ext.getExtOrDefault = {name ->
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNativeWebView_' + name]
}
import java.nio.file.Paths

// The Android Gradle plugin is only required when opening the android folder stand-alone.
// This avoids unnecessary downloads and potential conflicts when the library is included as a
// module dependency in an application project.
if (project == rootProject) {
buildscript {
ext.safeExtGet = {prop ->
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : project.properties['ReactNativeWebView_' + prop]
}
repositories {
mavenCentral()
google()
google()
gradlePluginPortal()
}

dependencies {
classpath("com.android.tools.build:gradle:3.6.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
}
} else {
repositories {
mavenCentral()
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${safeExtGet('kotlinVersion')}")
classpath("com.android.tools.build:gradle:7.0.4")
}
}

dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}")
def getExtOrIntegerDefault(prop) {
return rootProject.ext.has(prop) ? rootProject.ext.get(prop) : (project.properties['ReactNativeWebView_' + prop]).toInteger()
}

static def findNodeModulePath(baseDir, packageName) {
def basePath = baseDir.toPath().normalize()
// Node's module resolution algorithm searches up to the root directory,
// after which the base path will be null
while (basePath) {
def candidatePath = Paths.get(basePath.toString(), "node_modules", packageName)
if (candidatePath.toFile().exists()) {
return candidatePath.toString()
}
basePath = basePath.getParent()
}
}
return null
}

def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties['ReactNativeWebView_' + name]).toInteger()
def isNewArchitectureEnabled() {
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
if (major == 7 && minor >= 3) {
return true
}

return major >= 8
}

apply plugin: 'com.android.library'
if (isNewArchitectureEnabled()) {
apply plugin: 'com.facebook.react'
}
apply plugin: 'kotlin-android'

android {
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
if (supportsNamespace()) {
namespace "com.reactnativecommunity.webview"
buildFeatures {
buildConfig true
}

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
}
lintOptions {
disable 'GradleCompatible'
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

repositories {
mavenCentral()
google()

def found = false
def defaultDir = null
def androidSourcesName = 'React Native sources'

if (rootProject.ext.has('reactNativeAndroidRoot')) {
defaultDir = rootProject.ext.get('reactNativeAndroidRoot')
} else {
defaultDir = new File(
projectDir,
'/../../../node_modules/react-native/android'
)
}
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')

if (defaultDir.exists()) {
maven {
url defaultDir.toString()
name androidSourcesName
defaultConfig {
minSdkVersion getExtOrIntegerDefault('minSdkVersion')
targetSdkVersion getExtOrIntegerDefault('targetSdkVersion')
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
}

logger.info(":${project.name}:reactNativeAndroidRoot ${defaultDir.canonicalPath}")
found = true
} else {
def parentDir = rootProject.projectDir

1.upto(5, {
if (found) return true
parentDir = parentDir.parentFile

def androidSourcesDir = new File(
parentDir,
'node_modules/react-native'
)

def androidPrebuiltBinaryDir = new File(
parentDir,
'node_modules/react-native/android'
)

if (androidPrebuiltBinaryDir.exists()) {
maven {
url androidPrebuiltBinaryDir.toString()
name androidSourcesName
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidPrebuiltBinaryDir.canonicalPath}")
found = true
} else if (androidSourcesDir.exists()) {
maven {
url androidSourcesDir.toString()
name androidSourcesName
sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += ['src/newarch']
} else {
java.srcDirs += ['src/oldarch']
}
}
}
}

logger.info(":${project.name}:reactNativeAndroidRoot ${androidSourcesDir.canonicalPath}")
found = true
}
})
}

if (!found) {
throw new GradleException(
"${project.name}: unable to locate React Native android sources. " +
"Ensure you have you installed React Native as a dependency in your project and try again."
)
}
def reactNativePath = findNodeModulePath(projectDir, "react-native")
def codegenPath = findNodeModulePath(projectDir, "@react-native/codegen")
if (codegenPath == null) {
// Compat for 0.71 and lower (to be removed)
codegenPath = findNodeModulePath(projectDir, "react-native-codegen")
}

def kotlin_version = getExtOrDefault('kotlinVersion')
def webkit_version = getExtOrDefault('webkitVersion')
repositories {
maven {
url "${reactNativePath}/android"
}
mavenCentral()
google()
}

dependencies {
//noinspection GradleDynamicVersion
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "androidx.webkit:webkit:$webkit_version"
implementation 'com.facebook.react:react-native:+'
implementation "org.jetbrains.kotlin:kotlin-stdlib:${safeExtGet('kotlinVersion')}"
implementation "androidx.webkit:webkit:${safeExtGet('webkitVersion')}"
}
5 changes: 2 additions & 3 deletions android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ReactNativeWebView_kotlinVersion=1.6.0
ReactNativeWebView_webkitVersion=1.4.0
ReactNativeWebView_compileSdkVersion=29
ReactNativeWebView_buildToolsVersion=29.0.3
ReactNativeWebView_targetSdkVersion=28
ReactNativeWebView_compileSdkVersion=31
ReactNativeWebView_targetSdkVersion=31
ReactNativeWebView_minSdkVersion=21
13 changes: 13 additions & 0 deletions android/src/main/AndroidManifestNew.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<provider
android:name=".RNCWebViewFileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_provider_paths" />
</provider>
</application>
</manifest>
Loading
Loading