|
| 1 | +Index: packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java |
| 2 | +IDEA additional info: |
| 3 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 4 | +<+>UTF-8 |
| 5 | +=================================================================== |
| 6 | +--- packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 7 | ++++ packages/webview_flutter/android/src/main/java/io/flutter/plugins/webviewflutter/FlutterWebView.java (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 8 | +@@ -10,6 +10,7 @@ |
| 9 | + import android.os.Build; |
| 10 | + import android.os.Handler; |
| 11 | + import android.view.View; |
| 12 | ++import android.webkit.CookieManager; |
| 13 | + import android.webkit.WebStorage; |
| 14 | + import android.webkit.WebViewClient; |
| 15 | + import io.flutter.plugin.common.BinaryMessenger; |
| 16 | +@@ -155,6 +156,9 @@ |
| 17 | + case "clearCache": |
| 18 | + clearCache(result); |
| 19 | + break; |
| 20 | ++ case "getAllCookies": |
| 21 | ++ getAllCookies(result); |
| 22 | ++ break; |
| 23 | + case "getTitle": |
| 24 | + getTitle(result); |
| 25 | + break; |
| 26 | +@@ -262,6 +266,12 @@ |
| 27 | + result.success(null); |
| 28 | + } |
| 29 | + |
| 30 | ++ private void getAllCookies(Result result) { |
| 31 | ++ String url = webView.getUrl(); |
| 32 | ++ String cookiesStr = CookieManager.getInstance().getCookie(url); |
| 33 | ++ result.success(cookiesStr); |
| 34 | ++ } |
| 35 | ++ |
| 36 | + private void getTitle(Result result) { |
| 37 | + result.success(webView.getTitle()); |
| 38 | + } |
| 39 | +Index: packages/webview_flutter/example/ios/Runner.xcodeproj/project.pbxproj |
| 40 | +IDEA additional info: |
| 41 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 42 | +<+>UTF-8 |
| 43 | +=================================================================== |
| 44 | +--- packages/webview_flutter/example/ios/Runner.xcodeproj/project.pbxproj (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 45 | ++++ packages/webview_flutter/example/ios/Runner.xcodeproj/project.pbxproj (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 46 | +@@ -298,12 +298,9 @@ |
| 47 | + files = ( |
| 48 | + ); |
| 49 | + inputPaths = ( |
| 50 | +- "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", |
| 51 | +- "${PODS_ROOT}/../Flutter/Flutter.framework", |
| 52 | + ); |
| 53 | + name = "[CP] Embed Pods Frameworks"; |
| 54 | + outputPaths = ( |
| 55 | +- "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework", |
| 56 | + ); |
| 57 | + runOnlyForDeploymentPostprocessing = 0; |
| 58 | + shellPath = /bin/sh; |
| 59 | +Index: packages/webview_flutter/example/lib/main.dart |
| 60 | +IDEA additional info: |
| 61 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 62 | +<+>UTF-8 |
| 63 | +=================================================================== |
| 64 | +--- packages/webview_flutter/example/lib/main.dart (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 65 | ++++ packages/webview_flutter/example/lib/main.dart (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 66 | +@@ -207,7 +207,7 @@ |
| 67 | + void _onListCookies( |
| 68 | + WebViewController controller, BuildContext context) async { |
| 69 | + final String cookies = |
| 70 | +- await controller.evaluateJavascript('document.cookie'); |
| 71 | ++ await controller.getAllCookies(); |
| 72 | + Scaffold.of(context).showSnackBar(SnackBar( |
| 73 | + content: Column( |
| 74 | + mainAxisAlignment: MainAxisAlignment.end, |
| 75 | +Index: packages/webview_flutter/ios/Classes/FlutterWebView.m |
| 76 | +IDEA additional info: |
| 77 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 78 | +<+>UTF-8 |
| 79 | +=================================================================== |
| 80 | +--- packages/webview_flutter/ios/Classes/FlutterWebView.m (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 81 | ++++ packages/webview_flutter/ios/Classes/FlutterWebView.m (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 82 | +@@ -148,6 +148,8 @@ |
| 83 | + [self onRemoveJavaScriptChannels:call result:result]; |
| 84 | + } else if ([[call method] isEqualToString:@"clearCache"]) { |
| 85 | + [self clearCache:result]; |
| 86 | ++ } else if ([[call method] isEqualToString:@"getAllCookies"]) { |
| 87 | ++ [self getAllCookies:result]; |
| 88 | + } else if ([[call method] isEqualToString:@"getTitle"]) { |
| 89 | + [self onGetTitle:result]; |
| 90 | + } else if ([[call method] isEqualToString:@"scrollTo"]) { |
| 91 | +@@ -278,6 +280,23 @@ |
| 92 | + } |
| 93 | + } |
| 94 | + |
| 95 | ++- (void)getAllCookies:(FlutterResult)result { |
| 96 | ++ if (@available(iOS 11.0, *)) { |
| 97 | ++ NSString *url = [_webView.URL absoluteURL]; |
| 98 | ++ WKHTTPCookieStore *cookieStore = _webView.configuration.websiteDataStore.httpCookieStore; |
| 99 | ++ [cookieStore getAllCookies:^(NSArray<NSHTTPCookie *> * _Nonnull cookies) { |
| 100 | ++ NSString *allCookies = @""; |
| 101 | ++ NSEnumerator *cookie_enum = [cookies objectEnumerator]; |
| 102 | ++ NSHTTPCookie *temp_cookie; |
| 103 | ++ while (temp_cookie = [cookie_enum nextObject]) { |
| 104 | ++ NSString *temp = [NSString stringWithFormat:@"%@=%@;",[temp_cookie name],[temp_cookie value]]; |
| 105 | ++ allCookies = [allCookies stringByAppendingString:temp]; |
| 106 | ++ } |
| 107 | ++ result([NSString stringWithFormat:@"%@", allCookies]); |
| 108 | ++ }]; |
| 109 | ++ } |
| 110 | ++} |
| 111 | ++ |
| 112 | + - (void)onGetTitle:(FlutterResult)result { |
| 113 | + NSString* title = _webView.title; |
| 114 | + result(title); |
| 115 | +Index: packages/webview_flutter/lib/platform_interface.dart |
| 116 | +IDEA additional info: |
| 117 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 118 | +<+>UTF-8 |
| 119 | +=================================================================== |
| 120 | +--- packages/webview_flutter/lib/platform_interface.dart (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 121 | ++++ packages/webview_flutter/lib/platform_interface.dart (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 122 | +@@ -279,6 +279,11 @@ |
| 123 | + throw UnimplementedError( |
| 124 | + "WebView removeJavascriptChannels is not implemented on the current platform"); |
| 125 | + } |
| 126 | ++ |
| 127 | ++ Future<String> getAllCookies() { |
| 128 | ++ throw UnimplementedError( |
| 129 | ++ "WebView getAllCookies is not implemented on the current platform"); |
| 130 | ++ } |
| 131 | + |
| 132 | + /// Returns the title of the currently loaded page. |
| 133 | + Future<String> getTitle() { |
| 134 | +Index: packages/webview_flutter/lib/src/webview_method_channel.dart |
| 135 | +IDEA additional info: |
| 136 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 137 | +<+>UTF-8 |
| 138 | +=================================================================== |
| 139 | +--- packages/webview_flutter/lib/src/webview_method_channel.dart (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 140 | ++++ packages/webview_flutter/lib/src/webview_method_channel.dart (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 141 | +@@ -128,6 +128,9 @@ |
| 142 | + 'removeJavascriptChannels', javascriptChannelNames.toList()); |
| 143 | + } |
| 144 | + |
| 145 | ++ @override |
| 146 | ++ Future<String> getAllCookies() => _channel.invokeMethod<String>('getAllCookies'); |
| 147 | ++ |
| 148 | + @override |
| 149 | + Future<String> getTitle() => _channel.invokeMethod<String>("getTitle"); |
| 150 | + |
| 151 | +Index: packages/webview_flutter/lib/webview_flutter.dart |
| 152 | +IDEA additional info: |
| 153 | +Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP |
| 154 | +<+>UTF-8 |
| 155 | +=================================================================== |
| 156 | +--- packages/webview_flutter/lib/webview_flutter.dart (revision 999e11bc5cfe4689270fc5592d4a05e01a473e5c) |
| 157 | ++++ packages/webview_flutter/lib/webview_flutter.dart (revision 088c46ae375c92e956f581cbd4cba8e1485336a2) |
| 158 | +@@ -672,6 +672,10 @@ |
| 159 | + return _webViewPlatformController.evaluateJavascript(javascriptString); |
| 160 | + } |
| 161 | + |
| 162 | ++ Future<String> getAllCookies() { |
| 163 | ++ return _webViewPlatformController.getAllCookies(); |
| 164 | ++ } |
| 165 | ++ |
| 166 | + /// Returns the title of the currently loaded page. |
| 167 | + Future<String> getTitle() { |
| 168 | + return _webViewPlatformController.getTitle(); |
0 commit comments