package com.kickstarter.libs;

import android.webkit.JavascriptInterface;

import com.kickstarter.services.KickstarterWebViewClient;

public class WebViewJavascriptInterface {
  private final KickstarterWebViewClient kickstarterWebViewClient;

  public WebViewJavascriptInterface(final KickstarterWebViewClient kickstarterWebViewClient) {
    this.kickstarterWebViewClient = kickstarterWebViewClient;
  }

  @JavascriptInterface
  public void setFormContents(final String serialized, final String method, final String encodingType) {
    kickstarterWebViewClient.setFormContents(new FormContents(serialized, method, encodingType));
  }
}


@@ -523,24 +523,548 @@
 dingType) %7B%0A
+    /*%0A     *  WebViewJavascript.html is inserted into Kickstarter web view pages - it intercepts form submits,%0A     *  captures form info (serialized fields, method, encoding type) and sends it to this method, before continuing%0A     *  on with the form submit. The form info is stored in the web view client.%0A     *%0A     *  When the web view client intercepts the outgoing request, it uses the form contents passed to it here to%0A     *  construct a new request with the correct form body, method and encoding type.%0A     */%0A
     kickstar

Add comment explaining how we capture form contents