diff --git a/.gradle/4.4.1/fileChanges/last-build.bin b/.gradle/4.4.1/fileChanges/last-build.bin
new file mode 100644
index 00000000..f76dd238
Binary files /dev/null and b/.gradle/4.4.1/fileChanges/last-build.bin differ
diff --git a/.gradle/4.4.1/fileHashes/fileHashes.lock b/.gradle/4.4.1/fileHashes/fileHashes.lock
new file mode 100644
index 00000000..3ae95879
Binary files /dev/null and b/.gradle/4.4.1/fileHashes/fileHashes.lock differ
diff --git a/.gradle/4.4.1/taskHistory/taskHistory.lock b/.gradle/4.4.1/taskHistory/taskHistory.lock
new file mode 100644
index 00000000..b18ddce2
Binary files /dev/null and b/.gradle/4.4.1/taskHistory/taskHistory.lock differ
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 00000000..9a4cb628
Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 00000000..3d1809d4
--- /dev/null
+++ b/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Sun Sep 16 19:20:12 CEST 2018
+gradle.version=4.4.1
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index b8bd6388..a2b99c7e 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,8 +2,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -20,14 +36,12 @@
-
-
+
+
-
-
-
-
-
+
+
+
@@ -35,60 +49,25 @@
-
-
+
+
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -166,17 +145,19 @@
+
+
+
-
-
-
-
+
+
+
@@ -195,6 +176,9 @@
+
+
+
@@ -206,7 +190,37 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -218,9 +232,6 @@
-
-
-
@@ -228,8 +239,17 @@
+
+
+
+
+
+
+
+
+
@@ -398,69 +418,149 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
+
+
-
+
+
+
-
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -468,7 +568,6 @@
-
@@ -476,9 +575,6 @@
-
-
-
@@ -502,7 +598,6 @@
-
@@ -527,13 +622,6 @@
-
-
-
-
-
-
-
@@ -559,7 +647,6 @@
-
@@ -567,7 +654,6 @@
-
@@ -575,23 +661,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -627,7 +696,6 @@
-
@@ -635,7 +703,6 @@
-
@@ -643,7 +710,6 @@
-
@@ -651,7 +717,6 @@
-
@@ -659,23 +724,13 @@
-
-
-
-
-
-
-
-
-
-
-
+
@@ -684,7 +739,6 @@
-
@@ -694,47 +748,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -742,7 +755,6 @@
-
@@ -750,16 +762,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
@@ -767,45 +846,86 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Android
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 1.8
+
+
+
+
+
+
+
+
+
+
+
+ flutter_inappbrowser_android
+
+
+
+
+
+
+
+
+
+
+
+ Dart SDK
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/README.md b/README.md
index da10681a..cfa417a8 100644
--- a/README.md
+++ b/README.md
@@ -91,7 +91,7 @@ class _MyAppState extends State {
### InAppBrowser.open
-Opens a URL in a new InAppBrowser instance, the current browser instance, or the system browser.
+Opens a URL in a new InAppBrowser instance or the system browser.
```dart
inAppBrowser.open(url, target, options);
diff --git a/android/build.gradle b/android/build.gradle
index 04b65821..24f18e77 100644
--- a/android/build.gradle
+++ b/android/build.gradle
@@ -32,3 +32,7 @@ android {
disable 'InvalidPackage'
}
}
+
+dependencies {
+ implementation 'com.android.support:customtabs:27.1.1'
+}
\ No newline at end of file
diff --git a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java
index 7866fe8f..d38cbc0e 100644
--- a/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java
+++ b/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java
@@ -155,6 +155,7 @@ public class InAppBrowser implements MethodCallHandler {
switch (call.method) {
case "open":
final String url = call.argument("url").toString();
+
String t = call.argument("target").toString();
if (t == null || t.equals("") || t.equals(NULL)) {
t = SELF;
diff --git a/example/android/build.gradle b/example/android/build.gradle
index d4225c79..ae216294 100644
--- a/example/android/build.gradle
+++ b/example/android/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
dependencies {
- classpath 'com.android.tools.build:gradle:3.1.2'
+ classpath 'com.android.tools.build:gradle:3.1.4'
}
}
diff --git a/example/flutter_plugin/.gitignore b/example/flutter_plugin/.gitignore
new file mode 100644
index 00000000..7ecebb44
--- /dev/null
+++ b/example/flutter_plugin/.gitignore
@@ -0,0 +1,8 @@
+.DS_Store
+.dart_tool/
+
+.packages
+.pub/
+pubspec.lock
+
+build/
diff --git a/example/flutter_plugin/CHANGELOG.md b/example/flutter_plugin/CHANGELOG.md
new file mode 100644
index 00000000..41cc7d81
--- /dev/null
+++ b/example/flutter_plugin/CHANGELOG.md
@@ -0,0 +1,3 @@
+## 0.0.1
+
+* TODO: Describe initial release.
diff --git a/example/flutter_plugin/LICENSE b/example/flutter_plugin/LICENSE
new file mode 100644
index 00000000..ba75c69f
--- /dev/null
+++ b/example/flutter_plugin/LICENSE
@@ -0,0 +1 @@
+TODO: Add your license here.
diff --git a/example/flutter_plugin/README.md b/example/flutter_plugin/README.md
new file mode 100644
index 00000000..69a4389d
--- /dev/null
+++ b/example/flutter_plugin/README.md
@@ -0,0 +1,10 @@
+# flutter_plugin
+
+A new Flutter plugin.
+
+## Getting Started
+
+For help getting started with Flutter, view our online
+[documentation](https://flutter.io/).
+
+For help on editing plugin code, view the [documentation](https://flutter.io/developing-packages/#edit-plugin-package).
diff --git a/example/flutter_plugin/android/.gitignore b/example/flutter_plugin/android/.gitignore
new file mode 100644
index 00000000..c6cbe562
--- /dev/null
+++ b/example/flutter_plugin/android/.gitignore
@@ -0,0 +1,8 @@
+*.iml
+.gradle
+/local.properties
+/.idea/workspace.xml
+/.idea/libraries
+.DS_Store
+/build
+/captures
diff --git a/example/flutter_plugin/android/build.gradle b/example/flutter_plugin/android/build.gradle
new file mode 100644
index 00000000..a5addfb0
--- /dev/null
+++ b/example/flutter_plugin/android/build.gradle
@@ -0,0 +1,34 @@
+group 'com.pichillilorenzo.flutterplugin'
+version '1.0-SNAPSHOT'
+
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.1.2'
+ }
+}
+
+rootProject.allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+apply plugin: 'com.android.library'
+
+android {
+ compileSdkVersion 27
+
+ defaultConfig {
+ minSdkVersion 16
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+}
diff --git a/example/flutter_plugin/android/gradle.properties b/example/flutter_plugin/android/gradle.properties
new file mode 100644
index 00000000..8bd86f68
--- /dev/null
+++ b/example/flutter_plugin/android/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx1536M
diff --git a/example/flutter_plugin/android/settings.gradle b/example/flutter_plugin/android/settings.gradle
new file mode 100644
index 00000000..e039a04a
--- /dev/null
+++ b/example/flutter_plugin/android/settings.gradle
@@ -0,0 +1 @@
+rootProject.name = 'flutter_plugin'
diff --git a/example/flutter_plugin/android/src/main/AndroidManifest.xml b/example/flutter_plugin/android/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..1c580028
--- /dev/null
+++ b/example/flutter_plugin/android/src/main/AndroidManifest.xml
@@ -0,0 +1,3 @@
+
+
diff --git a/example/flutter_plugin/android/src/main/java/com/pichillilorenzo/flutterplugin/FlutterPlugin.java b/example/flutter_plugin/android/src/main/java/com/pichillilorenzo/flutterplugin/FlutterPlugin.java
new file mode 100644
index 00000000..a7ea5cc0
--- /dev/null
+++ b/example/flutter_plugin/android/src/main/java/com/pichillilorenzo/flutterplugin/FlutterPlugin.java
@@ -0,0 +1,25 @@
+package com.pichillilorenzo.flutterplugin;
+
+import io.flutter.plugin.common.MethodCall;
+import io.flutter.plugin.common.MethodChannel;
+import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
+import io.flutter.plugin.common.MethodChannel.Result;
+import io.flutter.plugin.common.PluginRegistry.Registrar;
+
+/** FlutterPlugin */
+public class FlutterPlugin implements MethodCallHandler {
+ /** Plugin registration. */
+ public static void registerWith(Registrar registrar) {
+ final MethodChannel channel = new MethodChannel(registrar.messenger(), "flutter_plugin");
+ channel.setMethodCallHandler(new FlutterPlugin());
+ }
+
+ @Override
+ public void onMethodCall(MethodCall call, Result result) {
+ if (call.method.equals("getPlatformVersion")) {
+ result.success("Android " + android.os.Build.VERSION.RELEASE);
+ } else {
+ result.notImplemented();
+ }
+ }
+}
diff --git a/example/flutter_plugin/example/.gitignore b/example/flutter_plugin/example/.gitignore
new file mode 100644
index 00000000..47e0b4d6
--- /dev/null
+++ b/example/flutter_plugin/example/.gitignore
@@ -0,0 +1,71 @@
+# Miscellaneous
+*.class
+*.lock
+*.log
+*.pyc
+*.swp
+.DS_Store
+.atom/
+.buildlog/
+.history
+.svn/
+
+# IntelliJ related
+*.iml
+*.ipr
+*.iws
+.idea/
+
+# Visual Studio Code related
+.vscode/
+
+# Flutter/Dart/Pub related
+**/doc/api/
+.dart_tool/
+.flutter-plugins
+.packages
+.pub-cache/
+.pub/
+build/
+
+# Android related
+**/android/**/gradle-wrapper.jar
+**/android/.gradle
+**/android/captures/
+**/android/gradlew
+**/android/gradlew.bat
+**/android/local.properties
+**/android/**/GeneratedPluginRegistrant.java
+
+# iOS/XCode related
+**/ios/**/*.mode1v3
+**/ios/**/*.mode2v3
+**/ios/**/*.moved-aside
+**/ios/**/*.pbxuser
+**/ios/**/*.perspectivev3
+**/ios/**/*sync/
+**/ios/**/.sconsign.dblite
+**/ios/**/.tags*
+**/ios/**/.vagrant/
+**/ios/**/DerivedData/
+**/ios/**/Icon?
+**/ios/**/Pods/
+**/ios/**/.symlinks/
+**/ios/**/profile
+**/ios/**/xcuserdata
+**/ios/.generated/
+**/ios/Flutter/App.framework
+**/ios/Flutter/Flutter.framework
+**/ios/Flutter/Generated.xcconfig
+**/ios/Flutter/app.flx
+**/ios/Flutter/app.zip
+**/ios/Flutter/flutter_assets/
+**/ios/ServiceDefinitions.json
+**/ios/Runner/GeneratedPluginRegistrant.*
+
+# Exceptions to above rules.
+!**/ios/**/default.mode1v3
+!**/ios/**/default.mode2v3
+!**/ios/**/default.pbxuser
+!**/ios/**/default.perspectivev3
+!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
diff --git a/example/flutter_plugin/example/.metadata b/example/flutter_plugin/example/.metadata
new file mode 100644
index 00000000..dbdb9afb
--- /dev/null
+++ b/example/flutter_plugin/example/.metadata
@@ -0,0 +1,8 @@
+# This file tracks properties of this Flutter project.
+# Used by Flutter tool to assess capabilities and perform upgrades etc.
+#
+# This file should be version controlled and should not be manually edited.
+
+version:
+ revision: 2bca8007bd1962940fa3b3d568bc52e446005616
+ channel: master
diff --git a/example/flutter_plugin/example/README.md b/example/flutter_plugin/example/README.md
new file mode 100644
index 00000000..17ecae4d
--- /dev/null
+++ b/example/flutter_plugin/example/README.md
@@ -0,0 +1,8 @@
+# flutter_plugin_example
+
+Demonstrates how to use the flutter_plugin plugin.
+
+## Getting Started
+
+For help getting started with Flutter, view our online
+[documentation](https://flutter.io/).
diff --git a/example/flutter_plugin/example/android/app/build.gradle b/example/flutter_plugin/example/android/app/build.gradle
new file mode 100644
index 00000000..545d4ec7
--- /dev/null
+++ b/example/flutter_plugin/example/android/app/build.gradle
@@ -0,0 +1,61 @@
+def localProperties = new Properties()
+def localPropertiesFile = rootProject.file('local.properties')
+if (localPropertiesFile.exists()) {
+ localPropertiesFile.withReader('UTF-8') { reader ->
+ localProperties.load(reader)
+ }
+}
+
+def flutterRoot = localProperties.getProperty('flutter.sdk')
+if (flutterRoot == null) {
+ throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
+}
+
+def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
+if (flutterVersionCode == null) {
+ flutterVersionCode = '1'
+}
+
+def flutterVersionName = localProperties.getProperty('flutter.versionName')
+if (flutterVersionName == null) {
+ flutterVersionName = '1.0'
+}
+
+apply plugin: 'com.android.application'
+apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"
+
+android {
+ compileSdkVersion 27
+
+ lintOptions {
+ disable 'InvalidPackage'
+ }
+
+ defaultConfig {
+ // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
+ applicationId "com.pichillilorenzo.flutterpluginexample"
+ minSdkVersion 16
+ targetSdkVersion 27
+ versionCode flutterVersionCode.toInteger()
+ versionName flutterVersionName
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ // TODO: Add your own signing config for the release build.
+ // Signing with the debug keys for now, so `flutter run --release` works.
+ signingConfig signingConfigs.debug
+ }
+ }
+}
+
+flutter {
+ source '../..'
+}
+
+dependencies {
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'com.android.support.test:runner:1.0.2'
+ androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
+}
diff --git a/example/flutter_plugin/example/android/app/src/main/AndroidManifest.xml b/example/flutter_plugin/example/android/app/src/main/AndroidManifest.xml
new file mode 100644
index 00000000..dbdb33a8
--- /dev/null
+++ b/example/flutter_plugin/example/android/app/src/main/AndroidManifest.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/android/app/src/main/java/com/pichillilorenzo/flutterpluginexample/MainActivity.java b/example/flutter_plugin/example/android/app/src/main/java/com/pichillilorenzo/flutterpluginexample/MainActivity.java
new file mode 100644
index 00000000..98ae0639
--- /dev/null
+++ b/example/flutter_plugin/example/android/app/src/main/java/com/pichillilorenzo/flutterpluginexample/MainActivity.java
@@ -0,0 +1,13 @@
+package com.pichillilorenzo.flutterpluginexample;
+
+import android.os.Bundle;
+import io.flutter.app.FlutterActivity;
+import io.flutter.plugins.GeneratedPluginRegistrant;
+
+public class MainActivity extends FlutterActivity {
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ GeneratedPluginRegistrant.registerWith(this);
+ }
+}
diff --git a/example/flutter_plugin/example/android/app/src/main/res/drawable/launch_background.xml b/example/flutter_plugin/example/android/app/src/main/res/drawable/launch_background.xml
new file mode 100644
index 00000000..304732f8
--- /dev/null
+++ b/example/flutter_plugin/example/android/app/src/main/res/drawable/launch_background.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/example/flutter_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
new file mode 100644
index 00000000..db77bb4b
Binary files /dev/null and b/example/flutter_plugin/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ
diff --git a/example/flutter_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/example/flutter_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
new file mode 100644
index 00000000..17987b79
Binary files /dev/null and b/example/flutter_plugin/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ
diff --git a/example/flutter_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
new file mode 100644
index 00000000..09d43914
Binary files /dev/null and b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ
diff --git a/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
new file mode 100644
index 00000000..d5f1c8d3
Binary files /dev/null and b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ
diff --git a/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
new file mode 100644
index 00000000..4d6372ee
Binary files /dev/null and b/example/flutter_plugin/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ
diff --git a/example/flutter_plugin/example/android/app/src/main/res/values/styles.xml b/example/flutter_plugin/example/android/app/src/main/res/values/styles.xml
new file mode 100644
index 00000000..00fa4417
--- /dev/null
+++ b/example/flutter_plugin/example/android/app/src/main/res/values/styles.xml
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/example/flutter_plugin/example/android/build.gradle b/example/flutter_plugin/example/android/build.gradle
new file mode 100644
index 00000000..d4225c79
--- /dev/null
+++ b/example/flutter_plugin/example/android/build.gradle
@@ -0,0 +1,29 @@
+buildscript {
+ repositories {
+ google()
+ jcenter()
+ }
+
+ dependencies {
+ classpath 'com.android.tools.build:gradle:3.1.2'
+ }
+}
+
+allprojects {
+ repositories {
+ google()
+ jcenter()
+ }
+}
+
+rootProject.buildDir = '../build'
+subprojects {
+ project.buildDir = "${rootProject.buildDir}/${project.name}"
+}
+subprojects {
+ project.evaluationDependsOn(':app')
+}
+
+task clean(type: Delete) {
+ delete rootProject.buildDir
+}
diff --git a/example/flutter_plugin/example/android/gradle.properties b/example/flutter_plugin/example/android/gradle.properties
new file mode 100644
index 00000000..8bd86f68
--- /dev/null
+++ b/example/flutter_plugin/example/android/gradle.properties
@@ -0,0 +1 @@
+org.gradle.jvmargs=-Xmx1536M
diff --git a/example/flutter_plugin/example/android/gradle/wrapper/gradle-wrapper.properties b/example/flutter_plugin/example/android/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 00000000..9372d0f3
--- /dev/null
+++ b/example/flutter_plugin/example/android/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,6 @@
+#Fri Jun 23 08:50:38 CEST 2017
+distributionBase=GRADLE_USER_HOME
+distributionPath=wrapper/dists
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
diff --git a/example/flutter_plugin/example/android/settings.gradle b/example/flutter_plugin/example/android/settings.gradle
new file mode 100644
index 00000000..5a2f14fb
--- /dev/null
+++ b/example/flutter_plugin/example/android/settings.gradle
@@ -0,0 +1,15 @@
+include ':app'
+
+def flutterProjectRoot = rootProject.projectDir.parentFile.toPath()
+
+def plugins = new Properties()
+def pluginsFile = new File(flutterProjectRoot.toFile(), '.flutter-plugins')
+if (pluginsFile.exists()) {
+ pluginsFile.withReader('UTF-8') { reader -> plugins.load(reader) }
+}
+
+plugins.each { name, path ->
+ def pluginDirectory = flutterProjectRoot.resolve(path).resolve('android').toFile()
+ include ":$name"
+ project(":$name").projectDir = pluginDirectory
+}
diff --git a/example/flutter_plugin/example/ios/Flutter/AppFrameworkInfo.plist b/example/flutter_plugin/example/ios/Flutter/AppFrameworkInfo.plist
new file mode 100644
index 00000000..9367d483
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Flutter/AppFrameworkInfo.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ App
+ CFBundleIdentifier
+ io.flutter.flutter.app
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ App
+ CFBundlePackageType
+ FMWK
+ CFBundleShortVersionString
+ 1.0
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ MinimumOSVersion
+ 8.0
+
+
diff --git a/example/flutter_plugin/example/ios/Flutter/Debug.xcconfig b/example/flutter_plugin/example/ios/Flutter/Debug.xcconfig
new file mode 100644
index 00000000..1fce94d3
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Flutter/Debug.xcconfig
@@ -0,0 +1,3 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
+#include "Generated.xcconfig"
+FLUTTER_BUILD_MODE=debug
\ No newline at end of file
diff --git a/example/flutter_plugin/example/ios/Flutter/Release.xcconfig b/example/flutter_plugin/example/ios/Flutter/Release.xcconfig
new file mode 100644
index 00000000..399e9340
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Flutter/Release.xcconfig
@@ -0,0 +1,2 @@
+#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
+#include "Generated.xcconfig"
diff --git a/example/flutter_plugin/example/ios/Podfile b/example/flutter_plugin/example/ios/Podfile
new file mode 100644
index 00000000..2dfb5019
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Podfile
@@ -0,0 +1,65 @@
+# Uncomment this line to define a global platform for your project
+# platform :ios, '9.0'
+
+# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
+ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+
+def parse_KV_file(file, separator='=')
+ file_abs_path = File.expand_path(file)
+ if !File.exists? file_abs_path
+ return [];
+ end
+ pods_ary = []
+ skip_line_start_symbols = ["#", "/"]
+ File.foreach(file_abs_path) { |line|
+ next if skip_line_start_symbols.any? { |symbol| line =~ /^\s*#{symbol}/ }
+ plugin = line.split(pattern=separator)
+ if plugin.length == 2
+ podname = plugin[0].strip()
+ path = plugin[1].strip()
+ podpath = File.expand_path("#{path}", file_abs_path)
+ pods_ary.push({:name => podname, :path => podpath});
+ else
+ puts "Invalid plugin specification: #{line}"
+ end
+ }
+ return pods_ary
+end
+
+target 'Runner' do
+ use_frameworks!
+
+ # Prepare symlinks folder. We use symlinks to avoid having Podfile.lock
+ # referring to absolute paths on developers' machines.
+ system('rm -rf .symlinks')
+ system('mkdir -p .symlinks/plugins')
+
+ # Flutter Pods
+ generated_xcode_build_settings = parse_KV_file('./Flutter/Generated.xcconfig')
+ if generated_xcode_build_settings.empty?
+ puts "Generated.xcconfig must exist. If you're running pod install manually, make sure flutter packages get is executed first."
+ end
+ generated_xcode_build_settings.map { |p|
+ if p[:name] == 'FLUTTER_FRAMEWORK_DIR'
+ symlink = File.join('.symlinks', 'flutter')
+ File.symlink(File.dirname(p[:path]), symlink)
+ pod 'Flutter', :path => File.join(symlink, File.basename(p[:path]))
+ end
+ }
+
+ # Plugin Pods
+ plugin_pods = parse_KV_file('../.flutter-plugins')
+ plugin_pods.map { |p|
+ symlink = File.join('.symlinks', 'plugins', p[:name])
+ File.symlink(p[:path], symlink)
+ pod p[:name], :path => File.join(symlink, 'ios')
+ }
+end
+
+post_install do |installer|
+ installer.pods_project.targets.each do |target|
+ target.build_configurations.each do |config|
+ config.build_settings['ENABLE_BITCODE'] = 'NO'
+ end
+ end
+end
diff --git a/example/flutter_plugin/example/ios/Runner.xcodeproj/project.pbxproj b/example/flutter_plugin/example/ios/Runner.xcodeproj/project.pbxproj
new file mode 100644
index 00000000..23216f50
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner.xcodeproj/project.pbxproj
@@ -0,0 +1,509 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 46;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
+ 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */ = {isa = PBXBuildFile; fileRef = 2D5378251FAA1A9400D5DBA9 /* flutter_assets */; };
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
+ 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
+ 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
+ 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
+ 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
+ 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ DB2612FCD79CFD30D1ED676B /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = C43B270A1396F896DC0446C6 /* Pods_Runner.framework */; };
+ ED5EF107214FEBA60065FD45 /* Storyboard.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ED5EF106214FEBA60065FD45 /* Storyboard.storyboard */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 9705A1C41CF9048500538489 /* Embed Frameworks */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 2147483647;
+ dstPath = "";
+ dstSubfolderSpec = 10;
+ files = (
+ 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
+ 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
+ );
+ name = "Embed Frameworks";
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
+ 2D5378251FAA1A9400D5DBA9 /* flutter_assets */ = {isa = PBXFileReference; lastKnownFileType = folder; name = flutter_assets; path = Flutter/flutter_assets; sourceTree = SOURCE_ROOT; };
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
+ 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; };
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
+ 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
+ 97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
+ 97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; };
+ 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
+ 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
+ C43B270A1396F896DC0446C6 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ ED5EF106214FEBA60065FD45 /* Storyboard.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Storyboard.storyboard; sourceTree = ""; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 97C146EB1CF9000F007C117D /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
+ 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
+ DB2612FCD79CFD30D1ED676B /* Pods_Runner.framework in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 1370AF27C0FCD5A746BF55B6 /* Frameworks */ = {
+ isa = PBXGroup;
+ children = (
+ C43B270A1396F896DC0446C6 /* Pods_Runner.framework */,
+ );
+ name = Frameworks;
+ sourceTree = "";
+ };
+ 5BC6EF24EEA526A3E6F37537 /* Pods */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = Pods;
+ sourceTree = "";
+ };
+ 9740EEB11CF90186004384FC /* Flutter */ = {
+ isa = PBXGroup;
+ children = (
+ 2D5378251FAA1A9400D5DBA9 /* flutter_assets */,
+ 3B80C3931E831B6300D905FE /* App.framework */,
+ 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
+ 9740EEBA1CF902C7004384FC /* Flutter.framework */,
+ 9740EEB21CF90195004384FC /* Debug.xcconfig */,
+ 7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
+ 9740EEB31CF90195004384FC /* Generated.xcconfig */,
+ );
+ name = Flutter;
+ sourceTree = "";
+ };
+ 97C146E51CF9000F007C117D = {
+ isa = PBXGroup;
+ children = (
+ 9740EEB11CF90186004384FC /* Flutter */,
+ 97C146F01CF9000F007C117D /* Runner */,
+ 97C146EF1CF9000F007C117D /* Products */,
+ 5BC6EF24EEA526A3E6F37537 /* Pods */,
+ 1370AF27C0FCD5A746BF55B6 /* Frameworks */,
+ );
+ sourceTree = "";
+ };
+ 97C146EF1CF9000F007C117D /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146EE1CF9000F007C117D /* Runner.app */,
+ );
+ name = Products;
+ sourceTree = "";
+ };
+ 97C146F01CF9000F007C117D /* Runner */ = {
+ isa = PBXGroup;
+ children = (
+ 97C146FA1CF9000F007C117D /* Main.storyboard */,
+ 97C146FD1CF9000F007C117D /* Assets.xcassets */,
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */,
+ 97C147021CF9000F007C117D /* Info.plist */,
+ 97C146F11CF9000F007C117D /* Supporting Files */,
+ 1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */,
+ 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
+ 74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
+ 74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ ED5EF106214FEBA60065FD45 /* Storyboard.storyboard */,
+ );
+ path = Runner;
+ sourceTree = "";
+ };
+ 97C146F11CF9000F007C117D /* Supporting Files */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = "Supporting Files";
+ sourceTree = "";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+ 97C146ED1CF9000F007C117D /* Runner */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
+ buildPhases = (
+ 3410A771F369E256652931DE /* [CP] Check Pods Manifest.lock */,
+ 9740EEB61CF901F6004384FC /* Run Script */,
+ 97C146EA1CF9000F007C117D /* Sources */,
+ 97C146EB1CF9000F007C117D /* Frameworks */,
+ 97C146EC1CF9000F007C117D /* Resources */,
+ 9705A1C41CF9048500538489 /* Embed Frameworks */,
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
+ C682215FBA770A2F10789415 /* [CP] Embed Pods Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = Runner;
+ productName = Runner;
+ productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
+ productType = "com.apple.product-type.application";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 97C146E61CF9000F007C117D /* Project object */ = {
+ isa = PBXProject;
+ attributes = {
+ LastUpgradeCheck = 0910;
+ ORGANIZATIONNAME = "The Chromium Authors";
+ TargetAttributes = {
+ 97C146ED1CF9000F007C117D = {
+ CreatedOnToolsVersion = 7.3.1;
+ DevelopmentTeam = PFP8UV45Y6;
+ LastSwiftMigration = 0910;
+ };
+ };
+ };
+ buildConfigurationList = 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */;
+ compatibilityVersion = "Xcode 3.2";
+ developmentRegion = English;
+ hasScannedForEncodings = 0;
+ knownRegions = (
+ en,
+ Base,
+ );
+ mainGroup = 97C146E51CF9000F007C117D;
+ productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 97C146ED1CF9000F007C117D /* Runner */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 97C146EC1CF9000F007C117D /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
+ 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
+ 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
+ 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
+ 2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
+ ED5EF107214FEBA60065FD45 /* Storyboard.storyboard in Resources */,
+ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXShellScriptBuildPhase section */
+ 3410A771F369E256652931DE /* [CP] Check Pods Manifest.lock */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
+ "${PODS_ROOT}/Manifest.lock",
+ );
+ name = "[CP] Check Pods Manifest.lock";
+ outputPaths = (
+ "$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
+ showEnvVarsInLog = 0;
+ };
+ 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Thin Binary";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
+ };
+ 9740EEB61CF901F6004384FC /* Run Script */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ );
+ name = "Run Script";
+ outputPaths = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
+ };
+ C682215FBA770A2F10789415 /* [CP] Embed Pods Frameworks */ = {
+ isa = PBXShellScriptBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ inputPaths = (
+ "${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
+ "${PODS_ROOT}/../.symlinks/flutter/ios-release/Flutter.framework",
+ "${BUILT_PRODUCTS_DIR}/flutter_plugin/flutter_plugin.framework",
+ );
+ name = "[CP] Embed Pods Frameworks";
+ outputPaths = (
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
+ "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_plugin.framework",
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ shellPath = /bin/sh;
+ shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
+ showEnvVarsInLog = 0;
+ };
+/* End PBXShellScriptBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 97C146EA1CF9000F007C117D /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */,
+ 1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+ 97C146FA1CF9000F007C117D /* Main.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C146FB1CF9000F007C117D /* Base */,
+ );
+ name = Main.storyboard;
+ sourceTree = "";
+ };
+ 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */ = {
+ isa = PBXVariantGroup;
+ children = (
+ 97C147001CF9000F007C117D /* Base */,
+ );
+ name = LaunchScreen.storyboard;
+ sourceTree = "";
+ };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+ 97C147031CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = dwarf;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "DEBUG=1",
+ "$(inherited)",
+ );
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ SDKROOT = iphoneos;
+ TARGETED_DEVICE_FAMILY = "1,2";
+ };
+ name = Debug;
+ };
+ 97C147041CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ CLANG_ANALYZER_NONNULL = YES;
+ CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
+ CLANG_CXX_LIBRARY = "libc++";
+ CLANG_ENABLE_MODULES = YES;
+ CLANG_ENABLE_OBJC_ARC = YES;
+ CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
+ CLANG_WARN_BOOL_CONVERSION = YES;
+ CLANG_WARN_COMMA = YES;
+ CLANG_WARN_CONSTANT_CONVERSION = YES;
+ CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
+ CLANG_WARN_EMPTY_BODY = YES;
+ CLANG_WARN_ENUM_CONVERSION = YES;
+ CLANG_WARN_INFINITE_RECURSION = YES;
+ CLANG_WARN_INT_CONVERSION = YES;
+ CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
+ CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
+ CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
+ CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
+ CLANG_WARN_STRICT_PROTOTYPES = YES;
+ CLANG_WARN_SUSPICIOUS_MOVE = YES;
+ CLANG_WARN_UNREACHABLE_CODE = YES;
+ CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
+ "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
+ COPY_PHASE_STRIP = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ ENABLE_NS_ASSERTIONS = NO;
+ ENABLE_STRICT_OBJC_MSGSEND = YES;
+ GCC_C_LANGUAGE_STANDARD = gnu99;
+ GCC_NO_COMMON_BLOCKS = YES;
+ GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
+ GCC_WARN_UNDECLARED_SELECTOR = YES;
+ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
+ GCC_WARN_UNUSED_FUNCTION = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ IPHONEOS_DEPLOYMENT_TARGET = 8.0;
+ MTL_ENABLE_DEBUG_INFO = NO;
+ SDKROOT = iphoneos;
+ SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
+ TARGETED_DEVICE_FAMILY = "1,2";
+ VALIDATE_PRODUCT = YES;
+ };
+ name = Release;
+ };
+ 97C147061CF9000F007C117D /* Debug */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = PFP8UV45Y6;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.pichillilorenzo.flutterPluginExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_OPTIMIZATION_LEVEL = "-Onone";
+ SWIFT_SWIFT3_OBJC_INFERENCE = On;
+ SWIFT_VERSION = 4.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Debug;
+ };
+ 97C147071CF9000F007C117D /* Release */ = {
+ isa = XCBuildConfiguration;
+ baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
+ buildSettings = {
+ ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
+ CLANG_ENABLE_MODULES = YES;
+ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = PFP8UV45Y6;
+ ENABLE_BITCODE = NO;
+ FRAMEWORK_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ INFOPLIST_FILE = Runner/Info.plist;
+ LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ LIBRARY_SEARCH_PATHS = (
+ "$(inherited)",
+ "$(PROJECT_DIR)/Flutter",
+ );
+ PRODUCT_BUNDLE_IDENTIFIER = com.pichillilorenzo.flutterPluginExample;
+ PRODUCT_NAME = "$(TARGET_NAME)";
+ SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h";
+ SWIFT_SWIFT3_OBJC_INFERENCE = On;
+ SWIFT_VERSION = 4.0;
+ VERSIONING_SYSTEM = "apple-generic";
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 97C146E91CF9000F007C117D /* Build configuration list for PBXProject "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147031CF9000F007C117D /* Debug */,
+ 97C147041CF9000F007C117D /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 97C147061CF9000F007C117D /* Debug */,
+ 97C147071CF9000F007C117D /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 97C146E61CF9000F007C117D /* Project object */;
+}
diff --git a/example/flutter_plugin/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/flutter_plugin/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..1d526a16
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,7 @@
+
+
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/flutter_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
new file mode 100644
index 00000000..1263ac84
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner.xcworkspace/contents.xcworkspacedata b/example/flutter_plugin/example/ios/Runner.xcworkspace/contents.xcworkspacedata
new file mode 100644
index 00000000..21a3cc14
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner.xcworkspace/contents.xcworkspacedata
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/example/flutter_plugin/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
new file mode 100644
index 00000000..18d98100
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
@@ -0,0 +1,8 @@
+
+
+
+
+ IDEDidComputeMac32BitWarning
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner/AppDelegate.swift b/example/flutter_plugin/example/ios/Runner/AppDelegate.swift
new file mode 100644
index 00000000..71cc41e3
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/AppDelegate.swift
@@ -0,0 +1,13 @@
+import UIKit
+import Flutter
+
+@UIApplicationMain
+@objc class AppDelegate: FlutterAppDelegate {
+ override func application(
+ _ application: UIApplication,
+ didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?
+ ) -> Bool {
+ GeneratedPluginRegistrant.register(with: self)
+ return super.application(application, didFinishLaunchingWithOptions: launchOptions)
+ }
+}
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
new file mode 100644
index 00000000..d36b1fab
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
@@ -0,0 +1,122 @@
+{
+ "images" : [
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-20x20@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-29x29@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-40x40@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "60x60",
+ "idiom" : "iphone",
+ "filename" : "Icon-App-60x60@3x.png",
+ "scale" : "3x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "20x20",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-20x20@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "29x29",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-29x29@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "40x40",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-40x40@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@1x.png",
+ "scale" : "1x"
+ },
+ {
+ "size" : "76x76",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-76x76@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "83.5x83.5",
+ "idiom" : "ipad",
+ "filename" : "Icon-App-83.5x83.5@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "size" : "1024x1024",
+ "idiom" : "ios-marketing",
+ "filename" : "Icon-App-1024x1024@1x.png",
+ "scale" : "1x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
new file mode 100644
index 00000000..3d43d11e
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
new file mode 100644
index 00000000..28c6bf03
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
new file mode 100644
index 00000000..2ccbfd96
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
new file mode 100644
index 00000000..f091b6b0
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
new file mode 100644
index 00000000..4cde1211
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
new file mode 100644
index 00000000..d0ef06e7
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
new file mode 100644
index 00000000..dcdc2306
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
new file mode 100644
index 00000000..2ccbfd96
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
new file mode 100644
index 00000000..c8f9ed8f
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
new file mode 100644
index 00000000..a6d6b860
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
new file mode 100644
index 00000000..a6d6b860
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
new file mode 100644
index 00000000..75b2d164
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
new file mode 100644
index 00000000..c4df70d3
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
new file mode 100644
index 00000000..6a84f41e
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
new file mode 100644
index 00000000..d0e1f585
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
new file mode 100644
index 00000000..0bedcf2f
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
@@ -0,0 +1,23 @@
+{
+ "images" : [
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage.png",
+ "scale" : "1x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@2x.png",
+ "scale" : "2x"
+ },
+ {
+ "idiom" : "universal",
+ "filename" : "LaunchImage@3x.png",
+ "scale" : "3x"
+ }
+ ],
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
new file mode 100644
index 00000000..9da19eac
Binary files /dev/null and b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png differ
diff --git a/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
new file mode 100644
index 00000000..89c2725b
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
@@ -0,0 +1,5 @@
+# Launch Screen Assets
+
+You can customize the launch screen with your own desired assets by replacing the image files in this directory.
+
+You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
\ No newline at end of file
diff --git a/example/flutter_plugin/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/flutter_plugin/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
new file mode 100644
index 00000000..f2e259c7
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner/Base.lproj/Main.storyboard b/example/flutter_plugin/example/ios/Runner/Base.lproj/Main.storyboard
new file mode 100644
index 00000000..f3c28516
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Base.lproj/Main.storyboard
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner/Info.plist b/example/flutter_plugin/example/ios/Runner/Info.plist
new file mode 100644
index 00000000..ca4d58e7
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Info.plist
@@ -0,0 +1,45 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ en
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundleName
+ flutter_plugin_example
+ CFBundlePackageType
+ APPL
+ CFBundleShortVersionString
+ $(FLUTTER_BUILD_NAME)
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ $(FLUTTER_BUILD_NUMBER)
+ LSRequiresIPhoneOS
+
+ UILaunchStoryboardName
+ LaunchScreen
+ UIMainStoryboardFile
+ Main
+ UISupportedInterfaceOrientations
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UISupportedInterfaceOrientations~ipad
+
+ UIInterfaceOrientationPortrait
+ UIInterfaceOrientationPortraitUpsideDown
+ UIInterfaceOrientationLandscapeLeft
+ UIInterfaceOrientationLandscapeRight
+
+ UIViewControllerBasedStatusBarAppearance
+
+
+
diff --git a/example/flutter_plugin/example/ios/Runner/Runner-Bridging-Header.h b/example/flutter_plugin/example/ios/Runner/Runner-Bridging-Header.h
new file mode 100644
index 00000000..7335fdf9
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Runner-Bridging-Header.h
@@ -0,0 +1 @@
+#import "GeneratedPluginRegistrant.h"
\ No newline at end of file
diff --git a/example/flutter_plugin/example/ios/Runner/Storyboard.storyboard b/example/flutter_plugin/example/ios/Runner/Storyboard.storyboard
new file mode 100644
index 00000000..e1d3fb08
--- /dev/null
+++ b/example/flutter_plugin/example/ios/Runner/Storyboard.storyboard
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/flutter_plugin/example/lib/main.dart b/example/flutter_plugin/example/lib/main.dart
new file mode 100644
index 00000000..0cff52da
--- /dev/null
+++ b/example/flutter_plugin/example/lib/main.dart
@@ -0,0 +1,39 @@
+import 'package:flutter/material.dart';
+import 'dart:async';
+
+import 'package:flutter/services.dart';
+import 'package:flutter_plugin/flutter_plugin.dart';
+
+void main() => runApp(new MyApp());
+
+class MyApp extends StatefulWidget {
+ @override
+ _MyAppState createState() => new _MyAppState();
+}
+
+class _MyAppState extends State {
+ String _platformVersion = 'Unknown';
+
+ @override
+ void initState() {
+ super.initState();
+ }
+
+ @override
+ Widget build(BuildContext context) {
+ return new MaterialApp(
+ home: new Scaffold(
+ appBar: new AppBar(
+ title: const Text('Flutter InAppBrowser Plugin example app'),
+ ),
+ body: new Center(
+ child: new RaisedButton(onPressed: () {
+ FlutterPlugin.open();
+ },
+ child: Text("Open InAppBrowser")
+ ),
+ ),
+ ),
+ );
+ }
+}
diff --git a/example/flutter_plugin/example/pubspec.yaml b/example/flutter_plugin/example/pubspec.yaml
new file mode 100644
index 00000000..0efda104
--- /dev/null
+++ b/example/flutter_plugin/example/pubspec.yaml
@@ -0,0 +1,70 @@
+name: flutter_plugin_example
+description: Demonstrates how to use the flutter_plugin plugin.
+
+# The following defines the version and build number for your application.
+# A version number is three numbers separated by dots, like 1.2.43
+# followed by an optional build number separated by a +.
+# Both the version and the builder number may be overridden in flutter
+# build by specifying --build-name and --build-number, respectively.
+# Read more about versioning at semver.org.
+version: 1.0.0+1
+
+environment:
+ sdk: ">=2.0.0-dev.68.0 <3.0.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+
+ # The following adds the Cupertino Icons font to your application.
+ # Use with the CupertinoIcons class for iOS style icons.
+ cupertino_icons: ^0.1.2
+
+dev_dependencies:
+ flutter_test:
+ sdk: flutter
+
+ flutter_plugin:
+ path: ../
+
+# For information on the generic Dart part of this file, see the
+# following page: https://www.dartlang.org/tools/pub/pubspec
+
+# The following section is specific to Flutter.
+flutter:
+
+ # The following line ensures that the Material Icons font is
+ # included with your application, so that you can use the icons in
+ # the material Icons class.
+ uses-material-design: true
+
+ # To add assets to your application, add an assets section, like this:
+ # assets:
+ # - images/a_dot_burr.jpeg
+ # - images/a_dot_ham.jpeg
+
+ # An image asset can refer to one or more resolution-specific "variants", see
+ # https://flutter.io/assets-and-images/#resolution-aware.
+
+ # For details regarding adding assets from package dependencies, see
+ # https://flutter.io/assets-and-images/#from-packages
+
+ # To add custom fonts to your application, add a fonts section here,
+ # in this "flutter" section. Each entry in this list should have a
+ # "family" key with the font family name, and a "fonts" key with a
+ # list giving the asset and other descriptors for the font. For
+ # example:
+ # fonts:
+ # - family: Schyler
+ # fonts:
+ # - asset: fonts/Schyler-Regular.ttf
+ # - asset: fonts/Schyler-Italic.ttf
+ # style: italic
+ # - family: Trajan Pro
+ # fonts:
+ # - asset: fonts/TrajanPro.ttf
+ # - asset: fonts/TrajanPro_Bold.ttf
+ # weight: 700
+ #
+ # For details regarding fonts from package dependencies,
+ # see https://flutter.io/custom-fonts/#from-packages
diff --git a/example/flutter_plugin/example/test/widget_test.dart b/example/flutter_plugin/example/test/widget_test.dart
new file mode 100644
index 00000000..c5f8290b
--- /dev/null
+++ b/example/flutter_plugin/example/test/widget_test.dart
@@ -0,0 +1,25 @@
+// This is a basic Flutter widget test.
+// To perform an interaction with a widget in your test, use the WidgetTester utility that Flutter
+// provides. For example, you can send tap and scroll gestures. You can also use WidgetTester to
+// find child widgets in the widget tree, read text, and verify that the values of widget properties
+// are correct.
+
+import 'package:flutter/material.dart';
+import 'package:flutter_test/flutter_test.dart';
+
+import 'package:flutter_plugin_example/main.dart';
+
+void main() {
+ testWidgets('Verify Platform version', (WidgetTester tester) async {
+ // Build our app and trigger a frame.
+ await tester.pumpWidget(new MyApp());
+
+ // Verify that platform version is retrieved.
+ expect(
+ find.byWidgetPredicate(
+ (Widget widget) =>
+ widget is Text && widget.data.startsWith('Running on:'),
+ ),
+ findsOneWidget);
+ });
+}
diff --git a/example/flutter_plugin/ios/.gitignore b/example/flutter_plugin/ios/.gitignore
new file mode 100644
index 00000000..710ec6cf
--- /dev/null
+++ b/example/flutter_plugin/ios/.gitignore
@@ -0,0 +1,36 @@
+.idea/
+.vagrant/
+.sconsign.dblite
+.svn/
+
+.DS_Store
+*.swp
+profile
+
+DerivedData/
+build/
+GeneratedPluginRegistrant.h
+GeneratedPluginRegistrant.m
+
+.generated/
+
+*.pbxuser
+*.mode1v3
+*.mode2v3
+*.perspectivev3
+
+!default.pbxuser
+!default.mode1v3
+!default.mode2v3
+!default.perspectivev3
+
+xcuserdata
+
+*.moved-aside
+
+*.pyc
+*sync/
+Icon?
+.tags*
+
+/Flutter/Generated.xcconfig
diff --git a/example/flutter_plugin/ios/Assets/.gitkeep b/example/flutter_plugin/ios/Assets/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/example/flutter_plugin/ios/Classes/FlutterPlugin.h b/example/flutter_plugin/ios/Classes/FlutterPlugin.h
new file mode 100644
index 00000000..0798c8fd
--- /dev/null
+++ b/example/flutter_plugin/ios/Classes/FlutterPlugin.h
@@ -0,0 +1,4 @@
+#import
+
+@interface FlutterPlugin : NSObject
+@end
diff --git a/example/flutter_plugin/ios/Classes/FlutterPlugin.m b/example/flutter_plugin/ios/Classes/FlutterPlugin.m
new file mode 100644
index 00000000..13208f03
--- /dev/null
+++ b/example/flutter_plugin/ios/Classes/FlutterPlugin.m
@@ -0,0 +1,8 @@
+#import "FlutterPlugin.h"
+#import
+
+@implementation FlutterPlugin
++ (void)registerWithRegistrar:(NSObject*)registrar {
+ [SwiftFlutterPlugin registerWithRegistrar:registrar];
+}
+@end
diff --git a/example/flutter_plugin/ios/Classes/SwiftFlutterPlugin.swift b/example/flutter_plugin/ios/Classes/SwiftFlutterPlugin.swift
new file mode 100644
index 00000000..c60ff46b
--- /dev/null
+++ b/example/flutter_plugin/ios/Classes/SwiftFlutterPlugin.swift
@@ -0,0 +1,45 @@
+import Flutter
+import UIKit
+import WebKit
+
+public class SwiftFlutterPlugin: NSObject, Flutter.FlutterPlugin {
+ public static func register(with registrar: FlutterPluginRegistrar) {
+ let channel = FlutterMethodChannel(name: "flutter_plugin", binaryMessenger: registrar.messenger())
+ let instance = SwiftFlutterPlugin()
+ registrar.addMethodCallDelegate(instance, channel: channel)
+ }
+
+ public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
+
+ let frame: CGRect = UIScreen.main.bounds
+ let tmpWindow = UIWindow(frame: frame)
+ let storyboard = UIStoryboard(name: "Storyboard", bundle: nil)
+ let vc = storyboard.instantiateViewController(withIdentifier: "viewController")
+ let tmpController = UIViewController()
+ let baseWindowLevel = UIApplication.shared.keyWindow?.windowLevel
+ tmpWindow.rootViewController = tmpController
+ tmpWindow.windowLevel = UIWindowLevel(baseWindowLevel! + 1)
+ tmpWindow.makeKeyAndVisible()
+ tmpController.present(vc, animated: true, completion: nil)
+ //tmpController.present(nav, animated: true) { () -> Void in }
+ result(true)
+ }
+}
+
+public class testViewController: UIViewController {
+ @IBOutlet var webView: WKWebView!
+ @IBOutlet var urlField: UITextField!
+ @IBOutlet var done: UIButton!
+
+ public override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
+ super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
+ }
+
+ required public init?(coder aDecoder: NSCoder) {
+ super.init(coder: aDecoder)
+ }
+
+ override public func viewDidLoad() {
+ print("asdasdasd")
+ }
+}
diff --git a/example/flutter_plugin/ios/flutter_plugin.podspec b/example/flutter_plugin/ios/flutter_plugin.podspec
new file mode 100644
index 00000000..c28187c4
--- /dev/null
+++ b/example/flutter_plugin/ios/flutter_plugin.podspec
@@ -0,0 +1,21 @@
+#
+# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html
+#
+Pod::Spec.new do |s|
+ s.name = 'flutter_plugin'
+ s.version = '0.0.1'
+ s.summary = 'A new Flutter plugin.'
+ s.description = <<-DESC
+A new Flutter plugin.
+ DESC
+ s.homepage = 'http://example.com'
+ s.license = { :file => '../LICENSE' }
+ s.author = { 'Your Company' => 'email@example.com' }
+ s.source = { :path => '.' }
+ s.source_files = 'Classes/**/*'
+ s.public_header_files = 'Classes/**/*.h'
+ s.dependency 'Flutter'
+
+ s.ios.deployment_target = '8.0'
+end
+
diff --git a/example/flutter_plugin/lib/flutter_plugin.dart b/example/flutter_plugin/lib/flutter_plugin.dart
new file mode 100644
index 00000000..5588bff0
--- /dev/null
+++ b/example/flutter_plugin/lib/flutter_plugin.dart
@@ -0,0 +1,17 @@
+import 'dart:async';
+
+import 'package:flutter/services.dart';
+
+class FlutterPlugin {
+ static const MethodChannel _channel =
+ const MethodChannel('flutter_plugin');
+
+ static Future get platformVersion async {
+ final String version = await _channel.invokeMethod('getPlatformVersion');
+ return version;
+ }
+
+ static Future open() async {
+ return await _channel.invokeMethod('open');
+ }
+}
diff --git a/example/flutter_plugin/pubspec.yaml b/example/flutter_plugin/pubspec.yaml
new file mode 100644
index 00000000..a866a4d8
--- /dev/null
+++ b/example/flutter_plugin/pubspec.yaml
@@ -0,0 +1,52 @@
+name: flutter_plugin
+description: A new Flutter plugin.
+version: 0.0.1
+author:
+homepage:
+
+environment:
+ sdk: ">=2.0.0-dev.68.0 <3.0.0"
+
+dependencies:
+ flutter:
+ sdk: flutter
+
+# For information on the generic Dart part of this file, see the
+# following page: https://www.dartlang.org/tools/pub/pubspec
+
+# The following section is specific to Flutter.
+flutter:
+ plugin:
+ androidPackage: com.pichillilorenzo.flutterplugin
+ pluginClass: FlutterPlugin
+
+ # To add assets to your plugin package, add an assets section, like this:
+ # assets:
+ # - images/a_dot_burr.jpeg
+ # - images/a_dot_ham.jpeg
+ #
+ # For details regarding assets in packages, see
+ # https://flutter.io/assets-and-images/#from-packages
+ #
+ # An image asset can refer to one or more resolution-specific "variants", see
+ # https://flutter.io/assets-and-images/#resolution-aware.
+
+ # To add custom fonts to your plugin package, add a fonts section here,
+ # in this "flutter" section. Each entry in this list should have a
+ # "family" key with the font family name, and a "fonts" key with a
+ # list giving the asset and other descriptors for the font. For
+ # example:
+ # fonts:
+ # - family: Schyler
+ # fonts:
+ # - asset: fonts/Schyler-Regular.ttf
+ # - asset: fonts/Schyler-Italic.ttf
+ # style: italic
+ # - family: Trajan Pro
+ # fonts:
+ # - asset: fonts/TrajanPro.ttf
+ # - asset: fonts/TrajanPro_Bold.ttf
+ # weight: 700
+ #
+ # For details regarding fonts in packages, see
+ # https://flutter.io/custom-fonts/#from-packages
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 6359b202..0f0a6312 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -20,6 +20,7 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
+ ED5EF13121506A3E0065FD45 /* WebView.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = ED5EF108214FF6F80065FD45 /* WebView.storyboard */; };
/* End PBXBuildFile section */
/* Begin PBXCopyFilesBuildPhase section */
@@ -55,6 +56,7 @@
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
E8D91E403808A7540F18B75D /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+ ED5EF108214FF6F80065FD45 /* WebView.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = WebView.storyboard; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -131,6 +133,7 @@
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */,
74858FAE1ED2DC5600515810 /* AppDelegate.swift */,
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */,
+ ED5EF108214FF6F80065FD45 /* WebView.storyboard */,
);
path = Runner;
sourceTree = "";
@@ -178,6 +181,7 @@
TargetAttributes = {
97C146ED1CF9000F007C117D = {
CreatedOnToolsVersion = 7.3.1;
+ DevelopmentTeam = PFP8UV45Y6;
LastSwiftMigration = 0910;
};
};
@@ -208,6 +212,7 @@
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */,
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */,
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */,
+ ED5EF13121506A3E0065FD45 /* WebView.storyboard in Resources */,
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */,
2D5378261FAA1A9400D5DBA9 /* flutter_assets in Resources */,
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */,
@@ -427,6 +432,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = PFP8UV45Y6;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@@ -455,6 +461,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
+ DEVELOPMENT_TEAM = PFP8UV45Y6;
ENABLE_BITCODE = NO;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
index 1263ac84..f5a8db1a 100644
--- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
@@ -26,7 +26,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
@@ -46,7 +45,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
- language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
diff --git a/example/ios/Runner/Assets.xcassets/Contents.json b/example/ios/Runner/Assets.xcassets/Contents.json
new file mode 100644
index 00000000..da4a164c
--- /dev/null
+++ b/example/ios/Runner/Assets.xcassets/Contents.json
@@ -0,0 +1,6 @@
+{
+ "info" : {
+ "version" : 1,
+ "author" : "xcode"
+ }
+}
\ No newline at end of file
diff --git a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard b/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
index f2e259c7..e5f47340 100644
--- a/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
+++ b/example/ios/Runner/Base.lproj/LaunchScreen.storyboard
@@ -1,37 +1,31 @@
-
-
+
+
+
+
+
-
-
+
+
+
-
+
-
+
-
-
+
+
-
+
+
-
-
-
-
-
-
-
-
-
+
-
+
-
+
-
-
-
diff --git a/example/ios/Runner/Base.lproj/Main.storyboard b/example/ios/Runner/Base.lproj/Main.storyboard
index f3c28516..c0688ac0 100644
--- a/example/ios/Runner/Base.lproj/Main.storyboard
+++ b/example/ios/Runner/Base.lproj/Main.storyboard
@@ -1,8 +1,12 @@
-
-
+
+
+
+
+
-
+
+
@@ -10,17 +14,18 @@
-
-
+
+
-
+
-
+
+
diff --git a/example/ios/Runner/WebView.storyboard b/example/ios/Runner/WebView.storyboard
new file mode 100644
index 00000000..125c7877
--- /dev/null
+++ b/example/ios/Runner/WebView.storyboard
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 68d82e4c..bc5b063a 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -14,16 +14,16 @@ class MyInAppBrowser extends InAppBrowser {
void onLoadStop(String url) {
super.onLoadStop(url);
print("\n\nStopped $url\n\n");
- this.injectScriptFile("https://code.jquery.com/jquery-3.3.1.min.js");
- /*this.injectScriptCode("""
+ /*this.injectScriptFile("https://code.jquery.com/jquery-3.3.1.min.js");
+ this.injectScriptCode("""
\$( "body" ).html( "Next Step..." )
- """);*/
+ """);
this.injectStyleCode("""
body {
background-color: #3c3c3c !important;
}
""");
- this.injectStyleFile("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css");
+ this.injectStyleFile("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css");*/
}
@override
@@ -65,7 +65,10 @@ class _MyAppState extends State {
),
body: new Center(
child: new RaisedButton(onPressed: () {
- inAppBrowser.open("https://flutter.io/");
+ inAppBrowser.open("https://flutter.io/", options: {
+ //"toolbarTop": false,
+ //"toolbarBottom": false
+ });
},
child: Text("Open InAppBrowser")
),
diff --git a/flutter_inappbrowser.iml b/flutter_inappbrowser.iml
index 98c4874a..c5627b49 100644
--- a/flutter_inappbrowser.iml
+++ b/flutter_inappbrowser.iml
@@ -11,6 +11,9 @@
+
+
+
diff --git a/flutter_inappbrowser_android.iml b/flutter_inappbrowser_android.iml
index ac5d744d..a06f850a 100644
--- a/flutter_inappbrowser_android.iml
+++ b/flutter_inappbrowser_android.iml
@@ -27,4 +27,4 @@
-
+
\ No newline at end of file
diff --git a/ios/Classes/InAppBrowserOptions.swift b/ios/Classes/InAppBrowserOptions.swift
new file mode 100644
index 00000000..01ff0bfc
--- /dev/null
+++ b/ios/Classes/InAppBrowserOptions.swift
@@ -0,0 +1,42 @@
+//
+// InAppBrowserOptions.swift
+// flutter_inappbrowser
+//
+// Created by Lorenzo on 17/09/18.
+//
+
+import Foundation
+
+@objcMembers
+public class InAppBrowserOptions: NSObject {
+ var closeButtonCaption = ""
+ var closeButtonColor = ""
+ var clearCache = false
+ var clearSessionCache = false
+ var spinner = true
+ var enableViewportScale = false
+ var mediaPlaybackRequiresUserAction = false
+ var allowInlineMediaPlayback = false
+ var keyboardDisplayRequiresUserAction = true
+ var suppressesIncrementalRendering = false
+ var hidden = false
+ var disallowOverScroll = false
+ var toolbarTop = true
+ var toolbarTopColor = ""
+ var toolbarTopTranslucent = true
+ var toolbarBottom = true
+ var toolbarBottomColor = ""
+ var toolbarBottomTranslucent = true
+ var hideUrlBar = false
+ var presentationStyle = 0 //fullscreen
+ var transitionStyle = 0 //crossDissolve
+
+ public func parse(options: [String: Any]) {
+ for (key, value) in options {
+ if self.value(forKey: key) != nil {
+ self.setValue(value, forKey: key)
+ }
+ }
+ }
+}
+
diff --git a/ios/Classes/InAppBrowserWebViewController.swift b/ios/Classes/InAppBrowserWebViewController.swift
new file mode 100644
index 00000000..1411ffdb
--- /dev/null
+++ b/ios/Classes/InAppBrowserWebViewController.swift
@@ -0,0 +1,566 @@
+//
+// InAppBrowserWebViewController.swift
+// flutter_inappbrowser
+//
+// Created by Lorenzo on 17/09/18.
+//
+
+import Flutter
+import UIKit
+import WebKit
+import Foundation
+import AVFoundation
+
+typealias OlderClosureType = @convention(c) (Any, Selector, UnsafeRawPointer, Bool, Bool, Any?) -> Void
+typealias NewerClosureType = @convention(c) (Any, Selector, UnsafeRawPointer, Bool, Bool, Bool, Any?) -> Void
+
+extension WKWebView{
+
+ var keyboardDisplayRequiresUserAction: Bool? {
+ get {
+ return self.keyboardDisplayRequiresUserAction
+ }
+ set {
+ self.setKeyboardRequiresUserInteraction(newValue ?? true)
+ }
+ }
+
+ func setKeyboardRequiresUserInteraction( _ value: Bool) {
+
+ guard
+ let WKContentViewClass: AnyClass = NSClassFromString("WKContentView") else {
+ print("Cannot find the WKContentView class")
+ return
+ }
+
+ let olderSelector: Selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:")
+ let newerSelector: Selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:")
+
+ if let method = class_getInstanceMethod(WKContentViewClass, olderSelector) {
+
+ let originalImp: IMP = method_getImplementation(method)
+ let original: OlderClosureType = unsafeBitCast(originalImp, to: OlderClosureType.self)
+ let block : @convention(block) (Any, UnsafeRawPointer, Bool, Bool, Any?) -> Void = { (me, arg0, arg1, arg2, arg3) in
+ original(me, olderSelector, arg0, !value, arg2, arg3)
+ }
+ let imp: IMP = imp_implementationWithBlock(block)
+ method_setImplementation(method, imp)
+ }
+
+ if let method = class_getInstanceMethod(WKContentViewClass, newerSelector) {
+
+ let originalImp: IMP = method_getImplementation(method)
+ let original: NewerClosureType = unsafeBitCast(originalImp, to: NewerClosureType.self)
+ let block : @convention(block) (Any, UnsafeRawPointer, Bool, Bool, Bool, Any?) -> Void = { (me, arg0, arg1, arg2, arg3, arg4) in
+ original(me, newerSelector, arg0, !value, arg2, arg3, arg4)
+ }
+ let imp: IMP = imp_implementationWithBlock(block)
+ method_setImplementation(method, imp)
+ }
+
+ }
+
+}
+
+class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigationDelegate, UITextFieldDelegate {
+ @IBOutlet var webView: WKWebView!
+ @IBOutlet var closeButton: UIButton!
+ @IBOutlet var reloadButton: UIBarButtonItem!
+ @IBOutlet var backButton: UIBarButtonItem!
+ @IBOutlet var forwardButton: UIBarButtonItem!
+ @IBOutlet var shareButton: UIBarButtonItem!
+ @IBOutlet var spinner: UIActivityIndicatorView!
+ @IBOutlet var toolbarTop: UIView!
+ @IBOutlet var toolbarBottom: UIToolbar!
+ @IBOutlet var urlField: UITextField!
+
+ weak var navigationDelegate: SwiftFlutterPlugin?
+ var currentURL: URL?
+ var tmpWindow: UIWindow?
+ var browserOptions: InAppBrowserOptions?
+
+ required init(coder aDecoder: NSCoder) {
+ super.init(coder: aDecoder)!
+ }
+
+ override func viewWillAppear(_ animated: Bool) {
+ UIApplication.shared.statusBarStyle = preferredStatusBarStyle
+ super.viewWillAppear(animated)
+ prepareWebView()
+ }
+
+ override func viewDidLoad() {
+ webView.uiDelegate = self
+ webView.navigationDelegate = self
+
+ urlField.delegate = self
+ urlField.text = self.currentURL?.absoluteString
+
+ closeButton.addTarget(self, action: #selector(self.close), for: .touchUpInside)
+
+ forwardButton.target = self
+ forwardButton.action = #selector(self.goForward)
+
+ forwardButton.target = self
+ forwardButton.action = #selector(self.goForward)
+
+ backButton.target = self
+ backButton.action = #selector(self.goBack)
+
+ reloadButton.target = self
+ reloadButton.action = #selector(self.reload)
+
+ shareButton.target = self
+ shareButton.action = #selector(self.share)
+
+ spinner.hidesWhenStopped = true
+ spinner.isHidden = false
+ spinner.stopAnimating()
+
+ navigate(to: self.currentURL!)
+ }
+
+ // Prevent crashes on closing windows
+ deinit {
+ webView?.uiDelegate = nil
+ }
+
+ override func viewWillDisappear (_ animated: Bool) {
+ super.viewWillDisappear(animated)
+ }
+
+ func prepareWebView() {
+
+ if (browserOptions?.hideUrlBar)! {
+ self.urlField.isHidden = true
+ self.urlField.isEnabled = false
+ }
+
+ if (browserOptions?.toolbarTop)! {
+ if browserOptions?.toolbarTopColor != "" {
+ self.toolbarTop.backgroundColor = color(fromHexString: (browserOptions?.toolbarTopColor)!)
+ }
+ }
+ else {
+ self.toolbarTop.removeFromSuperview()
+ self.webView.bounds.size.height += self.toolbarTop.bounds.height
+
+ if #available(iOS 9.0, *) {
+ let topConstraint = webView.topAnchor.constraint(equalTo: self.view.topAnchor, constant: CGFloat(getStatusBarOffset()))
+ NSLayoutConstraint.activate([topConstraint])
+ }
+ }
+
+ if (browserOptions?.toolbarBottom)! {
+ if browserOptions?.toolbarBottomColor != "" {
+ self.toolbarBottom.backgroundColor = color(fromHexString: (browserOptions?.toolbarBottomColor)!)
+ }
+ self.toolbarBottom.isTranslucent = (browserOptions?.toolbarBottomTranslucent)!
+ }
+ else {
+ self.toolbarBottom.removeFromSuperview()
+ self.webView.bounds.size.height += self.toolbarBottom.bounds.height
+
+ if #available(iOS 9.0, *) {
+ let bottomConstraint = webView.bottomAnchor.constraint(equalTo: self.view.bottomAnchor)
+ NSLayoutConstraint.activate([bottomConstraint])
+ }
+ }
+
+ if browserOptions?.closeButtonCaption != "" {
+ closeButton.setTitle(browserOptions?.closeButtonCaption, for: .normal)
+ }
+ if browserOptions?.closeButtonColor != "" {
+ closeButton.tintColor = color(fromHexString: (browserOptions?.closeButtonColor)!)
+ }
+
+ self.modalPresentationStyle = UIModalPresentationStyle(rawValue: (browserOptions?.presentationStyle)!)!
+ self.modalTransitionStyle = UIModalTransitionStyle(rawValue: (browserOptions?.transitionStyle)!)!
+
+ // prevent webView from bouncing
+ if (browserOptions?.disallowOverScroll)! {
+ if self.webView.responds(to: #selector(getter: self.webView.scrollView)) {
+ self.webView.scrollView.bounces = false
+ }
+ else {
+ for subview: UIView in self.webView.subviews {
+ if subview is UIScrollView {
+ (subview as! UIScrollView).bounces = false
+ }
+ }
+ }
+ }
+
+ let wkUController = WKUserContentController()
+ self.webView.configuration.userContentController = wkUController
+
+ if (browserOptions?.enableViewportScale)! {
+ let jscript = "var meta = document.createElement('meta'); meta.setAttribute('name', 'viewport'); meta.setAttribute('content', 'width=device-width'); document.getElementsByTagName('head')[0].appendChild(meta);"
+ let userScript = WKUserScript(source: jscript, injectionTime: .atDocumentEnd, forMainFrameOnly: true)
+ self.webView.configuration.userContentController.addUserScript(userScript)
+ }
+
+ // Prevents long press on links that cause WKWebView exit
+ let jscriptWebkitTouchCallout = WKUserScript(source: "document.body.style.webkitTouchCallout='none';", injectionTime: .atDocumentEnd, forMainFrameOnly: true)
+ self.webView.configuration.userContentController.addUserScript(jscriptWebkitTouchCallout)
+
+ if (browserOptions?.mediaPlaybackRequiresUserAction)! {
+ if #available(iOS 10.0, *) {
+ self.webView.configuration.mediaTypesRequiringUserActionForPlayback = .all
+ } else {
+ // Fallback on earlier versions
+ }
+ }
+
+ self.webView.configuration.allowsInlineMediaPlayback = (browserOptions?.allowInlineMediaPlayback)!
+
+ self.webView.keyboardDisplayRequiresUserAction = browserOptions?.keyboardDisplayRequiresUserAction
+ self.webView.configuration.suppressesIncrementalRendering = (browserOptions?.suppressesIncrementalRendering)!
+ }
+
+ // Load user requested url
+ func textFieldShouldReturn(_ textField: UITextField) -> Bool {
+ textField.resignFirstResponder()
+ if textField.text != nil && textField.text != "" {
+ let url = textField.text?.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)
+ let request = URLRequest(url: URL(string: url!)!)
+ webView.load(request)
+ }
+ else {
+ updateUrlTextField(url: (currentURL?.absoluteString)!)
+ }
+ //var list : WKBackForwardList = self.webView.backForwardList
+ return false
+ }
+
+ // func createViews() {
+ // // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included
+ //// let screenSize: CGRect = view.bounds
+ //// let myView = UIView(frame: CGRect(x: 0, y: 0, width: screenSize.width, height: screenSize.height-44-CGFloat((browserOptions?.location)! ? FOOTER_HEIGHT : TOOLBAR_HEIGHT)))
+ ////
+ //
+ ////
+ //// let webViewFrame = CGRect(x: 0, y: urlField.frame.height, width: screenSize.width, height: screenSize.height-44-CGFloat((browserOptions?.location)! ? FOOTER_HEIGHT : TOOLBAR_HEIGHT))
+ ////
+ //// let webConfiguration = WKWebViewConfiguration()
+ //// webView = WKWebView(frame: webViewFrame, configuration: webConfiguration)
+ //// webView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+ //
+ // let toolbarIsAtBottom: Bool = browserOptions!.toolbarposition == kInAppBrowserToolbarBarPositionBottom
+ //
+ // var webViewBounds: CGRect = view.bounds
+ // webViewBounds.origin.y += (toolbarIsAtBottom) ? 0 : CGFloat(TOOLBAR_HEIGHT+getStatusBarOffset())
+ // webViewBounds.size.height -= (browserOptions?.location)! ? CGFloat(TOOLBAR_HEIGHT+getStatusBarOffset()) : 0
+ // let webConfiguration = WKWebViewConfiguration()
+ // webView = WKWebView(frame: webViewBounds, configuration: webConfiguration)
+ // webView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+ // view.addSubview(webView!)
+ // //view.sendSubview(toBack: webView!)
+ //
+ // webView?.uiDelegate = self
+ // webView?.navigationDelegate = self
+ // webView?.backgroundColor = UIColor.white
+ // webView?.clearsContextBeforeDrawing = true
+ // webView?.clipsToBounds = true
+ // webView?.contentMode = .scaleToFill
+ // webView?.isMultipleTouchEnabled = true
+ // webView?.isOpaque = true
+ // //webView?.scalesPageToFit = false
+ // webView?.isUserInteractionEnabled = true
+ //
+ // spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
+ // spinner.alpha = 1.000
+ // spinner.autoresizesSubviews = true
+ // spinner.autoresizingMask = [.flexibleLeftMargin, .flexibleTopMargin, .flexibleBottomMargin, .flexibleRightMargin]
+ // spinner.clearsContextBeforeDrawing = false
+ // spinner.clipsToBounds = false
+ // spinner.contentMode = .scaleToFill
+ // spinner.frame = CGRect(x: (webView?.frame.midX)!, y: (webView?.frame.midY)!, width: 20.0, height: 20.0)
+ // spinner.isHidden = false
+ // spinner.hidesWhenStopped = true
+ // spinner.isMultipleTouchEnabled = false
+ // spinner.isOpaque = false
+ // spinner.isUserInteractionEnabled = false
+ // spinner.stopAnimating()
+ //
+ // closeButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
+ // closeButton.isEnabled = true
+ // let flexibleSpaceButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
+ // let fixedSpaceButton = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
+ // fixedSpaceButton.width = 20
+ //
+ //
+ // let toolbarY: Float = toolbarIsAtBottom ? Float(view.bounds.size.height) - TOOLBAR_HEIGHT : 0.0
+ // let toolbarFrame = CGRect(x: 0.0, y: CGFloat(toolbarY), width: view.bounds.size.width, height: CGFloat(TOOLBAR_HEIGHT))
+ //
+ // toolbar = UIToolbar(frame: toolbarFrame)
+ // toolbar.alpha = 1.000
+ // toolbar.autoresizesSubviews = true
+ // toolbar.autoresizingMask = toolbarIsAtBottom ? ([.flexibleWidth, .flexibleTopMargin]) : .flexibleWidth
+ // toolbar.barStyle = .blackOpaque
+ // toolbar.clearsContextBeforeDrawing = false
+ // toolbar.clipsToBounds = false
+ // toolbar.contentMode = .scaleToFill
+ // toolbar.isHidden = false
+ // toolbar.isMultipleTouchEnabled = false
+ // toolbar.isOpaque = false
+ // toolbar.isUserInteractionEnabled = true
+ // if browserOptions?.toolbarcolor != nil {
+ // // Set toolbar color if user sets it in options
+ // toolbar.barTintColor = color(fromHexString: (browserOptions?.toolbarcolor)!)
+ // }
+ // if !(browserOptions?.toolbartranslucent)! {
+ // // Set toolbar translucent to no if user sets it in options
+ // toolbar.isTranslucent = false
+ // }
+ // let labelInset: CGFloat = 5.0
+ // let locationBarY: Float = toolbarIsAtBottom ? Float(view.bounds.size.height) - FOOTER_HEIGHT : Float(view.bounds.size.height) - LOCATIONBAR_HEIGHT
+ //
+ //
+ // let frontArrowString = NSLocalizedString("►", comment: "")
+ // // create arrow from Unicode char
+ // forwardButton = UIBarButtonItem(title: frontArrowString, style: .plain, target: self, action: #selector(self.goForward))
+ //
+ // //forwardButton = UIBarButtonItem(barButtonSystemItem: .fastForward, target: self, action: #selector(self.goForward))
+ // forwardButton.isEnabled = true
+ // forwardButton.imageInsets = UIEdgeInsets.zero as? UIEdgeInsets ?? UIEdgeInsets()
+ // if browserOptions?.navigationbuttoncolor != nil {
+ // // Set button color if user sets it in options
+ // forwardButton.tintColor = color(fromHexString: (browserOptions?.navigationbuttoncolor)!)
+ // }
+ //
+ // let backArrowString = NSLocalizedString("◄", comment: "")
+ // // create arrow from Unicode char
+ // backButton = UIBarButtonItem(title: backArrowString, style: .plain, target: self, action: #selector(self.goBack))
+ // backButton.isEnabled = true
+ // backButton.imageInsets = UIEdgeInsets.zero as? UIEdgeInsets ?? UIEdgeInsets()
+ // if browserOptions?.navigationbuttoncolor != nil {
+ // // Set button color if user sets it in options
+ // backButton.tintColor = color(fromHexString: (browserOptions?.navigationbuttoncolor)!)
+ // }
+ //
+ // reloadButton = UIBarButtonItem(barButtonSystemItem: .refresh, target: self, action: #selector(self.reload))
+ // reloadButton.isEnabled = true
+ // reloadButton.imageInsets = UIEdgeInsetsMake(0, 0, 0, 15)
+ //
+ // urlField = UITextField()
+ // urlField.bounds.size.width = toolbar.bounds.width - 150
+ // urlField.bounds.size.height = CGFloat(TOOLBAR_HEIGHT-15)
+ // urlField.backgroundColor = color(fromHexString: "#ECECED")
+ // urlField.center.y = toolbar.center.y
+ // urlField.autoresizesSubviews = true
+ // urlField.autoresizingMask = [.flexibleWidth, .flexibleHeight]
+ // urlField.text = currentURL?.absoluteString
+ // urlField.textAlignment = NSTextAlignment.center
+ // urlField.font = UIFont.systemFont(ofSize: 15)
+ // urlField.borderStyle = UITextBorderStyle.roundedRect
+ // urlField.autocorrectionType = UITextAutocorrectionType.no
+ // urlField.keyboardType = UIKeyboardType.default
+ // urlField.returnKeyType = UIReturnKeyType.done
+ // urlField.clearButtonMode = UITextFieldViewMode.whileEditing;
+ // urlField.contentVerticalAlignment = UIControlContentVerticalAlignment.center
+ // urlField.delegate = self
+ // urlFieldBarButton = UIBarButtonItem.init(customView: urlField)
+ //
+ // // Filter out Navigation Buttons if user requests so
+ // if (browserOptions?.hidenavigationbuttons)! {
+ // toolbar.items = [closeButton, flexibleSpaceButton, urlFieldBarButton]
+ // }
+ // else {
+ // //toolbar.items = [urlFieldBarButton, closeButton, flexibleSpaceButton, backButton, fixedSpaceButton, forwardButton]
+ // toolbar.items = [urlFieldBarButton, flexibleSpaceButton, reloadButton, closeButton]
+ // }
+ //
+ // view.backgroundColor = UIColor.gray
+ // view.addSubview(toolbar)
+ // view.addSubview(spinner)
+ // }
+
+ func setWebViewFrame(_ frame: CGRect) {
+ print("Setting the WebView's frame to \(NSStringFromCGRect(frame))")
+ webView.frame = frame
+ }
+
+ // func showToolBar(_ show: Bool, toolbarPosition: String) {
+ // var toolbarFrame: CGRect = toolbar.frame
+ // // prevent double show/hide
+ // if show == !toolbar.isHidden {
+ // return
+ // }
+ // if show {
+ // toolbar.isHidden = false
+ // var webViewBounds: CGRect = view.bounds
+ //
+ // webViewBounds.size.height -= CGFloat(TOOLBAR_HEIGHT)
+ // toolbar.frame = toolbarFrame
+ //
+ // if (toolbarPosition == kInAppBrowserToolbarBarPositionTop) {
+ // toolbarFrame.origin.y = 0
+ // webViewBounds.origin.y += toolbarFrame.size.height
+ // setWebViewFrame(webViewBounds)
+ // }
+ // else {
+ // toolbarFrame.origin.y = webViewBounds.size.height + CGFloat(LOCATIONBAR_HEIGHT)
+ // }
+ // setWebViewFrame(webViewBounds)
+ // }
+ // else {
+ // toolbar.isHidden = true
+ // setWebViewFrame(view.bounds)
+ // }
+ // }
+
+ // override func viewDidUnload() {
+ // webView?.loadHTMLString(nil, baseURL: nil)
+ // CDVUserAgentUtil.releaseLock(userAgentLockToken)
+ // super.viewDidUnload()
+ // }
+
+ @objc func reload () {
+ webView.reload()
+ }
+
+ @objc func share () {
+ let vc = UIActivityViewController(activityItems: [currentURL ?? ""], applicationActivities: [])
+ present(vc, animated: true, completion: nil)
+ }
+
+ @objc func close() {
+ currentURL = nil
+
+ if (navigationDelegate != nil) {
+ navigationDelegate?.browserExit()
+ }
+ // if (navigationDelegate != nil) && navigationDelegate?.responds(to: #selector(self.browserExit)) {
+ // navigationDelegate?.browserExit()
+ // }
+ weak var weakSelf = self
+
+ // Run later to avoid the "took a long time" log message.
+ DispatchQueue.main.async(execute: {() -> Void in
+ if (weakSelf?.responds(to: #selector(getter: self.presentingViewController)))! {
+ weakSelf?.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
+ self.tmpWindow?.windowLevel = 0.0
+ UIApplication.shared.delegate?.window??.makeKeyAndVisible()
+ })
+ }
+ else {
+ weakSelf?.parent?.dismiss(animated: true, completion: {() -> Void in
+ self.tmpWindow?.windowLevel = 0.0
+ UIApplication.shared.delegate?.window??.makeKeyAndVisible()
+ })
+ }
+ })
+ }
+
+ func navigate(to url: URL) {
+ let request = URLRequest(url: url)
+ currentURL = url
+ updateUrlTextField(url: (currentURL?.absoluteString)!)
+ webView.load(request)
+ }
+
+ @objc func goBack(_ sender: Any) {
+ webView.goBack()
+ updateUrlTextField(url: (webView?.url?.absoluteString)!)
+ }
+
+ @objc func goForward(_ sender: Any) {
+ webView.goForward()
+ updateUrlTextField(url: (webView?.url?.absoluteString)!)
+ }
+
+ func updateUrlTextField(url: String) {
+ urlField.text = url
+ }
+
+ //
+ // On iOS 7 the status bar is part of the view's dimensions, therefore it's height has to be taken into account.
+ // The height of it could be hardcoded as 20 pixels, but that would assume that the upcoming releases of iOS won't
+ // change that value.
+ //
+
+ func getStatusBarOffset() -> Float {
+ let statusBarFrame: CGRect = UIApplication.shared.statusBarFrame
+ let statusBarOffset: Float = Float(min(statusBarFrame.size.width, statusBarFrame.size.height))
+ return statusBarOffset
+ }
+
+ // func rePositionViews() {
+ // if (browserOptions?.toolbarposition == kInAppBrowserToolbarBarPositionTop) {
+ // webView?.frame = CGRect(x: (webView?.frame.origin.x)!, y: CGFloat(TOOLBAR_HEIGHT+getStatusBarOffset()), width: (webView?.frame.size.width)!, height: (webView?.frame.size.height)!)
+ // toolbar.frame = CGRect(x: toolbar.frame.origin.x, y: CGFloat(getStatusBarOffset()), width: toolbar.frame.size.width, height: toolbar.frame.size.height)
+ // }
+ // }
+
+ // Helper function to convert hex color string to UIColor
+ // Assumes input like "#00FF00" (#RRGGBB).
+ // Taken from https://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string
+
+ func color(fromHexString: String, alpha:CGFloat? = 1.0) -> UIColor {
+
+ // Convert hex string to an integer
+ let hexint = Int(self.intFromHexString(hexStr: fromHexString))
+ let red = CGFloat((hexint & 0xff0000) >> 16) / 255.0
+ let green = CGFloat((hexint & 0xff00) >> 8) / 255.0
+ let blue = CGFloat((hexint & 0xff) >> 0) / 255.0
+ let alpha = alpha!
+
+ // Create color object, specifying alpha as well
+ let color = UIColor(red: red, green: green, blue: blue, alpha: alpha)
+ return color
+ }
+
+ func intFromHexString(hexStr: String) -> UInt32 {
+ var hexInt: UInt32 = 0
+ // Create scanner
+ let scanner: Scanner = Scanner(string: hexStr)
+ // Tell scanner to skip the # character
+ scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
+ // Scan hex value
+ scanner.scanHexInt32(&hexInt)
+ return hexInt
+ }
+
+ func webView(_ webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
+ // loading url, start spinner, update back/forward
+ backButton.isEnabled = webView.canGoBack
+ forwardButton.isEnabled = webView.canGoForward
+
+ if (browserOptions?.spinner)! {
+ spinner.startAnimating()
+ }
+
+ return (navigationDelegate?.webViewDidStartLoad(webView))!
+ }
+
+ // func webView(_ theWebView: WKWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
+ // let isTopLevelNavigation: Bool? = request.url == request.mainDocumentURL
+ // if isTopLevelNavigation ?? false {
+ // currentURL = request.url
+ // }
+ //
+ // return (navigationDelegate?.webView(theWebView, shouldStartLoadWith: request, navigationType: navigationType))!
+ // }
+
+ func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
+ //func webViewDidFinishLoad(_ theWebView: WKWebView) {
+ // update url, stop spinner, update back/forward
+ currentURL = webView.url
+ updateUrlTextField(url: (currentURL?.absoluteString)!)
+ backButton.isEnabled = webView.canGoBack
+ forwardButton.isEnabled = webView.canGoForward
+ spinner.stopAnimating()
+ navigationDelegate?.webViewDidFinishLoad(webView)
+ }
+
+ func webView(_ webView: WKWebView, didFail navigation: WKNavigation!, withError error: Error) {
+ //func webView(_ theWebView: WKWebView, didFailLoadWithError error: Error) {
+ // log fail message, stop spinner, update back/forward
+ print("webView:didFailLoadWithError - \(Int(error._code)): \(error.localizedDescription)")
+ backButton.isEnabled = webView.canGoBack
+ forwardButton.isEnabled = webView.canGoForward
+ spinner.stopAnimating()
+ navigationDelegate?.webView(webView, didFailLoadWithError: error)
+ }
+}
diff --git a/ios/Classes/SwiftFlutterPlugin.swift b/ios/Classes/SwiftFlutterPlugin.swift
index 5ea1006e..6e26cb4c 100644
--- a/ios/Classes/SwiftFlutterPlugin.swift
+++ b/ios/Classes/SwiftFlutterPlugin.swift
@@ -21,101 +21,11 @@ import WebKit
import Foundation
import AVFoundation
-let kInAppBrowserTargetSelf = "_self"
-let kInAppBrowserTargetSystem = "_system"
-let kInAppBrowserTargetBlank = "_blank"
-let kInAppBrowserToolbarBarPositionBottom = "bottom"
-let kInAppBrowserToolbarBarPositionTop = "top"
-let TOOLBAR_HEIGHT: Float = 44.0
-let STATUSBAR_HEIGHT: Float = 20.0
-let LOCATIONBAR_HEIGHT: Float = 21.0
-let FOOTER_HEIGHT: Float = (TOOLBAR_HEIGHT + LOCATIONBAR_HEIGHT)
-
-@objcMembers
-class CDVInAppBrowserOptions: NSObject {
- var location = false
- var toolbar = false
- var closebuttoncaption = ""
- var closebuttoncolor = ""
- var toolbarposition = ""
- var toolbarcolor = ""
- var toolbartranslucent = false
- var hidenavigationbuttons = false
- var navigationbuttoncolor = ""
- var clearcache = false
- var clearsessioncache = false
- var hidespinner = false
- var presentationstyle = ""
- var transitionstyle = ""
- var enableviewportscale = false
- var mediaplaybackrequiresuseraction = false
- var allowinlinemediaplayback = false
- var keyboarddisplayrequiresuseraction = false
- var suppressesincrementalrendering = false
- var hidden = false
- var disallowoverscroll = false
-
- override init() {
- super.init()
-
- // default values
- location = true
- toolbar = true
- closebuttoncaption = "Done"
- closebuttoncolor = "#FFFFFF"
- toolbarposition = kInAppBrowserToolbarBarPositionBottom
- clearcache = false
- clearsessioncache = false
- hidespinner = false
- enableviewportscale = false
- mediaplaybackrequiresuseraction = false
- allowinlinemediaplayback = false
- keyboarddisplayrequiresuseraction = true
- suppressesincrementalrendering = false
- hidden = false
- disallowoverscroll = false
- hidenavigationbuttons = false
- toolbarcolor = ""
- toolbartranslucent = true
-
- }
-
- class func parseOptions(_ options: String) -> CDVInAppBrowserOptions {
- let obj = CDVInAppBrowserOptions()
- // NOTE: this parsing does not handle quotes within values
- let pairs = options.components(separatedBy: ",")
- // parse keys and values, set the properties
- for pair: String in pairs {
- let keyvalue = pair.components(separatedBy: "=")
- if keyvalue.count == 2 {
- let key: String = keyvalue[0].lowercased()
- let value: String = keyvalue[1]
- let value_lc: String = value.lowercased()
- let isBoolean: Bool = (value_lc == "yes") || (value_lc == "no")
- let numberFormatter = NumberFormatter()
- numberFormatter.allowsFloats = true
- let isNumber: Bool = numberFormatter.number(from: value_lc) != nil
- // set the property according to the key name
- if obj.responds(to: NSSelectorFromString(key)) {
- if isNumber {
- obj.setValue(numberFormatter.number(from: value_lc), forKey: key)
- }
- else if isBoolean {
- obj.setValue(((value_lc == "yes") ? 1 : 0), forKey: key)
- }
- else {
- obj.setValue(value, forKey: key)
- }
- }
- }
- }
- return obj
- }
-}
-
+let WEBVIEW_STORYBOARD = "WebView"
+let WEBVIEW_STORYBOARD_CONTROLLER_ID = "viewController"
public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
- var inAppBrowserViewController: CDVInAppBrowserViewController?
+ var webViewController: InAppBrowserWebViewController?
var tmpWindow: UIWindow?
var channel: FlutterMethodChannel
@@ -134,57 +44,49 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) {
let arguments = call.arguments as? NSDictionary
switch call.method {
- case "open":
- self.open(arguments: arguments!, result: result)
- break
- case "close":
- self.close()
- result(true)
- break
- case "show":
- self.show()
- result(true)
- break
- case "hide":
- self.hide()
- result(true)
- break
- case "injectScriptCode":
- self.injectScriptCode(arguments: arguments!)
- result(true)
- break
- case "injectScriptFile":
- self.injectScriptFile(arguments: arguments!)
- result(true)
- break
- case "injectStyleCode":
- self.injectStyleCode(arguments: arguments!)
- result(true)
- break
- case "injectStyleFile":
- self.injectStyleFile(arguments: arguments!)
- result(true)
- break
- default:
- break
+ case "open":
+ self.open(arguments: arguments!, result: result)
+ break
+ case "close":
+ self.close()
+ result(true)
+ break
+ case "show":
+ self.show()
+ result(true)
+ break
+ case "hide":
+ self.hide()
+ result(true)
+ break
+ case "injectScriptCode":
+ self.injectScriptCode(arguments: arguments!)
+ result(true)
+ break
+ case "injectScriptFile":
+ self.injectScriptFile(arguments: arguments!)
+ result(true)
+ break
+ case "injectStyleCode":
+ self.injectStyleCode(arguments: arguments!)
+ result(true)
+ break
+ case "injectStyleFile":
+ self.injectStyleFile(arguments: arguments!)
+ result(true)
+ break
+ default:
+ break
}
}
- func setting(forKey key: String) -> Any {
- return ""//commandDelegate.settings[key.lowercased()]!
- }
-
- func onReset() {
- close()
- }
-
func close() {
- if inAppBrowserViewController == nil {
+ if webViewController == nil {
print("IAB.close() called but it was already closed.")
return
}
// Things are cleaned up in browserExit.
- inAppBrowserViewController?.close()
+ webViewController?.close()
}
func isSystemUrl(_ url: URL) -> Bool {
@@ -197,25 +99,24 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
public func open(arguments: NSDictionary, result: @escaping FlutterResult) {
let url: String? = (arguments["url"] as? String)!
var target: String? = (arguments["target"] as? String)!
- target = target != nil ? target : kInAppBrowserTargetSelf
- let options = (arguments["options"] as? String)!
-
+ target = target != nil ? target : "_self"
+ let options = (arguments["options"] as? [String: Any])!
+
if url != nil {
- let baseUrl: URL? = nil
- let absoluteUrl = URL(string: url!, relativeTo: baseUrl)?.absoluteURL
+ let absoluteUrl = URL(string: url!)?.absoluteURL
if isSystemUrl(absoluteUrl!) {
- target = kInAppBrowserTargetSystem
+ target = "_system"
}
- if (target == kInAppBrowserTargetSelf) {
- open(inCordovaWebView: absoluteUrl!, withOptions: options)
+ if (target == "_self" || target == "_target") {
+ openIn(inAppBrowser: absoluteUrl!, withOptions: options)
}
- else if (target == kInAppBrowserTargetSystem) {
+ else if (target == "_system") {
open(inSystem: absoluteUrl!)
}
else {
- // _blank or anything else
+ // anything else
openIn(inAppBrowser: absoluteUrl!, withOptions: options)
}
}
@@ -225,10 +126,12 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
result(true)
}
- func openIn(inAppBrowser url: URL, withOptions options: String) {
- let browserOptions = CDVInAppBrowserOptions.parseOptions(options)
+ func openIn(inAppBrowser url: URL, withOptions options: [String: Any]) {
+
+ let browserOptions = InAppBrowserOptions()
+ browserOptions.parse(options: options)
- if browserOptions.clearcache {
+ if browserOptions.clearCache {
let _: HTTPCookie?
let storage = HTTPCookieStorage.shared
for cookie in storage.cookies! {
@@ -238,8 +141,7 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
}
}
- if browserOptions.clearsessioncache {
- let _: HTTPCookie?
+ if browserOptions.clearSessionCache {
let storage = HTTPCookieStorage.shared
for cookie in storage.cookies! {
if !(cookie.domain.isEqual(".^filecookies^") && cookie.isSessionOnly) {
@@ -248,88 +150,29 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
}
}
- if inAppBrowserViewController == nil {
- var userAgent: String = UIWebView().stringByEvaluatingJavaScript(from: "navigator.userAgent")!
+ if webViewController == nil {
- let overrideUserAgent: String = ""
- let appendUserAgent: String = ""
- if overrideUserAgent != "" {
- userAgent = overrideUserAgent
- }
- if appendUserAgent != "" {
- userAgent = userAgent + (appendUserAgent)
- }
if !(self.tmpWindow != nil) {
let frame: CGRect = UIScreen.main.bounds
self.tmpWindow = UIWindow(frame: frame)
}
- inAppBrowserViewController = CDVInAppBrowserViewController(userAgent: userAgent, prevUserAgent: userAgent, browserOptions: browserOptions, tmpWindow: tmpWindow)
- inAppBrowserViewController?.navigationDelegate = self
+
+ let storyboard = UIStoryboard(name: WEBVIEW_STORYBOARD, bundle: nil)
+ let vc = storyboard.instantiateViewController(withIdentifier: WEBVIEW_STORYBOARD_CONTROLLER_ID)
+ webViewController = vc as? InAppBrowserWebViewController
+ webViewController?.browserOptions = browserOptions
+ webViewController?.tmpWindow = tmpWindow
+ webViewController?.currentURL = url
+ webViewController?.navigationDelegate = self
}
- inAppBrowserViewController?.showLocationBar(browserOptions.location)
- inAppBrowserViewController?.showToolBar(browserOptions.toolbar, toolbarPosition: browserOptions.toolbarposition)
- if browserOptions.closebuttoncaption != nil || browserOptions.closebuttoncolor != nil {
- inAppBrowserViewController?.setCloseButtonTitle(browserOptions.closebuttoncaption, colorString: browserOptions.closebuttoncolor)
- }
-
- // Set Presentation Style
- var presentationStyle: UIModalPresentationStyle = .fullScreen
- // default
- if browserOptions.presentationstyle != nil {
- if (browserOptions.presentationstyle.lowercased() == "pagesheet") {
- presentationStyle = .pageSheet
- }
- else if (browserOptions.presentationstyle.lowercased() == "formsheet") {
- presentationStyle = .formSheet
- }
- }
- inAppBrowserViewController?.modalPresentationStyle = presentationStyle
-
- // Set Transition Style
- var transitionStyle: UIModalTransitionStyle = .coverVertical
- // default
- if browserOptions.transitionstyle != nil {
- if (browserOptions.transitionstyle.lowercased() == "fliphorizontal") {
- transitionStyle = .flipHorizontal
- }
- else if (browserOptions.transitionstyle.lowercased() == "crossdissolve") {
- transitionStyle = .crossDissolve
- }
- }
- inAppBrowserViewController?.modalTransitionStyle = transitionStyle
-
- // prevent webView from bouncing
- if browserOptions.disallowoverscroll {
- if inAppBrowserViewController?.webView?.responds(to: #selector(getter: inAppBrowserViewController?.webView?.scrollView)) ?? false {
- (inAppBrowserViewController?.webView?.scrollView)?.bounces = false
- }
- else {
- for subview: UIView in (inAppBrowserViewController?.webView?.subviews)! {
- if subview is UIScrollView {
- (subview as? UIScrollView)?.bounces = false
- }
- }
- }
- }
-
- // UIWebView options
- inAppBrowserViewController?.webView?.scalesPageToFit = browserOptions.enableviewportscale
- inAppBrowserViewController?.webView?.mediaPlaybackRequiresUserAction = browserOptions.mediaplaybackrequiresuseraction
- inAppBrowserViewController?.webView?.allowsInlineMediaPlayback = browserOptions.allowinlinemediaplayback
- //if IsAtLeastiOSVersion("6.0") {
- inAppBrowserViewController?.webView?.keyboardDisplayRequiresUserAction = browserOptions.keyboarddisplayrequiresuseraction
- inAppBrowserViewController?.webView?.suppressesIncrementalRendering = browserOptions.suppressesincrementalrendering
- //}
-
- inAppBrowserViewController?.navigate(to: url)
if !browserOptions.hidden {
show()
}
}
public func show() {
- if inAppBrowserViewController == nil {
+ if webViewController == nil {
print("Tried to show IAB after it was closed.")
return
}
@@ -338,17 +181,11 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
return
}
- previousStatusBarStyle = UIApplication.shared.statusBarStyle.rawValue
- let nav = CDVInAppBrowserNavigationController(rootViewController: inAppBrowserViewController!)
- nav.orientationDelegate = inAppBrowserViewController
- nav.isNavigationBarHidden = true
- nav.modalPresentationStyle = (inAppBrowserViewController?.modalPresentationStyle)!
-
weak var weakSelf: SwiftFlutterPlugin? = self
// Run later to avoid the "took a long time" log message.
DispatchQueue.main.async(execute: {() -> Void in
- if weakSelf?.inAppBrowserViewController != nil {
+ if weakSelf?.webViewController != nil {
if !(self.tmpWindow != nil) {
let frame: CGRect = UIScreen.main.bounds
self.tmpWindow = UIWindow(frame: frame)
@@ -358,13 +195,14 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
self.tmpWindow?.rootViewController = tmpController
self.tmpWindow?.windowLevel = UIWindowLevel(baseWindowLevel! + 1)
self.tmpWindow?.makeKeyAndVisible()
- tmpController.present(nav, animated: true) { () -> Void in }
+
+ tmpController.present(self.webViewController!, animated: true, completion: nil)
}
})
}
public func hide() {
- if inAppBrowserViewController == nil {
+ if webViewController == nil {
print("Tried to hide IAB after it was closed.")
return
}
@@ -372,12 +210,13 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
print("Tried to hide IAB while already hidden")
return
}
+
previousStatusBarStyle = UIApplication.shared.statusBarStyle.rawValue
// Run later to avoid the "took a long time" log message.
DispatchQueue.main.async(execute: {() -> Void in
- if self.inAppBrowserViewController != nil {
+ if self.webViewController != nil {
self.previousStatusBarStyle = -1
- self.inAppBrowserViewController?.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
+ self.webViewController?.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
self.tmpWindow?.windowLevel = 0.0
UIApplication.shared.delegate?.window??.makeKeyAndVisible()
})
@@ -385,11 +224,6 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
})
}
- func open(inCordovaWebView url: URL, withOptions options: String) {
- _ = URLRequest(url: url)
- openIn(inAppBrowser: url, withOptions: options)
- }
-
func open(inSystem url: URL) {
if UIApplication.shared.openURL(url) == false {
NotificationCenter.default.post(Notification(name: Notification.Name(rawValue: "CDVPluginHandleOpenURLNotification"), object: url))
@@ -411,11 +245,11 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
if sourceArrayString != nil {
let sourceString: String? = (sourceArrayString! as NSString).substring(with: NSRange(location: 1, length: (sourceArrayString?.characters.count ?? 0) - 2))
let jsToInject = String(format: jsWrapper, sourceString!)
- inAppBrowserViewController?.webView?.stringByEvaluatingJavaScript(from: jsToInject)
+ webViewController?.webView?.evaluateJavaScript(jsToInject)
}
}
else {
- inAppBrowserViewController?.webView?.stringByEvaluatingJavaScript(from: source)
+ webViewController?.webView?.evaluateJavaScript(source)
}
}
@@ -439,18 +273,18 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
injectDeferredObject(arguments["urlFile"] as! String, withWrapper: jsWrapper)
}
- func webViewDidStartLoad(_ webView: UIWebView) {
- let url: String = inAppBrowserViewController!.currentURL!.absoluteString
+ func webViewDidStartLoad(_ webView: WKWebView) {
+ let url: String = webViewController!.currentURL!.absoluteString
channel.invokeMethod("loadstart", arguments: ["type": "loadstart", "url": url])
}
- func webViewDidFinishLoad(_ webView: UIWebView) {
- let url: String = inAppBrowserViewController!.currentURL!.absoluteString
+ func webViewDidFinishLoad(_ webView: WKWebView) {
+ let url: String = webViewController!.currentURL!.absoluteString
channel.invokeMethod("loadstop", arguments: ["type": "loadstop", "url": url])
}
- func webView(_ webView: UIWebView, didFailLoadWithError error: Error) {
- let url: String = inAppBrowserViewController!.currentURL!.absoluteString
+ func webView(_ webView: WKWebView, didFailLoadWithError error: Error) {
+ let url: String = webViewController!.currentURL!.absoluteString
let arguments = ["type": "loaderror", "url": url, "code": error._code, "message": error.localizedDescription] as [String : Any]
channel.invokeMethod("loaderror", arguments: arguments)
}
@@ -458,577 +292,19 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
func browserExit() {
channel.invokeMethod("exit", arguments: ["type": "exit"])
-
+
// Set navigationDelegate to nil to ensure no callbacks are received from it.
- inAppBrowserViewController?.navigationDelegate = nil
+ webViewController?.navigationDelegate = nil
// Don't recycle the ViewController since it may be consuming a lot of memory.
// Also - this is required for the PDF/User-Agent bug work-around.
- inAppBrowserViewController = nil
+ webViewController = nil
- //if (IsAtLeastiOSVersion(@"7.0")) {
- if previousStatusBarStyle != -1 {
- UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue: previousStatusBarStyle)!
- }
- //}
+ if previousStatusBarStyle != -1 {
+ UIApplication.shared.statusBarStyle = UIStatusBarStyle(rawValue: previousStatusBarStyle)!
+ }
previousStatusBarStyle = -1
// this value was reset before reapplying it. caused statusbar to stay black on ios7
}
-
-}
-
-class CDVInAppBrowserViewController: UIViewController, UIWebViewDelegate {
- @IBOutlet var webView: UIWebView!
- @IBOutlet var closeButton: UIBarButtonItem!
- @IBOutlet var addressLabel: UILabel!
- @IBOutlet var backButton: UIBarButtonItem!
- @IBOutlet var forwardButton: UIBarButtonItem!
- @IBOutlet var spinner: UIActivityIndicatorView!
- @IBOutlet var toolbar: UIToolbar!
- weak var orientationDelegate: CDVInAppBrowserViewController?
- weak var navigationDelegate: SwiftFlutterPlugin?
- var currentURL: URL?
- var tmpWindow: UIWindow?
-
- private var userAgent = ""
- private var prevUserAgent = ""
- private var userAgentLockToken: Int = 0
- private var browserOptions: CDVInAppBrowserOptions?
-
- init(userAgent: String, prevUserAgent: String, browserOptions: CDVInAppBrowserOptions, tmpWindow: UIWindow?) {
-
- super.init(nibName: nil, bundle: nil)
-
- self.userAgent = userAgent
- self.prevUserAgent = prevUserAgent
- self.browserOptions = browserOptions
- self.tmpWindow = tmpWindow
- createViews()
-
- }
-
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
-
- // Prevent crashes on closing windows
- deinit {
- webView?.delegate = nil
- }
-
- func createViews() {
- // We create the views in code for primarily for ease of upgrades and not requiring an external .xib to be included
- var webViewBounds: CGRect = view.bounds
- let toolbarIsAtBottom: Bool = !(browserOptions!.toolbarposition == kInAppBrowserToolbarBarPositionTop)
- webViewBounds.size.height -= CGFloat((browserOptions?.location)! ? FOOTER_HEIGHT : TOOLBAR_HEIGHT)
- webView = UIWebView(frame: webViewBounds)// as WKWebView
- webView?.autoresizingMask = [.flexibleWidth, .flexibleHeight]
-
- view.addSubview(webView!)
- view.sendSubview(toBack: webView!)
- webView?.delegate = self
- webView?.backgroundColor = UIColor.white
- webView?.clearsContextBeforeDrawing = true
- webView?.clipsToBounds = true
- webView?.contentMode = .scaleToFill
- webView?.isMultipleTouchEnabled = true
- webView?.isOpaque = true
- webView?.scalesPageToFit = false
- webView?.isUserInteractionEnabled = true
-
- spinner = UIActivityIndicatorView(activityIndicatorStyle: .gray)
- spinner.alpha = 1.000
- spinner.autoresizesSubviews = true
- spinner.autoresizingMask = [.flexibleLeftMargin, .flexibleTopMargin, .flexibleBottomMargin, .flexibleRightMargin]
- spinner.clearsContextBeforeDrawing = false
- spinner.clipsToBounds = false
- spinner.contentMode = .scaleToFill
- spinner.frame = CGRect(x: (webView?.frame.midX)!, y: (webView?.frame.midY)!, width: 20.0, height: 20.0)
- spinner.isHidden = false
- spinner.hidesWhenStopped = true
- spinner.isMultipleTouchEnabled = false
- spinner.isOpaque = false
- spinner.isUserInteractionEnabled = false
- spinner.stopAnimating()
-
- closeButton = UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
- closeButton.isEnabled = true
- let flexibleSpaceButton = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: nil, action: nil)
- let fixedSpaceButton = UIBarButtonItem(barButtonSystemItem: .fixedSpace, target: nil, action: nil)
- fixedSpaceButton.width = 20
- let toolbarY: Float = toolbarIsAtBottom ? Float(view.bounds.size.height) - TOOLBAR_HEIGHT : 0.0
- let toolbarFrame = CGRect(x: 0.0, y: CGFloat(toolbarY), width: view.bounds.size.width, height: CGFloat(TOOLBAR_HEIGHT))
-
- toolbar = UIToolbar(frame: toolbarFrame)
- toolbar.alpha = 1.000
- toolbar.autoresizesSubviews = true
- toolbar.autoresizingMask = toolbarIsAtBottom ? ([.flexibleWidth, .flexibleTopMargin]) : .flexibleWidth
- toolbar.barStyle = .blackOpaque
- toolbar.clearsContextBeforeDrawing = false
- toolbar.clipsToBounds = false
- toolbar.contentMode = .scaleToFill
- toolbar.isHidden = false
- toolbar.isMultipleTouchEnabled = false
- toolbar.isOpaque = false
- toolbar.isUserInteractionEnabled = true
- if browserOptions?.toolbarcolor != nil {
- // Set toolbar color if user sets it in options
- toolbar.barTintColor = color(fromHexString: (browserOptions?.toolbarcolor)!)
- }
- if !(browserOptions?.toolbartranslucent)! {
- // Set toolbar translucent to no if user sets it in options
- toolbar.isTranslucent = false
- }
- let labelInset: CGFloat = 5.0
- let locationBarY: Float = toolbarIsAtBottom ? Float(view.bounds.size.height) - FOOTER_HEIGHT : Float(view.bounds.size.height) - LOCATIONBAR_HEIGHT
-
- addressLabel = UILabel(frame: CGRect(x: labelInset, y: CGFloat(locationBarY), width: view.bounds.size.width - labelInset, height: CGFloat(LOCATIONBAR_HEIGHT)))
- addressLabel.adjustsFontSizeToFitWidth = false
- addressLabel.alpha = 1.000
- addressLabel.autoresizesSubviews = true
- addressLabel.autoresizingMask = [.flexibleWidth, .flexibleRightMargin, .flexibleTopMargin]
- addressLabel.backgroundColor = UIColor.clear// as? CGColor
- addressLabel.baselineAdjustment = .alignCenters
- addressLabel.clearsContextBeforeDrawing = true
- addressLabel.clipsToBounds = true
- addressLabel.contentMode = .scaleToFill
- addressLabel.isEnabled = true
- addressLabel.isHidden = false
- addressLabel.lineBreakMode = .byTruncatingTail
-
- if addressLabel.responds(to: NSSelectorFromString("setMinimumScaleFactor:")) {
- addressLabel.setValue((10.0 / UIFont.labelFontSize), forKey: "minimumScaleFactor")
- }
- else if addressLabel.responds(to: NSSelectorFromString("setMinimumFontSize:")) {
- addressLabel.setValue(10.0, forKey: "minimumFontSize")
- }
-
- addressLabel.isMultipleTouchEnabled = false
- addressLabel.numberOfLines = 1
- addressLabel.isOpaque = false
- addressLabel.shadowOffset = CGSize(width: 0.0, height: -1.0)
- addressLabel.text = NSLocalizedString("Loading...", comment: "")
- addressLabel.textAlignment = .left
- addressLabel.textColor = UIColor(white: 1.000, alpha: 1.000)
- addressLabel.isUserInteractionEnabled = false
-
- let frontArrowString = NSLocalizedString("►", comment: "")
- // create arrow from Unicode char
- forwardButton = UIBarButtonItem(title: frontArrowString, style: .plain, target: self, action: #selector(self.goForward))
- forwardButton.isEnabled = true
- forwardButton.imageInsets = UIEdgeInsets.zero as? UIEdgeInsets ?? UIEdgeInsets()
- if browserOptions?.navigationbuttoncolor != nil {
- // Set button color if user sets it in options
- forwardButton.tintColor = color(fromHexString: (browserOptions?.navigationbuttoncolor)!)
- }
-
- let backArrowString = NSLocalizedString("◄", comment: "")
- // create arrow from Unicode char
- backButton = UIBarButtonItem(title: backArrowString, style: .plain, target: self, action: #selector(self.goBack))
- backButton.isEnabled = true
- backButton.imageInsets = UIEdgeInsets.zero as? UIEdgeInsets ?? UIEdgeInsets()
- if browserOptions?.navigationbuttoncolor != nil {
- // Set button color if user sets it in options
- backButton.tintColor = color(fromHexString: (browserOptions?.navigationbuttoncolor)!)
- }
-
- // Filter out Navigation Buttons if user requests so
- if (browserOptions?.hidenavigationbuttons)! {
- toolbar.items = [closeButton, flexibleSpaceButton]
- }
- else {
- toolbar.items = [closeButton, flexibleSpaceButton, backButton, fixedSpaceButton, forwardButton]
- }
- view.backgroundColor = UIColor.gray// as? CGColor
- view.addSubview(toolbar)
- view.addSubview(addressLabel)
- view.addSubview(spinner)
- }
-
- func setWebViewFrame(_ frame: CGRect) {
- print("Setting the WebView's frame to \(NSStringFromCGRect(frame))")
- webView?.frame = frame
- }
-
- func setCloseButtonTitle(_ title: String, colorString: String) {
- // the advantage of using UIBarButtonSystemItemDone is the system will localize it for you automatically
- // but, if you want to set this yourself, knock yourself out (we can't set the title for a system Done button, so we have to create a new one)
- closeButton = nil
- // Initialize with title if title is set, otherwise the title will be 'Done' localized
- closeButton = title != nil ? UIBarButtonItem(title: title, style: .bordered, target: self, action: #selector(self.close)) : UIBarButtonItem(barButtonSystemItem: .done, target: self, action: #selector(self.close))
- closeButton.isEnabled = true
- // If color on closebutton is requested then initialize with that that color, otherwise use initialize with default
- closeButton.tintColor = colorString != nil ? color(fromHexString: colorString) : UIColor(red: 60.0 / 255.0, green: 136.0 / 255.0, blue: 230.0 / 255.0, alpha: 1)
-
- var items = toolbar.items
- items![0] = closeButton
- toolbar.items = items //as? [AVMetadataItem] ?? [AVMetadataItem]()
- }
-
- func showLocationBar(_ show: Bool) {
- var locationbarFrame: CGRect = addressLabel.frame
- let toolbarVisible: Bool = !toolbar.isHidden
- // prevent double show/hide
- if show == !addressLabel.isHidden {
- return
- }
-
- if show {
- addressLabel.isHidden = false
- if toolbarVisible {
- // toolBar at the bottom, leave as is
- // put locationBar on top of the toolBar
- var webViewBounds: CGRect = view.bounds
- webViewBounds.size.height -= CGFloat(FOOTER_HEIGHT)
- setWebViewFrame(webViewBounds)
- locationbarFrame.origin.y = webViewBounds.size.height
- addressLabel.frame = locationbarFrame
- }
- else {
- // no toolBar, so put locationBar at the bottom
- var webViewBounds: CGRect = view.bounds
- webViewBounds.size.height -= CGFloat(LOCATIONBAR_HEIGHT)
- setWebViewFrame(webViewBounds)
- locationbarFrame.origin.y = webViewBounds.size.height
- addressLabel.frame = locationbarFrame
- }
- }
- else {
- addressLabel.isHidden = true
- if toolbarVisible {
- // locationBar is on top of toolBar, hide locationBar
- // webView take up whole height less toolBar height
- var webViewBounds: CGRect = view.bounds
- webViewBounds.size.height -= CGFloat(TOOLBAR_HEIGHT)
- setWebViewFrame(webViewBounds)
- }
- else {
- // no toolBar, expand webView to screen dimensions
- setWebViewFrame(view.bounds)
- }
- }
- }
-
- func showToolBar(_ show: Bool, toolbarPosition: String) {
- var toolbarFrame: CGRect = toolbar.frame
- var locationbarFrame: CGRect = addressLabel.frame
- let locationbarVisible: Bool = !addressLabel.isHidden
- // prevent double show/hide
- if show == !toolbar.isHidden {
- return
- }
- if show {
- toolbar.isHidden = false
- var webViewBounds: CGRect = view.bounds
-
- if locationbarVisible {
- // locationBar at the bottom, move locationBar up
- // put toolBar at the bottom
- webViewBounds.size.height -= CGFloat(FOOTER_HEIGHT)
- locationbarFrame.origin.y = webViewBounds.size.height
- addressLabel.frame = locationbarFrame
- toolbar.frame = toolbarFrame
- }
- else {
- // no locationBar, so put toolBar at the bottom
- var webViewBounds: CGRect = view.bounds
- webViewBounds.size.height -= CGFloat(TOOLBAR_HEIGHT)
- toolbar.frame = toolbarFrame
- }
-
- if (toolbarPosition == kInAppBrowserToolbarBarPositionTop) {
- toolbarFrame.origin.y = 0
- webViewBounds.origin.y += toolbarFrame.size.height
- setWebViewFrame(webViewBounds)
- }
- else {
- toolbarFrame.origin.y = webViewBounds.size.height + CGFloat(LOCATIONBAR_HEIGHT)
- }
- setWebViewFrame(webViewBounds)
- }
- else {
- toolbar.isHidden = true
- if locationbarVisible {
- // locationBar is on top of toolBar, hide toolBar
- // put locationBar at the bottom
- // webView take up whole height less locationBar height
- var webViewBounds: CGRect = view.bounds
- webViewBounds.size.height -= CGFloat(LOCATIONBAR_HEIGHT)
- setWebViewFrame(webViewBounds)
- // move locationBar down
- locationbarFrame.origin.y = webViewBounds.size.height
- addressLabel.frame = locationbarFrame
- }
- else {
- // no locationBar, expand webView to screen dimensions
- setWebViewFrame(view.bounds)
- }
- }
- }
-
- override func viewDidLoad() {
- super.viewDidLoad()
- }
-
-// override func viewDidUnload() {
-// webView?.loadHTMLString(nil, baseURL: nil)
-// CDVUserAgentUtil.releaseLock(userAgentLockToken)
-// super.viewDidUnload()
-// }
-
-// func preferredStatusBarStyle() -> UIStatusBarStyle {
-// return .default
-// }
-//
-// func prefersStatusBarHidden() -> Bool {
-// return false
-// }
-
- @objc func close() {
- currentURL = nil
- if (navigationDelegate != nil) {
- navigationDelegate?.browserExit()
- }
-// if (navigationDelegate != nil) && navigationDelegate?.responds(to: #selector(self.browserExit)) {
-// navigationDelegate?.browserExit()
-// }
- weak var weakSelf = self// as? UIViewController
- // Run later to avoid the "took a long time" log message.
-
- DispatchQueue.main.async(execute: {() -> Void in
- if (weakSelf?.responds(to: #selector(getter: self.presentingViewController)))! {
- weakSelf?.presentingViewController?.dismiss(animated: true, completion: {() -> Void in
- self.tmpWindow?.windowLevel = 0.0
- UIApplication.shared.delegate?.window??.makeKeyAndVisible()
- })
- }
- else {
- weakSelf?.parent?.dismiss(animated: true, completion: {() -> Void in
- self.tmpWindow?.windowLevel = 0.0
- UIApplication.shared.delegate?.window??.makeKeyAndVisible()
- })
- }
- })
- }
-
- func navigate(to url: URL) {
- let request = URLRequest(url: url)
- currentURL = url
- webView?.loadRequest(request)
-// if userAgentLockToken != 0 {
-// webView?.load(request, mimeType: <#String#>, textEncodingName: <#String#>, baseURL: <#URL#>)
-// }
-// else {
-// weak var weakSelf: CDVInAppBrowserViewController? = self
-// CDVUserAgentUtil.acquireLock({(_ lockToken: Int) -> Void in
-// userAgentLockToken = lockToken
-// CDVUserAgentUtil.setUserAgent(userAgent, lockToken: lockToken)
-// weakSelf?.webView?.load(request)
-// })
-// }
- }
-
- @objc func goBack(_ sender: Any) {
- webView?.goBack()
- }
-
- @objc func goForward(_ sender: Any) {
- webView?.goForward()
- }
-
- override func viewWillAppear(_ animated: Bool) {
- //if IsAtLeastiOSVersion("7.0") {
- UIApplication.shared.statusBarStyle = preferredStatusBarStyle
- //}
- rePositionViews()
- super.viewWillAppear(animated)
- }
-
- //
- // On iOS 7 the status bar is part of the view's dimensions, therefore it's height has to be taken into account.
- // The height of it could be hardcoded as 20 pixels, but that would assume that the upcoming releases of iOS won't
- // change that value.
- //
-
- func getStatusBarOffset() -> Float {
- let statusBarFrame: CGRect = UIApplication.shared.statusBarFrame
- let statusBarOffset: Float = Float(min(statusBarFrame.size.width, statusBarFrame.size.height))//IsAtLeastiOSVersion("7.0") ? min(statusBarFrame.size.width, statusBarFrame.size.height) : 0.0
- return statusBarOffset
- }
-
- func rePositionViews() {
- if (browserOptions?.toolbarposition == kInAppBrowserToolbarBarPositionTop) {
- webView?.frame = CGRect(x: (webView?.frame.origin.x)!, y: CGFloat(TOOLBAR_HEIGHT), width: (webView?.frame.size.width)!, height: (webView?.frame.size.height)!)
- toolbar.frame = CGRect(x: toolbar.frame.origin.x, y: CGFloat(getStatusBarOffset()), width: toolbar.frame.size.width, height: toolbar.frame.size.height)
- }
- }
-
- // Helper function to convert hex color string to UIColor
- // Assumes input like "#00FF00" (#RRGGBB).
- // Taken from https://stackoverflow.com/questions/1560081/how-can-i-create-a-uicolor-from-a-hex-string
-
- func color(fromHexString: String, alpha:CGFloat? = 1.0) -> UIColor {
-
- // Convert hex string to an integer
- let hexint = Int(self.intFromHexString(hexStr: fromHexString))
- let red = CGFloat((hexint & 0xff0000) >> 16) / 255.0
- let green = CGFloat((hexint & 0xff00) >> 8) / 255.0
- let blue = CGFloat((hexint & 0xff) >> 0) / 255.0
- let alpha = alpha!
-
- // Create color object, specifying alpha as well
- let color = UIColor(red: red, green: green, blue: blue, alpha: alpha)
- return color
- }
-
- func intFromHexString(hexStr: String) -> UInt32 {
- var hexInt: UInt32 = 0
- // Create scanner
- let scanner: Scanner = Scanner(string: hexStr)
- // Tell scanner to skip the # character
- scanner.charactersToBeSkipped = CharacterSet(charactersIn: "#")
- // Scan hex value
- scanner.scanHexInt32(&hexInt)
- return hexInt
- }
-
- // MARK: UIWebViewDelegate
-
- func webViewDidStartLoad(_ theWebView: UIWebView) {
- // loading url, start spinner, update back/forward
- addressLabel.text = NSLocalizedString("Loading...", comment: "")
- backButton.isEnabled = theWebView.canGoBack
- forwardButton.isEnabled = theWebView.canGoForward
- print((browserOptions?.hidespinner)! ? "Yes" : "No")
- if !(browserOptions?.hidespinner)! {
- spinner.startAnimating()
- }
- return (navigationDelegate?.webViewDidStartLoad(theWebView))!
- }
-
-// func webView(_ theWebView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
-// let isTopLevelNavigation: Bool? = request.url == request.mainDocumentURL
-// if isTopLevelNavigation ?? false {
-// currentURL = request.url
-// }
-//
-// return (navigationDelegate?.webView(theWebView, shouldStartLoadWith: request, navigationType: navigationType))!
-// }
-
- func webViewDidFinishLoad(_ theWebView: UIWebView) {
- // update url, stop spinner, update back/forward
- currentURL = theWebView.request?.url
- addressLabel.text = currentURL?.absoluteString
- backButton.isEnabled = theWebView.canGoBack
- forwardButton.isEnabled = theWebView.canGoForward
- spinner.stopAnimating()
-
- // Work around a bug where the first time a PDF is opened, all UIWebViews
- // reload their User-Agent from NSUserDefaults.
- // This work-around makes the following assumptions:
- // 1. The app has only a single Cordova Webview. If not, then the app should
- // take it upon themselves to load a PDF in the background as a part of
- // their start-up flow.
- // 2. That the PDF does not require any additional network requests. We change
- // the user-agent here back to that of the CDVViewController, so requests
- // from it must pass through its white-list. This *does* break PDFs that
- // contain links to other remote PDF/websites.
- // More info at https://issues.apache.org/jira/browse/CB-2225
- let isPDF: Bool = "true" == theWebView.stringByEvaluatingJavaScript(from: "document.body==null")
- if isPDF {
- //CDVUserAgentUtil.setUserAgent(prevUserAgent, lockToken: userAgentLockToken)
- }
- navigationDelegate?.webViewDidFinishLoad(theWebView)
- }
-
- func webView(_ theWebView: UIWebView, didFailLoadWithError error: Error) {
- // log fail message, stop spinner, update back/forward
- print("webView:didFailLoadWithError - \(Int(error._code)): \(error.localizedDescription)")
- backButton.isEnabled = theWebView.canGoBack
- forwardButton.isEnabled = theWebView.canGoForward
- spinner.stopAnimating()
- addressLabel.text = NSLocalizedString("Load Error", comment: "")
- navigationDelegate?.webView(theWebView, didFailLoadWithError: error)
- }
-
- // MARK: CDVScreenOrientationDelegate
-// func shouldAutorotate() -> Bool {
-// if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(getter: self.shouldAutorotate)))! {
-// return orientationDelegate!.shouldAutorotate
-// }
-// return true
-// }
-//
-// func supportedInterfaceOrientations() -> Int {
-// if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(getter: self.supportedInterfaceOrientations)))! {
-// return Int(orientationDelegate!.supportedInterfaceOrientations.rawValue)
-// }
-// //return Int(1 << .portrait)
-// return 1
-// }
-
-// override func shouldAutorotate(to interfaceOrientation: UIInterfaceOrientation) -> Bool {
-// if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(self.shouldAutorotateToInterfaceOrientation)))! {
-// return orientationDelegate!.shouldAutorotate(to: interfaceOrientation)
-// }
-// return true
-// }
-
-}
-
-class CDVInAppBrowserNavigationController: UINavigationController {
- weak var orientationDelegate: AnyObject?
-
- override func dismiss(animated flag: Bool, completion: (() -> Void)? = nil) {
- if presentedViewController != nil {
- super.dismiss(animated: flag, completion: completion)
- }
- }
-
- override func viewDidLoad() {
- var statusBarFrame: CGRect = invertFrameIfNeeded(UIApplication.shared.statusBarFrame)
- statusBarFrame.size.height = CGFloat(STATUSBAR_HEIGHT)
- // simplified from: http://stackoverflow.com/a/25669695/219684
- let bgToolbar = UIToolbar(frame: statusBarFrame)
- bgToolbar.barStyle = .default
- bgToolbar.autoresizingMask = .flexibleWidth
- view.addSubview(bgToolbar)
- super.viewDidLoad()
- }
-
- func invertFrameIfNeeded(_ rect: CGRect) -> CGRect {
- // We need to invert since on iOS 7 frames are always in Portrait context
-// if !IsAtLeastiOSVersion("8.0") {
-// if UIInterfaceOrientationIsLandscape(UIApplication.shared.statusBarOrientation) {
-// let temp: CGFloat = rect.size.width
-// rect.size.width = rect.size.height
-// rect.size.height = temp
-// }
-// rect.origin = CGPoint.zero
-// }
- return rect
- }
-
- // MARK: CDVScreenOrientationDelegate
- override var shouldAutorotate: Bool {
- if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(getter: self.shouldAutorotate)))! {
- return orientationDelegate!.shouldAutorotate
- }
- return true
- }
-
- override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
- if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(getter: self.supportedInterfaceOrientations)))! {
- return orientationDelegate!.supportedInterfaceOrientations
- }
- //return Int(1 << .portrait)
- return UIInterfaceOrientationMask(rawValue: 1)
- }
-
-// override func shouldAutorotate(to interfaceOrientation: UIInterfaceOrientation) -> Bool {
-// if (orientationDelegate != nil) && (orientationDelegate?.responds(to: #selector(self.shouldAutorotateToInterfaceOrientation)))! {
-// return orientationDelegate!.shouldAutorotate(to: interfaceOrientation)
-// }
-// return true
-// }
+
}
diff --git a/lib/flutter_inappbrowser.dart b/lib/flutter_inappbrowser.dart
index 40f52fb0..c8836a45 100644
--- a/lib/flutter_inappbrowser.dart
+++ b/lib/flutter_inappbrowser.dart
@@ -121,7 +121,7 @@ class InAppBrowser {
/// - __transitionstyle__: Set to `fliphorizontal`, `crossdissolve` or `coververtical` to set the [transition style](http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html#//apple_ref/occ/instp/UIViewController/modalTransitionStyle) (defaults to `coververtical`).
/// - __toolbarposition__: Set to `top` or `bottom` (default is `bottom`). Causes the toolbar to be at the top or bottom of the window.
/// - __hidespinner__: Set to `yes` or `no` to change the visibility of the loading indicator (defaults to `no`).
- Future open(String url, {String target = "_self", String options = "location=yes"}) async {
+ Future open(String url, {String target = "_self", Map options = const {}}) async {
Map args = {};
args.putIfAbsent('url', () => url);
args.putIfAbsent('target', () => target);