| Line 1... |
Line 1... |
| 1 |
package com.saholic.profittill.main;
|
1 |
package com.saholic.profittill.main;
|
| 2 |
|
2 |
|
| 3 |
import android.app.Activity;
|
- |
|
| 4 |
import android.app.AlertDialog;
|
3 |
import android.app.AlertDialog;
|
| - |
|
4 |
import android.app.Fragment;
|
| 5 |
import android.app.ProgressDialog;
|
5 |
import android.app.ProgressDialog;
|
| 6 |
import android.content.Context;
|
6 |
import android.content.Context;
|
| 7 |
import android.content.DialogInterface;
|
7 |
import android.content.DialogInterface;
|
| 8 |
import android.content.Intent;
|
8 |
import android.content.Intent;
|
| 9 |
import android.content.SharedPreferences;
|
9 |
import android.content.SharedPreferences;
|
| Line 12... |
Line 12... |
| 12 |
import android.net.ConnectivityManager;
|
12 |
import android.net.ConnectivityManager;
|
| 13 |
import android.net.Uri;
|
13 |
import android.net.Uri;
|
| 14 |
import android.os.AsyncTask;
|
14 |
import android.os.AsyncTask;
|
| 15 |
import android.os.Build;
|
15 |
import android.os.Build;
|
| 16 |
import android.os.Bundle;
|
16 |
import android.os.Bundle;
|
| 17 |
import android.app.Fragment;
|
- |
|
| 18 |
import android.os.Message;
|
17 |
import android.os.Handler;
|
| 19 |
import android.util.Base64;
|
18 |
import android.util.Base64;
|
| 20 |
import android.util.Log;
|
19 |
import android.util.Log;
|
| 21 |
import android.view.KeyEvent;
|
20 |
import android.view.KeyEvent;
|
| 22 |
import android.view.LayoutInflater;
|
21 |
import android.view.LayoutInflater;
|
| 23 |
import android.view.MotionEvent;
|
- |
|
| 24 |
import android.view.View;
|
22 |
import android.view.View;
|
| 25 |
import android.view.ViewGroup;
|
23 |
import android.view.ViewGroup;
|
| 26 |
import android.webkit.CookieManager;
|
24 |
import android.webkit.CookieManager;
|
| 27 |
import android.webkit.CookieSyncManager;
|
25 |
import android.webkit.CookieSyncManager;
|
| 28 |
import android.webkit.HttpAuthHandler;
|
26 |
import android.webkit.HttpAuthHandler;
|
| 29 |
import android.webkit.JavascriptInterface;
|
27 |
import android.webkit.JavascriptInterface;
|
| 30 |
import android.webkit.WebChromeClient;
|
- |
|
| 31 |
import android.webkit.WebSettings;
|
28 |
import android.webkit.WebSettings;
|
| 32 |
import android.webkit.WebView;
|
29 |
import android.webkit.WebView;
|
| 33 |
import android.webkit.WebViewClient;
|
30 |
import android.webkit.WebViewClient;
|
| 34 |
import android.webkit.WebViewDatabase;
|
- |
|
| 35 |
import android.widget.CheckBox;
|
31 |
import android.widget.CheckBox;
|
| 36 |
import android.widget.CompoundButton;
|
32 |
import android.widget.CompoundButton;
|
| 37 |
import android.widget.Toast;
|
33 |
import android.widget.Toast;
|
| - |
|
34 |
|
| - |
|
35 |
import com.facebook.Session;
|
| - |
|
36 |
import com.google.android.gms.common.ConnectionResult;
|
| - |
|
37 |
import com.google.android.gms.common.api.GoogleApiClient;
|
| 38 |
import com.mixpanel.android.mpmetrics.MixpanelAPI;
|
38 |
import com.google.android.gms.plus.Plus;
|
| 39 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
39 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
| 40 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
40 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
| 41 |
import com.saholic.profittill.R;
|
41 |
import com.saholic.profittill.R;
|
| 42 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
42 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| 43 |
import com.saholic.profittill.Utils.WebKitCookieManagerProxy;
|
- |
|
| 44 |
import com.testin.agent.TestinAgent;
|
43 |
import com.testin.agent.TestinAgent;
|
| 45 |
|
44 |
|
| 46 |
|
- |
|
| 47 |
import org.apache.http.Header;
|
- |
|
| 48 |
import org.apache.http.HttpEntity;
|
45 |
import org.apache.http.HttpEntity;
|
| 49 |
import org.apache.http.HttpResponse;
|
46 |
import org.apache.http.HttpResponse;
|
| 50 |
import org.apache.http.NameValuePair;
|
47 |
import org.apache.http.NameValuePair;
|
| 51 |
import org.apache.http.client.ClientProtocolException;
|
48 |
import org.apache.http.client.ClientProtocolException;
|
| 52 |
import org.apache.http.client.HttpClient;
|
49 |
import org.apache.http.client.HttpClient;
|
| 53 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
50 |
import org.apache.http.client.entity.UrlEncodedFormEntity;
|
| 54 |
import org.apache.http.client.methods.HttpGet;
|
51 |
import org.apache.http.client.methods.HttpGet;
|
| 55 |
import org.apache.http.client.methods.HttpPost;
|
52 |
import org.apache.http.client.methods.HttpPost;
|
| 56 |
import org.apache.http.cookie.Cookie;
|
- |
|
| 57 |
import org.apache.http.entity.StringEntity;
|
53 |
import org.apache.http.entity.StringEntity;
|
| 58 |
import org.apache.http.impl.client.DefaultHttpClient;
|
54 |
import org.apache.http.impl.client.DefaultHttpClient;
|
| 59 |
import org.apache.http.impl.cookie.BasicClientCookie;
|
- |
|
| 60 |
import org.apache.http.impl.cookie.RFC2109Spec;
|
- |
|
| 61 |
import org.apache.http.message.BasicNameValuePair;
|
55 |
import org.apache.http.message.BasicNameValuePair;
|
| 62 |
|
- |
|
| 63 |
import org.apache.http.util.EntityUtils;
|
56 |
import org.apache.http.util.EntityUtils;
|
| 64 |
import org.json.JSONArray;
|
57 |
import org.json.JSONArray;
|
| 65 |
import org.json.JSONException;
|
58 |
import org.json.JSONException;
|
| 66 |
import org.json.JSONObject;
|
59 |
import org.json.JSONObject;
|
| 67 |
|
60 |
|
| 68 |
import java.io.ByteArrayOutputStream;
|
- |
|
| 69 |
import java.io.IOException;
|
61 |
import java.io.IOException;
|
| 70 |
import java.io.InputStream;
|
62 |
import java.io.InputStream;
|
| 71 |
import java.nio.charset.StandardCharsets;
|
- |
|
| 72 |
import java.text.SimpleDateFormat;
|
63 |
import java.text.SimpleDateFormat;
|
| 73 |
import java.util.ArrayList;
|
64 |
import java.util.ArrayList;
|
| 74 |
import java.util.Date;
|
65 |
import java.util.Date;
|
| 75 |
import java.util.LinkedList;
|
66 |
import java.util.LinkedList;
|
| 76 |
import java.util.List;
|
67 |
import java.util.List;
|
| 77 |
import java.util.StringTokenizer;
|
68 |
import java.util.StringTokenizer;
|
| 78 |
import java.util.regex.Matcher;
|
- |
|
| 79 |
import java.util.regex.Pattern;
|
- |
|
| 80 |
import java.util.zip.Deflater;
|
- |
|
| 81 |
import java.util.zip.GZIPOutputStream;
|
- |
|
| 82 |
|
69 |
|
| 83 |
public class DealsHomeFragment extends Fragment {
|
70 |
public class DealsHomeFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
| 84 |
|
71 |
|
| 85 |
public DealsHomeFragment(){
|
72 |
public DealsHomeFragment(){
|
| 86 |
|
73 |
|
| 87 |
}
|
74 |
}
|
| 88 |
|
75 |
|
| Line 106... |
Line 93... |
| 106 |
String pageLoad;
|
93 |
String pageLoad;
|
| 107 |
SharedPreferences.Editor amazonapiSettingsEditor;
|
94 |
SharedPreferences.Editor amazonapiSettingsEditor;
|
| 108 |
List<NameValuePair> amazonOrderTrackingData;
|
95 |
List<NameValuePair> amazonOrderTrackingData;
|
| 109 |
int pageRedirect=0;
|
96 |
int pageRedirect=0;
|
| 110 |
int snapdealPageLoad;
|
97 |
int snapdealPageLoad;
|
| 111 |
int snapdealPageLoad1;
|
- |
|
| 112 |
String packageName=null;
|
98 |
String packageName=null;
|
| 113 |
final ArrayList<String> redirectUrlsList = new ArrayList<String>();
|
99 |
final ArrayList<String> redirectUrlsList = new ArrayList<String>();
|
| 114 |
final ArrayList<String> pageLoadList = new ArrayList<String>();
|
100 |
final ArrayList<String> pageLoadList = new ArrayList<String>();
|
| 115 |
String flipkartUrl;
|
101 |
String flipkartUrl;
|
| 116 |
View checkBoxView;
|
102 |
View checkBoxView;
|
| 117 |
boolean flipkartFlag;
|
103 |
boolean flipkartFlag;
|
| 118 |
String saholicUrl;
|
104 |
String saholicUrl;
|
| 119 |
JSONObject jSaholic;
|
105 |
JSONObject jSaholic;
|
| 120 |
JSONArray jsArraySaholic;
|
106 |
JSONArray jsArraySaholic;
|
| - |
|
107 |
String snapdealJavascriptUrl;
|
| 121 |
UtilityFunctions utf;
|
108 |
String type1;
|
| 122 |
|
- |
|
| - |
|
109 |
public GoogleApiClient mGoogleApiClient;
|
| 123 |
@Override
|
110 |
@Override
|
| 124 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
111 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
| 125 |
Bundle savedInstanceState) {
|
112 |
Bundle savedInstanceState) {
|
| 126 |
|
113 |
|
| 127 |
|
114 |
|
| Line 141... |
Line 128... |
| 141 |
orderDetails = new OrderTransactionDetails(getActivity());
|
128 |
orderDetails = new OrderTransactionDetails(getActivity());
|
| 142 |
Log.d("Order details","Orders");
|
129 |
Log.d("Order details","Orders");
|
| 143 |
|
130 |
|
| 144 |
|
131 |
|
| 145 |
if(isInternetOn()) {
|
132 |
if(isInternetOn()) {
|
| - |
|
133 |
if(type1!=null && type1.equalsIgnoreCase("google")) {
|
| - |
|
134 |
mGoogleApiClient = new GoogleApiClient.Builder(getActivity())
|
| - |
|
135 |
.addConnectionCallbacks(this)
|
| - |
|
136 |
.addOnConnectionFailedListener(this).addApi(Plus.API)
|
| - |
|
137 |
.addScope(Plus.SCOPE_PLUS_LOGIN).build();
|
| - |
|
138 |
mGoogleApiClient.connect();
|
| - |
|
139 |
}
|
| 146 |
redirectUrls=apiData.getString("profitmandi.redirect.urls","");
|
140 |
redirectUrls=apiData.getString("profitmandi.redirect.urls","");
|
| 147 |
StringTokenizer st = new StringTokenizer(redirectUrls,"|");
|
141 |
StringTokenizer st = new StringTokenizer(redirectUrls,"|");
|
| 148 |
while(st.hasMoreTokens()){
|
142 |
while(st.hasMoreTokens()){
|
| 149 |
redirectUrlsList.add( st.nextToken());
|
143 |
redirectUrlsList.add( st.nextToken());
|
| 150 |
}
|
144 |
}
|
| Line 200... |
Line 194... |
| 200 |
|
194 |
|
| 201 |
|
195 |
|
| 202 |
|
196 |
|
| 203 |
|
197 |
|
| 204 |
JSONObject obj;
|
198 |
JSONObject obj;
|
| - |
|
199 |
|
| - |
|
200 |
@Override
|
| - |
|
201 |
public void onConnected(Bundle bundle) {
|
| - |
|
202 |
|
| - |
|
203 |
}
|
| - |
|
204 |
|
| - |
|
205 |
@Override
|
| - |
|
206 |
public void onConnectionSuspended(int i) {
|
| - |
|
207 |
|
| - |
|
208 |
}
|
| - |
|
209 |
|
| - |
|
210 |
@Override
|
| - |
|
211 |
public void onConnectionFailed(ConnectionResult connectionResult) {
|
| - |
|
212 |
|
| - |
|
213 |
}
|
| 205 |
public class WebClientClass extends WebViewClient {
|
214 |
public class WebClientClass extends WebViewClient {
|
| 206 |
ProgressDialog pd = null;
|
215 |
ProgressDialog pd = null;
|
| 207 |
ProgressDialog pd1 = null;
|
216 |
ProgressDialog pd1 = null;
|
| 208 |
ProgressDialog pd2 = null;
|
217 |
ProgressDialog pd2 = null;
|
| 209 |
|
218 |
|
| Line 217... |
Line 226... |
| 217 |
|
226 |
|
| 218 |
|
227 |
|
| 219 |
@Override
|
228 |
@Override
|
| 220 |
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
229 |
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
| 221 |
|
230 |
|
| 222 |
/* if(url.contains("flipkart") && apiData.getString("flipkart.appopen","").equalsIgnoreCase("true")){
|
231 |
if(url.contains(apiData.getString("wallet.auth","api.profittill.com/special/native/login"))){
|
| - |
|
232 |
//Toast.makeText(getActivity(),apiData.getString("wallet.error", "Error while logging in to the wallet. Please log in again"), Toast.LENGTH_SHORT).show();
|
| - |
|
233 |
android.webkit.CookieManager cookieManager = android.webkit.CookieManager.getInstance();
|
| - |
|
234 |
android.webkit.CookieSyncManager.createInstance(getActivity());
|
| 223 |
StringTokenizer st = new StringTokenizer(url,";");
|
235 |
cookieManager.removeAllCookie();
|
| 224 |
while(st.hasMoreTokens()){
|
236 |
AlertDialog alert;
|
| - |
|
237 |
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
| - |
|
238 |
builder.setMessage(apiData.getString("wallet.auth.message","You are not authenticated. Please log in again")).setCancelable(false);
|
| 225 |
String token=st.nextToken();
|
239 |
alert = builder.create();
|
| - |
|
240 |
alert.show();
|
| - |
|
241 |
try{
|
| 226 |
if(token.contains("package")){
|
242 |
if (mGoogleApiClient.isConnected()) {
|
| - |
|
243 |
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
|
| - |
|
244 |
mGoogleApiClient.disconnect();
|
| 227 |
packageName = token.split("=")[1];
|
245 |
mGoogleApiClient.connect();
|
| - |
|
246 |
/* userDataEditor.clear().commit();
|
| - |
|
247 |
startActivity(new Intent(getActivity(), LoginActivity.class));*/
|
| 228 |
System.out.println(packageName);
|
248 |
redirectPage(alert);
|
| 229 |
}
|
249 |
}
|
| 230 |
}
|
- |
|
| 231 |
final boolean checkAppInstalled = appInstalledOrNot(packageName);
|
- |
|
| 232 |
|
- |
|
| 233 |
new AlertDialog.Builder(getActivity())
|
250 |
else if(Session.getActiveSession() != null){
|
| 234 |
.setMessage(apiData.getString("flipkart.message","You won't be able to track your orders & earn cashbacks if you purchase using Flipkart App."))
|
- |
|
| 235 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
251 |
Session.getActiveSession().closeAndClearTokenInformation();
|
| 236 |
@Override
|
252 |
Session.setActiveSession(null);
|
| 237 |
public void onClick(DialogInterface dialog, int which) {
|
- |
|
| 238 |
*//* if(checkAppInstalled){
|
253 |
/*userDataEditor.clear().commit();
|
| 239 |
Intent LaunchIntent = getActivity().getPackageManager()
|
254 |
startActivity(new Intent(getActivity(), LoginActivity.class));*/
|
| 240 |
.getLaunchIntentForPackage(packageName);
|
- |
|
| 241 |
*//**//*String url1 ="http://dl.flipkart.com/dl/huawei-honor-6-h60-l04/p/itmdzm66rhvhchha?pid=MOBDZM5TMHQHGWDD&affid=saholic1g&affExtParam1=SHA21427733689";
|
- |
|
| 242 |
*//**//*
|
255 |
redirectPage(alert);
|
| 243 |
LaunchIntent.setData(Uri.parse(flipkartUrl));
|
- |
|
| 244 |
startActivity(LaunchIntent);
|
- |
|
| 245 |
}else {
|
256 |
}
|
| 246 |
Intent intent = null;
|
- |
|
| 247 |
try {
|
257 |
else{
|
| 248 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + packageName));
|
258 |
if(!mGoogleApiClient.isConnected() || Session.getActiveSession()==null){
|
| 249 |
//intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
259 |
/*userDataEditor.clear().commit();
|
| 250 |
} catch (android.content.ActivityNotFoundException anfe) {
|
260 |
startActivity(new Intent(getActivity(), LoginActivity.class));*/
|
| 251 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("https://play.google.com/store/apps/details?id=" + packageName));
|
- |
|
| 252 |
}
|
261 |
redirectPage(alert);
|
| 253 |
|
- |
|
| 254 |
startActivity(intent);
|
262 |
}
|
| 255 |
}*//*
|
263 |
}
|
| 256 |
Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(flipkartUrl));
|
- |
|
| 257 |
startActivity(i);
|
264 |
}catch (Exception e){
|
| 258 |
}
|
265 |
redirectPage(alert);
|
| 259 |
|
- |
|
| 260 |
})
|
266 |
/* userDataEditor.clear().commit();
|
| 261 |
.setNegativeButton("No", null)
|
267 |
startActivity(new Intent(getActivity(), LoginActivity.class));*/
|
| 262 |
.show();
|
268 |
}
|
| 263 |
|
- |
|
| 264 |
|
- |
|
| 265 |
return true;
|
269 |
return true;
|
| 266 |
}*/
|
270 |
}
|
| 267 |
if(url.contains("com.saholic.profittill")){
|
271 |
if(url.contains("com.saholic.profittill")){
|
| 268 |
Intent intent = null;
|
272 |
Intent intent = null;
|
| 269 |
try {
|
273 |
try {
|
| 270 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getActivity().getPackageName()));
|
274 |
intent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id=" + getActivity().getPackageName()));
|
| 271 |
} catch (android.content.ActivityNotFoundException anfe) {
|
275 |
} catch (android.content.ActivityNotFoundException anfe) {
|
| Line 294... |
Line 298... |
| 294 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
298 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
| 295 |
super.onPageStarted(view, url, favicon);
|
299 |
super.onPageStarted(view, url, favicon);
|
| 296 |
final CharSequence[] items = {" Don't show me again "};
|
300 |
final CharSequence[] items = {" Don't show me again "};
|
| 297 |
final ArrayList seletedItems=new ArrayList();
|
301 |
final ArrayList seletedItems=new ArrayList();
|
| 298 |
try {
|
302 |
try {
|
| - |
|
303 |
/* Toast.makeText(getActivity(),"Wifi " + UtilityFunctions.checkWifi(getActivity()),Toast.LENGTH_SHORT).show();*/
|
| - |
|
304 |
/*if(Uri.parse(url).getHost().contains("saholic.com")) {*/
|
| 299 |
CookieSyncManager.createInstance(getActivity());
|
305 |
CookieSyncManager.createInstance(getActivity());
|
| 300 |
CookieManager cookieManager = CookieManager.getInstance();
|
306 |
CookieManager cookieManager = CookieManager.getInstance();
|
| 301 |
cookieManager.setCookie(url, "token="+userData.getString("token",""));
|
307 |
cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
|
| - |
|
308 |
cookieManager.setCookie(url, "walletAuthentication=true");
|
| - |
|
309 |
/*if(Uri.parse(url).getHost().contains("snapdeal") && url.contains("supc")){
|
| - |
|
310 |
new SnapdealSUPCCall().execute(url);
|
| - |
|
311 |
}*/
|
| - |
|
312 |
//}
|
| 302 |
if(url.contains("dl.flipkart.com/dl/")){
|
313 |
if(url.contains("dl.flipkart.com/dl/")){
|
| 303 |
flipkartUrl=url;
|
314 |
flipkartUrl=url;
|
| 304 |
|
315 |
|
| 305 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
316 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
| 306 |
AlertDialog dialog;
|
317 |
AlertDialog dialog;
|
| Line 373... |
Line 384... |
| 373 |
}
|
384 |
}
|
| 374 |
else {
|
385 |
else {
|
| 375 |
for (String s : pageLoadList) {
|
386 |
for (String s : pageLoadList) {
|
| 376 |
if (url.contains(s)) {
|
387 |
if (url.contains(s)) {
|
| 377 |
PAGE_LOAD = true;
|
388 |
PAGE_LOAD = true;
|
| 378 |
|
- |
|
| 379 |
}
|
389 |
}
|
| 380 |
}
|
390 |
}
|
| 381 |
if (PAGE_LOAD) {
|
391 |
if (PAGE_LOAD) {
|
| 382 |
//clearCookies(url);
|
392 |
//clearCookies(url);
|
| 383 |
Log.d("Cookie after calling", "Cookie after calling" + CookieManager.getInstance().getCookie(url));
|
393 |
Log.d("Cookie after calling", "Cookie after calling" + CookieManager.getInstance().getCookie(url));
|
| Line 419... |
Line 429... |
| 419 |
pd1.setMessage("Loading..");
|
429 |
pd1.setMessage("Loading..");
|
| 420 |
pd1.show();
|
430 |
pd1.show();
|
| 421 |
}
|
431 |
}
|
| 422 |
}
|
432 |
}
|
| 423 |
}
|
433 |
}
|
| 424 |
if(Uri.parse(url).getHost().contains("saholic") && apiData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
434 |
if(Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
| 425 |
|
435 |
|
| 426 |
}else {
|
436 |
}else {
|
| 427 |
obj = new JSONObject();
|
437 |
obj = new JSONObject();
|
| 428 |
JSONObject j = new JSONObject();
|
438 |
JSONObject j = new JSONObject();
|
| 429 |
JSONArray jsArray = new JSONArray();
|
439 |
JSONArray jsArray = new JSONArray();
|
| Line 472... |
Line 482... |
| 472 |
snapdealPageLoad=0;
|
482 |
snapdealPageLoad=0;
|
| 473 |
}
|
483 |
}
|
| 474 |
if(pd2!=null){
|
484 |
if(pd2!=null){
|
| 475 |
pd2.dismiss();
|
485 |
pd2.dismiss();
|
| 476 |
}
|
486 |
}
|
| - |
|
487 |
/*if(Uri.parse(url).getHost().contains("snapdeal") && url.contains("supc")){
|
| - |
|
488 |
Log.d("In page Finished","In page finished" + snapdealJavascriptUrl);
|
| - |
|
489 |
view.loadUrl(snapdealJavascriptUrl);
|
| - |
|
490 |
}*/
|
| 477 |
if(Uri.parse(url).getHost().contains("saholic") && apiData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
491 |
if(Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
| 478 |
saholicUrl=url;
|
492 |
saholicUrl=url;
|
| 479 |
view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
493 |
view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
| 480 |
}
|
494 |
}
|
| 481 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
495 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
| 482 |
/* StringTokenizer st2 = new StringTokenizer(url, "&");
|
496 |
/* StringTokenizer st2 = new StringTokenizer(url, "&");
|
| Line 832... |
Line 846... |
| 832 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
846 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
| 833 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
847 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
| 834 |
postDataNameValuePair=orderDetails.readData1();
|
848 |
postDataNameValuePair=orderDetails.readData1();
|
| 835 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
849 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
| 836 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
850 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
| - |
|
851 |
orderDetail.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
852 |
orderDetail.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
853 |
orderDetail.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 837 |
PushRawHTML pm =new PushRawHTML();
|
854 |
PushRawHTML pm =new PushRawHTML();
|
| 838 |
pm.execute(orderDetail);
|
855 |
pm.execute(orderDetail);
|
| 839 |
}
|
856 |
}
|
| 840 |
}
|
857 |
}
|
| 841 |
|
858 |
|
| 842 |
@JavascriptInterface
|
859 |
@JavascriptInterface
|
| 843 |
public void amazonOrderTrackingHTML(String html) {
|
860 |
public void amazonOrderTrackingHTML(String html) {
|
| 844 |
amazonOrderTrackingData.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(html)));
|
861 |
amazonOrderTrackingData.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(html)));
|
| 845 |
amazonOrderTrackingData.add(new BasicNameValuePair("zip","1"));
|
862 |
amazonOrderTrackingData.add(new BasicNameValuePair("zip","1"));
|
| - |
|
863 |
amazonOrderTrackingData.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
864 |
amazonOrderTrackingData.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
865 |
amazonOrderTrackingData.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 846 |
new AmazonOrderTrackingDetails().execute(amazonOrderTrackingData);
|
866 |
new AmazonOrderTrackingDetails().execute(amazonOrderTrackingData);
|
| 847 |
}
|
867 |
}
|
| 848 |
|
868 |
|
| 849 |
@JavascriptInterface
|
869 |
@JavascriptInterface
|
| 850 |
public void showHTML(String html) {
|
870 |
public void showHTML(String html) {
|
| Line 857... |
Line 877... |
| 857 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
877 |
long x = orderDetails.insertOrderDetails(nameValuePairsRawHtml);
|
| 858 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
878 |
List<List<NameValuePair>> postDataNameValuePair = new ArrayList<List<NameValuePair>>();
|
| 859 |
postDataNameValuePair=orderDetails.readData1();
|
879 |
postDataNameValuePair=orderDetails.readData1();
|
| 860 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
880 |
for(List<NameValuePair> orderDetail : postDataNameValuePair) {
|
| 861 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
881 |
orderDetail.add(new BasicNameValuePair("zip","1"));
|
| - |
|
882 |
orderDetail.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
883 |
orderDetail.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
884 |
orderDetail.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 862 |
new loadData().execute(orderDetail);
|
885 |
new loadData().execute(orderDetail);
|
| 863 |
}
|
886 |
}
|
| 864 |
}
|
887 |
}
|
| 865 |
|
888 |
|
| 866 |
@JavascriptInterface
|
889 |
@JavascriptInterface
|
| Line 976... |
Line 999... |
| 976 |
/** Show a toast from the web page */
|
999 |
/** Show a toast from the web page */
|
| 977 |
@JavascriptInterface
|
1000 |
@JavascriptInterface
|
| 978 |
public void showToast(String toast) {
|
1001 |
public void showToast(String toast) {
|
| 979 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(toast)));
|
1002 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("rawhtml",UtilityFunctions.compress(toast)));
|
| 980 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("zip","1"));
|
1003 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("zip","1"));
|
| - |
|
1004 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
1005 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
1006 |
nameValuePairsRawHtmlAmazon.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 981 |
if(isInternetOn()) {
|
1007 |
if(isInternetOn()) {
|
| 982 |
new amazonPushData().execute(nameValuePairsRawHtmlAmazon);
|
1008 |
new amazonPushData().execute(nameValuePairsRawHtmlAmazon);
|
| 983 |
}
|
1009 |
}
|
| 984 |
}
|
1010 |
}
|
| 985 |
|
1011 |
|
| Line 993... |
Line 1019... |
| 993 |
public void orderHistory(String html) {
|
1019 |
public void orderHistory(String html) {
|
| 994 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
1020 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 995 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(0)));
|
1021 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(0)));
|
| 996 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
1022 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 997 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
1023 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| - |
|
1024 |
amazonOrderHistory.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
1025 |
amazonOrderHistory.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
1026 |
amazonOrderHistory.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 998 |
if(isInternetOn()) {
|
1027 |
if(isInternetOn()) {
|
| 999 |
new pushQueuedData().execute(amazonOrderHistory);
|
1028 |
new pushQueuedData().execute(amazonOrderHistory);
|
| 1000 |
}
|
1029 |
}
|
| 1001 |
else{
|
1030 |
else{
|
| 1002 |
|
1031 |
|
| Line 1006... |
Line 1035... |
| 1006 |
public void cancelledHistory(String html) {
|
1035 |
public void cancelledHistory(String html) {
|
| 1007 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
1036 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 1008 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(j++)));
|
1037 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(j++)));
|
| 1009 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
1038 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 1010 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
1039 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| - |
|
1040 |
amazonOrderHistory.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
1041 |
amazonOrderHistory.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
1042 |
amazonOrderHistory.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 1011 |
if(isInternetOn()) {
|
1043 |
if(isInternetOn()) {
|
| 1012 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
1044 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
| 1013 |
}
|
1045 |
}
|
| 1014 |
else{
|
1046 |
else{
|
| 1015 |
|
1047 |
|
| Line 1021... |
Line 1053... |
| 1021 |
//Log.e("OrderUrls","Order amazonOrderUrls" + html);
|
1053 |
//Log.e("OrderUrls","Order amazonOrderUrls" + html);
|
| 1022 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
1054 |
List<NameValuePair> amazonOrderHistory = new ArrayList<>();
|
| 1023 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(1)));
|
1055 |
amazonOrderHistory.add(new BasicNameValuePair("url",str.get(1)));
|
| 1024 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
1056 |
amazonOrderHistory.add(new BasicNameValuePair("html",UtilityFunctions.compress(html)));
|
| 1025 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
1057 |
amazonOrderHistory.add(new BasicNameValuePair("zip","1"));
|
| - |
|
1058 |
amazonOrderHistory.add(new BasicNameValuePair("wifi",UtilityFunctions.checkWifi(getActivity())+""));
|
| - |
|
1059 |
amazonOrderHistory.add(new BasicNameValuePair("imeinumber",UtilityFunctions.getImeiNumber(getActivity())));
|
| - |
|
1060 |
amazonOrderHistory.add(new BasicNameValuePair("appversion",UtilityFunctions.getAppVersion(getActivity())));
|
| 1026 |
if(isInternetOn()) {
|
1061 |
if(isInternetOn()) {
|
| 1027 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
1062 |
new pushCancelledQueuedData().execute(amazonOrderHistory);
|
| 1028 |
}
|
1063 |
}
|
| 1029 |
else{
|
1064 |
else{
|
| 1030 |
|
1065 |
|
| Line 1756... |
Line 1791... |
| 1756 |
public void onDetach() {
|
1791 |
public void onDetach() {
|
| 1757 |
Log.d("Deals Home on Detach","Deals Home");
|
1792 |
Log.d("Deals Home on Detach","Deals Home");
|
| 1758 |
super.onDetach();
|
1793 |
super.onDetach();
|
| 1759 |
}
|
1794 |
}
|
| 1760 |
*/
|
1795 |
*/
|
| - |
|
1796 |
|
| - |
|
1797 |
/*
|
| - |
|
1798 |
class SnapdealSUPCCall extends AsyncTask<String, Integer, String> {
|
| - |
|
1799 |
|
| - |
|
1800 |
@Override
|
| - |
|
1801 |
protected void onPreExecute() {
|
| - |
|
1802 |
Log.d("In Supc ","In supc Call");
|
| - |
|
1803 |
super.onPreExecute();
|
| - |
|
1804 |
}
|
| - |
|
1805 |
|
| - |
|
1806 |
@Override
|
| - |
|
1807 |
protected String doInBackground(String... arg0) {
|
| - |
|
1808 |
HttpClient httpclient = new DefaultHttpClient();
|
| - |
|
1809 |
try {
|
| - |
|
1810 |
String url = arg0[0];
|
| - |
|
1811 |
String supcUrl = apiData.getString("snapdeal.supc","");
|
| - |
|
1812 |
HttpGet httppost = new HttpGet(supcUrl + Base64.encodeToString(url.getBytes(),Base64.NO_WRAP));
|
| - |
|
1813 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
| - |
|
1814 |
HttpResponse response = httpclient.execute(httppost);
|
| - |
|
1815 |
HttpEntity entity = response.getEntity();
|
| - |
|
1816 |
int status = response.getStatusLine().getStatusCode();
|
| - |
|
1817 |
if (status == 200) {
|
| - |
|
1818 |
System.out.println("ResponseCode While fetching URL: " + status + " is ");
|
| - |
|
1819 |
} else {
|
| - |
|
1820 |
Log.d("ResponseCode", status + "");
|
| - |
|
1821 |
System.out.println(" NOT Transfered");
|
| - |
|
1822 |
}
|
| - |
|
1823 |
|
| - |
|
1824 |
String jObjGmail = EntityUtils.toString(entity);
|
| - |
|
1825 |
System.out.println(jObjGmail);
|
| - |
|
1826 |
return jObjGmail;
|
| - |
|
1827 |
|
| - |
|
1828 |
} catch (ClientProtocolException e) {
|
| - |
|
1829 |
Log.e("data FetchOrderURLS ", "data FetchOrderURLS " + e.getMessage());
|
| - |
|
1830 |
return null;
|
| - |
|
1831 |
} catch (IOException e) {
|
| - |
|
1832 |
Log.e("data FetchOrderURLS ", "data FetchOrderURLS " + e.getMessage());
|
| - |
|
1833 |
return null;
|
| - |
|
1834 |
} catch (Exception e) {
|
| - |
|
1835 |
Log.e("data FetchOrderURLS ", "data FetchOrderURLS " + e.getMessage());
|
| - |
|
1836 |
return null;
|
| - |
|
1837 |
}
|
| - |
|
1838 |
}
|
| - |
|
1839 |
|
| - |
|
1840 |
@Override
|
| - |
|
1841 |
protected void onPostExecute(String result) {
|
| - |
|
1842 |
super.onPostExecute(result);
|
| - |
|
1843 |
snapdealJavascriptUrl=result;
|
| - |
|
1844 |
Log.d("In Supc ","In supc Call post execute " + result);
|
| - |
|
1845 |
}
|
| - |
|
1846 |
}
|
| - |
|
1847 |
*/
|
| - |
|
1848 |
public void redirectPage(final AlertDialog builder){
|
| - |
|
1849 |
Handler h =new Handler();
|
| - |
|
1850 |
h.postDelayed(new Runnable() {
|
| - |
|
1851 |
@Override
|
| - |
|
1852 |
public void run() {
|
| - |
|
1853 |
if(builder!=null){
|
| - |
|
1854 |
builder.dismiss();
|
| - |
|
1855 |
}
|
| - |
|
1856 |
userDataEditor.clear().commit();
|
| - |
|
1857 |
startActivity(new Intent(getActivity(), LoginActivity.class));
|
| - |
|
1858 |
}
|
| - |
|
1859 |
},3000);
|
| - |
|
1860 |
|
| - |
|
1861 |
}
|
| 1761 |
}
|
1862 |
}
|
| 1762 |
|
1863 |
|
| 1763 |
|
1864 |
|
| 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
|
1865 |
//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
|
| 1765 |
|
1866 |
|