Skip to content

Commit

Permalink
fixed android zoom, added new ios webview options, added
Browse files Browse the repository at this point in the history
>  onLongPressHitTestResult event, updated test cases, fixed Promise polyfill, fixed android options
  • Loading branch information
Lorenzo Pichilli authored and Lorenzo Pichilli committed May 9, 2020
1 parent 7d9f9f5 commit 6a7963e
Show file tree
Hide file tree
Showing 236 changed files with 1,496 additions and 963 deletions.
Empty file modified .github/FUNDING.yml
100644 → 100755
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/BUG_REPORT.md
100644 → 100755
Empty file.
Empty file modified .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md
100644 → 100755
Empty file.
Empty file modified .github/PULL_REQUEST_TEMPLATE.md
100644 → 100755
Empty file.
Empty file modified .gitignore
100644 → 100755
Empty file.
Empty file modified .gradle/4.4.1/fileChanges/last-build.bin
100644 → 100755
Empty file.
Empty file modified .gradle/4.4.1/fileHashes/fileHashes.lock
100644 → 100755
Empty file.
Empty file modified .gradle/4.4.1/taskHistory/taskHistory.lock
100644 → 100755
Empty file.
Empty file modified .gradle/5.1.1/fileChanges/last-build.bin
100644 → 100755
Empty file.
Empty file modified .gradle/5.1.1/fileHashes/fileHashes.lock
100644 → 100755
Empty file.
Empty file modified .gradle/5.1.1/gc.properties
100644 → 100755
Empty file.
Empty file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
100644 → 100755
Empty file.
Empty file modified .gradle/buildOutputCleanup/cache.properties
100644 → 100755
Empty file.
Empty file modified .gradle/vcs-1/gc.properties
100644 → 100755
Empty file.
Empty file modified .idea/codeStyles/Project.xml
100644 → 100755
Empty file.
Empty file modified .idea/codeStyles/codeStyleConfig.xml
100644 → 100755
Empty file.
Empty file modified .idea/encodings.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/Dart_SDK.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/Flutter_Plugins.xml
100644 → 100755
Empty file.
Empty file modified .idea/libraries/Flutter_for_Android.xml
100644 → 100755
Empty file.
Empty file modified .idea/markdown-navigator.xml
100644 → 100755
Empty file.
Empty file modified .idea/markdown-navigator/profiles_settings.xml
100644 → 100755
Empty file.
Empty file modified .idea/misc.xml
100644 → 100755
Empty file.
Empty file modified .idea/modules.xml
100644 → 100755
Empty file.
Empty file modified .idea/runConfigurations/example_lib_main_dart.xml
100644 → 100755
Empty file.
Empty file modified .idea/vcs.xml
100644 → 100755
Empty file.
17 changes: 12 additions & 5 deletions CHANGELOG.md
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,26 +1,33 @@
## 3.0.0

- Added `Promise` javascript [polyfill](https://github.com/taylorhakes/promise-polyfill/blob/master/src/index.js) for webviews that doesn't support it for `window.flutter_inappwebview.callHandler`
- Added `Promise` javascript [polyfill](https://github.com/tildeio/rsvp.js) for webviews that doesn't support it for `window.flutter_inappwebview.callHandler`
- Added `getDefaultUserAgent` static method to `InAppWebViewController`
- Added `onUpdateVisitedHistory`, `onPrint` event
- Added `onGeolocationPermissionsHidePrompt` event for Android
- Added `onUpdateVisitedHistory`, `onPrint`, `onLongPressHitTestResult` event
- Added `androidOnGeolocationPermissionsHidePrompt` event for Android webview
- Added `iosOnWebContentProcessDidTerminate`, `iosOnDidCommit`, `iosOnDidReceiveServerRedirectForProvisionalNavigation` events for iOS webview
- Added `supportMultipleWindows` webview option for Android
- Added `regexToCancelSubFramesLoading` webview option for Android to cancel subframe requests on `shouldOverrideUrlLoading` event based on a Regular Expression
- Added `getContentHeight`, `zoomBy`, `printCurrentPage`, `getScale` methods
- Added `getOriginalUrl` webview method for Android
- Added `reloadFromOrigin` webview method for iOS
- Added `automaticallyAdjustsScrollIndicatorInsets` webview options for iOS
- Added `reloadFromOrigin`, `hasOnlySecureContent` webview methods for iOS
- Added `automaticallyAdjustsScrollIndicatorInsets`, `accessibilityIgnoresInvertColors`, `decelerationRate`, `alwaysBounceVertical`, `alwaysBounceHorizontal`, `scrollsToTop`, `isPagingEnabled`, `maximumZoomScale`, `minimumZoomScale` webview options for iOS
- Added `WebStorageManager` class which manages the web storage used by WebView instances
- Added `packageName` [#229](https://github.com/pichillilorenzo/flutter_inappwebview/issues/229) and `keepAliveEnabled` ChromeCustomTab options for Android
- Updated for Flutter 1.12 new Java Embedding API (Android)
- Updated `clearCache` for Android
- Updated default value for `domStorageEnabled` and `databaseEnabled` options to `true` for Android
- Merge "Fixes null error when calling getOptions for InAppBrowser class" [#214](https://github.com/pichillilorenzo/flutter_inappwebview/pull/214) (thanks to [panndoraBoo](https://github.com/panndoraBoo))
- Merge "Fixes crash onConsoleMessage iOS forced unwrapping" [#228](https://github.com/pichillilorenzo/flutter_inappwebview/pull/228) (thanks to [tokonu](https://github.com/tokonu))
- Merge "Fix HTTPCookie.secure" [#311](https://github.com/pichillilorenzo/flutter_inappwebview/pull/311) (thanks to [xtyxtyx](https://github.com/xtyxtyx))
- Merge "Fix config options for Android release builds" [#295](https://github.com/pichillilorenzo/flutter_inappwebview/pull/295) (thanks to [wwwdata](https://github.com/wwwdata))
- Merge "fix scrollbar on iOS always show if not disable scroll" [#256](https://github.com/pichillilorenzo/flutter_inappwebview/pull/256) (thanks to [phamnhuvu-dev](https://github.com/phamnhuvu-dev))
- Merge "Fix crash on nil/invalid URL (iOS)" [#262](https://github.com/pichillilorenzo/flutter_inappwebview/pull/262) (thanks to [AlexVincent525](https://github.com/AlexVincent525))
- Merge "Fix crash when `prompt` was called on Android Q." [#262](https://github.com/pichillilorenzo/flutter_inappwebview/pull/263) (thanks to [AlexVincent525](https://github.com/AlexVincent525))
- Fix for Android and iOS `InAppBrowser` for some controller methods not exposed.
- Fixed "App Crashes after clicking on dropdown (Using inappwebview)" [#182](https://github.com/pichillilorenzo/flutter_inappwebview/issues/182)
- Fixed "webview can not be released when in ios" [#225](https://github.com/pichillilorenzo/flutter_inappwebview/issues/225). Now the iOS WebView is released from memory when it is disposed from Flutter.
- Fixed "Setting of presentationStyle not working on iOS" [#213](https://github.com/pichillilorenzo/flutter_inappwebview/issues/213)
- Fixed "Android zoom issues" [#270](https://github.com/pichillilorenzo/flutter_inappwebview/issues/270)

### BREAKING CHANGES

Expand Down
Empty file modified LICENSE
100644 → 100755
Empty file.
31 changes: 27 additions & 4 deletions README.md
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ A Flutter plugin that allows you to add an inline webview or open an in-app brow

### Requirements

- Dart sdk: ">=2.0.0-dev.68.0 <3.0.0"
- Flutter: ">=1.9.1+hotfix.5 <2.0.0"
- Dart sdk: ">=2.7.0 <3.0.0"
- Flutter: ">=1.12.13+hotfix.5"
- Android: `minSdkVersion 17` and add support for `androidx` (see [AndroidX Migration](https://flutter.dev/docs/development/androidx-migration) to migrate an existing app)
- iOS: `--ios-language swift`, Xcode version `>= 11`

Expand Down Expand Up @@ -448,6 +448,15 @@ Instead, on the `onLoadStop` WebView event, you can use `callHandler` directly:
* `selectionGranularity`: The level of granularity with which the user can interactively select content in the web view.
* `dataDetectorTypes`: Specifying a dataDetectoryTypes value adds interactivity to web content that matches the value.
* `sharedCookiesEnabled`: Set `true` if shared cookies from `HTTPCookieStorage.shared` should used for every load request in the WebView.
* `automaticallyAdjustsScrollIndicatorInsets`: Configures whether the scroll indicator insets are automatically adjusted by the system. The default value is `false`.
* `accessibilityIgnoresInvertColors`: A Boolean value indicating whether the view ignores an accessibility request to invert its colors. The default value is `false`.
* `decelerationRate`: A `IOSUIScrollViewDecelerationRate` value that determines the rate of deceleration after the user lifts their finger. The default value is `IOSUIScrollViewDecelerationRate.NORMAL`.
* `alwaysBounceVertical`: A Boolean value that determines whether bouncing always occurs when vertical scrolling reaches the end of the content. The default value is `false`.
* `alwaysBounceHorizontal`: A Boolean value that determines whether bouncing always occurs when horizontal scrolling reaches the end of the content view. The default value is `false`.
* `scrollsToTop`: A Boolean value that controls whether the scroll-to-top gesture is enabled. The default value is `true`.
* `isPagingEnabled`: A Boolean value that determines whether paging is enabled for the scroll view. The default value is `false`.
* `maximumZoomScale`: A floating-point value that specifies the maximum scale factor that can be applied to the scroll view's content. The default value is `1.0`.
* `minimumZoomScale`: A floating-point value that specifies the minimum scale factor that can be applied to the scroll view's content. The default value is `1.0`.

#### `InAppWebView` Events

Expand Down Expand Up @@ -479,10 +488,14 @@ Event names that starts with `android` or `ios` are events platform-specific.
* `onAjaxProgress`: Event fired as an `XMLHttpRequest` progress (to use this event, the `useShouldInterceptAjaxRequest` option must be `true`).
* `shouldInterceptFetchRequest`: Event fired when a request is sent to a server through [Fetch API](https://developer.mozilla.org/it/docs/Web/API/Fetch_API) (to use this event, the `useShouldInterceptFetchRequest` option must be `true`).
* `onPrint`: Event fired when `window.print()` is called from JavaScript side.
* `onLongPressHitTestResult`: Event fired when an HTML element of the webview has been clicked and held.
* `androidOnSafeBrowsingHit`: Event fired when the webview notifies that a loading URL has been flagged by Safe Browsing (available only on Android).
* `androidOnPermissionRequest`: Event fired when the webview is requesting permission to access the specified resources and the permission currently isn't granted or denied (available only on Android).
* `androidOnGeolocationPermissionsShowPrompt`: Event that notifies the host application that web content from the specified origin is attempting to use the Geolocation API, but no permission state is currently set for that origin (available only on Android).
* `androidOnGeolocationPermissionsHidePrompt`: Notify the host application that a request for Geolocation permissions, made with a previous call to `androidOnGeolocationPermissionsShowPrompt` has been canceled. (available only on Android).
* `iosOnWebContentProcessDidTerminate`: Invoked when the web view's web content process is terminated (available only on iOS).
* `iosOnDidCommit`: Called when the web view begins to receive web content (available only on iOS).
* `iosOnDidReceiveServerRedirectForProvisionalNavigation`: Called when a web view receives a server redirect (available only on iOS).

### `InAppBrowser` class

Expand Down Expand Up @@ -553,7 +566,12 @@ class MyInAppBrowser extends InAppBrowser {
}
}
void main() => runApp(new MyApp());
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
new MyApp(),
);
}
class MyApp extends StatefulWidget {
final MyInAppBrowser browser = new MyInAppBrowser();
Expand Down Expand Up @@ -707,7 +725,12 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
}
}
void main() => runApp(new MyApp());
void main() {
WidgetsFlutterBinding.ensureInitialized();
runApp(
new MyApp(),
);
}
class MyApp extends StatefulWidget {
final ChromeSafariBrowser browser = new MyChromeSafariBrowser(new MyInAppBrowser());
Expand Down
Empty file modified android/.gitignore
100644 → 100755
Empty file.
Empty file modified android/.idea/.name
100644 → 100755
Empty file.
Empty file modified android/.idea/caches/build_file_checksums.ser
100644 → 100755
Empty file.
Empty file modified android/.idea/caches/gradle_models.ser
100644 → 100755
Empty file.
Empty file modified android/.idea/codeStyles/Project.xml
100644 → 100755
Empty file.
Empty file modified android/.idea/gradle.xml
100644 → 100755
Empty file.
Empty file modified android/.idea/misc.xml
100644 → 100755
Empty file.
Empty file modified android/.idea/modules.xml
100644 → 100755
Empty file.
Empty file modified android/.idea/runConfigurations.xml
100644 → 100755
Empty file.
Empty file modified android/.idea/vcs.xml
100644 → 100755
Empty file.
Empty file modified android/build.gradle
100644 → 100755
Empty file.
Empty file modified android/gradle/wrapper/gradle-wrapper.jar
100644 → 100755
Empty file.
Empty file modified android/gradle/wrapper/gradle-wrapper.properties
100644 → 100755
Empty file.
Empty file modified android/proguard-rules.pro
100644 → 100755
Empty file.
Empty file modified android/settings.gradle
100644 → 100755
Empty file.
Empty file modified android/src/main/AndroidManifest.xml
100644 → 100755
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@

import com.pichillilorenzo.flutter_inappwebview.Options;

public class ChromeCustomTabsOptions extends Options {
import java.util.HashMap;
import java.util.Map;

public class ChromeCustomTabsOptions implements Options {

final static String LOG_TAG = "ChromeCustomTabsOptions";

Expand All @@ -14,4 +17,53 @@ public class ChromeCustomTabsOptions extends Options {
public String packageName;
public Boolean keepAliveEnabled = false;

@Override
public ChromeCustomTabsOptions parse(HashMap<String, Object> options) {
for (Map.Entry<String, Object> pair : options.entrySet()) {
String key = pair.getKey();
Object value = pair.getValue();
if (value == null) {
continue;
}

switch (key) {
case "addDefaultShareMenuItem":
addDefaultShareMenuItem = (boolean) value;
break;
case "showTitle":
showTitle = (boolean) value;
break;
case "toolbarBackgroundColor":
toolbarBackgroundColor = (String) value;
break;
case "enableUrlBarHiding":
enableUrlBarHiding = (boolean) value;
break;
case "instantAppsEnabled":
instantAppsEnabled = (boolean) value;
break;
case "packageName":
packageName = (String) value;
break;
case "keepAliveEnabled":
keepAliveEnabled = (boolean) value;
break;
}
}

return this;
}

@Override
public HashMap<String, Object> getHashMap() {
HashMap<String, Object> options = new HashMap<>();
options.put("addDefaultShareMenuItem", addDefaultShareMenuItem);
options.put("showTitle", showTitle);
options.put("toolbarBackgroundColor", toolbarBackgroundColor);
options.put("enableUrlBarHiding", enableUrlBarHiding);
options.put("instantAppsEnabled", instantAppsEnabled);
options.put("packageName", packageName);
options.put("keepAliveEnabled", keepAliveEnabled);
return options;
}
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
59 changes: 58 additions & 1 deletion android/src/main/java/com/pichillilorenzo/flutter_inappwebview/InAppBrowserOptions.java
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package com.pichillilorenzo.flutter_inappwebview;

public class InAppBrowserOptions extends Options {
import java.util.HashMap;
import java.util.Map;

public class InAppBrowserOptions implements Options {

public static final String LOG_TAG = "InAppBrowserOptions";

Expand All @@ -13,4 +16,58 @@ public class InAppBrowserOptions extends Options {
public Boolean hideTitleBar = false;
public Boolean closeOnCannotGoBack = true;
public Boolean progressBar = true;

@Override
public InAppBrowserOptions parse(HashMap<String, Object> options) {
for (Map.Entry<String, Object> pair : options.entrySet()) {
String key = pair.getKey();
Object value = pair.getValue();
if (value == null) {
continue;
}

switch (key) {
case "hidden":
hidden = (boolean) value;
break;
case "toolbarTop":
toolbarTop = (boolean) value;
break;
case "toolbarTopBackgroundColor":
toolbarTopBackgroundColor = (String) value;
break;
case "toolbarTopFixedTitle":
toolbarTopFixedTitle = (String) value;
break;
case "hideUrlBar":
hideUrlBar = (boolean) value;
break;
case "hideTitleBar":
hideTitleBar = (boolean) value;
break;
case "closeOnCannotGoBack":
closeOnCannotGoBack = (boolean) value;
break;
case "progressBar":
progressBar = (boolean) value;
break;
}
}

return this;
}

@Override
public HashMap<String, Object> getHashMap() {
HashMap<String, Object> options = new HashMap<>();
options.put("hidden", hidden);
options.put("toolbarTop", toolbarTop);
options.put("toolbarTopBackgroundColor", toolbarTopBackgroundColor);
options.put("toolbarTopFixedTitle", toolbarTopFixedTitle);
options.put("hideUrlBar", hideUrlBar);
options.put("hideTitleBar", hideTitleBar);
options.put("closeOnCannotGoBack", closeOnCannotGoBack);
options.put("progressBar", progressBar);
return options;
}
}
Empty file.
Loading

0 comments on commit 6a7963e

Please sign in to comment.