fix(gradle): Load Android Gradle Plugin conditionally (#1230 by @SaeedZhiany)
BREAKING CHANGE:
The Android Gradle plugin is only required when opening the project stand-alone, not when it is included as a dependency. By doing this, the project opens correctly in Android Studio, and it can also be consumed as a native module dependency from an application project without affecting the app project (avoiding unnecessary downloads/conflicts/etc).
Also moved getExtOrDefault to buildScript block to able to use everywhere in the file
This change shouldn't break any apps, but we are marking it as a breaking change in case there are some use cases we've missed.
[skip ci]
`onFileDownload` is called with the URL that you can use to download the file.
When RNCWebView detects that the HTTP response should result in a file download,
`onFileDownload` is called. The client can then provide code to download
the file.
RNCWebView determines that a file download should take place if either of the
following is true:
1. The HTTP response contains a `Content-Disposition` header that is of type
'attachment'
2. The MIME type of the response cannot be rendered by the iOS WebView
feat(macOS): Make podspec compatible with macOS (#1328)
* [apple] Move iOS/macOS src into common apple dir
* [apple] Enable macOS as platform in podspec
* [example] Use CocoaPods & auto-linking on macOS
* [docs] Update setup for macOS
* [package] Include apple dir in distribution
fix(iOS): Adds missing silent hardware declaration to header file (#1319)
* Fixes Issue #1140
Fixes https://github.com/react-native-community/react-native-webview/issues/1140
Based on a solution found at: https://stackoverflow.com/questions/56460362/how-to-force-wkwebview-to-ignore-hardware-silent-switch-on-ios
I changed the code found in the linked source from Swift to Objective-C, as required by this project. WARNING: I haven't used Swift before and very limited experience with Objective-C.
- For me this seems to work, but it is not the cleanest solution in my opinion.
- It might also be possible to play generated sound (i.e. using oscillator) instead of hardcoding the silent base64 mp3 data.
- Maybe ignoring silence switch should only be done if a parameter is supplied
* fixes import path
* adds documentation for ignoreSilentHardwareSwitch
* adds ignoreSilentHardwareSwitch parameter
* reverting back to old import path
* Update Guide.md
* adds missing variable
Co-authored-by: Dominik Beste <dominik.beste@gmail.com>
* Fixes Issue #1140
Fixes https://github.com/react-native-community/react-native-webview/issues/1140
Based on a solution found at: https://stackoverflow.com/questions/56460362/how-to-force-wkwebview-to-ignore-hardware-silent-switch-on-ios
I changed the code found in the linked source from Swift to Objective-C, as required by this project. WARNING: I haven't used Swift before and very limited experience with Objective-C.
- For me this seems to work, but it is not the cleanest solution in my opinion.
- It might also be possible to play generated sound (i.e. using oscillator) instead of hardcoding the silent base64 mp3 data.
- Maybe ignoring silence switch should only be done if a parameter is supplied
* fixes import path
* adds documentation for ignoreSilentHardwareSwitch
* adds ignoreSilentHardwareSwitch parameter
* reverting back to old import path
* Update Guide.md
Co-authored-by: Dominik Beste <dominik.beste@gmail.com>
There is a bug in the WebView that causes a spurious call to onReceivedError
whenever you download a file.
This commit is a workaround for that bug. The idea here is to try and detect
these spurious errors and drop them before they cause problems.
This commit should be reverted once those chromium bugs are fixed.
fix(Android): Ensure each mounted WebView binds their personal onMessage handler (#1301)
* Ensure each mounted WebView binds their personal onMessage handler
* Changed unique ref generation to uuid
Uses `uuid` npm package.
Dashes are removed from the ref for sanity.
fix(Android): Don't show camera options for a file upload when they can not be used (#1210)
* Don't show camera options for a file upload that would result in nothing happening for the user.
On Android, if the application declares the camera permission, then even intents
that use the camera require permission to be granted. This is a problem for apps
that combine an in-app camera with a WebView that has file uploading and the user
has not given permission for the camera.
Note, this will not request permission for camera. This will simply prevent
showing the camera options that would be a no-op action for users. It does this
by checking if the camera permission is declared, and if so, checks that the
user has granted permission.
More information: https://blog.egorand.me/taking-photos-not-so-simply-how-i-got-bitten-by-action_image_capture/
* Add example and documentation about camera option availability in file uploads for Android.