Subversion Repositories SmartDukaan

Rev

Rev 17503 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 17503 Rev 18078
Line 111... Line 111...
111
    JSONArray jsArraySaholic;
111
    JSONArray jsArraySaholic;
112
    String snapdealJavascriptUrl;
112
    String snapdealJavascriptUrl;
113
    String type1;
113
    String type1;
114
    ArrayList<String> orderSuccessUrlList;
114
    ArrayList<String> orderSuccessUrlList;
115
    public GoogleApiClient mGoogleApiClient;
115
    public GoogleApiClient mGoogleApiClient;
-
 
116
    ProgressDialog pd1 = null;
116
    @Override
117
    @Override
117
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
118
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
118
                             Bundle savedInstanceState) {
119
                             Bundle savedInstanceState) {
119
 
120
 
120
 
121
 
Line 265... Line 266...
265
    public void onConnectionFailed(ConnectionResult connectionResult) {
266
    public void onConnectionFailed(ConnectionResult connectionResult) {
266
 
267
 
267
    }
268
    }
268
    public class WebClientClass extends WebViewClient {
269
    public class WebClientClass extends WebViewClient {
269
        ProgressDialog pd = null;
270
        ProgressDialog pd = null;
270
        ProgressDialog pd1 = null;
-
 
-
 
271
 
271
        ProgressDialog pd2 = null;
272
        ProgressDialog pd2 = null;
272
 
273
 
273
 
274
 
274
        @Override
275
        @Override
275
        public void onReceivedHttpAuthRequest(WebView view,
276
        public void onReceivedHttpAuthRequest(WebView view,
Line 586... Line 587...
586
                    FLAG = true;
587
                    FLAG = true;
587
                    userDataEditor.putString("amazonOrder","true").commit();
588
                    userDataEditor.putString("amazonOrder","true").commit();
588
                    userDataEditor.putBoolean("amazonLoggedIn",true).commit();
589
                    userDataEditor.putBoolean("amazonLoggedIn",true).commit();
589
                }
590
                }
590
            } else if (FLAG) {
591
            } else if (FLAG) {
-
 
592
                view.loadUrl("javascript:try{" +
-
 
593
                        "var lastUrl=document.URL;" +
-
 
594
                        "setInterval(function(){var currentUrl=document.URL;" +
-
 
595
                        "if(currentUrl!=lastUrl){window.HTMLOUT.amazonUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
-
 
596
                        "}catch(error){Android.onError(error.message);}");
591
                amazonOrderHistoryWebView = new WebView(webView.getContext());
597
                amazonOrderHistoryWebView = new WebView(webView.getContext());
592
                amazonOrderHistoryWebView.setVisibility(View.GONE);
598
                amazonOrderHistoryWebView.setVisibility(View.GONE);
593
                amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
599
                amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
594
                amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
600
                amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
595
                amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
601
                amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
Line 957... Line 963...
957
            } catch (Exception e) {
963
            } catch (Exception e) {
958
 
964
 
959
            }
965
            }
960
            new checkGateWayProblem().execute(saholicUrl);
966
            new checkGateWayProblem().execute(saholicUrl);
961
        }
967
        }
-
 
968
        @JavascriptInterface
-
 
969
        public void amazonUrls(String url){
-
 
970
            try{
-
 
971
                obj = new JSONObject();
-
 
972
                JSONObject j = new JSONObject();
-
 
973
                JSONArray jsArray = new JSONArray();
-
 
974
                j.put("url", url);
-
 
975
                j.put("user_id", userData.getString("id", null));
-
 
976
                j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
-
 
977
                jsArray.put(j);
-
 
978
                obj.put("pushdata", jsArray);
-
 
979
                new pushData().execute();
-
 
980
            }catch (Exception e){
-
 
981
                e.printStackTrace();
-
 
982
            }
962
 
983
 
-
 
984
            try {
-
 
985
                getOrderSuccessUrlConfirmation(url);
-
 
986
                if (displayActionBar) {
-
 
987
                    fetchAmazonOrder(url);
-
 
988
                }
-
 
989
            }catch(Exception e){
-
 
990
                e.printStackTrace();
-
 
991
            }
-
 
992
        }
963
        @JavascriptInterface
993
        @JavascriptInterface
964
        public void paytmUrls(String html){
994
        public void paytmUrls(String html){
965
            try{
995
            try{
966
                obj = new JSONObject();
996
                obj = new JSONObject();
967
                JSONObject j = new JSONObject();
997
                JSONObject j = new JSONObject();
968
                JSONArray jsArray = new JSONArray();
998
                JSONArray jsArray = new JSONArray();
969
                Log.d("URL in page start","Url in page start "  + html);
-
 
970
                j.put("url", html);
999
                j.put("url", html);
971
                j.put("user_id", userData.getString("id", null));
1000
                j.put("user_id", userData.getString("id", null));
972
                j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
1001
                j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
973
                jsArray.put(j);
1002
                jsArray.put(j);
974
                obj.put("pushdata", jsArray);
1003
                obj.put("pushdata", jsArray);
975
                new pushData().execute();
1004
                new pushData().execute();
976
            }catch (Exception e){
1005
            }catch (Exception e){
977
                e.printStackTrace();
1006
                e.printStackTrace();
978
            }
1007
            }
-
 
1008
 
979
            if (html.contains("https://paytm.com/login")) {
1009
            if (html.contains("https://paytm.com/login")) {
980
                if (!PAYTMFLAG) {
1010
                if (!PAYTMFLAG) {
981
                    PAYTMFLAG = true;
1011
                    PAYTMFLAG = true;
982
                    userDataEditor.putString("paytmOrder","true").commit();
1012
                    userDataEditor.putString("paytmOrder","true").commit();
983
                    userDataEditor.putBoolean("paytmLoggedIn",true).commit();
1013
                    userDataEditor.putBoolean("paytmLoggedIn",true).commit();
Line 1953... Line 1983...
1953
            }
1983
            }
1954
        }catch (Exception e){
1984
        }catch (Exception e){
1955
            e.printStackTrace();
1985
            e.printStackTrace();
1956
        }
1986
        }
1957
    }
1987
    }
-
 
1988
 
-
 
1989
    public void fetchAmazonOrder(String url){
-
 
1990
        pd1 = new ProgressDialog(getActivity());
-
 
1991
        pd1.setTitle("Please wait");
-
 
1992
        pd1.setMessage("Placing your order...");
-
 
1993
        pd1.show();
-
 
1994
        webView.post(new Runnable() {
-
 
1995
            @Override
-
 
1996
            public void run() {
-
 
1997
                webView.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
-
 
1998
            }
-
 
1999
        });
-
 
2000
 
-
 
2001
    }
1958
}
2002
}