| Line 45... |
Line 45... |
| 45 |
import android.webkit.CookieSyncManager;
|
45 |
import android.webkit.CookieSyncManager;
|
| 46 |
import android.webkit.HttpAuthHandler;
|
46 |
import android.webkit.HttpAuthHandler;
|
| 47 |
import android.webkit.JavascriptInterface;
|
47 |
import android.webkit.JavascriptInterface;
|
| 48 |
import android.webkit.ValueCallback;
|
48 |
import android.webkit.ValueCallback;
|
| 49 |
import android.webkit.WebChromeClient;
|
49 |
import android.webkit.WebChromeClient;
|
| - |
|
50 |
import android.webkit.WebResourceError;
|
| 50 |
import android.webkit.WebResourceResponse;
|
51 |
import android.webkit.WebResourceRequest;
|
| 51 |
import android.webkit.WebSettings;
|
52 |
import android.webkit.WebSettings;
|
| 52 |
import android.webkit.WebView;
|
53 |
import android.webkit.WebView;
|
| 53 |
import android.webkit.WebViewClient;
|
54 |
import android.webkit.WebViewClient;
|
| 54 |
import android.widget.CheckBox;
|
55 |
import android.widget.CheckBox;
|
| 55 |
import android.widget.CompoundButton;
|
56 |
import android.widget.CompoundButton;
|
| Line 83... |
Line 84... |
| 83 |
import org.json.JSONObject;
|
84 |
import org.json.JSONObject;
|
| 84 |
|
85 |
|
| 85 |
import java.io.File;
|
86 |
import java.io.File;
|
| 86 |
import java.io.IOException;
|
87 |
import java.io.IOException;
|
| 87 |
import java.io.InputStream;
|
88 |
import java.io.InputStream;
|
| 88 |
import java.io.StringBufferInputStream;
|
- |
|
| 89 |
import java.io.UnsupportedEncodingException;
|
89 |
import java.io.UnsupportedEncodingException;
|
| - |
|
90 |
import java.net.URISyntaxException;
|
| 90 |
import java.text.SimpleDateFormat;
|
91 |
import java.text.SimpleDateFormat;
|
| 91 |
import java.util.ArrayList;
|
92 |
import java.util.ArrayList;
|
| 92 |
import java.util.Date;
|
93 |
import java.util.Date;
|
| 93 |
import java.util.HashMap;
|
94 |
import java.util.HashMap;
|
| 94 |
import java.util.Iterator;
|
95 |
import java.util.Iterator;
|
| Line 175... |
Line 176... |
| 175 |
notifciationCount.setVisibility(View.GONE);
|
176 |
notifciationCount.setVisibility(View.GONE);
|
| 176 |
}*/
|
177 |
}*/
|
| 177 |
}
|
178 |
}
|
| 178 |
@Override
|
179 |
@Override
|
| 179 |
public boolean onOptionsItemSelected(MenuItem item) {
|
180 |
public boolean onOptionsItemSelected(MenuItem item) {
|
| 180 |
Fragment menuFragment = null;
|
- |
|
| 181 |
JSONObject props = new JSONObject();
|
- |
|
| 182 |
Bundle args = new Bundle();
|
- |
|
| 183 |
String id = userData.getString("id", null);
|
- |
|
| 184 |
/*if (mDrawerToggle.onOptionsItemSelected(item)) {
|
- |
|
| 185 |
return true;
|
- |
|
| 186 |
}
|
- |
|
| 187 |
*/
|
181 |
|
| 188 |
switch (item.getItemId()) {
|
182 |
switch (item.getItemId()) {
|
| 189 |
|
183 |
|
| 190 |
case android.R.id.home:
|
184 |
case android.R.id.home:
|
| 191 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
185 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
| 192 |
i.putExtra("displayView", "0");
|
186 |
i.putExtra("displayView", "13");
|
| 193 |
startActivity(i);
|
187 |
startActivity(i);
|
| 194 |
return true;
|
188 |
return true;
|
| 195 |
|
189 |
|
| 196 |
}
|
190 |
}
|
| 197 |
return super.onOptionsItemSelected(item);
|
191 |
return super.onOptionsItemSelected(item);
|
| 198 |
}
|
192 |
}
|
| 199 |
|
193 |
|
| 200 |
@Override
|
194 |
@Override
|
| - |
|
195 |
public void startActivityForResult(Intent intent, int requestCode, Bundle options) {
|
| - |
|
196 |
super.startActivityForResult(intent, requestCode, options);
|
| - |
|
197 |
}
|
| - |
|
198 |
|
| - |
|
199 |
@Override
|
| 201 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
200 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
| 202 |
Bundle savedInstanceState) {
|
201 |
Bundle savedInstanceState) {
|
| 203 |
|
202 |
|
| 204 |
|
203 |
|
| 205 |
View rootView = inflater.inflate(R.layout.fragment_deals_home, container, false);
|
204 |
View rootView = inflater.inflate(R.layout.fragment_deals_home, container, false);
|
| 206 |
|
- |
|
| 207 |
TestinAgent.init(getActivity());
|
205 |
TestinAgent.init(getActivity());
|
| - |
|
206 |
int InstanceId = DealsHomeFragment.class.hashCode();
|
| 208 |
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
207 |
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
| 209 |
ActionBar actionBar = activity.getSupportActionBar();
|
208 |
ActionBar actionBar = activity.getSupportActionBar();
|
| 210 |
actionBar.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
209 |
actionBar.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
| 211 |
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
210 |
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
| 212 |
upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
211 |
upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
| 213 |
actionBar.setHomeAsUpIndicator(upArrow);
|
212 |
actionBar.setHomeAsUpIndicator(upArrow);
|
| 214 |
//actionBar.setIcon(R.drawable.logo_cirlce_1);
|
- |
|
| 215 |
actionBar.setDisplayShowCustomEnabled(true);
|
213 |
actionBar.setDisplayShowCustomEnabled(true);
|
| 216 |
actionBar.setDisplayShowTitleEnabled(false);
|
214 |
actionBar.setDisplayShowTitleEnabled(false);
|
| 217 |
actionBar.setDisplayHomeAsUpEnabled(true);
|
215 |
actionBar.setDisplayHomeAsUpEnabled(true);
|
| 218 |
actionBar.setHomeButtonEnabled(true);
|
216 |
actionBar.setHomeButtonEnabled(true);
|
| 219 |
actionBar.setCustomView(R.layout.actionbarprofittill);
|
217 |
actionBar.setCustomView(R.layout.actionbarprofittill);
|
| Line 268... |
Line 266... |
| 268 |
webView.getSettings().setDomStorageEnabled(true);
|
266 |
webView.getSettings().setDomStorageEnabled(true);
|
| 269 |
webView.getSettings().setDatabaseEnabled(true);
|
267 |
webView.getSettings().setDatabaseEnabled(true);
|
| 270 |
webView.getSettings().setJavaScriptEnabled(true);
|
268 |
webView.getSettings().setJavaScriptEnabled(true);
|
| 271 |
webView.getSettings().setAllowContentAccess(true);
|
269 |
webView.getSettings().setAllowContentAccess(true);
|
| 272 |
webView.getSettings().setAllowFileAccess(true);
|
270 |
webView.getSettings().setAllowFileAccess(true);
|
| 273 |
//webView.getSettings().setAppCacheEnabled(false);
|
- |
|
| - |
|
271 |
|
| 274 |
webView.addJavascriptInterface(new javascriptInterface(webView),"HTMLOUT");
|
272 |
webView.addJavascriptInterface(new javascriptInterface(webView),"HTMLOUT");
|
| 275 |
if(Build.VERSION.SDK_INT >= 21){
|
273 |
if(Build.VERSION.SDK_INT >= 21){
|
| 276 |
webView.getSettings().setMixedContentMode(0);
|
274 |
webView.getSettings().setMixedContentMode(0);
|
| 277 |
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
275 |
webView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
| 278 |
}else if(Build.VERSION.SDK_INT >= 19){
|
276 |
}else if(Build.VERSION.SDK_INT >= 19){
|
| Line 361... |
Line 359... |
| 361 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
359 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
| 362 |
webView.getSettings().setAllowContentAccess(true);
|
360 |
webView.getSettings().setAllowContentAccess(true);
|
| 363 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
361 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
| 364 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
362 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
| 365 |
}
|
363 |
}
|
| 366 |
if (Uri.parse(getArguments().getString("key")).getHost().contains("api.profittill")) {
|
364 |
if (Uri.parse(getArguments().getString("key")).getHost().contains("app.profitmandi")) {
|
| 367 |
userDataEditor.putString("saholic.data", UtilityFunctions.clearCookiesNew(getArguments().getString("key"), getActivity())).commit();
|
365 |
userDataEditor.putString("saholic.data", UtilityFunctions.clearCookiesNew(getArguments().getString("key"), getActivity())).commit();
|
| 368 |
}
|
366 |
}
|
| 369 |
String url = getArguments().getString("key");
|
367 |
String url = getArguments().getString("key");
|
| 370 |
if (Uri.parse(url).getHost().equalsIgnoreCase(ProfitTillConstants.DOMAIN)) {
|
368 |
if (Uri.parse(url).getHost().equalsIgnoreCase(ProfitTillConstants.DOMAIN)) {
|
| 371 |
CookieSyncManager.createInstance(getActivity());
|
369 |
CookieSyncManager.createInstance(getActivity());
|
| Line 430... |
Line 428... |
| 430 |
.addToBackStack(null)
|
428 |
.addToBackStack(null)
|
| 431 |
.commit();
|
429 |
.commit();
|
| 432 |
}
|
430 |
}
|
| 433 |
return rootView;
|
431 |
return rootView;
|
| 434 |
}
|
432 |
}
|
| - |
|
433 |
|
| - |
|
434 |
|
| 435 |
@Override
|
435 |
@Override
|
| 436 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
436 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
| 437 |
super.onViewCreated(view, savedInstanceState);
|
437 |
super.onViewCreated(view, savedInstanceState);
|
| 438 |
}
|
438 |
}
|
| 439 |
|
439 |
|
| Line 601... |
Line 601... |
| 601 |
if (url.startsWith("tel")) {
|
601 |
if (url.startsWith("tel")) {
|
| 602 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
602 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
| 603 |
startActivity(intent);
|
603 |
startActivity(intent);
|
| 604 |
return true;
|
604 |
return true;
|
| 605 |
}
|
605 |
}
|
| - |
|
606 |
|
| 606 |
if (url.contains(apiData.getString("contactus.url", ""))) {
|
607 |
/* if (url.contains("intent://send")) {
|
| 607 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
608 |
Intent intent = null;
|
| 608 |
i.putExtra("displayView", "6");
|
609 |
try {
|
| - |
|
610 |
intent = new Intent().parseUri(url, Intent.URI_INTENT_SCHEME);
|
| 609 |
startActivity(i);
|
611 |
} catch (URISyntaxException e) {
|
| 610 |
return true;
|
612 |
e.printStackTrace();
|
| 611 |
}
|
613 |
}
|
| 612 |
if (url.contains(apiData.getString("howitworks.url", ""))) {
|
- |
|
| 613 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
- |
|
| 614 |
i.putExtra("displayView", "7");
|
- |
|
| 615 |
startActivity(i);
|
614 |
startActivity(intent);
|
| 616 |
return true;
|
615 |
return true;
|
| 617 |
}
|
616 |
}*/
|
| - |
|
617 |
|
| 618 |
if (url.contains(apiData.getString("myprofile.url", "http://api.profittill.com/aboutus/profile"))) {
|
618 |
if (url.contains("mailto")) {
|
| 619 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
619 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
| 620 |
i.putExtra("displayView", "15");
|
- |
|
| 621 |
startActivity(i);
|
620 |
startActivity(intent);
|
| 622 |
return true;
|
621 |
return true;
|
| 623 |
}
|
622 |
}
|
| - |
|
623 |
|
| - |
|
624 |
|
| 624 |
return false;
|
625 |
return false;
|
| 625 |
|
626 |
|
| 626 |
}
|
627 |
}
|
| 627 |
|
628 |
|
| 628 |
|
629 |
|
| Line 664... |
Line 665... |
| 664 |
}
|
665 |
}
|
| 665 |
})
|
666 |
})
|
| 666 |
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
667 |
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
| 667 |
@Override
|
668 |
@Override
|
| 668 |
public void onClick(DialogInterface dialog, int id) {
|
669 |
public void onClick(DialogInterface dialog, int id) {
|
| 669 |
view.loadUrl(apiData.getString("mobile.website.url", "") + "?user_id=" + userData.getString("id", ""));
|
670 |
view.loadUrl((apiData.getString("domain","http://app.profitmandi.com")));
|
| 670 |
|
671 |
|
| 671 |
}
|
672 |
}
|
| 672 |
});
|
673 |
});
|
| 673 |
dialog = builder.create();
|
674 |
dialog = builder.create();
|
| 674 |
dialog.show();
|
675 |
dialog.show();
|
| Line 701... |
Line 702... |
| 701 |
}
|
702 |
}
|
| 702 |
})
|
703 |
})
|
| 703 |
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
704 |
.setNegativeButton("No", new DialogInterface.OnClickListener() {
|
| 704 |
@Override
|
705 |
@Override
|
| 705 |
public void onClick(DialogInterface dialog, int id) {
|
706 |
public void onClick(DialogInterface dialog, int id) {
|
| 706 |
view.loadUrl(apiData.getString("mobile.website.url", "") + "?user_id=" + userData.getString("id", ""));
|
707 |
view.loadUrl((apiData.getString("domain","http://app.profitmandi.com")));
|
| 707 |
|
708 |
|
| 708 |
}
|
709 |
}
|
| 709 |
});
|
710 |
});
|
| 710 |
dialog = builder.create();
|
711 |
dialog = builder.create();
|
| 711 |
dialog.show();
|
712 |
dialog.show();
|
| Line 781... |
Line 782... |
| 781 |
}
|
782 |
}
|
| 782 |
}
|
783 |
}
|
| 783 |
|
784 |
|
| 784 |
@Override
|
785 |
@Override
|
| 785 |
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
786 |
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
|
| 786 |
super.onReceivedError(view, errorCode, description, failingUrl);
|
787 |
try{
|
| 787 |
if (getActivity() != null) {
|
788 |
if (getActivity() != null) {
|
| 788 |
SearchFragment nextFrag = new SearchFragment();
|
789 |
SearchFragment nextFrag = new SearchFragment();
|
| 789 |
Bundle args = new Bundle();
|
790 |
Bundle args = new Bundle();
|
| 790 |
args.putString("finishingurl", failingUrl);
|
791 |
args.putString("finishingurl", failingUrl);
|
| 791 |
nextFrag.setArguments(args);
|
792 |
nextFrag.setArguments(args);
|
| 792 |
getActivity().getFragmentManager().beginTransaction().replace(R.id.frame_container,nextFrag).addToBackStack(null).commitAllowingStateLoss();
|
793 |
getActivity().getFragmentManager().beginTransaction().replace(R.id.frame_container,nextFrag).addToBackStack(null).commitAllowingStateLoss();
|
| 793 |
|
794 |
|
| - |
|
795 |
}}
|
| - |
|
796 |
catch (Exception e){
|
| - |
|
797 |
e.printStackTrace();
|
| 794 |
}
|
798 |
}
|
| - |
|
799 |
|
| - |
|
800 |
super.onReceivedError(view, errorCode, description, failingUrl);
|
| 795 |
}
|
801 |
}
|
| - |
|
802 |
|
| - |
|
803 |
|
| 796 |
@Override
|
804 |
@Override
|
| 797 |
public synchronized void onPageFinished(WebView view, String url) {
|
805 |
public synchronized void onPageFinished(WebView view, String url) {
|
| 798 |
super.onPageFinished(view, url);
|
806 |
super.onPageFinished(view, url);
|
| 799 |
|
807 |
|
| 800 |
|
- |
|
| 801 |
|
- |
|
| 802 |
if(url.contains(apiData.getString("Web_Uri","http://pm.shop2020.in/entry-point"))){
|
808 |
if(url.contains(apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point"))){
|
| 803 |
|
809 |
|
| 804 |
|
810 |
|
| 805 |
// if(url.contains(ProfitTillConstants.Web_Uri)){
|
811 |
// if(url.contains(ProfitTillConstants.Web_Uri)){
|
| - |
|
812 |
StringBuffer commandsBuffer = new StringBuffer("javascript:");
|
| 806 |
String js1 =("javascript:document.getElementById('authToken').value ='" +userData.getString("token","")+"'");
|
813 |
commandsBuffer.append("document.getElementById('authToken').value ='" +userData.getString("token","")+ "';");
|
| - |
|
814 |
commandsBuffer.append("document.getElementById('androidId').value ='" +UtilityFunctions.androidId(getActivity()) + "';");
|
| 807 |
Log.d("authToken",js1);
|
815 |
String js1 =commandsBuffer.toString();
|
| 808 |
if(Build.VERSION.SDK_INT >= 19){
|
816 |
if(Build.VERSION.SDK_INT >= 19){
|
| 809 |
view.evaluateJavascript(js1, new ValueCallback<String>() {
|
817 |
view.evaluateJavascript(js1, new ValueCallback<String>() {
|
| 810 |
@Override
|
818 |
@Override
|
| 811 |
public void onReceiveValue(String s) {
|
819 |
public void onReceiveValue(String s) {
|
| 812 |
}
|
820 |
}
|
| 813 |
});
|
821 |
});
|
| 814 |
}
|
822 |
}
|
| 815 |
else {
|
823 |
else {
|
| 816 |
view.loadUrl(js1);
|
824 |
view.loadUrl(js1);
|
| 817 |
}
|
825 |
}
|
| - |
|
826 |
|
| - |
|
827 |
|
| 818 |
String js2 =("javascript:document.getElementById('authTokenSubmit').click()");
|
828 |
String js2 =("javascript:document.getElementById('authTokenSubmit').click()");
|
| 819 |
view.loadUrl(js2);
|
829 |
view.loadUrl(js2);
|
| 820 |
String js = ("javascript:window.localStorage.removeItem('android.otpReceived');");
|
830 |
String js = ("javascript:window.localStorage.removeItem('android.otpReceived');");
|
| 821 |
Log.d("storage",js);
|
831 |
Log.d("storage",js);
|
| 822 |
view.loadUrl(js);
|
832 |
view.loadUrl(js);
|
| 823 |
}
|
833 |
}
|
| 824 |
|
834 |
|
| 825 |
if(url.contains("http://pm.shop2020.in")|| url.contains("about:blank")){
|
835 |
if(url.contains(apiData.getString("domain","http://app.profitmandi.com "))|| url.contains("about:blank")){
|
| 826 |
// ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
836 |
// ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
| 827 |
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
|
837 |
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
|
| 828 |
}
|
838 |
}
|
| 829 |
else{
|
839 |
else{
|
| 830 |
((AppCompatActivity)getActivity()).getSupportActionBar().show();
|
840 |
((AppCompatActivity)getActivity()).getSupportActionBar().show();
|
| Line 934... |
Line 944... |
| 934 |
if (!FLAG) {
|
944 |
if (!FLAG) {
|
| 935 |
FLAG = true;
|
945 |
FLAG = true;
|
| 936 |
userDataEditor.putString("amazonOrder", "true").commit();
|
946 |
userDataEditor.putString("amazonOrder", "true").commit();
|
| 937 |
userDataEditor.putBoolean("amazonLoggedIn", true).commit();
|
947 |
userDataEditor.putBoolean("amazonLoggedIn", true).commit();
|
| 938 |
}
|
948 |
}
|
| - |
|
949 |
}
|
| 939 |
} else if (FLAG) {
|
950 |
else if (FLAG) {
|
| 940 |
view.loadUrl("javascript:try{" +
|
951 |
view.loadUrl("javascript:try{" +
|
| 941 |
"var lastUrl=document.URL;" +
|
952 |
"var lastUrl=document.URL;" +
|
| 942 |
"setInterval(function(){var currentUrl=document.URL;" +
|
953 |
"setInterval(function(){var currentUrl=document.URL;" +
|
| 943 |
"if(currentUrl!=lastUrl){window.HTMLOUT.amazonUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
954 |
"if(currentUrl!=lastUrl){window.HTMLOUT.amazonUrls(currentUrl);lastUrl=currentUrl;}},2000)" +
|
| 944 |
"}catch(error){Android.onError(error.message);}");
|
955 |
"}catch(error){Android.onError(error.message);}");
|
| Line 983... |
Line 994... |
| 983 |
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
994 |
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
| 984 |
WebView webView = (WebView) v;
|
995 |
WebView webView = (WebView) v;
|
| 985 |
switch (keyCode) {
|
996 |
switch (keyCode) {
|
| 986 |
case KeyEvent.KEYCODE_BACK:
|
997 |
case KeyEvent.KEYCODE_BACK:
|
| 987 |
String veb=webView.getUrl();
|
998 |
String veb=webView.getUrl();
|
| 988 |
if ((webView.canGoBack() && !webView.getUrl().contains(apiData.getString("dashboard","http://pm.shop2020.in/pages/home/dashboard")) && !webView.getUrl().contains(apiData.getString("mobileOtp","http://pm.shop2020.in/pages/mobileOtp"))&& !webView.getUrl().contains(apiData.getString("registration","http://pm.shop2020.in/pages/registration")) && !webView.getUrl().contains(apiData.getString("checkRegistration","http://pm.shop2020.in/pages/checkRegistration"))&&!webView.getUrl().contains(apiData.getString("thankYou","http://pm.shop2020.in/pages/home/thankYou")))|| pageRedirect == 2) {
|
999 |
if ((webView.canGoBack() && !webView.getUrl().contains(apiData.getString("dashboard","http://app.profitmandi.com/pages/home/dashboard")) && !webView.getUrl().contains(apiData.getString("mobileOtp","http://app.profitmandi.com/pages/mobileOtp"))&& !webView.getUrl().contains(apiData.getString("registration","http://app.profitmandi.com/pages/registration")) && !webView.getUrl().contains(apiData.getString("checkRegistration","http://app.profitmandi.com/pages/checkRegistration"))&&!webView.getUrl().contains(apiData.getString("thankYou","http://app.profitmandi.com/pages/home/thankYou")))|| pageRedirect == 2) {
|
| 989 |
webView.goBack();
|
1000 |
webView.goBack();
|
| 990 |
pageRedirect = 0;
|
1001 |
pageRedirect = 0;
|
| 991 |
snapdealPageLoad = 0;
|
1002 |
snapdealPageLoad = 0;
|
| 992 |
return true;
|
1003 |
return true;
|
| 993 |
} 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", ""))) {
|
1004 |
} 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", ""))) {
|
| 994 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
1005 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
| 995 |
i.putExtra("displayView", "0");
|
1006 |
i.putExtra("displayView", "0");
|
| 996 |
startActivity(i);
|
1007 |
startActivity(i);
|
| 997 |
return true;
|
1008 |
return true;
|
| 998 |
}
|
1009 |
}
|
| 999 |
else if (webView.getUrl().contains(apiData.getString("domain","http://pm.shop2020.in"))) {
|
1010 |
else if (webView.getUrl().contains(apiData.getString("domain","http://app.profitmandi.com"))) {
|
| 1000 |
//else if(webView.getUrl().contains(ProfitTillConstants.Web_Uri)){
|
1011 |
//else if(webView.getUrl().contains(ProfitTillConstants.Web_Uri)){
|
| 1001 |
if (doubleBackToExitPressedOnce) {
|
1012 |
if (doubleBackToExitPressedOnce) {
|
| 1002 |
new AlertDialog.Builder(getActivity())
|
1013 |
new AlertDialog.Builder(getActivity())
|
| 1003 |
.setIcon(R.drawable.symbol)
|
1014 |
.setIcon(R.drawable.symbol)
|
| 1004 |
.setTitle("Exit!")
|
1015 |
.setTitle("Exit!")
|
| Line 1037... |
Line 1048... |
| 1037 |
@Override
|
1048 |
@Override
|
| 1038 |
public void run() {
|
1049 |
public void run() {
|
| 1039 |
doubleBackToExitPressedOnce = false;
|
1050 |
doubleBackToExitPressedOnce = false;
|
| 1040 |
}
|
1051 |
}
|
| 1041 |
}, 5000);
|
1052 |
}, 5000);
|
| - |
|
1053 |
}
|
| 1042 |
} else {
|
1054 |
else {
|
| 1043 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
1055 |
Intent i = new Intent(getActivity(), MainActivity.class);
|
| 1044 |
i.putExtra("displayView", "0");
|
1056 |
i.putExtra("displayView", "0");
|
| 1045 |
startActivity(i);
|
1057 |
startActivity(i);
|
| 1046 |
return true;
|
1058 |
return true;
|
| 1047 |
}
|
1059 |
}
|
| Line 1051... |
Line 1063... |
| 1051 |
}
|
1063 |
}
|
| 1052 |
return false;
|
1064 |
return false;
|
| 1053 |
}
|
1065 |
}
|
| 1054 |
});
|
1066 |
});
|
| 1055 |
}
|
1067 |
}
|
| - |
|
1068 |
}
|
| 1056 |
} catch (Exception e) {
|
1069 |
catch (Exception e) {
|
| 1057 |
e.printStackTrace();
|
1070 |
e.printStackTrace();
|
| 1058 |
TestinAgent.uploadException(getActivity(), "On Page Finished", e);
|
1071 |
TestinAgent.uploadException(getActivity(), "On Page Finished", e);
|
| 1059 |
}
|
1072 |
}
|
| - |
|
1073 |
}}
|
| 1060 |
}}
|
1074 |
|
| 1061 |
public class Callback extends WebViewClient{
|
1075 |
public class Callback extends WebViewClient{
|
| 1062 |
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){
|
1076 |
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl){
|
| 1063 |
Toast.makeText(getActivity(), "Failed loading app!", Toast.LENGTH_SHORT).show();
|
1077 |
Toast.makeText(getActivity(), "Failed loading app!", Toast.LENGTH_SHORT).show();
|
| 1064 |
}
|
1078 |
}
|
| 1065 |
}
|
1079 |
}
|
| 1066 |
// Create an image file
|
1080 |
// Create an image file
|
| 1067 |
private File createImageFile() throws IOException{
|
1081 |
private File createImageFile() throws IOException{
|
| 1068 |
@SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
1082 |
@SuppressLint("SimpleDateFormat") String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
|
| 1069 |
String imageFileName = "img_"+timeStamp+"_";
|
1083 |
String imageFileName = "img_"+timeStamp+"_";
|
| 1070 |
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
1084 |
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
|
| 1071 |
return File.createTempFile(imageFileName,".jpg",storageDir);
|
1085 |
return File.createTempFile(imageFileName,".jpg",storageDir);
|
| 1072 |
}
|
1086 |
}
|
| - |
|
1087 |
|
| - |
|
1088 |
|
| 1073 |
|
1089 |
|
| 1074 |
|
1090 |
|
| 1075 |
@Override
|
1091 |
@Override
|
| 1076 |
public void onActivityResult(int requestCode, int resultCode, Intent intent){
|
1092 |
public void onActivityResult(int requestCode, int resultCode, Intent intent){
|
| 1077 |
super.onActivityResult(requestCode, resultCode, intent);
|
1093 |
super.onActivityResult(requestCode, resultCode, intent);
|
| Line 1124... |
Line 1140... |
| 1124 |
@Override
|
1140 |
@Override
|
| 1125 |
protected void onPreExecute() {
|
1141 |
protected void onPreExecute() {
|
| 1126 |
|
1142 |
|
| 1127 |
super.onPreExecute();
|
1143 |
super.onPreExecute();
|
| 1128 |
|
1144 |
|
| 1129 |
pg1.show();
|
- |
|
| - |
|
1145 |
|
| 1130 |
}
|
1146 |
}
|
| 1131 |
@Override
|
1147 |
@Override
|
| 1132 |
protected String doInBackground(String... arg0) {
|
1148 |
protected String doInBackground(String... arg0) {
|
| 1133 |
try {
|
1149 |
try {
|
| 1134 |
HttpClient httpclient = new DefaultHttpClient();
|
1150 |
HttpClient httpclient = new DefaultHttpClient();
|
| Line 1178... |
Line 1194... |
| 1178 |
}
|
1194 |
}
|
| 1179 |
@Override
|
1195 |
@Override
|
| 1180 |
protected void onPostExecute(String jsonObject) {
|
1196 |
protected void onPostExecute(String jsonObject) {
|
| 1181 |
super.onPostExecute(jsonObject);
|
1197 |
super.onPostExecute(jsonObject);
|
| 1182 |
|
1198 |
|
| 1183 |
pg1.dismiss();
|
- |
|
| 1184 |
|
1199 |
|
| 1185 |
}}
|
1200 |
}}
|
| 1186 |
|
1201 |
|
| 1187 |
@Override
|
1202 |
@Override
|
| - |
|
1203 |
public void onDetach() {
|
| - |
|
1204 |
super.onDetach();
|
| - |
|
1205 |
if(webView != null) {
|
| - |
|
1206 |
webView.clearHistory();
|
| - |
|
1207 |
webView.removeAllViews();
|
| - |
|
1208 |
webView.clearView();
|
| - |
|
1209 |
webView.destroy();
|
| - |
|
1210 |
}
|
| - |
|
1211 |
|
| - |
|
1212 |
}
|
| - |
|
1213 |
|
| - |
|
1214 |
|
| - |
|
1215 |
@Override
|
| 1188 |
public void onResume() {
|
1216 |
public void onResume() {
|
| 1189 |
super.onResume();
|
1217 |
super.onResume();
|
| 1190 |
getView().setFocusableInTouchMode(true);
|
1218 |
getView().setFocusableInTouchMode(true);
|
| 1191 |
getView().requestFocus();
|
1219 |
getView().requestFocus();
|
| 1192 |
getView().setOnKeyListener(new View.OnKeyListener() {
|
1220 |
getView().setOnKeyListener(new View.OnKeyListener() {
|
| Line 1194... |
Line 1222... |
| 1194 |
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
1222 |
public boolean onKey(View v, int keyCode, KeyEvent event) {
|
| 1195 |
|
1223 |
|
| 1196 |
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
|
1224 |
if (event.getAction() == KeyEvent.ACTION_DOWN && keyCode == KeyEvent.KEYCODE_BACK) {
|
| 1197 |
try {
|
1225 |
try {
|
| 1198 |
String veb=webView.getUrl();
|
1226 |
String veb=webView.getUrl();
|
| 1199 |
if (webView.getUrl().contains(apiData.getString("dashboard","http://pm.shop2020.in/pages/home/dashboard"))||webView.getUrl().contains(apiData.getString("mobileOtp","http://pm.shop2020.in/pages/mobileOtp"))||webView.getUrl().contains(apiData.getString("registration","http://pm.shop2020.in/pages/registration"))||webView.getUrl().contains(apiData.getString("checkRegistration","http://pm.shop2020.in/pages/checkRegistration"))||webView.getUrl().contains(apiData.getString("thankYou","http://pm.shop2020.in/pages/home/thankYou"))) {
|
1227 |
if (webView.getUrl().contains(apiData.getString("dashboard","http://app.profitmandi.com/pages/home/dashboard"))||webView.getUrl().contains(apiData.getString("mobileOtp","http://app.profitmandi.com/pages/mobileOtp"))||webView.getUrl().contains(apiData.getString("registration","http://app.profitmandi.com/pages/registration"))||webView.getUrl().contains(apiData.getString("checkRegistration","http://app.profitmandi.com/pages/checkRegistration"))||webView.getUrl().contains(apiData.getString("thankYou","http://app.profitmandi.com/pages/home/thankYou"))) {
|
| 1200 |
if (doubleBackToExitPressedOnce) {
|
1228 |
if (doubleBackToExitPressedOnce) {
|
| 1201 |
new AlertDialog.Builder(getActivity())
|
1229 |
new AlertDialog.Builder(getActivity())
|
| 1202 |
.setIcon(R.drawable.symbol)
|
1230 |
.setIcon(R.drawable.symbol)
|
| 1203 |
.setTitle("Exit!")
|
1231 |
.setTitle("Exit!")
|
| 1204 |
.setMessage("Are you sure you want to close?")
|
1232 |
.setMessage("Are you sure you want to close?")
|
| Line 1211... |
Line 1239... |
| 1211 |
mGoogleApiClient.disconnect();
|
1239 |
mGoogleApiClient.disconnect();
|
| 1212 |
userDataEditor.clear().commit();
|
1240 |
userDataEditor.clear().commit();
|
| 1213 |
mGoogleApiClient.connect();
|
1241 |
mGoogleApiClient.connect();
|
| 1214 |
startActivity(new Intent(getActivity(), LoginActivity.class));
|
1242 |
startActivity(new Intent(getActivity(), LoginActivity.class));
|
| 1215 |
}
|
1243 |
}
|
| 1216 |
else{
|
1244 |
else{
|
| 1217 |
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
1245 |
Intent startMain = new Intent(Intent.ACTION_MAIN);
|
| 1218 |
startMain.addCategory(Intent.CATEGORY_HOME);
|
1246 |
startMain.addCategory(Intent.CATEGORY_HOME);
|
| 1219 |
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
1247 |
startMain.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
| 1220 |
|
1248 |
|
| 1221 |
startActivity(startMain);
|
1249 |
startActivity(startMain);
|
| Line 1456... |
Line 1484... |
| 1456 |
try{
|
1484 |
try{
|
| 1457 |
if (mGoogleApiClient.isConnected()) {
|
1485 |
if (mGoogleApiClient.isConnected()) {
|
| 1458 |
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
|
1486 |
Plus.AccountApi.clearDefaultAccount(mGoogleApiClient);
|
| 1459 |
mGoogleApiClient.disconnect();
|
1487 |
mGoogleApiClient.disconnect();
|
| 1460 |
mGoogleApiClient.connect();
|
1488 |
mGoogleApiClient.connect();
|
| - |
|
1489 |
webView.clearHistory();
|
| - |
|
1490 |
webView.removeAllViews();
|
| - |
|
1491 |
webView.clearView();
|
| - |
|
1492 |
webView.destroy();
|
| 1461 |
userDataEditor.clear().commit();
|
1493 |
userDataEditor.clear().commit();
|
| 1462 |
startActivity(new Intent(getActivity(), LoginActivity.class));
|
1494 |
startActivity(new Intent(getActivity(), LoginActivity.class));
|
| 1463 |
}
|
1495 |
}
|
| 1464 |
else{
|
1496 |
else{
|
| 1465 |
if(!mGoogleApiClient.isConnected()){
|
1497 |
if(!mGoogleApiClient.isConnected()){
|
| Line 1622... |
Line 1654... |
| 1622 |
}
|
1654 |
}
|
| 1623 |
}
|
1655 |
}
|
| 1624 |
@JavascriptInterface
|
1656 |
@JavascriptInterface
|
| 1625 |
public void angularUrls(String url) {
|
1657 |
public void angularUrls(String url) {
|
| 1626 |
if(!isInternetOn()){
|
1658 |
if(!isInternetOn()){
|
| - |
|
1659 |
try {
|
| 1627 |
SearchFragment nextFrag = new SearchFragment();
|
1660 |
SearchFragment nextFrag = new SearchFragment();
|
| 1628 |
Bundle args = new Bundle();
|
1661 |
Bundle args = new Bundle();
|
| 1629 |
args.putString("finishingurl", url);
|
1662 |
args.putString("finishingurl", url);
|
| 1630 |
nextFrag.setArguments(args);
|
1663 |
nextFrag.setArguments(args);
|
| 1631 |
getActivity().getFragmentManager().beginTransaction().replace(R.id.frame_container,nextFrag).addToBackStack(null).commitAllowingStateLoss();
|
1664 |
getActivity().getFragmentManager().beginTransaction().replace(R.id.frame_container, nextFrag).addToBackStack(null).commitAllowingStateLoss();
|
| - |
|
1665 |
}catch (Exception e) {
|
| - |
|
1666 |
e.printStackTrace();
|
| - |
|
1667 |
}
|
| 1632 |
|
1668 |
|
| 1633 |
}
|
1669 |
}
|
| 1634 |
else{
|
1670 |
else{
|
| 1635 |
try {
|
1671 |
try {
|
| 1636 |
obj = new JSONObject();
|
1672 |
obj = new JSONObject();
|
| Line 1656... |
Line 1692... |
| 1656 |
|
1692 |
|
| 1657 |
@Override
|
1693 |
@Override
|
| 1658 |
protected String doInBackground(String... params) {
|
1694 |
protected String doInBackground(String... params) {
|
| 1659 |
try {
|
1695 |
try {
|
| 1660 |
HttpClient httpclient = new DefaultHttpClient();
|
1696 |
HttpClient httpclient = new DefaultHttpClient();
|
| 1661 |
HttpGet httpget=new HttpGet(apiData.getString("Web_Api_Tokeninfo","http://api.profitmandi.com:8080/profitmandi-web/user/token-info"));
|
1697 |
HttpGet httpget=new HttpGet(apiData.getString("Web_Api_Tokendetail","http://app.profitmandi.com/apis/user/detail/token"));
|
| 1662 |
// HttpGet httpget = new HttpGet(ProfitTillConstants.Web_Api + "/user/token-info");
|
1698 |
// HttpGet httpget = new HttpGet(ProfitTillConstants.Web_Api + "/user/token-info");
|
| 1663 |
httpget.setHeader("Auth-Token", userData.getString("token", ""));
|
1699 |
httpget.setHeader("Auth-Token", userData.getString("token", ""));
|
| 1664 |
HttpResponse response = httpclient.execute(httpget);
|
1700 |
HttpResponse response = httpclient.execute(httpget);
|
| 1665 |
HttpEntity entity = response.getEntity();
|
1701 |
HttpEntity entity = response.getEntity();
|
| 1666 |
int status = response.getStatusLine().getStatusCode();
|
1702 |
int status = response.getStatusLine().getStatusCode();
|
| Line 1716... |
Line 1752... |
| 1716 |
|
1752 |
|
| 1717 |
@Override
|
1753 |
@Override
|
| 1718 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
1754 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
| 1719 |
try {
|
1755 |
try {
|
| 1720 |
HttpClient httpclient = new DefaultHttpClient();
|
1756 |
HttpClient httpclient = new DefaultHttpClient();
|
| 1721 |
HttpPost httppost = new HttpPost("http://api.profittill.com/devices/add");
|
1757 |
HttpPost httppost = new HttpPost(apiData.getString("devices_info","http://api.profittill.com/devices/add"));
|
| 1722 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Push_Url);
|
1758 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Push_Url);
|
| 1723 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
1759 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
| 1724 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
1760 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
| 1725 |
HttpResponse response = httpclient.execute(httppost);
|
1761 |
HttpResponse response = httpclient.execute(httppost);
|
| 1726 |
HttpEntity entity = response.getEntity();
|
1762 |
HttpEntity entity = response.getEntity();
|
| Line 1755... |
Line 1791... |
| 1755 |
@Override
|
1791 |
@Override
|
| 1756 |
protected String doInBackground(String... arg0) {
|
1792 |
protected String doInBackground(String... arg0) {
|
| 1757 |
String id = null;
|
1793 |
String id = null;
|
| 1758 |
try {
|
1794 |
try {
|
| 1759 |
HttpClient httpclient = new DefaultHttpClient();
|
1795 |
HttpClient httpclient = new DefaultHttpClient();
|
| 1760 |
HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url", ""));
|
1796 |
HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url","http://api.profittill.com/gcm_users/add"));
|
| 1761 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.gcm_url);
|
1797 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.gcm_url);
|
| 1762 |
ArrayList<NameValuePair> nameValuePairsGcm = new ArrayList<>();
|
1798 |
ArrayList<NameValuePair> nameValuePairsGcm = new ArrayList<>();
|
| 1763 |
TelephonyManager telephonyManager = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
1799 |
TelephonyManager telephonyManager = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
| 1764 |
nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid", regId));
|
1800 |
nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid", regId));
|
| 1765 |
nameValuePairsGcm.add(new BasicNameValuePair("imeinumber", telephonyManager.getDeviceId()));
|
1801 |
nameValuePairsGcm.add(new BasicNameValuePair("imeinumber", telephonyManager.getDeviceId()));
|
| Line 2190... |
Line 2226... |
| 2190 |
@Override
|
2226 |
@Override
|
| 2191 |
protected String doInBackground(String... params) {
|
2227 |
protected String doInBackground(String... params) {
|
| 2192 |
try {
|
2228 |
try {
|
| 2193 |
|
2229 |
|
| 2194 |
HttpClient httpclient = new DefaultHttpClient();
|
2230 |
HttpClient httpclient = new DefaultHttpClient();
|
| 2195 |
HttpPost httppost = new HttpPost(apiData.getString("Web_Api_Otp","http://api.profitmandi.com:8080/profitmandi-web/otp/parseOTP"));
|
2231 |
HttpPost httppost = new HttpPost(apiData.getString("Web_Api_Otp","http://app.profitmandi.com/apis/otp/parseOTP"));
|
| 2196 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Web_Api + "/otp/parseOTP");
|
2232 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Web_Api + "/otp/parseOTP");
|
| 2197 |
httppost.setHeader("Auth-Token", userData.getString("token", ""));
|
2233 |
httppost.setHeader("Auth-Token", userData.getString("token", ""));
|
| 2198 |
httppost.setEntity(new UrlEncodedFormEntity(messageNameValuePair));
|
2234 |
httppost.setEntity(new UrlEncodedFormEntity(messageNameValuePair));
|
| 2199 |
HttpResponse response = httpclient.execute(httppost);
|
2235 |
HttpResponse response = httpclient.execute(httppost);
|
| 2200 |
HttpEntity entity = response.getEntity();
|
2236 |
HttpEntity entity = response.getEntity();
|
| Line 2868... |
Line 2904... |
| 2868 |
public void onPause() {
|
2904 |
public void onPause() {
|
| 2869 |
super.onPause();
|
2905 |
super.onPause();
|
| 2870 |
if (apiData.getString("deal.redirect", "false").equalsIgnoreCase("true")) {
|
2906 |
if (apiData.getString("deal.redirect", "false").equalsIgnoreCase("true")) {
|
| 2871 |
if (webView != null) {
|
2907 |
if (webView != null) {
|
| 2872 |
if (isPause) {
|
2908 |
if (isPause) {
|
| 2873 |
webView.loadUrl(apiData.getString("mobile.website.url", "") + "?user_id=" + userData.getString("id", ""));
|
2909 |
webView.loadUrl(apiData.getString("app.domain.profitmandi", "http://app.profitmandi.com"));
|
| 2874 |
isPause = false;
|
2910 |
isPause = false;
|
| 2875 |
}
|
2911 |
}
|
| 2876 |
}
|
2912 |
}
|
| 2877 |
}
|
2913 |
}
|
| 2878 |
}
|
2914 |
}
|