Subversion Repositories SmartDukaan

Rev

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

Rev 19946 Rev 20407
Line 16... Line 16...
16
import android.os.AsyncTask;
16
import android.os.AsyncTask;
17
import android.os.Build;
17
import android.os.Build;
18
import android.os.Bundle;
18
import android.os.Bundle;
19
import android.os.Handler;
19
import android.os.Handler;
20
import android.os.Parcelable;
20
import android.os.Parcelable;
-
 
21
import android.support.v4.os.AsyncTaskCompat;
21
import android.util.Base64;
22
import android.util.Base64;
22
import android.util.Log;
23
import android.util.Log;
23
import android.view.KeyEvent;
24
import android.view.KeyEvent;
24
import android.view.LayoutInflater;
25
import android.view.LayoutInflater;
25
import android.view.Menu;
26
import android.view.Menu;
Line 83... Line 84...
83
 
84
 
84
    }
85
    }
85
 
86
 
86
    static boolean FLAG=false,REDIRECT=false,PAGE_LOAD=false,PAYTMFLAG=false,isPause=false;
87
    static boolean FLAG=false,REDIRECT=false,PAGE_LOAD=false,PAYTMFLAG=false,isPause=false;
87
    int snapdealException=0;
88
    int snapdealException=0;
-
 
89
    static String BASIC_AUTH = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
88
    public static WebView webView;
90
    public static WebView webView;;
89
    WebView amazonWebView,amazonOrderHistoryWebView,amazonOrderHistoryCancelledWebView,paytmWebView;
91
    WebView amazonWebView,amazonOrderHistoryWebView,amazonOrderHistoryCancelledWebView,paytmWebView;
90
    WebView amazonAllUrlsWebView;
92
    WebView amazonAllUrlsWebView;
91
    SharedPreferences userData;
93
    SharedPreferences userData;
92
    SharedPreferences apiData;
94
    SharedPreferences apiData;
93
    SharedPreferences flipkartData;
95
    SharedPreferences flipkartData;
Line 121... Line 123...
121
    public GoogleApiClient mGoogleApiClient;
123
    public GoogleApiClient mGoogleApiClient;
122
    ProgressDialog pd1 = null;
124
    ProgressDialog pd1 = null;
123
    @Override
125
    @Override
124
    public void onCreate(Bundle savedInstanceState) {
126
    public void onCreate(Bundle savedInstanceState) {
125
        super.onCreate(savedInstanceState);
127
        super.onCreate(savedInstanceState);
-
 
128
        setRetainInstance(true);
126
        setHasOptionsMenu(true);
129
        setHasOptionsMenu(true);
127
    }
130
    }
128
 
131
 
129
    @Override
132
    @Override
130
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
133
    public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
Line 441... Line 444...
441
                        cookieManager.setCookie(url, "paytmActive=true");
444
                        cookieManager.setCookie(url, "paytmActive=true");
442
                        cookieManager.setCookie(url, "shareApps=true");
445
                        cookieManager.setCookie(url, "shareApps=true");
443
                        cookieManager.setCookie(url, "homeshop18=true");
446
                        cookieManager.setCookie(url, "homeshop18=true");
444
                        cookieManager.setCookie(url, "isRedirect=true");
447
                        cookieManager.setCookie(url, "isRedirect=true");
445
                    }
448
                    }
446
                    if(url.contains("dl.flipkart.com/dl/")){
449
                    if(false){
447
                        flipkartUrl=url;
450
                        flipkartUrl=url;
448
 
451
 
449
                        if(flipkartData.getInt("showagainflag",0)<3) {
452
                        if(flipkartData.getInt("showagainflag",0)<3) {
450
                            AlertDialog dialog;
453
                            AlertDialog dialog;
451
                            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
454
                            AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
Line 560... Line 563...
560
                            }
563
                            }
561
                        }
564
                        }
562
                        if(Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data","false").equalsIgnoreCase("true")){
565
                        if(Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data","false").equalsIgnoreCase("true")){
563
 
566
 
564
                        }else {
567
                        }else {
565
                            obj = new JSONObject();
-
 
566
                            JSONObject j = new JSONObject();
568
                            JSONObject j = new JSONObject();
567
                            JSONArray jsArray = new JSONArray();
569
                            JSONArray jsArray = new JSONArray();
568
                            j.put("url", url);
570
                            j.put("url", url);
569
                            j.put("user_id", userData.getString("id", null));
571
                            j.put("user_id", userData.getString("id", null));
570
                            j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
572
                            j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
571
                            jsArray.put(j);
573
                            jsArray.put(j);
572
                            obj.put("pushdata", jsArray);
574
                            AsyncTaskCompat.executeParallel(new pushData(),new JSONObject().put("pushdata", jsArray));
573
                            new pushData().execute();
-
 
574
                        }
575
                        }
575
                        storeSubTagId(url);
576
                        storeSubTagId(url);
576
                    }
577
                    }
577
                } catch (Exception e) {
578
                } catch (Exception e) {
578
                    e.printStackTrace();
579
                    e.printStackTrace();
Line 955... Line 956...
955
            return "7";
956
            return "7";
956
        }*/
957
        }*/
957
        return UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,saholic=4,shopclues=5,")),url);
958
        return UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,saholic=4,shopclues=5,")),url);
958
    }
959
    }
959
 
960
 
960
    class pushData extends AsyncTask<String, Integer, String> {
961
    class pushData extends AsyncTask<JSONObject, Integer, String> {
961
 
962
 
962
        @Override
963
        @Override
963
        protected void onPreExecute() {
964
        protected void onPreExecute() {
964
            super.onPreExecute();
965
            super.onPreExecute();
965
        }
966
        }
966
 
967
 
967
        @Override
968
        @Override
968
        protected String doInBackground(String... arg0) {
969
        protected String doInBackground(JSONObject... objs) {
969
            HttpClient httpclient = new DefaultHttpClient();
970
            HttpClient httpclient = new DefaultHttpClient();
970
            try {
971
            try {
971
 
-
 
972
                ArrayList<NameValuePair> nameValuePairs = new ArrayList<>();
972
                ArrayList<NameValuePair> nameValuePairs = new ArrayList<>();
973
                nameValuePairs.add(new BasicNameValuePair("pushdata",obj.toString()));
973
                nameValuePairs.add(new BasicNameValuePair("pushdata",objs[0].toString()));
974
 
974
 
975
                HttpPost httppost = new HttpPost(apiData.getString("url.push.api",null));
975
                HttpPost httppost = new HttpPost(apiData.getString("url.push.api",null));
976
                final String basicAuth = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
-
 
977
                httppost.setHeader("Authorization", basicAuth);
976
                httppost.setHeader("Authorization", BASIC_AUTH);
978
 
977
 
979
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
978
                httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
980
                System.out.println(obj.toString());
-
 
981
                StringEntity se = new StringEntity(obj.toString());
-
 
982
                HttpResponse response = httpclient.execute(httppost);
979
                    HttpResponse response = httpclient.execute(httppost);
983
                int status = response.getStatusLine().getStatusCode();
980
                int status = response.getStatusLine().getStatusCode();
984
 
981
 
985
                if(status == 200){
982
                if(status == 200){
986
                    return "success";
983
                    return "success";
987
                } else {
984
                } else {