| Line 1... |
Line 1... |
| 1 |
package com.saholic.profittill.main;
|
1 |
package com.saholic.profittill.main;
|
| 2 |
|
2 |
|
| - |
|
3 |
import android.app.Activity;
|
| 3 |
import android.app.AlertDialog;
|
4 |
import android.app.AlertDialog;
|
| 4 |
import android.app.ProgressDialog;
|
5 |
import android.app.ProgressDialog;
|
| 5 |
import android.content.Context;
|
6 |
import android.content.Context;
|
| 6 |
import android.content.DialogInterface;
|
7 |
import android.content.DialogInterface;
|
| 7 |
import android.content.Intent;
|
8 |
import android.content.Intent;
|
| Line 36... |
Line 37... |
| 36 |
import android.widget.Toast;
|
37 |
import android.widget.Toast;
|
| 37 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
38 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
| 38 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
39 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
| 39 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
40 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
| 40 |
import com.saholic.profittill.R;
|
41 |
import com.saholic.profittill.R;
|
| - |
|
42 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| 41 |
import com.saholic.profittill.Utils.WebKitCookieManagerProxy;
|
43 |
import com.saholic.profittill.Utils.WebKitCookieManagerProxy;
|
| 42 |
import com.testin.agent.TestinAgent;
|
44 |
import com.testin.agent.TestinAgent;
|
| 43 |
|
45 |
|
| 44 |
|
46 |
|
| 45 |
import org.apache.http.Header;
|
47 |
import org.apache.http.Header;
|
| Line 60... |
Line 62... |
| 60 |
|
62 |
|
| 61 |
import org.apache.http.util.EntityUtils;
|
63 |
import org.apache.http.util.EntityUtils;
|
| 62 |
import org.json.JSONArray;
|
64 |
import org.json.JSONArray;
|
| 63 |
import org.json.JSONException;
|
65 |
import org.json.JSONException;
|
| 64 |
import org.json.JSONObject;
|
66 |
import org.json.JSONObject;
|
| - |
|
67 |
|
| - |
|
68 |
import java.io.ByteArrayOutputStream;
|
| 65 |
import java.io.IOException;
|
69 |
import java.io.IOException;
|
| 66 |
import java.io.InputStream;
|
70 |
import java.io.InputStream;
|
| - |
|
71 |
import java.nio.charset.StandardCharsets;
|
| 67 |
import java.text.SimpleDateFormat;
|
72 |
import java.text.SimpleDateFormat;
|
| 68 |
import java.util.ArrayList;
|
73 |
import java.util.ArrayList;
|
| 69 |
import java.util.Date;
|
74 |
import java.util.Date;
|
| 70 |
import java.util.LinkedList;
|
75 |
import java.util.LinkedList;
|
| 71 |
import java.util.List;
|
76 |
import java.util.List;
|
| 72 |
import java.util.StringTokenizer;
|
77 |
import java.util.StringTokenizer;
|
| 73 |
import java.util.regex.Matcher;
|
78 |
import java.util.regex.Matcher;
|
| 74 |
import java.util.regex.Pattern;
|
79 |
import java.util.regex.Pattern;
|
| - |
|
80 |
import java.util.zip.Deflater;
|
| - |
|
81 |
import java.util.zip.GZIPOutputStream;
|
| 75 |
|
82 |
|
| 76 |
public class DealsHomeFragment extends Fragment {
|
83 |
public class DealsHomeFragment extends Fragment {
|
| 77 |
|
84 |
|
| 78 |
public DealsHomeFragment(){
|
85 |
public DealsHomeFragment(){
|
| 79 |
|
86 |
|
| Line 106... |
Line 113... |
| 106 |
final ArrayList<String> redirectUrlsList = new ArrayList<String>();
|
113 |
final ArrayList<String> redirectUrlsList = new ArrayList<String>();
|
| 107 |
final ArrayList<String> pageLoadList = new ArrayList<String>();
|
114 |
final ArrayList<String> pageLoadList = new ArrayList<String>();
|
| 108 |
String flipkartUrl;
|
115 |
String flipkartUrl;
|
| 109 |
View checkBoxView;
|
116 |
View checkBoxView;
|
| 110 |
boolean flipkartFlag;
|
117 |
boolean flipkartFlag;
|
| - |
|
118 |
String saholicUrl;
|
| - |
|
119 |
JSONObject jSaholic;
|
| - |
|
120 |
JSONArray jsArraySaholic;
|
| - |
|
121 |
UtilityFunctions utf;
|
| - |
|
122 |
|
| 111 |
@Override
|
123 |
@Override
|
| 112 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
124 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
| 113 |
Bundle savedInstanceState) {
|
125 |
Bundle savedInstanceState) {
|
| 114 |
|
126 |
|
| 115 |
|
127 |
|
| Line 134... |
Line 146... |
| 134 |
redirectUrls=apiData.getString("profitmandi.redirect.urls","");
|
146 |
redirectUrls=apiData.getString("profitmandi.redirect.urls","");
|
| 135 |
StringTokenizer st = new StringTokenizer(redirectUrls,"|");
|
147 |
StringTokenizer st = new StringTokenizer(redirectUrls,"|");
|
| 136 |
while(st.hasMoreTokens()){
|
148 |
while(st.hasMoreTokens()){
|
| 137 |
redirectUrlsList.add( st.nextToken());
|
149 |
redirectUrlsList.add( st.nextToken());
|
| 138 |
}
|
150 |
}
|
| 139 |
pageLoad =apiData.getString("profitmandi.pageloads.pattern","");
|
151 |
pageLoad =apiData.getString("profitmandi.pageloads.pattern","");
|
| 140 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
152 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
| 141 |
while(st1.hasMoreTokens()){
|
153 |
while(st1.hasMoreTokens()){
|
| 142 |
pageLoadList.add( st1.nextToken());
|
154 |
pageLoadList.add( st1.nextToken());
|
| 143 |
}
|
155 |
}
|
| 144 |
//pageLoadList.add("tag");
|
156 |
//pageLoadList.add("tag");
|
| Line 158... |
Line 170... |
| 158 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
170 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
| 159 |
webView.getSettings().setAllowContentAccess(true);
|
171 |
webView.getSettings().setAllowContentAccess(true);
|
| 160 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
172 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
| 161 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
173 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
| 162 |
}
|
174 |
}
|
| - |
|
175 |
if(Uri.parse(getArguments().getString("key")).getHost().contains("api.profittill")) {
|
| - |
|
176 |
userDataEditor.putString("saholic.data",UtilityFunctions.clearCookiesNew(getArguments().getString("key"),getActivity())).commit();
|
| - |
|
177 |
}
|
| 163 |
webView.loadUrl(getArguments().getString("key"));
|
178 |
webView.loadUrl(getArguments().getString("key"));
|
| 164 |
webView.setWebViewClient(webViewClient);
|
179 |
webView.setWebViewClient(webViewClient);
|
| 165 |
|
180 |
|
| 166 |
}
|
181 |
}
|
| 167 |
else{
|
182 |
else{
|
| Line 279... |
Line 294... |
| 279 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
294 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
| 280 |
super.onPageStarted(view, url, favicon);
|
295 |
super.onPageStarted(view, url, favicon);
|
| 281 |
final CharSequence[] items = {" Don't show me again "};
|
296 |
final CharSequence[] items = {" Don't show me again "};
|
| 282 |
final ArrayList seletedItems=new ArrayList();
|
297 |
final ArrayList seletedItems=new ArrayList();
|
| 283 |
try {
|
298 |
try {
|
| 284 |
/* String pattern = "(.*)(\\saholic+)(.*)";
|
- |
|
| 285 |
Pattern p = Pattern.compile(pattern);
|
299 |
CookieSyncManager.createInstance(getActivity());
|
| 286 |
Matcher matcher =p.matcher(url);
|
300 |
CookieManager cookieManager = CookieManager.getInstance();
|
| 287 |
if(matcher.matches()) {
|
- |
|
| 288 |
parseCookieString(CookieManager.getInstance().getCookie(url));
|
301 |
cookieManager.setCookie(url, "token="+userData.getString("token",""));
|
| 289 |
}*/
|
- |
|
| 290 |
|
- |
|
| 291 |
if(url.contains("dl.flipkart.com/dl/")){
|
302 |
if(url.contains("dl.flipkart.com/dl/")){
|
| 292 |
flipkartUrl=url;
|
303 |
flipkartUrl=url;
|
| 293 |
|
304 |
|
| 294 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
305 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
| 295 |
AlertDialog dialog;
|
306 |
AlertDialog dialog;
|
| Line 408... |
Line 419... |
| 408 |
pd1.setMessage("Loading..");
|
419 |
pd1.setMessage("Loading..");
|
| 409 |
pd1.show();
|
420 |
pd1.show();
|
| 410 |
}
|
421 |
}
|
| 411 |
}
|
422 |
}
|
| 412 |
}
|
423 |
}
|
| - |
|
424 |
if(Uri.parse(url).getHost().contains("saholic") && apiData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
| 413 |
|
425 |
|
| - |
|
426 |
}else {
|
| 414 |
obj = new JSONObject();
|
427 |
obj = new JSONObject();
|
| 415 |
JSONObject j = new JSONObject();
|
428 |
JSONObject j = new JSONObject();
|
| 416 |
JSONArray jsArray = new JSONArray();
|
429 |
JSONArray jsArray = new JSONArray();
|
| 417 |
j.put("url", url);
|
430 |
j.put("url", url);
|
| 418 |
j.put("user_id", userData.getString("id", null));
|
431 |
j.put("user_id", userData.getString("id", null));
|
| 419 |
j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
432 |
j.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
| 420 |
jsArray.put(j);
|
433 |
jsArray.put(j);
|
| 421 |
/* new FetchIPAddress().execute();*/
|
434 |
obj.put("pushdata", jsArray);
|
| 422 |
obj.put("pushdata", jsArray);
|
435 |
new pushData().execute();
|
| 423 |
new pushData().execute();
|
436 |
}
|
| 424 |
storeSubTagId(url);
|
437 |
storeSubTagId(url);
|
| 425 |
}
|
438 |
}
|
| 426 |
} catch (Exception e) {
|
439 |
} catch (Exception e) {
|
| 427 |
e.printStackTrace();
|
440 |
e.printStackTrace();
|
| 428 |
}
|
441 |
}
|
| Line 459... |
Line 472... |
| 459 |
snapdealPageLoad=0;
|
472 |
snapdealPageLoad=0;
|
| 460 |
}
|
473 |
}
|
| 461 |
if(pd2!=null){
|
474 |
if(pd2!=null){
|
| 462 |
pd2.dismiss();
|
475 |
pd2.dismiss();
|
| 463 |
}
|
476 |
}
|
| 464 |
|
- |
|
| 465 |
Log.d("Snapdeal Page Redirect1 " ,"Snapdeal Page Redirect1 " + snapdealPageLoad1);
|
477 |
if(Uri.parse(url).getHost().contains("saholic") && apiData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
| - |
|
478 |
saholicUrl=url;
|
| - |
|
479 |
view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
| - |
|
480 |
}
|
| 466 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
481 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
| 467 |
/* StringTokenizer st2 = new StringTokenizer(url, "&");
|
482 |
/* StringTokenizer st2 = new StringTokenizer(url, "&");
|
| 468 |
String orderid = null;
|
483 |
String orderid = null;
|
| 469 |
while (st2.hasMoreTokens()) {
|
484 |
while (st2.hasMoreTokens()) {
|
| 470 |
String token = st2.nextToken();
|
485 |
String token = st2.nextToken();
|
| Line 811... |
Line 826... |
| 811 |
}
|
826 |
}
|
| 812 |
|
827 |
|
| 813 |
/** Show a toast from the web page */
|
828 |
/** Show a toast from the web page */
|
| 814 |
@JavascriptInterface
|
829 |
@JavascriptInterface
|
| 815 |
public void showToast(String toast) {
|
830 |
public void showToast(String toast) {
|
| 816 |
nameValuePairsRawHtml.add(new BasicNameValuePair("rawhtml",toast));
|
831 |
nameValuePairsRawHtml.add(new BasicNameValuePair("rawhtml", UtilityFunctions.compress(toast)));
|
| 817 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
832 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
| 818 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
833 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
| 819 |
postDataNameValuePair=orderDetails.readData1();
|
834 |
postDataNameValuePair=orderDetails.readData1();
|
| 820 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
835 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
| - |
|
836 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
| 821 |
PushRawHTML pm =new PushRawHTML();
|
837 |
PushRawHTML pm =new PushRawHTML();
|
| 822 |
pm.execute(orderDetail);
|
838 |
pm.execute(orderDetail);
|
| 823 |
}
|
839 |
}
|
| 824 |
}
|
840 |
}
|
| 825 |
|
841 |
|
| 826 |
@JavascriptInterface
|
842 |
@JavascriptInterface
|
| 827 |
public void amazonOrderTrackingHTML(String html) {
|
843 |
public void amazonOrderTrackingHTML(String html) {
|
| - |
|
844 |
amazonOrderTrackingData.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(html)));
|
| 828 |
amazonOrderTrackingData.add(new BasicNameValuePair("rawhtml",html));
|
845 |
amazonOrderTrackingData.add(new BasicNameValuePair("zip","1"));
|
| 829 |
new AmazonOrderTrackingDetails().execute(amazonOrderTrackingData);
|
846 |
new AmazonOrderTrackingDetails().execute(amazonOrderTrackingData);
|
| 830 |
}
|
847 |
}
|
| 831 |
|
848 |
|
| 832 |
@JavascriptInterface
|
849 |
@JavascriptInterface
|
| 833 |
public void showHTML(String html) {
|
850 |
public void showHTML(String html) {
|
| 834 |
showToast(html);
|
851 |
showToast(html);
|
| 835 |
}
|
852 |
}
|
| 836 |
|
853 |
|
| 837 |
@JavascriptInterface
|
854 |
@JavascriptInterface
|
| 838 |
public void flipkartHTML(String html) {
|
855 |
public void flipkartHTML(String html) {
|
| 839 |
nameValuePairsRawHtml.add(new BasicNameValuePair("rawhtml",html));
|
856 |
nameValuePairsRawHtml.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(html)));
|
| 840 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
857 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
| 841 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
858 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
| 842 |
postDataNameValuePair=orderDetails.readData1();
|
859 |
postDataNameValuePair=orderDetails.readData1();
|
| 843 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
860 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
| - |
|
861 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
| 844 |
new loadData().execute(orderDetail);
|
862 |
new loadData().execute(orderDetail);
|
| 845 |
}
|
863 |
}
|
| 846 |
}
|
864 |
}
|
| - |
|
865 |
|
| - |
|
866 |
@JavascriptInterface
|
| - |
|
867 |
public void saholicHTML(String html) {
|
| - |
|
868 |
|
| - |
|
869 |
try {
|
| - |
|
870 |
obj = new JSONObject();
|
| - |
|
871 |
jSaholic = new JSONObject();
|
| - |
|
872 |
jSaholic.put("html", UtilityFunctions.compress(html));
|
| - |
|
873 |
jSaholic.put("zip", "1");
|
| - |
|
874 |
jSaholic.put("user_id", userData.getString("id", null));
|
| - |
|
875 |
} catch (Exception e) {
|
| - |
|
876 |
|
| - |
|
877 |
}
|
| - |
|
878 |
new checkGateWayProblem().execute(saholicUrl);
|
| - |
|
879 |
}
|
| 847 |
}
|
880 |
}
|
| 848 |
|
881 |
|
| 849 |
|
882 |
|
| 850 |
|
883 |
|
| 851 |
|
884 |
|
| Line 873... |
Line 906... |
| 873 |
|
906 |
|
| 874 |
if(status == 200){
|
907 |
if(status == 200){
|
| 875 |
NameValuePair y = orderDetail[0].get(2);
|
908 |
NameValuePair y = orderDetail[0].get(2);
|
| 876 |
int z =orderDetails.deleteRecord(y.getName(),new String[]{y.getValue()});
|
909 |
int z =orderDetails.deleteRecord(y.getName(),new String[]{y.getValue()});
|
| 877 |
} else {
|
910 |
} else {
|
| - |
|
911 |
Log.d("Status in load Data " ,"Status Load data " + status);
|
| - |
|
912 |
|
| 878 |
}
|
913 |
}
|
| 879 |
String getJSON = EntityUtils.toString(entity);
|
914 |
String getJSON = EntityUtils.toString(entity);
|
| 880 |
if(getJSON==null){
|
915 |
if(getJSON==null){
|
| 881 |
return null;
|
916 |
return null;
|
| 882 |
}else {
|
917 |
}else {
|
| Line 939... |
Line 974... |
| 939 |
}
|
974 |
}
|
| 940 |
|
975 |
|
| 941 |
/** Show a toast from the web page */
|
976 |
/** Show a toast from the web page */
|
| 942 |
@JavascriptInterface
|
977 |
@JavascriptInterface
|
| 943 |
public void showToast(String toast) {
|
978 |
public void showToast(String toast) {
|
| 944 |
//Log.e("Total Records before Inserting", "Total records before inserting " + orderDetails.countTotalRecords());
|
979 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(toast)));
|
| 945 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("rawhtml",toast));
|
980 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("zip","1"));
|
| 946 |
if(isInternetOn()) {
|
981 |
if(isInternetOn()) {
|
| 947 |
new amazonPushData().execute(nameValuePairsRawHtmlAmazon);
|
982 |
new amazonPushData().execute(nameValuePairsRawHtmlAmazon);
|
| 948 |
}
|
983 |
}
|
| 949 |
}
|
984 |
}
|
| 950 |
|
985 |
|
| Line 956... |
Line 991... |
| 956 |
|
991 |
|
| 957 |
@JavascriptInterface
|
992 |
@JavascriptInterface
|
| 958 |
public void orderHistory(String html) {
|
993 |
public void orderHistory(String html) {
|
| 959 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
994 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 960 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(0)));
|
995 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(0)));
|
| - |
|
996 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 961 |
amazonOrderHistory.add(new BasicNameValuePair("html",html));
|
997 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| 962 |
if(isInternetOn()) {
|
998 |
if(isInternetOn()) {
|
| 963 |
new pushQueuedData().execute(amazonOrderHistory);
|
999 |
new pushQueuedData().execute(amazonOrderHistory);
|
| 964 |
}
|
1000 |
}
|
| 965 |
else{
|
1001 |
else{
|
| 966 |
|
1002 |
|
| Line 968... |
Line 1004... |
| 968 |
}
|
1004 |
}
|
| 969 |
@JavascriptInterface
|
1005 |
@JavascriptInterface
|
| 970 |
public void cancelledHistory(String html) {
|
1006 |
public void cancelledHistory(String html) {
|
| 971 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
1007 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 972 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(j++)));
|
1008 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(j++)));
|
| - |
|
1009 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 973 |
amazonOrderHistory.add(new BasicNameValuePair("html",html));
|
1010 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| 974 |
if(isInternetOn()) {
|
1011 |
if(isInternetOn()) {
|
| 975 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
1012 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
| 976 |
}
|
1013 |
}
|
| 977 |
else{
|
1014 |
else{
|
| 978 |
|
1015 |
|
| Line 982... |
Line 1019... |
| 982 |
@JavascriptInterface
|
1019 |
@JavascriptInterface
|
| 983 |
public void amazonOrderUrls(String html) {
|
1020 |
public void amazonOrderUrls(String html) {
|
| 984 |
//Log.e("OrderUrls","Order amazonOrderUrls" + html);
|
1021 |
//Log.e("OrderUrls","Order amazonOrderUrls" + html);
|
| 985 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
1022 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 986 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(1)));
|
1023 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(1)));
|
| - |
|
1024 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 987 |
amazonOrderHistory.add(new BasicNameValuePair("html",html));
|
1025 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| 988 |
if(isInternetOn()) {
|
1026 |
if(isInternetOn()) {
|
| 989 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
1027 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
| 990 |
}
|
1028 |
}
|
| 991 |
else{
|
1029 |
else{
|
| 992 |
|
1030 |
|
| Line 1485... |
Line 1523... |
| 1485 |
|
1523 |
|
| 1486 |
return false;
|
1524 |
return false;
|
| 1487 |
}
|
1525 |
}
|
| 1488 |
return false;
|
1526 |
return false;
|
| 1489 |
}
|
1527 |
}
|
| 1490 |
/*public byte[] compress(String string) throws IOException {
|
- |
|
| 1491 |
ByteArrayOutputStream os = new ByteArrayOutputStream(string.length());
|
- |
|
| 1492 |
GZIPOutputStream gos = new GZIPOutputStream(os);
|
- |
|
| 1493 |
gos.write(string.getBytes());
|
- |
|
| 1494 |
gos.close();
|
- |
|
| 1495 |
byte[] compressed = os.toByteArray();
|
- |
|
| 1496 |
os.close();
|
- |
|
| 1497 |
return compressed;
|
- |
|
| 1498 |
}*/
|
- |
|
| 1499 |
|
- |
|
| 1500 |
class FetchAllOrderURLS extends AsyncTask<String, Integer, JSONObject> {
|
1528 |
class FetchAllOrderURLS extends AsyncTask<String, Integer, JSONObject> {
|
| 1501 |
|
1529 |
|
| 1502 |
@Override
|
1530 |
@Override
|
| 1503 |
protected void onPreExecute() {
|
1531 |
protected void onPreExecute() {
|
| 1504 |
super.onPreExecute();
|
1532 |
super.onPreExecute();
|
| Line 1560... |
Line 1588... |
| 1560 |
}
|
1588 |
}
|
| 1561 |
Log.e("data","data FetchOrderURLS " + result);
|
1589 |
Log.e("data","data FetchOrderURLS " + result);
|
| 1562 |
}
|
1590 |
}
|
| 1563 |
}
|
1591 |
}
|
| 1564 |
|
1592 |
|
| 1565 |
public void clearCookies(String domain) {
|
1593 |
/*public void clearCookies(String domain) {
|
| 1566 |
/*CookieSyncManager.createInstance(getActivity());
|
- |
|
| 1567 |
CookieManager cookieManager = CookieManager.getInstance();
|
- |
|
| 1568 |
String cookiestring = cookieManager.getCookie(domain);
|
- |
|
| 1569 |
Log.d("Cookies setting ","Cookies " + cookiestring);
|
- |
|
| 1570 |
String[] cookies = cookiestring.split(";");
|
- |
|
| 1571 |
for (int i=0; i<cookies.length; i++) {
|
- |
|
| 1572 |
String[] cookieparts = cookies[i].split("=");
|
- |
|
| 1573 |
Log.d("Cookies setting ","Cookies to be set " + cookies[i]);
|
- |
|
| 1574 |
cookieManager.setCookie(domain, cookieparts[0].trim()+"=; Expires=Wed, 31 Dec 2025 23:59:59 GMT");
|
- |
|
| 1575 |
}
|
- |
|
| 1576 |
CookieSyncManager.getInstance().sync();*/
|
- |
|
| 1577 |
DefaultHttpClient httpClient=new DefaultHttpClient();
|
1594 |
DefaultHttpClient httpClient=new DefaultHttpClient();
|
| 1578 |
Cookie cookie = null;
|
1595 |
Cookie cookie = null;
|
| 1579 |
|
1596 |
|
| 1580 |
List<Cookie> cookies1 = httpClient.getCookieStore().getCookies();
|
1597 |
List<Cookie> cookies1 = httpClient.getCookieStore().getCookies();
|
| 1581 |
for (int i = 0; i < cookies1.size(); i++) {
|
1598 |
for (int i = 0; i < cookies1.size(); i++) {
|
| 1582 |
cookie = cookies1.get(i);
|
1599 |
cookie = cookies1.get(i);
|
| 1583 |
}
|
1600 |
}
|
| 1584 |
|
- |
|
| 1585 |
//------- Web Browser activity
|
- |
|
| 1586 |
Cookie sessionCookie = cookie;
|
1601 |
Cookie sessionCookie = cookie;
|
| 1587 |
CookieSyncManager.createInstance(getActivity());
|
1602 |
CookieSyncManager.createInstance(getActivity());
|
| 1588 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
1603 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
| 1589 |
Log.d("Cookie ","Session Cookie " + sessionCookie);
|
1604 |
Log.d("Cookie ","Session Cookie " + sessionCookie);
|
| 1590 |
if (sessionCookie != null) {
|
1605 |
if (sessionCookie != null) {
|
| 1591 |
//cookieManager.removeSessionCookie();
|
- |
|
| - |
|
1606 |
|
| 1592 |
String cookieString = sessionCookie.getName() + "=" + sessionCookie.getValue() + "; domain=" + sessionCookie.getDomain();
|
1607 |
String cookieString = sessionCookie.getName() + "=" + sessionCookie.getValue() + "; domain=" + sessionCookie.getDomain();
|
| 1593 |
Log.d("Cookie ","Session Cookie " + cookieString);
|
1608 |
Log.d("Cookie ","Session Cookie " + cookieString);
|
| 1594 |
cookieManager1.setCookie(domain, cookieString);
|
1609 |
cookieManager1.setCookie(domain, cookieString);
|
| 1595 |
CookieSyncManager.getInstance().sync();
|
1610 |
CookieSyncManager.getInstance().sync();
|
| 1596 |
}
|
1611 |
}
|
| 1597 |
}
|
1612 |
}*/
|
| 1598 |
|
1613 |
|
| 1599 |
public List<Cookie> parseCookieString(String cookies) {
|
1614 |
/* public List<Cookie> parseCookieString(String cookies) {
|
| 1600 |
List<Cookie> cookieList = new ArrayList<Cookie>();
|
1615 |
List<Cookie> cookieList = new ArrayList<Cookie>();
|
| 1601 |
Pattern cookiePattern = Pattern.compile("([^=]+)=([^\\;]*);?\\s?");
|
1616 |
Pattern cookiePattern = Pattern.compile("([^=]+)=([^\\;]*);?\\s?");
|
| 1602 |
Matcher matcher = cookiePattern.matcher(cookies);
|
1617 |
Matcher matcher = cookiePattern.matcher(cookies);
|
| 1603 |
while (matcher.find()) {
|
1618 |
while (matcher.find()) {
|
| 1604 |
int groupCount = matcher.groupCount();
|
1619 |
int groupCount = matcher.groupCount();
|
| Line 1613... |
Line 1628... |
| 1613 |
android.webkit.CookieManager.getInstance().setCookie("m.saholic.com", cookieKey+"=");
|
1628 |
android.webkit.CookieManager.getInstance().setCookie("m.saholic.com", cookieKey+"=");
|
| 1614 |
Cookie cookie = new BasicClientCookie(cookieKey, cookieValue);
|
1629 |
Cookie cookie = new BasicClientCookie(cookieKey, cookieValue);
|
| 1615 |
cookieList.add(cookie);
|
1630 |
cookieList.add(cookie);
|
| 1616 |
}
|
1631 |
}
|
| 1617 |
return cookieList;
|
1632 |
return cookieList;
|
| 1618 |
}
|
1633 |
}*/
|
| - |
|
1634 |
/*
|
| 1619 |
public List<Cookie> parseCookieString(String cookies,String domain) {
|
1635 |
public List<Cookie> parseCookieString(String cookies,String domain) {
|
| 1620 |
List<Cookie> cookieList = new ArrayList<Cookie>();
|
1636 |
List<Cookie> cookieList = new ArrayList<Cookie>();
|
| 1621 |
Pattern cookiePattern = Pattern.compile("([^=]+)=([^\\;]*);?\\s?");
|
1637 |
Pattern cookiePattern = Pattern.compile("([^=]+)=([^\\;]*);?\\s?");
|
| 1622 |
Matcher matcher = cookiePattern.matcher(cookies);
|
1638 |
Matcher matcher = cookiePattern.matcher(cookies);
|
| 1623 |
while (matcher.find()) {
|
1639 |
while (matcher.find()) {
|
| Line 1634... |
Line 1650... |
| 1634 |
Cookie cookie = new BasicClientCookie(cookieKey, cookieValue);
|
1650 |
Cookie cookie = new BasicClientCookie(cookieKey, cookieValue);
|
| 1635 |
cookieList.add(cookie);
|
1651 |
cookieList.add(cookie);
|
| 1636 |
}
|
1652 |
}
|
| 1637 |
return cookieList;
|
1653 |
return cookieList;
|
| 1638 |
}
|
1654 |
}
|
| - |
|
1655 |
*/
|
| - |
|
1656 |
|
| - |
|
1657 |
class checkGateWayProblem extends AsyncTask<String, Integer, String> {
|
| - |
|
1658 |
|
| - |
|
1659 |
// JSONObject jobj1;
|
| - |
|
1660 |
|
| - |
|
1661 |
@Override
|
| - |
|
1662 |
protected void onPreExecute() {
|
| - |
|
1663 |
super.onPreExecute();
|
| - |
|
1664 |
}
|
| - |
|
1665 |
|
| - |
|
1666 |
@Override
|
| - |
|
1667 |
protected String doInBackground(String... arg0) {
|
| - |
|
1668 |
HttpClient httpclient = new DefaultHttpClient();
|
| - |
|
1669 |
try {
|
| - |
|
1670 |
//jobj1 = new JSONObject();
|
| - |
|
1671 |
HttpPost httppost = new HttpPost(arg0[0]);
|
| - |
|
1672 |
final String basicAuth = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
|
| - |
|
1673 |
httppost.setHeader("Authorization", basicAuth);
|
| - |
|
1674 |
HttpResponse response = httpclient.execute(httppost);
|
| - |
|
1675 |
int status = response.getStatusLine().getStatusCode();
|
| - |
|
1676 |
|
| - |
|
1677 |
jsArraySaholic = new JSONArray();
|
| - |
|
1678 |
jSaholic.put("url", arg0[0]);
|
| - |
|
1679 |
|
| - |
|
1680 |
jSaholic.put("time", new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
| - |
|
1681 |
jSaholic.put("httpstatus", status);
|
| - |
|
1682 |
jSaholic.put("cookies", CookieManager.getInstance().getCookie(arg0[0]));
|
| - |
|
1683 |
jsArraySaholic.put(jSaholic);
|
| - |
|
1684 |
obj.put("pushdata", jsArraySaholic);
|
| - |
|
1685 |
Log.d("status " ,"Status in checkGatewayProbelm " + status);
|
| - |
|
1686 |
if(status == 200){
|
| - |
|
1687 |
return "success";
|
| - |
|
1688 |
} else {
|
| - |
|
1689 |
return "failure";
|
| - |
|
1690 |
}
|
| - |
|
1691 |
|
| - |
|
1692 |
} catch (ClientProtocolException e) {
|
| - |
|
1693 |
return "failure";
|
| - |
|
1694 |
} catch (IOException e) {
|
| - |
|
1695 |
return "failure";
|
| - |
|
1696 |
}catch (JSONException e){
|
| - |
|
1697 |
return "failure";
|
| - |
|
1698 |
}
|
| - |
|
1699 |
}
|
| - |
|
1700 |
|
| - |
|
1701 |
@Override
|
| - |
|
1702 |
protected void onPostExecute(String result) {
|
| - |
|
1703 |
super.onPostExecute(result);
|
| - |
|
1704 |
new pushData1().execute(obj);
|
| - |
|
1705 |
}
|
| - |
|
1706 |
}
|
| - |
|
1707 |
class pushData1 extends AsyncTask<JSONObject, Integer, String> {
|
| - |
|
1708 |
|
| - |
|
1709 |
@Override
|
| - |
|
1710 |
protected void onPreExecute() {
|
| - |
|
1711 |
super.onPreExecute();
|
| - |
|
1712 |
}
|
| - |
|
1713 |
|
| - |
|
1714 |
@Override
|
| - |
|
1715 |
protected String doInBackground(JSONObject... arg0) {
|
| - |
|
1716 |
HttpClient httpclient = new DefaultHttpClient();
|
| - |
|
1717 |
try {
|
| - |
|
1718 |
ArrayList<NameValuePair> nameValuePairs = new ArrayList<>();
|
| - |
|
1719 |
nameValuePairs.add(new BasicNameValuePair("pushdata",arg0[0].toString()));
|
| - |
|
1720 |
HttpPost httppost = new HttpPost(apiData.getString("url.push.api",null));
|
| - |
|
1721 |
final String basicAuth = "Basic " + Base64.encodeToString("dtr:dtr18Feb2015".getBytes(), Base64.NO_WRAP);
|
| - |
|
1722 |
httppost.setHeader("Authorization", basicAuth);
|
| - |
|
1723 |
|
| - |
|
1724 |
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
|
| - |
|
1725 |
System.out.println("JSON object in push Data 1 " + arg0[0].toString());
|
| - |
|
1726 |
StringEntity se = new StringEntity(arg0[0].toString());
|
| - |
|
1727 |
HttpResponse response = httpclient.execute(httppost);
|
| - |
|
1728 |
int status = response.getStatusLine().getStatusCode();
|
| - |
|
1729 |
|
| - |
|
1730 |
if(status == 200){
|
| - |
|
1731 |
return "success";
|
| - |
|
1732 |
} else {
|
| - |
|
1733 |
return "failure";
|
| - |
|
1734 |
}
|
| - |
|
1735 |
|
| - |
|
1736 |
} catch (ClientProtocolException e) {
|
| - |
|
1737 |
return "failure";
|
| - |
|
1738 |
} catch (IOException e) {
|
| - |
|
1739 |
return "failure";
|
| - |
|
1740 |
}
|
| - |
|
1741 |
}
|
| - |
|
1742 |
|
| - |
|
1743 |
@Override
|
| - |
|
1744 |
protected void onPostExecute(String result) {
|
| - |
|
1745 |
super.onPostExecute(result);
|
| - |
|
1746 |
}
|
| - |
|
1747 |
}
|
| - |
|
1748 |
|
| - |
|
1749 |
/* @Override
|
| - |
|
1750 |
public void onDestroy() {
|
| - |
|
1751 |
Log.d("Deals Home on Destroy","Deals Home");
|
| - |
|
1752 |
super.onDestroy();
|
| - |
|
1753 |
}
|
| - |
|
1754 |
|
| - |
|
1755 |
@Override
|
| - |
|
1756 |
public void onDetach() {
|
| - |
|
1757 |
Log.d("Deals Home on Detach","Deals Home");
|
| - |
|
1758 |
super.onDetach();
|
| - |
|
1759 |
}
|
| - |
|
1760 |
*/
|
| 1639 |
}
|
1761 |
}
|
| 1640 |
|
1762 |
|
| 1641 |
|
1763 |
|
| 1642 |
//https://www.amazon.in/ap/forgotpassword?suppressSignInRadioButtons=0&openid.pape.max_auth_age=0&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prevRID=1JZA0HFF0Z954AGQ0HX2&pageId=anywhere_in&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&siteState=IMBMsgs.&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.assoc_handle=anywhere_in&showRmrMe=1&openid.return_to=https%3A%2F%2Fwww.amazon.in%2Fgp%2Fcheckoutportal%2Fenter-checkout.html%3Fie%3DUTF8%26asin%3DB00GX9XFRM%26buyNow%3D1%26cartCustomerID%3DA36HI1A7IGU0T1%26fromSignIn%3D1%26offeringID%3DJh6%25252F3Ub%25252BpthAXjVfYxwB75kQiqEGByG9y2mMF1g%25252BhlBjgWsDLnX4sroH6dhJsVS9lMBaR%25252FW2m%25252FhYIqNkUAKNs97nPaxfPIbRsqftx5EseYCQWzJ45%25252F%25252BU3bW8p6PLoKGRkCg7s50jNROGKZHzSy3aBXT5iLQ1ALRG%26registryID%3D%26registryItemID%3D%26sessionID%3D276-7977280-3606555
|
1764 |
//https://www.amazon.in/ap/forgotpassword?suppressSignInRadioButtons=0&openid.pape.max_auth_age=0&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0&openid.ns.pape=http%3A%2F%2Fspecs.openid.net%2Fextensions%2Fpape%2F1.0&prevRID=1JZA0HFF0Z954AGQ0HX2&pageId=anywhere_in&openid.identity=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&siteState=IMBMsgs.&openid.claimed_id=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0%2Fidentifier_select&openid.mode=checkid_setup&openid.assoc_handle=anywhere_in&showRmrMe=1&openid.return_to=https%3A%2F%2Fwww.amazon.in%2Fgp%2Fcheckoutportal%2Fenter-checkout.html%3Fie%3DUTF8%26asin%3DB00GX9XFRM%26buyNow%3D1%26cartCustomerID%3DA36HI1A7IGU0T1%26fromSignIn%3D1%26offeringID%3DJh6%25252F3Ub%25252BpthAXjVfYxwB75kQiqEGByG9y2mMF1g%25252BhlBjgWsDLnX4sroH6dhJsVS9lMBaR%25252FW2m%25252FhYIqNkUAKNs97nPaxfPIbRsqftx5EseYCQWzJ45%25252F%25252BU3bW8p6PLoKGRkCg7s50jNROGKZHzSy3aBXT5iLQ1ALRG%26registryID%3D%26registryItemID%3D%26sessionID%3D276-7977280-3606555
|
| 1643 |
|
1765 |
|