-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
jiangwei
committed
Oct 28, 2021
0 parents
commit 5757e3c
Showing
5 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# ignore following files | ||
.DS_Store | ||
.settings | ||
.idea | ||
*.iml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
A plugin for cordova-ios@6+ | ||
``` | ||
[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever] | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env node | ||
|
||
module.exports = function (ctx) { | ||
var fs = require('fs'), | ||
path = require('path'); | ||
|
||
var platformRoot = path.join(ctx.opts.projectRoot, 'platforms', 'ios'); | ||
|
||
// clear onReceivedSslError body | ||
var fileCDVWebViewEnginePath = path.join(platformRoot, 'CordovaLib', 'Classes', 'Private', 'Plugins', 'CDVWebViewEngine', 'CDVWebViewEngine.m'); | ||
if (fs.existsSync(fileCDVWebViewEnginePath)) { | ||
var source = fs.readFileSync(fileCDVWebViewEnginePath, 'utf8'); | ||
if (source.indexOf('[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever];') < 0) { | ||
source = source.replace( | ||
'WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration];', | ||
`WKWebView* wkWebView = [[WKWebView alloc] initWithFrame:self.engineWebView.frame configuration:configuration]; | ||
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 | ||
if (@available(iOS 11.0, *)) { | ||
[wkWebView.scrollView setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentNever]; | ||
} | ||
#endif | ||
`) | ||
fs.writeFileSync(fileCDVWebViewEnginePath, source, 'utf8'); | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
{ | ||
"name": "cordova-plugin-wkwebview-inset-adjustment-never", | ||
"description": "WKWebview UIScrollViewContentInsetAdjustmentNever", | ||
"version": "0.0.1", | ||
"homepage": "", | ||
"cordova": { | ||
"id": "cordova-plugin-wkwebview-inset-adjustment-never", | ||
"platforms": [ | ||
"ios" | ||
] | ||
}, | ||
"engines": [ | ||
{ | ||
"name": "cordova", | ||
"version": ">=9.0.0" | ||
} | ||
], | ||
"author": "lovelyelfpop", | ||
"license": "MIT", | ||
"scripts": { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?xml version='1.0' encoding='utf-8'?> | ||
<plugin id="cordova-plugin-wkwebview-inset-adjustment-never" version="0.0.1" | ||
xmlns="http://apache.org/cordova/ns/plugins/1.0" | ||
xmlns:android="http://schemas.android.com/apk/res/android"> | ||
|
||
<name>WKWebview UIScrollViewContentInsetAdjustmentNever</name> | ||
<description>WKWebview UIScrollViewContentInsetAdjustmentNever</description> | ||
<author>lovelyelfpop</author> | ||
<license>MIT</license> | ||
<keywords>WKWebview,UIScrollViewContentInsetAdjustmentNever</keywords> | ||
<repo></repo> | ||
<issue></issue> | ||
|
||
<engines> | ||
<engine name="cordova" version=">=9" /> | ||
<engine name="cordova-ios" version=">=6.0.0" /> | ||
</engines> | ||
|
||
<platform name="ios"> | ||
<hook src="hooks/iosAfterPlatformAdd.js" type="after_platform_add" /> | ||
</platform> | ||
</plugin> |