Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
e25faa3
[webview_flutter_platform_interface] Update webview platform interfac…
BeMacized Oct 1, 2021
f19b5c3
Fix tests
BeMacized Oct 1, 2021
3a22d00
[webview_flutter] Implemented `runJavaScript` and `runJavaScriptForRe…
BeMacized Oct 1, 2021
2bcec1c
Remove accidental development team inclusion from project.pbxproj
BeMacized Oct 1, 2021
ff493a2
Implemented PR feedback
BeMacized Oct 1, 2021
6bf082f
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 1, 2021
ff125c9
Updated runJavaScriptForResult behaviour
BeMacized Oct 1, 2021
9f661e8
Implemented PR feedback partially
BeMacized Oct 4, 2021
cbc88e8
Implement PR feedback
BeMacized Oct 4, 2021
9f537c7
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 4, 2021
26004c3
Update changelog
BeMacized Oct 4, 2021
283f8a7
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 4, 2021
b95d986
Implement PR feedback from interface PR
BeMacized Oct 4, 2021
3d8b9ce
Update changelog
BeMacized Oct 4, 2021
0ecf641
Revert inclusion of development team
BeMacized Oct 4, 2021
02e1106
Implement PR feedback
BeMacized Oct 5, 2021
d7780dd
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 5, 2021
d8f51ed
Implemented platform interface PR feedback
BeMacized Oct 5, 2021
285c2cc
Merge branch 'master' into webview/js_eval_fix_platform
BeMacized Oct 6, 2021
90cb648
Merge branch 'webview/js_eval_fix_platform' into webview/js_eval_fix_…
BeMacized Oct 6, 2021
bfcacdc
Update pubspec dependency
BeMacized Oct 6, 2021
bcb368c
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 6, 2021
485ead3
Fixed capitalisation
BeMacized Oct 6, 2021
a7d10c0
Fixed capitalisation
BeMacized Oct 6, 2021
d98bc6a
Fix warning
BeMacized Oct 7, 2021
738a9ad
Partially implement PR feedback
BeMacized Oct 8, 2021
527bd67
Partially implement PR feedback
BeMacized Oct 8, 2021
acf5ff9
Format
BeMacized Oct 8, 2021
aed3830
Update podfile
BeMacized Oct 8, 2021
6967c4f
Update podfile
BeMacized Oct 8, 2021
37ba26e
Update podfiles
BeMacized Oct 8, 2021
13076ba
Update iOS project files
BeMacized Oct 8, 2021
0c87362
Update podspec
BeMacized Oct 8, 2021
28ac939
Merge remote-tracking branch 'origin/webview/js_eval_fix_native' into…
BeMacized Oct 8, 2021
962ad02
Remove unnecessary podfile configuration
BeMacized Oct 8, 2021
9184d48
Implemented PR feedback
BeMacized Oct 8, 2021
a111502
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 18, 2021
80cbe9b
Format
BeMacized Oct 18, 2021
9fdab9d
Revert podfile changes
BeMacized Oct 22, 2021
6e609d7
Implemented PR feedback
BeMacized Oct 22, 2021
f6d8cb4
Fix formatting
BeMacized Oct 22, 2021
b019d3c
Fix formatting
BeMacized Oct 22, 2021
2b0f490
Fixed test.
BeMacized Oct 22, 2021
fa9526c
Re-add integration tests for deprecated evaluateJavascript method.
BeMacized Oct 26, 2021
45e799b
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 28, 2021
40a6b38
Merge branch 'master' into webview/js_eval_fix_native
BeMacized Oct 28, 2021
e2f4710
Fix merge conflicts
BeMacized Oct 28, 2021
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
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## 1.1.0

* Added `runJavascript` and `runJavascriptReturningResult` interface methods to supersede `evaluateJavaScript`.
* Added `runJavascript` and `runJavascriptReturningResult` interface methods to supersede `evaluateJavascript`.

## 1.0.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,38 +103,38 @@ abstract class WebViewPlatformController {
"WebView clearCache is not implemented on the current platform");
}

/// Evaluates a Javascript expression in the context of the current page.
/// Evaluates a JavaScript expression in the context of the current page.
///
/// The Future completes with an error if a Javascript error occurred, or if the type of the
/// evaluated expression is not supported (e.g on iOS not all non primitive types can be evaluated).
/// The Future completes with an error if a JavaScript error occurred, or if the type of the
/// evaluated expression is not supported (e.g on iOS not all non-primitive types can be evaluated).
Future<String> evaluateJavascript(String javascript) {
throw UnimplementedError(
"WebView evaluateJavascript is not implemented on the current platform");
}

/// Runs the given Javascript in the context of the current page.
/// Runs the given JavaScript in the context of the current page.
///
/// The Future completes with an error if a Javascript error occurred.
/// The Future completes with an error if a JavaScript error occurred.
Future<void> runJavascript(String javascript) {
throw UnimplementedError(
"WebView runJavascript is not implemented on the current platform");
}

/// Runs the given Javascript in the context of the current page, and returns the result.
/// Runs the given JavaScript in the context of the current page, and returns the result.
///
/// The Future completes with an error if a Javascript error occurred, or if the
/// The Future completes with an error if a JavaScript error occurred, or if the
/// type the given expression evaluates to is unsupported. Unsupported values include
/// certain non primitive types on iOS, as well as `undefined` or `null` on iOS 14+.
/// certain non-primitive types on iOS, as well as `undefined` or `null` on iOS 14+.
Future<String> runJavascriptReturningResult(String javascript) {
throw UnimplementedError(
"WebView runJavascriptReturningResult is not implemented on the current platform");
}

/// Adds new Javascript channels to the set of enabled channels.
/// Adds new JavaScript channels to the set of enabled channels.
///
/// For each value in this list the platform's webview should make sure that a corresponding
/// property with a postMessage method is set on `window`. For example for a Javascript channel
/// named `Foo` it should be possible for Javascript code executing in the webview to do
/// property with a postMessage method is set on `window`. For example for a JavaScript channel
/// named `Foo` it should be possible for JavaScript code executing in the webview to do
///
/// ```javascript
/// Foo.postMessage('hello');
Expand All @@ -146,7 +146,7 @@ abstract class WebViewPlatformController {
"WebView addJavascriptChannels is not implemented on the current platform");
}

/// Removes Javascript channel names from the set of enabled channels.
/// Removes JavaScript channel names from the set of enabled channels.
///
/// This disables channels that were previously enabled by [addJavascriptChannels] or through
/// [CreationParams.javascriptChannelNames].
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@

import 'javascript_message.dart';

/// Callback type for handling messages sent from Javascript running in a web view.
/// Callback type for handling messages sent from JavaScript running in a web view.
typedef void JavascriptMessageHandler(JavascriptMessage message);

final RegExp _validChannelNames = RegExp('^[a-zA-Z_][a-zA-Z0-9_]*\$');

/// A named channel for receiving messaged from JavaScript code running inside a web view.
class JavascriptChannel {
/// Constructs a Javascript channel.
/// Constructs a JavaScript channel.
///
/// The parameters `name` and `onMessageReceived` must not be null.
JavascriptChannel({
Expand All @@ -24,7 +24,7 @@ class JavascriptChannel {
/// The channel's name.
///
/// Passing this channel object as part of a [WebView.javascriptChannels] adds a channel object to
/// the Javascript window object's property named `name`.
/// the JavaScript window object's property named `name`.
///
/// The name must start with a letter or underscore(_), followed by any combination of those
/// characters plus digits.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -266,32 +266,32 @@ void main() {
test('evaluateJavascript', () async {
final String evaluateJavascript =
await webViewPlatform.evaluateJavascript(
'This simulates some Javascript code.',
'This simulates some JavaScript code.',
);

expect('This simulates some Javascript code.', evaluateJavascript);
expect('This simulates some JavaScript code.', evaluateJavascript);
expect(
log,
<Matcher>[
isMethodCall(
'evaluateJavascript',
arguments: 'This simulates some Javascript code.',
arguments: 'This simulates some JavaScript code.',
),
],
);
});

test('runJavascript', () async {
await webViewPlatform.runJavascript(
'This simulates some Javascript code.',
'This simulates some JavaScript code.',
);

expect(
log,
<Matcher>[
isMethodCall(
'runJavascript',
arguments: 'This simulates some Javascript code.',
arguments: 'This simulates some JavaScript code.',
),
],
);
Expand All @@ -300,16 +300,16 @@ void main() {
test('runJavascriptReturningResult', () async {
final String evaluateJavascript =
await webViewPlatform.runJavascriptReturningResult(
'This simulates some Javascript code.',
'This simulates some JavaScript code.',
);

expect('This simulates some Javascript code.', evaluateJavascript);
expect('This simulates some JavaScript code.', evaluateJavascript);
expect(
log,
<Matcher>[
isMethodCall(
'runJavascriptReturningResult',
arguments: 'This simulates some Javascript code.',
arguments: 'This simulates some JavaScript code.',
),
],
);
Expand Down