diff --git a/CHANGELOG.md b/CHANGELOG.md
index 78f386119..ea7f746e8 100755
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,9 @@
+## 3.3.0+3
+
+- Updated Android build.gradle version and some androidx properties
+- Fixed `Multiple sessions` [#371](https://github.com/pichillilorenzo/flutter_inappwebview/issues/371)
+- Fixed `incognito mode is broken swift` [#320](https://github.com/pichillilorenzo/flutter_inappwebview/issues/320)
+
## 3.3.0
- Updated API docs
diff --git a/android/.idea/modules.xml b/android/.idea/modules.xml
index 0100e7832..f33b6a320 100755
--- a/android/.idea/modules.xml
+++ b/android/.idea/modules.xml
@@ -2,7 +2,7 @@
-
+
\ No newline at end of file
diff --git a/android/build.gradle b/android/build.gradle
index 6a0bfcaba..338d0102c 100755
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -8,7 +8,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.3.2'
+ classpath 'com.android.tools.build:gradle:3.6.3'
}
}
@@ -51,27 +51,3 @@ android {
implementation 'com.squareup.okhttp3:mockwebserver:3.11.0'
}
}
-
-afterEvaluate {
- def containsEmbeddingDependencies = false
- for (def configuration : configurations.all) {
- for (def dependency : configuration.dependencies) {
- if (dependency.group == 'io.flutter' &&
- dependency.name.startsWith('flutter_embedding') &&
- dependency.isTransitive())
- {
- containsEmbeddingDependencies = true
- break
- }
- }
- }
- if (!containsEmbeddingDependencies) {
- android {
- dependencies {
- def lifecycle_version = "1.1.1"
- compileOnly "android.arch.lifecycle:common-java8:$lifecycle_version"
- compileOnly "android.arch.lifecycle:runtime:$lifecycle_version"
- }
- }
- }
-}
\ No newline at end of file
diff --git a/android/gradle.properties b/android/gradle.properties
new file mode 100644
index 000000000..94adc3a3f
--- /dev/null
+++ b/android/gradle.properties
@@ -0,0 +1,3 @@
+org.gradle.jvmargs=-Xmx1536M
+android.useAndroidX=true
+android.enableJetifier=true
diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties
index d76b502e2..01a286e96 100755
--- a/android/gradle/wrapper/gradle-wrapper.properties
+++ b/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
diff --git a/example/.flutter-plugins-dependencies b/example/.flutter-plugins-dependencies
index 6c7aa6b8a..dced1688e 100755
--- a/example/.flutter-plugins-dependencies
+++ b/example/.flutter-plugins-dependencies
@@ -1 +1 @@
-{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"macos":[],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-05-30 23:08:18.010942","version":"1.17.1"}
\ No newline at end of file
+{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.9/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"android":[{"name":"e2e","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/e2e-0.2.4+4/","dependencies":[]},{"name":"flutter_downloader","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_downloader-1.4.4/","dependencies":[]},{"name":"flutter_inappwebview","path":"/Users/lorenzopichilli/Desktop/flutter_inappwebview/","dependencies":[]},{"name":"path_provider","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider-1.6.9/","dependencies":[]},{"name":"permission_handler","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/permission_handler-5.0.0+hotfix.6/","dependencies":[]}],"macos":[{"name":"path_provider_macos","path":"/Users/lorenzopichilli/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_macos-0.0.4+3/","dependencies":[]}],"linux":[],"windows":[],"web":[]},"dependencyGraph":[{"name":"e2e","dependencies":[]},{"name":"flutter_downloader","dependencies":[]},{"name":"flutter_inappwebview","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_macos"]},{"name":"path_provider_macos","dependencies":[]},{"name":"permission_handler","dependencies":[]}],"date_created":"2020-06-03 01:35:21.255449","version":"1.17.1"}
\ No newline at end of file
diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml
index 7907dd038..b6bd289b3 100755
--- a/example/android/app/src/main/AndroidManifest.xml
+++ b/example/android/app/src/main/AndroidManifest.xml
@@ -75,15 +75,15 @@
android:resource="@xml/provider_paths" />
-
-
-
-
-
-
-
-
-
+
+
+
diff --git a/example/android/build.gradle b/example/android/build.gradle
index 6e12e86d7..11e3d0901 100755
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.3.2'
+ classpath 'com.android.tools.build:gradle:3.6.3'
}
}
diff --git a/example/android/gradle.properties b/example/android/gradle.properties
index 41672498a..a6738207f 100755
--- a/example/android/gradle.properties
+++ b/example/android/gradle.properties
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true
android.enableJetifier=true
-android.enableR8=true
\ No newline at end of file
+android.enableR8=true
diff --git a/example/android/gradle/wrapper/gradle-wrapper.properties b/example/android/gradle/wrapper/gradle-wrapper.properties
index 0ea206f2b..9d3660b24 100755
--- a/example/android/gradle/wrapper/gradle-wrapper.properties
+++ b/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Fri Oct 05 14:08:48 CEST 2018
+#Mon Jun 01 20:06:49 CEST 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
diff --git a/example/assets/index.html b/example/assets/index.html
index 632c8b444..4f1ae8474 100755
--- a/example/assets/index.html
+++ b/example/assets/index.html
@@ -2,7 +2,7 @@
-
+
Flutter InAppWebView
@@ -24,6 +24,7 @@
+
Inline WebView
diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh
new file mode 100755
index 000000000..4882a9e9f
--- /dev/null
+++ b/example/ios/Flutter/flutter_export_environment.sh
@@ -0,0 +1,11 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=/Users/lorenzopichilli/flutter"
+export "FLUTTER_APPLICATION_PATH=/Users/lorenzopichilli/Desktop/flutter_inappwebview/example"
+export "FLUTTER_TARGET=lib/main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "SYMROOT=${SOURCE_ROOT}/../build/ios"
+export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
+export "FLUTTER_FRAMEWORK_DIR=/Users/lorenzopichilli/flutter/bin/cache/artifacts/engine/ios"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1"
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 4fa3085fe..98e6ef55d 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -256,13 +256,17 @@
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/e2e/e2e.framework",
+ "${BUILT_PRODUCTS_DIR}/flutter_downloader/flutter_downloader.framework",
"${BUILT_PRODUCTS_DIR}/flutter_inappwebview/flutter_inappwebview.framework",
+ "${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/e2e.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_downloader.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_inappwebview.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 82f759414..1eddcc9ff 100755
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -1,69 +1,21 @@
import 'dart:async';
-
+import 'dart:io';
import 'package:flutter/material.dart';
-
-import 'package:flutter_inappwebview_example/chrome_safari_browser_example.screen.dart';
-import 'package:flutter_inappwebview_example/headless_in_app_webview.screen.dart';
-import 'package:flutter_inappwebview_example/in_app_webiew_example.screen.dart';
-import 'package:flutter_inappwebview_example/in_app_browser_example.screen.dart';
-// import 'package:permission_handler/permission_handler.dart';
-
-// InAppLocalhostServer localhostServer = new InAppLocalhostServer();
+import 'package:flutter_inappwebview/flutter_inappwebview.dart';
Future main() async {
WidgetsFlutterBinding.ensureInitialized();
-// await Permission.camera.request();
-// await Permission.storage.request();
- // await localhostServer.start();
runApp(MyApp());
}
-Drawer myDrawer({@required BuildContext context}) {
- return Drawer(
- child: ListView(
- padding: EdgeInsets.zero,
- children: [
- DrawerHeader(
- child: Text('flutter_inappbrowser example'),
- decoration: BoxDecoration(
- color: Colors.blue,
- ),
- ),
- ListTile(
- title: Text('InAppBrowser'),
- onTap: () {
- Navigator.pushReplacementNamed(context, '/InAppBrowser');
- },
- ),
- ListTile(
- title: Text('ChromeSafariBrowser'),
- onTap: () {
- Navigator.pushReplacementNamed(context, '/ChromeSafariBrowser');
- },
- ),
- ListTile(
- title: Text('InAppWebView'),
- onTap: () {
- Navigator.pushReplacementNamed(context, '/');
- },
- ),
- ListTile(
- title: Text('HeadlessInAppWebView'),
- onTap: () {
- Navigator.pushReplacementNamed(context, '/HeadlessInAppWebView');
- },
- ),
- ],
- ),
- );
-}
-
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State {
+ InAppWebViewController webView;
+ CookieManager _cookieManager = CookieManager.instance();
@override
void initState() {
@@ -78,13 +30,46 @@ class _MyAppState extends State {
@override
Widget build(BuildContext context) {
return MaterialApp(
- initialRoute: '/',
- routes: {
- '/': (context) => InAppWebViewExampleScreen(),
- '/InAppBrowser': (context) => InAppBrowserExampleScreen(),
- '/ChromeSafariBrowser': (context) => ChromeSafariBrowserExampleScreen(),
- '/HeadlessInAppWebView': (context) => HeadlessInAppWebViewExampleScreen(),
- }
+ home: Scaffold(
+ appBar: AppBar(
+ title: const Text('InAppWebView Example'),
+ ),
+ body: Container(
+ child: Column(children: [
+ Expanded(
+ child: InAppWebView(
+ initialUrl: "https://github.com/",
+ initialOptions: InAppWebViewGroupOptions(
+ crossPlatform: InAppWebViewOptions(
+ debuggingEnabled: true
+ ),
+ ),
+ onWebViewCreated: (InAppWebViewController controller) {
+ webView = controller;
+ },
+ onLoadStart: (InAppWebViewController controller, String url) {},
+ onLoadStop: (InAppWebViewController controller, String url) async {
+
+ },
+ )),
+ Expanded(
+ child: InAppWebView(
+ initialUrl: "https://github.com/",
+ initialOptions: InAppWebViewGroupOptions(
+ crossPlatform: InAppWebViewOptions(
+ debuggingEnabled: true
+ ),
+ ),
+ onWebViewCreated: (InAppWebViewController controller) {
+ webView = controller;
+ },
+ onLoadStart: (InAppWebViewController controller, String url) {},
+ onLoadStop: (InAppWebViewController controller, String url) async {
+
+ },
+ ))
+ ])),
+ ),
);
}
-}
\ No newline at end of file
+}
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index 948f10cfd..c4375f72f 100755
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -20,9 +20,10 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
- # flutter_downloader: ^1.3.2
- # path_provider: ^1.4.0
+ flutter_downloader: ^1.4.4
+ path_provider: ^1.6.9
permission_handler: ^5.0.0+hotfix.6
+ # webview_flutter: ^0.3.22+1
# connectivity: ^0.4.5+6
flutter_inappwebview:
path: ../
diff --git a/ios/Classes/InAppWebView.swift b/ios/Classes/InAppWebView.swift
index e9beed314..c6463b6f0 100755
--- a/ios/Classes/InAppWebView.swift
+++ b/ios/Classes/InAppWebView.swift
@@ -1037,28 +1037,7 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
configuration.userContentController.addUserScript(interceptFetchRequestsJSScript)
}
- if #available(iOS 9.0, *) {
- if ((options?.incognito)!) {
- configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
- } else if ((options?.cacheEnabled)!) {
- configuration.websiteDataStore = WKWebsiteDataStore.default()
- }
- }
-
if #available(iOS 11.0, *) {
- if((options?.sharedCookiesEnabled)!) {
- // More info to sending cookies with WKWebView
- // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303
- // Set Cookies in iOS 11 and above, initialize websiteDataStore before setting cookies
- // See also https://forums.developer.apple.com/thread/97194
- // check if websiteDataStore has not been initialized before
- if(!(options?.incognito)! && !(options?.cacheEnabled)!) {
- configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
- }
- for cookie in HTTPCookieStorage.shared.cookies ?? [] {
- configuration.websiteDataStore.httpCookieStore.setCookie(cookie, completionHandler: nil)
- }
- }
accessibilityIgnoresInvertColors = (options?.accessibilityIgnoresInvertColors)!
}
@@ -1229,6 +1208,30 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate, WKNavi
}
}
+ if #available(iOS 9.0, *) {
+ if ((options?.incognito)!) {
+ configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
+ } else if ((options?.cacheEnabled)!) {
+ configuration.websiteDataStore = WKWebsiteDataStore.default()
+ }
+ }
+
+ if #available(iOS 11.0, *) {
+ if((options?.sharedCookiesEnabled)!) {
+ // More info to sending cookies with WKWebView
+ // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303
+ // Set Cookies in iOS 11 and above, initialize websiteDataStore before setting cookies
+ // See also https://forums.developer.apple.com/thread/97194
+ // check if websiteDataStore has not been initialized before
+ if(!(options?.incognito)! && !(options?.cacheEnabled)!) {
+ configuration.websiteDataStore = WKWebsiteDataStore.nonPersistent()
+ }
+ for cookie in HTTPCookieStorage.shared.cookies ?? [] {
+ configuration.websiteDataStore.httpCookieStore.setCookie(cookie, completionHandler: nil)
+ }
+ }
+ }
+
return configuration
}
diff --git a/ios/flutter_inappwebview.podspec b/ios/flutter_inappwebview.podspec
index ce1835553..6e004a6bf 100755
--- a/ios/flutter_inappwebview.podspec
+++ b/ios/flutter_inappwebview.podspec
@@ -1,5 +1,6 @@
#
-# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html.
+# Run `pod lib lint flutterplugintest.podspec' to validate before publishing.
#
Pod::Spec.new do |s|
s.name = 'flutter_inappwebview'
@@ -16,7 +17,9 @@ A new Flutter plugin.
s.resources = 'Storyboards/**/*.storyboard'
s.public_header_files = 'Classes/**/*.h'
s.dependency 'Flutter'
-
+ s.platform = :ios, '8.0'
+
+ # Flutter.framework does not contain a i386 slice. Only x86_64 simulators are supported.
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
s.swift_version = '5.0'
end
diff --git a/lib/src/in_app_webview_controller.dart b/lib/src/in_app_webview_controller.dart
index ed9620600..10b3a436e 100644
--- a/lib/src/in_app_webview_controller.dart
+++ b/lib/src/in_app_webview_controller.dart
@@ -1597,7 +1597,7 @@ class AndroidInAppWebViewController {
return await _controller._channel.invokeMethod('pageUp', args);
}
- ///Saves the current view as a web archive.
+ ///Saves the current WebView as a web archive.
///Returns the filename under which the file was saved, or `null` if saving the file failed.
///
///[basename] the filename where the archive should be placed. This value cannot be `null`.
diff --git a/pubspec.yaml b/pubspec.yaml
index 32c4a798d..2840ded73 100755
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,6 +1,6 @@
name: flutter_inappwebview
description: A Flutter plugin that allows you to add an inline webview, to use an headless webview, and to open an in-app browser window.
-version: 3.3.0
+version: 3.3.0+3
homepage: https://github.com/pichillilorenzo/flutter_inappwebview
environment: