Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

webview_flutter version upgrade and linter fixes #100

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
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
41 changes: 41 additions & 0 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '11.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'

project 'Runner', {
'Debug' => :debug,
'Profile' => :release,
'Release' => :release,
}

def flutter_root
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
unless File.exist?(generated_xcode_build_settings_path)
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
end

File.foreach(generated_xcode_build_settings_path) do |line|
matches = line.match(/FLUTTER_ROOT\=(.*)/)
return matches[1].strip if matches
end
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
end

require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

flutter_ios_podfile_setup

target 'Runner' do
use_frameworks!
use_modular_headers!

flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
end

post_install do |installer|
installer.pods_project.targets.each do |target|
flutter_additional_ios_build_settings(target)
end
end
2 changes: 1 addition & 1 deletion example/lib/webview_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ class _WebViewXPageState extends State<WebViewXPage> {
),
Expanded(
child: Scrollbar(
isAlwaysShown: true,
thumbVisibility: true,
child: SizedBox(
width: min(screenSize.width * 0.8, 512),
child: ListView(
Expand Down
67 changes: 51 additions & 16 deletions example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
version: "2.6.1"
version: "2.9.0"
boolean_selector:
dependency: transitive
description:
Expand All @@ -21,7 +21,7 @@ packages:
name: characters
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.2.1"
charcode:
dependency: transitive
description:
Expand All @@ -35,14 +35,14 @@ packages:
name: clock
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
version: "1.15.0"
version: "1.16.0"
crypto:
dependency: transitive
description:
Expand All @@ -63,7 +63,7 @@ packages:
name: fake_async
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.3.1"
flutter:
dependency: "direct main"
description: flutter
Expand Down Expand Up @@ -101,28 +101,42 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
version: "0.12.10"
version: "0.12.12"
material_color_utilities:
dependency: transitive
description:
name: material_color_utilities
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.5"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
version: "1.3.0"
version: "1.8.0"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.0"
version: "1.8.2"
pedantic:
dependency: transitive
description:
name: pedantic
url: "https://pub.dartlang.org"
source: hosted
version: "1.11.0"
plugin_platform_interface:
dependency: transitive
description:
name: plugin_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.3"
pointer_interceptor:
dependency: transitive
description:
Expand All @@ -141,7 +155,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
version: "1.8.1"
version: "1.9.0"
stack_trace:
dependency: transitive
description:
Expand All @@ -162,21 +176,21 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
version: "1.1.0"
version: "1.1.1"
term_glyph:
dependency: transitive
description:
name: term_glyph
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.0"
version: "1.2.1"
test_api:
dependency: transitive
description:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
version: "0.3.0"
version: "0.4.12"
typed_data:
dependency: transitive
description:
Expand All @@ -197,14 +211,35 @@ packages:
name: vector_math
url: "https://pub.dartlang.org"
source: hosted
version: "2.1.0"
version: "2.1.2"
webview_flutter:
dependency: transitive
description:
name: webview_flutter
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.13"
version: "3.0.4"
webview_flutter_android:
dependency: transitive
description:
name: webview_flutter_android
url: "https://pub.dartlang.org"
source: hosted
version: "2.10.4"
webview_flutter_platform_interface:
dependency: transitive
description:
name: webview_flutter_platform_interface
url: "https://pub.dartlang.org"
source: hosted
version: "1.9.5"
webview_flutter_wkwebview:
dependency: transitive
description:
name: webview_flutter_wkwebview
url: "https://pub.dartlang.org"
source: hosted
version: "2.9.5"
webviewx:
dependency: "direct main"
description:
Expand All @@ -213,5 +248,5 @@ packages:
source: path
version: "0.2.1"
sdks:
dart: ">=2.13.0 <3.0.0"
flutter: ">=2.0.0"
dart: ">=2.17.0 <3.0.0"
flutter: ">=3.0.0"
9 changes: 3 additions & 6 deletions lib/src/controller/impl/mobile.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,8 @@ import 'dart:async' show Future;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:webview_flutter/webview_flutter.dart' as wf;
import 'package:webviewx/src/utils/html_utils.dart';
import 'package:webviewx/src/utils/source_type.dart';
import 'package:webviewx/src/utils/utils.dart';

import 'package:webviewx/src/controller/interface.dart' as i;
import 'package:webviewx/src/utils/utils.dart';

/// Mobile implementation
class WebViewXController extends ChangeNotifier
Expand Down Expand Up @@ -121,7 +118,7 @@ class WebViewXController extends ChangeNotifier
) async {
// This basically will transform a "raw" call (evaluateJavascript)
// into a little bit more "typed" call, that is - calling a method.
final result = await connector.evaluateJavascript(
final result = await connector.runJavascriptReturningResult(
HtmlUtils.buildJsFunction(name, params),
);

Expand All @@ -144,7 +141,7 @@ class WebViewXController extends ChangeNotifier
String rawJavascript, {
bool inGlobalContext = false, // NO-OP HERE
}) {
return connector.evaluateJavascript(rawJavascript);
return connector.runJavascriptReturningResult(rawJavascript);
}

/// Returns the current content
Expand Down
4 changes: 1 addition & 3 deletions lib/src/controller/impl/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@ import 'dart:js' as js;

import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:webviewx/src/controller/interface.dart' as i;
import 'package:webviewx/src/utils/logger.dart';
import 'package:webviewx/src/utils/source_type.dart';
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/utils/web_history.dart';

import 'package:webviewx/src/controller/interface.dart' as i;

/// Web implementation
class WebViewXController extends ChangeNotifier
implements i.WebViewXController<js.JsObject> {
Expand Down
2 changes: 0 additions & 2 deletions lib/src/utils/web_specific_params.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import 'package:webviewx/src/utils/css_loader.dart';
import 'package:webviewx/src/utils/source_type.dart';
import 'package:webviewx/src/utils/utils.dart';

/// Parameters specific to the web version.
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/impl/facade.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/view/interface.dart' as view_interface;

/// Facade class
Expand Down
7 changes: 2 additions & 5 deletions lib/src/view/impl/io.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:webviewx/src/utils/utils.dart';

import 'package:webviewx/src/view/interface.dart' as view_interface;
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;

import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/view/impl/mobile.dart' as mobile;
import 'package:webviewx/src/view/interface.dart' as view_interface;

/// IO implementation
///
Expand Down
9 changes: 3 additions & 6 deletions lib/src/view/impl/mobile.dart
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
import 'dart:async';
import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:webviewx/src/utils/utils.dart';

import 'package:webview_flutter/platform_interface.dart' as wf_pi;
import 'package:webview_flutter/webview_flutter.dart' as wf;

import 'package:webviewx/src/view/interface.dart' as view_interface;
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;
import 'package:webviewx/src/controller/impl/mobile.dart';
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/view/interface.dart' as view_interface;

/// Mobile implementation
class WebViewX extends StatefulWidget implements view_interface.WebViewX {
Expand Down
8 changes: 3 additions & 5 deletions lib/src/view/impl/web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,15 @@ import 'dart:convert';
import 'dart:html' as html;
import 'dart:js' as js;

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:pointer_interceptor/pointer_interceptor.dart';

import 'package:webviewx/src/utils/dart_ui_fix.dart' as ui;
import 'package:webviewx/src/controller/impl/web.dart';
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;
import 'package:webviewx/src/utils/constants.dart';
import 'package:webviewx/src/utils/dart_ui_fix.dart' as ui;
import 'package:webviewx/src/utils/logger.dart';
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/controller/impl/web.dart';
import 'package:webviewx/src/controller/interface.dart' as ctrl_interface;
import 'package:webviewx/src/view/interface.dart' as view_interface;

/// Web implementation
Expand Down
2 changes: 1 addition & 1 deletion lib/src/view/interface.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:webviewx/src/utils/utils.dart';
import 'package:webviewx/src/controller/interface.dart';
import 'package:webviewx/src/utils/utils.dart';

/// Interface for widget
abstract class WebViewX {
Expand Down
Loading