| Line 83... |
Line 83... |
| 83 |
|
83 |
|
| 84 |
}
|
84 |
}
|
| 85 |
|
85 |
|
| 86 |
static boolean FLAG=false,REDIRECT=false,PAGE_LOAD=false,PAYTMFLAG=false,isPause=false;
|
86 |
static boolean FLAG=false,REDIRECT=false,PAGE_LOAD=false,PAYTMFLAG=false,isPause=false;
|
| 87 |
int snapdealException=0;
|
87 |
int snapdealException=0;
|
| 88 |
WebView webView;
|
88 |
public static WebView webView;
|
| 89 |
WebView amazonWebView,amazonOrderHistoryWebView,amazonOrderHistoryCancelledWebView,paytmWebView;
|
89 |
WebView amazonWebView,amazonOrderHistoryWebView,amazonOrderHistoryCancelledWebView,paytmWebView;
|
| 90 |
WebView amazonAllUrlsWebView;
|
90 |
WebView amazonAllUrlsWebView;
|
| 91 |
SharedPreferences userData;
|
91 |
SharedPreferences userData;
|
| 92 |
SharedPreferences apiData;
|
92 |
SharedPreferences apiData;
|
| 93 |
SharedPreferences flipkartData;
|
93 |
SharedPreferences flipkartData;
|
| Line 187... |
Line 187... |
| 187 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
187 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
| 188 |
while(st1.hasMoreTokens()){
|
188 |
while(st1.hasMoreTokens()){
|
| 189 |
pageLoadList.add( st1.nextToken());
|
189 |
pageLoadList.add( st1.nextToken());
|
| 190 |
}
|
190 |
}
|
| 191 |
WebClientClass webViewClient = new WebClientClass();
|
191 |
WebClientClass webViewClient = new WebClientClass();
|
| - |
|
192 |
if(webView !=null){
|
| - |
|
193 |
webView.loadUrl("about:blank");
|
| - |
|
194 |
}
|
| 192 |
webView = (WebView) rootView.findViewById(R.id.webView);
|
195 |
webView = (WebView) rootView.findViewById(R.id.webView);
|
| 193 |
webView.setClickable(true);
|
196 |
webView.setClickable(true);
|
| 194 |
webView.setFocusableInTouchMode(true);
|
197 |
webView.setFocusableInTouchMode(true);
|
| 195 |
webView.getSettings().setDomStorageEnabled(true);
|
198 |
webView.getSettings().setDomStorageEnabled(true);
|
| 196 |
webView.getSettings().setJavaScriptEnabled(true);
|
199 |
webView.getSettings().setJavaScriptEnabled(true);
|
| Line 312... |
Line 315... |
| 312 |
List<String> snapdealExceptionUrls = new ArrayList<>();
|
315 |
List<String> snapdealExceptionUrls = new ArrayList<>();
|
| 313 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls",""),"|");
|
316 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls",""),"|");
|
| 314 |
while(st.hasMoreTokens()){
|
317 |
while(st.hasMoreTokens()){
|
| 315 |
snapdealExceptionUrls.add( st.nextToken());
|
318 |
snapdealExceptionUrls.add( st.nextToken());
|
| 316 |
}
|
319 |
}
|
| - |
|
320 |
try {
|
| - |
|
321 |
Log.d("Count","Count " +apiData.getString("snapdeal.exception.count","1"));
|
| 317 |
for(String s:snapdealExceptionUrls){
|
322 |
for(String s:snapdealExceptionUrls){
|
| 318 |
if(url.contains(s)){
|
323 |
if(url.contains(s)){
|
| 319 |
if(snapdealException==0){
|
324 |
if(snapdealException<=Integer.parseInt(apiData.getString("snapdeal.exception.count","1"))){
|
| 320 |
webView.reload();
|
325 |
webView.reload();
|
| 321 |
snapdealException=1;
|
326 |
snapdealException+=1;
|
| - |
|
327 |
}
|
| - |
|
328 |
return false;
|
| 322 |
}
|
329 |
}
|
| 323 |
return false;
|
- |
|
| 324 |
}
|
330 |
}
|
| - |
|
331 |
}catch(Exception e){
|
| - |
|
332 |
e.printStackTrace();
|
| 325 |
}
|
333 |
}
|
| 326 |
}
|
334 |
}
|
| 327 |
if(apiData.getString("isRedirect","false").equalsIgnoreCase("true")){
|
335 |
if(apiData.getString("isRedirect","false").equalsIgnoreCase("true")){
|
| 328 |
List<String> browserRedirectUrl = new ArrayList<>();
|
336 |
List<String> browserRedirectUrl = new ArrayList<>();
|
| 329 |
StringTokenizer st = new StringTokenizer(apiData.getString("redirect.urls",""),"|");
|
337 |
StringTokenizer st = new StringTokenizer(apiData.getString("redirect.urls",""),"|");
|
| Line 394... |
Line 402... |
| 394 |
if(url.startsWith("tel")){
|
402 |
if(url.startsWith("tel")){
|
| 395 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
403 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
| 396 |
startActivity(intent);
|
404 |
startActivity(intent);
|
| 397 |
return true;
|
405 |
return true;
|
| 398 |
}
|
406 |
}
|
| - |
|
407 |
if(url.contains(apiData.getString("contactus.url", ""))){
|
| - |
|
408 |
Intent i = new Intent(getActivity(),MainActivity.class);
|
| - |
|
409 |
i.putExtra("displayView","6");
|
| - |
|
410 |
startActivity(i);
|
| - |
|
411 |
return true;
|
| - |
|
412 |
}
|
| - |
|
413 |
if(url.contains(apiData.getString("howitworks.url",""))){
|
| - |
|
414 |
Intent i = new Intent(getActivity(),MainActivity.class);
|
| - |
|
415 |
i.putExtra("displayView", "7");
|
| - |
|
416 |
startActivity(i);
|
| - |
|
417 |
return true;
|
| - |
|
418 |
}
|
| - |
|
419 |
if(url.contains(apiData.getString("myprofile.url", "http://api.profittill.com/aboutus/profile"))){
|
| - |
|
420 |
Intent i = new Intent(getActivity(),MainActivity.class);
|
| - |
|
421 |
i.putExtra("displayView","15");
|
| - |
|
422 |
startActivity(i);
|
| - |
|
423 |
return true;
|
| - |
|
424 |
}
|
| 399 |
return false;
|
425 |
return false;
|
| 400 |
|
426 |
|
| 401 |
}
|
427 |
}
|
| 402 |
|
428 |
|
| 403 |
@Override
|
429 |
@Override
|
| Line 570... |
Line 596... |
| 570 |
|
596 |
|
| 571 |
@Override
|
597 |
@Override
|
| 572 |
public synchronized void onPageFinished(WebView view, String url) {
|
598 |
public synchronized void onPageFinished(WebView view, String url) {
|
| 573 |
super.onPageFinished(view, url);
|
599 |
super.onPageFinished(view, url);
|
| 574 |
try {
|
600 |
try {
|
| - |
|
601 |
if(url.equalsIgnoreCase("about:blank")){
|
| - |
|
602 |
Log.d("Blankl Url","Blank Url");
|
| - |
|
603 |
}else {
|
| 575 |
if(getActivity()!=null) {
|
604 |
if (getActivity() != null) {
|
| 576 |
if (url.contains(apiData.getString("notification.page.url", "http://api.profittill.com/users/usernotification"))) {
|
605 |
if (url.contains(apiData.getString("notification.page.url", "http://api.profittill.com/users/usernotification"))) {
|
| 577 |
String notificationUrl = apiData.getString("notification.count", "http://45.33.50.227:3001/getNotificationCount") + "?user_id=" + userData.getString("id", "") + "&android_id=" + UtilityFunctions.androidId(getActivity());
|
606 |
String notificationUrl = apiData.getString("notification.count", "http://45.33.50.227:3001/getNotificationCount") + "?user_id=" + userData.getString("id", "") + "&android_id=" + UtilityFunctions.androidId(getActivity());
|
| 578 |
new NotificationCount().getCount(getActivity(), null, notificationUrl);
|
607 |
new NotificationCount().getCount(getActivity(), null, notificationUrl);
|
| 579 |
new Handler().postDelayed(new Runnable() {
|
608 |
new Handler().postDelayed(new Runnable() {
|
| 580 |
@Override
|
609 |
@Override
|
| 581 |
public void run() {
|
610 |
public void run() {
|
| 582 |
getActivity().invalidateOptionsMenu();
|
611 |
getActivity().invalidateOptionsMenu();
|
| - |
|
612 |
}
|
| - |
|
613 |
}, 1000);
|
| - |
|
614 |
}
|
| - |
|
615 |
}
|
| - |
|
616 |
if (apiData.getString("snapdealException", "true").equalsIgnoreCase("true")) {
|
| - |
|
617 |
List<String> snapdealExceptionUrlsPass = new ArrayList<>();
|
| - |
|
618 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls.pass", ""), "|");
|
| - |
|
619 |
while (st.hasMoreTokens()) {
|
| - |
|
620 |
snapdealExceptionUrlsPass.add(st.nextToken());
|
| - |
|
621 |
}
|
| - |
|
622 |
for (String s : snapdealExceptionUrlsPass) {
|
| - |
|
623 |
if (url.contains(s)) {
|
| - |
|
624 |
snapdealException = 0;
|
| 583 |
}
|
625 |
}
|
| 584 |
},1000);
|
626 |
}
|
| 585 |
}
|
627 |
}
|
| 586 |
}
|
- |
|
| 587 |
if(apiData.getString("snapdealException","true").equalsIgnoreCase("true")){
|
- |
|
| 588 |
List<String> snapdealExceptionUrlsPass = new ArrayList<>();
|
- |
|
| 589 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls.pass",""),"|");
|
628 |
if (url.contains(apiData.getString("mobile.website.url", "")) || url.equalsIgnoreCase("http://api.profittill.com/categorydeals") || url.contains(apiData.getString("notification.page.url", "http://api.profittill.com/users/usernotification"))) {
|
| 590 |
while(st.hasMoreTokens()){
|
629 |
pd.dismiss();
|
| 591 |
snapdealExceptionUrlsPass.add( st.nextToken());
|
- |
|
| 592 |
}
|
630 |
}
|
| 593 |
for(String s:snapdealExceptionUrlsPass){
|
631 |
if (snapdealPageLoad == 1) {
|
| - |
|
632 |
snapdealPageLoad = 0;
|
| - |
|
633 |
}
|
| - |
|
634 |
if (pd2 != null) {
|
| - |
|
635 |
pd2.dismiss();
|
| - |
|
636 |
}
|
| - |
|
637 |
if (Uri.parse(url).getHost().equalsIgnoreCase("paytm.com")) {
|
| - |
|
638 |
view.loadUrl("javascript:try{" +
|
| - |
|
639 |
"var lastUrl=document.URL;" +
|
| - |
|
640 |
"setInterval(function(){var currentUrl=document.URL;" +
|
| - |
|
641 |
"if(currentUrl!=lastUrl){window.HTMLOUT.paytmUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
| - |
|
642 |
"}catch(error){Android.onError(error.message);}");
|
| - |
|
643 |
}
|
| - |
|
644 |
if (Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data", "false").equalsIgnoreCase("true")) {
|
| - |
|
645 |
saholicUrl = url;
|
| - |
|
646 |
view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
| - |
|
647 |
}
|
| - |
|
648 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
| - |
|
649 |
fetchOrderDetails();
|
| - |
|
650 |
}
|
| - |
|
651 |
if (displayActionBar) {
|
| 594 |
if(url.contains(s)){
|
652 |
if (url.contains("amazon")) {
|
| - |
|
653 |
view.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
| - |
|
654 |
pd1.dismiss();
|
| - |
|
655 |
amazonWebView = new WebView(webView.getContext());
|
| - |
|
656 |
amazonWebView.setVisibility(View.GONE);
|
| - |
|
657 |
amazonWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| - |
|
658 |
amazonWebView.getSettings().setJavaScriptEnabled(true);
|
| - |
|
659 |
|
| - |
|
660 |
} else if (url.contains(ProfitTillConstants.PAYTM)) {
|
| - |
|
661 |
PaytmWebViewClient paytmWebViewClient = new PaytmWebViewClient();
|
| - |
|
662 |
pd1.dismiss();
|
| - |
|
663 |
paytmWebView = new WebView(webView.getContext());
|
| - |
|
664 |
paytmWebView.setVisibility(View.GONE);
|
| - |
|
665 |
paytmWebView.addJavascriptInterface(new paytmInterface(getActivity()), "HTMLOUT");
|
| - |
|
666 |
paytmWebView.getSettings().setJavaScriptEnabled(true);
|
| - |
|
667 |
paytmWebView.loadUrl(getPaytmReferer(url));
|
| - |
|
668 |
paytmWebView.setWebViewClient(paytmWebViewClient);
|
| - |
|
669 |
} else {
|
| - |
|
670 |
view.loadUrl("javascript:window.HTMLOUT.flipkartHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
| 595 |
snapdealException=0;
|
671 |
pd1.dismiss();
|
| 596 |
}
|
672 |
}
|
| 597 |
}
|
673 |
}
|
| 598 |
}
|
- |
|
| 599 |
if (url.contains(apiData.getString("mobile.website.url", "")) || url.equalsIgnoreCase("http://api.profittill.com/categorydeals") || url.contains(apiData.getString("notification.page.url", "http://api.profittill.com/users/usernotification"))) {
|
- |
|
| 600 |
pd.dismiss();
|
- |
|
| 601 |
}
|
- |
|
| 602 |
if(snapdealPageLoad==1){
|
- |
|
| 603 |
snapdealPageLoad=0;
|
- |
|
| 604 |
}
|
- |
|
| 605 |
if(pd2!=null){
|
- |
|
| 606 |
pd2.dismiss();
|
- |
|
| 607 |
}
|
- |
|
| 608 |
if(Uri.parse(url).getHost().equalsIgnoreCase("paytm.com")){
|
- |
|
| 609 |
view.loadUrl("javascript:try{" +
|
- |
|
| 610 |
"var lastUrl=document.URL;" +
|
- |
|
| 611 |
"setInterval(function(){var currentUrl=document.URL;" +
|
- |
|
| 612 |
"if(currentUrl!=lastUrl){window.HTMLOUT.paytmUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
- |
|
| 613 |
"}catch(error){Android.onError(error.message);}");
|
- |
|
| 614 |
}
|
- |
|
| 615 |
if(Uri.parse(url).getHost().contains("saholic") && userData.getString("saholic.data","false").equalsIgnoreCase("true")){
|
- |
|
| 616 |
saholicUrl=url;
|
- |
|
| 617 |
view.loadUrl("javascript:window.HTMLOUT.saholicHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
- |
|
| 618 |
}
|
- |
|
| 619 |
if (url.contains(apiData.getString("amazon.tracking.order.url", ""))) {
|
- |
|
| 620 |
fetchOrderDetails();
|
- |
|
| 621 |
}
|
- |
|
| 622 |
if (displayActionBar) {
|
- |
|
| 623 |
if (url.contains("amazon")) {
|
- |
|
| 624 |
view.loadUrl("javascript:window.HTMLOUT.showHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
- |
|
| 625 |
pd1.dismiss();
|
- |
|
| 626 |
amazonWebView = new WebView(webView.getContext());
|
- |
|
| 627 |
amazonWebView.setVisibility(View.GONE);
|
- |
|
| 628 |
amazonWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
- |
|
| 629 |
amazonWebView.getSettings().setJavaScriptEnabled(true);
|
- |
|
| 630 |
|
- |
|
| 631 |
} else if(url.contains(ProfitTillConstants.PAYTM)) {
|
- |
|
| 632 |
PaytmWebViewClient paytmWebViewClient = new PaytmWebViewClient();
|
- |
|
| 633 |
pd1.dismiss();
|
- |
|
| 634 |
paytmWebView = new WebView(webView.getContext());
|
- |
|
| 635 |
paytmWebView.setVisibility(View.GONE);
|
- |
|
| 636 |
paytmWebView.addJavascriptInterface(new paytmInterface(getActivity()), "HTMLOUT");
|
- |
|
| 637 |
paytmWebView.getSettings().setJavaScriptEnabled(true);
|
- |
|
| 638 |
paytmWebView.loadUrl(getPaytmReferer(url));
|
- |
|
| 639 |
paytmWebView.setWebViewClient(paytmWebViewClient);
|
- |
|
| 640 |
} else {
|
- |
|
| 641 |
view.loadUrl("javascript:window.HTMLOUT.flipkartHTML('<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');");
|
- |
|
| 642 |
pd1.dismiss();
|
- |
|
| 643 |
}
|
- |
|
| 644 |
}
|
- |
|
| 645 |
|
- |
|
| 646 |
amazonOrderHistoryWebView = new WebView(webView.getContext());
|
- |
|
| 647 |
amazonOrderHistoryWebView.setVisibility(View.GONE);
|
- |
|
| 648 |
amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
- |
|
| 649 |
amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
|
- |
|
| 650 |
amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
- |
|
| 651 |
|
- |
|
| 652 |
amazonOrderHistoryCancelledWebView = new WebView(webView.getContext());
|
- |
|
| 653 |
amazonOrderHistoryCancelledWebView.setVisibility(View.GONE);
|
- |
|
| 654 |
amazonOrderHistoryCancelledWebView.getSettings().setJavaScriptEnabled(true);
|
- |
|
| 655 |
amazonOrderHistoryCancelledWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
- |
|
| 656 |
amazonOrderHistoryCancelledWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
- |
|
| 657 |
|
- |
|
| 658 |
amazonAllUrlsWebView = new WebView(webView.getContext());
|
- |
|
| 659 |
amazonAllUrlsWebView.setVisibility(View.GONE);
|
- |
|
| 660 |
amazonAllUrlsWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
- |
|
| 661 |
amazonAllUrlsWebView.getSettings().setJavaScriptEnabled(true);
|
- |
|
| 662 |
amazonAllUrlsWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
- |
|
| 663 |
|
674 |
|
| 664 |
if (url.contains("https://www.amazon.in/ap/signin")) {
|
- |
|
| 665 |
if (!FLAG) {
|
- |
|
| 666 |
FLAG = true;
|
- |
|
| 667 |
userDataEditor.putString("amazonOrder","true").commit();
|
- |
|
| 668 |
userDataEditor.putBoolean("amazonLoggedIn",true).commit();
|
- |
|
| 669 |
}
|
- |
|
| 670 |
} else if (FLAG) {
|
- |
|
| 671 |
view.loadUrl("javascript:try{" +
|
- |
|
| 672 |
"var lastUrl=document.URL;" +
|
- |
|
| 673 |
"setInterval(function(){var currentUrl=document.URL;" +
|
- |
|
| 674 |
"if(currentUrl!=lastUrl){window.HTMLOUT.amazonUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
- |
|
| 675 |
"}catch(error){Android.onError(error.message);}");
|
- |
|
| 676 |
amazonOrderHistoryWebView = new WebView(webView.getContext());
|
675 |
amazonOrderHistoryWebView = new WebView(webView.getContext());
|
| 677 |
amazonOrderHistoryWebView.setVisibility(View.GONE);
|
676 |
amazonOrderHistoryWebView.setVisibility(View.GONE);
|
| 678 |
amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
677 |
amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
| 679 |
amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
|
678 |
amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
|
| 680 |
amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
679 |
amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| - |
|
680 |
|
| 681 |
amazonOrderHistoryCancelledWebView = new WebView(webView.getContext());
|
681 |
amazonOrderHistoryCancelledWebView = new WebView(webView.getContext());
|
| 682 |
amazonOrderHistoryCancelledWebView.setVisibility(View.GONE);
|
682 |
amazonOrderHistoryCancelledWebView.setVisibility(View.GONE);
|
| 683 |
amazonOrderHistoryCancelledWebView.getSettings().setJavaScriptEnabled(true);
|
683 |
amazonOrderHistoryCancelledWebView.getSettings().setJavaScriptEnabled(true);
|
| 684 |
amazonOrderHistoryCancelledWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
684 |
amazonOrderHistoryCancelledWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
| 685 |
amazonOrderHistoryCancelledWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
685 |
amazonOrderHistoryCancelledWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| 686 |
fetchOrderDetails();
|
- |
|
| 687 |
FLAG = false;
|
- |
|
| 688 |
}
|
- |
|
| 689 |
|
686 |
|
| - |
|
687 |
amazonAllUrlsWebView = new WebView(webView.getContext());
|
| - |
|
688 |
amazonAllUrlsWebView.setVisibility(View.GONE);
|
| - |
|
689 |
amazonAllUrlsWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
| - |
|
690 |
amazonAllUrlsWebView.getSettings().setJavaScriptEnabled(true);
|
| - |
|
691 |
amazonAllUrlsWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| - |
|
692 |
|
| - |
|
693 |
if (url.contains("https://www.amazon.in/ap/signin")) {
|
| - |
|
694 |
if (!FLAG) {
|
| - |
|
695 |
FLAG = true;
|
| - |
|
696 |
userDataEditor.putString("amazonOrder", "true").commit();
|
| - |
|
697 |
userDataEditor.putBoolean("amazonLoggedIn", true).commit();
|
| - |
|
698 |
}
|
| - |
|
699 |
} else if (FLAG) {
|
| - |
|
700 |
view.loadUrl("javascript:try{" +
|
| - |
|
701 |
"var lastUrl=document.URL;" +
|
| - |
|
702 |
"setInterval(function(){var currentUrl=document.URL;" +
|
| - |
|
703 |
"if(currentUrl!=lastUrl){window.HTMLOUT.amazonUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
| - |
|
704 |
"}catch(error){Android.onError(error.message);}");
|
| - |
|
705 |
amazonOrderHistoryWebView = new WebView(webView.getContext());
|
| - |
|
706 |
amazonOrderHistoryWebView.setVisibility(View.GONE);
|
| - |
|
707 |
amazonOrderHistoryWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
| - |
|
708 |
amazonOrderHistoryWebView.getSettings().setJavaScriptEnabled(true);
|
| - |
|
709 |
amazonOrderHistoryWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| - |
|
710 |
amazonOrderHistoryCancelledWebView = new WebView(webView.getContext());
|
| - |
|
711 |
amazonOrderHistoryCancelledWebView.setVisibility(View.GONE);
|
| - |
|
712 |
amazonOrderHistoryCancelledWebView.getSettings().setJavaScriptEnabled(true);
|
| - |
|
713 |
amazonOrderHistoryCancelledWebView.getSettings().setUserAgentString("Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.99 Safari/537.36");
|
| - |
|
714 |
amazonOrderHistoryCancelledWebView.addJavascriptInterface(new amazonInterface(getActivity()), "HTMLOUT");
|
| - |
|
715 |
fetchOrderDetails();
|
| - |
|
716 |
FLAG = false;
|
| - |
|
717 |
}
|
| - |
|
718 |
|
| 690 |
view.setOnKeyListener(new View.OnKeyListener() {
|
719 |
view.setOnKeyListener(new View.OnKeyListener() {
|
| 691 |
@Override
|
720 |
@Override
|
| 692 |
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
721 |
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
| 693 |
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
722 |
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
| 694 |
WebView webView = (WebView) v;
|
723 |
WebView webView = (WebView) v;
|
| 695 |
switch (keyCode) {
|
724 |
switch (keyCode) {
|
| 696 |
case KeyEvent.KEYCODE_BACK:
|
725 |
case KeyEvent.KEYCODE_BACK:
|
| 697 |
if ((webView.canGoBack() && !webView.getUrl().contains(apiData.getString("mobile.website.url", null))) || pageRedirect==2) {
|
726 |
if ((webView.canGoBack() && !webView.getUrl().contains(apiData.getString("mobile.website.url", null))) || pageRedirect == 2) {
|
| 698 |
webView.goBack();
|
727 |
webView.goBack();
|
| 699 |
pageRedirect=0;
|
728 |
pageRedirect = 0;
|
| 700 |
snapdealPageLoad=0;
|
729 |
snapdealPageLoad = 0;
|
| 701 |
return true;
|
730 |
return true;
|
| 702 |
} else if (affliateUrl.contains("flipkart") || affliateUrl.contains("amazon") || affliateUrl.contains("snapdeal") || affliateUrl.contains("saholic") || affliateUrl.contains(apiData.getString("myorders.url", "")) || affliateUrl.contains(apiData.getString("search.url", ""))) {
|
731 |
} else if (affliateUrl.contains("flipkart") || affliateUrl.contains("amazon") || affliateUrl.contains("snapdeal") || affliateUrl.contains("saholic") || affliateUrl.contains(apiData.getString("myorders.url", "")) || affliateUrl.contains(apiData.getString("search.url", ""))) {
|
| 703 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
732 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
| 704 |
i.putExtra("displayView", "0");
|
733 |
i.putExtra("displayView", "0");
|
| 705 |
startActivity(i);
|
734 |
startActivity(i);
|
| 706 |
return true;
|
735 |
return true;
|
| 707 |
} else if (webView.getUrl().contains(apiData.getString("mobile.website.url", null))) {
|
736 |
} else if (webView.getUrl().contains(apiData.getString("mobile.website.url", null))) {
|
| 708 |
new AlertDialog.Builder(getActivity())
|
737 |
new AlertDialog.Builder(getActivity())
|
| 709 |
.setIcon(android.R.drawable.ic_dialog_alert)
|
738 |
.setIcon(android.R.drawable.ic_dialog_alert)
|
| 710 |
.setTitle("Exit!")
|
739 |
.setTitle("Exit!")
|
| 711 |
.setMessage("Are you sure you want to close?")
|
740 |
.setMessage("Are you sure you want to close?")
|
| 712 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
741 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
| 713 |
@Override
|
742 |
@Override
|
| 714 |
public void onClick(DialogInterface dialog, int which) {
|
743 |
public void onClick(DialogInterface dialog, int which) {
|
| 715 |
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
744 |
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
| 716 |
startMain.addCategory(Intent.CATEGORY_HOME);
|
745 |
startMain.addCategory(Intent.CATEGORY_HOME);
|
| 717 |
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
746 |
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
| 718 |
|
747 |
|
| 719 |
startActivity(startMain);
|
748 |
startActivity(startMain);
|
| 720 |
}
|
749 |
}
|
| 721 |
|
750 |
|
| 722 |
})
|
751 |
})
|
| 723 |
.setNegativeButton("No", null)
|
752 |
.setNegativeButton("No", null)
|
| 724 |
.show();
|
753 |
.show();
|
| 725 |
} else {
|
754 |
} else {
|
| 726 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
755 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
| 727 |
i.putExtra("displayView", "0");
|
756 |
i.putExtra("displayView", "0");
|
| 728 |
startActivity(i);
|
757 |
startActivity(i);
|
| 729 |
return true;
|
758 |
return true;
|
| 730 |
}
|
759 |
}
|
| 731 |
|
760 |
|
| 732 |
break;
|
761 |
break;
|
| - |
|
762 |
}
|
| 733 |
}
|
763 |
}
|
| - |
|
764 |
return false;
|
| 734 |
}
|
765 |
}
|
| 735 |
|
- |
|
| 736 |
return false;
|
- |
|
| 737 |
}
|
766 |
});
|
| 738 |
});
|
767 |
}
|
| 739 |
|
- |
|
| 740 |
}catch (Exception e){
|
768 |
}catch (Exception e){
|
| 741 |
e.printStackTrace();
|
769 |
e.printStackTrace();
|
| 742 |
TestinAgent.uploadException(getActivity(),"On Page Finished",e);
|
770 |
TestinAgent.uploadException(getActivity(),"On Page Finished",e);
|
| 743 |
}
|
771 |
}
|
| 744 |
}
|
772 |
}
|