@@ -40,31 +40,28 @@ class ResultHandler {
4040 public boolean handleResult (int requestCode , int resultCode , Intent intent ){
4141 boolean handled = false ;
4242 if (Build .VERSION .SDK_INT >= 21 ){
43- Uri [] results = null ;
44- // check result
45- if (resultCode == Activity .RESULT_OK ){
46- if (requestCode == FILECHOOSER_RESULTCODE ){
47- if (mUploadMessageArray != null ){
48- String dataString = intent .getDataString ();
49- if (dataString != null ){
50- results = new Uri []{Uri .parse (dataString )};
51- }
43+ if (requestCode == FILECHOOSER_RESULTCODE ){
44+ Uri [] results = null ;
45+ if (resultCode == Activity .RESULT_OK ){
46+ String dataString = intent .getDataString ();
47+ if (dataString != null ){
48+ results = new Uri []{ Uri .parse (dataString ) };
5249 }
53- handled = true ;
5450 }
51+ if (mUploadMessageArray != null ){
52+ mUploadMessageArray .onReceiveValue (results );
53+ mUploadMessageArray = null ;
54+ }
55+ handled = true ;
5556 }
56- if (mUploadMessageArray != null ){
57- mUploadMessageArray .onReceiveValue (results );
58- }
59- mUploadMessageArray = null ;
6057 }else {
6158 if (requestCode == FILECHOOSER_RESULTCODE ) {
62- if ( null != mUploadMessage ) {
63- Uri result = intent == null || resultCode != RESULT_OK ? null
64- : intent .getData ();
65- if ( mUploadMessageArray != null ){
66- mUploadMessageArray . onReceiveValue ( results );
67- }
59+ Uri result = null ;
60+ if ( resultCode == RESULT_OK && intent != null ) {
61+ result = intent .getData ();
62+ }
63+ if ( mUploadMessage != null ) {
64+ mUploadMessage . onReceiveValue ( result );
6865 mUploadMessage = null ;
6966 }
7067 handled = true ;
@@ -195,30 +192,30 @@ private void clearCache() {
195192 }
196193
197194 void openUrl (
198- boolean withJavascript ,
199- boolean clearCache ,
200- boolean hidden ,
201- boolean clearCookies ,
202- String userAgent ,
203- String url ,
204- Map <String , String > headers ,
205- boolean withZoom ,
206- boolean withLocalStorage ,
207- boolean scrollBar ,
208- boolean supportMultipleWindows ,
209- boolean appCacheEnabled ,
210- boolean allowFileURLs ,
195+ boolean withJavascript ,
196+ boolean clearCache ,
197+ boolean hidden ,
198+ boolean clearCookies ,
199+ String userAgent ,
200+ String url ,
201+ Map <String , String > headers ,
202+ boolean withZoom ,
203+ boolean withLocalStorage ,
204+ boolean scrollBar ,
205+ boolean supportMultipleWindows ,
206+ boolean appCacheEnabled ,
207+ boolean allowFileURLs
211208 ) {
212209 webView .getSettings ().setJavaScriptEnabled (withJavascript );
213210 webView .getSettings ().setBuiltInZoomControls (withZoom );
214211 webView .getSettings ().setSupportZoom (withZoom );
215212 webView .getSettings ().setDomStorageEnabled (withLocalStorage );
216213 webView .getSettings ().setJavaScriptCanOpenWindowsAutomatically (supportMultipleWindows );
217-
214+
218215 webView .getSettings ().setSupportMultipleWindows (supportMultipleWindows );
219-
216+
220217 webView .getSettings ().setAppCacheEnabled (appCacheEnabled );
221-
218+
222219 webView .getSettings ().setAllowFileAccessFromFileURLs (allowFileURLs );
223220 webView .getSettings ().setAllowUniversalAccessFromFileURLs (allowFileURLs );
224221
@@ -241,7 +238,7 @@ void openUrl(
241238 if (userAgent != null ) {
242239 webView .getSettings ().setUserAgentString (userAgent );
243240 }
244-
241+
245242 if (!scrollBar ){
246243 webView .setVerticalScrollBarEnabled (false );
247244 }
@@ -286,23 +283,23 @@ public void onReceiveValue(String value) {
286283 }
287284 });
288285 }
289- /**
286+ /**
290287 * Reloads the Webview.
291288 */
292289 void reload (MethodCall call , MethodChannel .Result result ) {
293290 if (webView != null ) {
294291 webView .reload ();
295292 }
296293 }
297- /**
294+ /**
298295 * Navigates back on the Webview.
299296 */
300297 void back (MethodCall call , MethodChannel .Result result ) {
301298 if (webView != null && webView .canGoBack ()) {
302299 webView .goBack ();
303300 }
304301 }
305- /**
302+ /**
306303 * Navigates forward on the Webview.
307304 */
308305 void forward (MethodCall call , MethodChannel .Result result ) {
@@ -314,13 +311,13 @@ void forward(MethodCall call, MethodChannel.Result result) {
314311 void resize (FrameLayout .LayoutParams params ) {
315312 webView .setLayoutParams (params );
316313 }
317- /**
314+ /**
318315 * Checks if going back on the Webview is possible.
319316 */
320317 boolean canGoBack () {
321318 return webView .canGoBack ();
322319 }
323- /**
320+ /**
324321 * Checks if going forward on the Webview is possible.
325322 */
326323 boolean canGoForward () {
0 commit comments