| Line 2... |
Line 2... |
| 2 |
|
2 |
|
| 3 |
import android.annotation.SuppressLint;
|
3 |
import android.annotation.SuppressLint;
|
| 4 |
import android.annotation.TargetApi;
|
4 |
import android.annotation.TargetApi;
|
| 5 |
import android.app.Activity;
|
5 |
import android.app.Activity;
|
| 6 |
import android.app.AlertDialog;
|
6 |
import android.app.AlertDialog;
|
| - |
|
7 |
import android.app.DownloadManager;
|
| 7 |
import android.app.Fragment;
|
8 |
import android.app.Fragment;
|
| 8 |
import android.app.ProgressDialog;
|
9 |
import android.app.ProgressDialog;
|
| - |
|
10 |
import android.content.ActivityNotFoundException;
|
| 9 |
import android.content.BroadcastReceiver;
|
11 |
import android.content.BroadcastReceiver;
|
| 10 |
import android.content.ComponentName;
|
12 |
import android.content.ComponentName;
|
| 11 |
import android.content.Context;
|
13 |
import android.content.Context;
|
| 12 |
import android.content.DialogInterface;
|
14 |
import android.content.DialogInterface;
|
| 13 |
import android.content.Intent;
|
15 |
import android.content.Intent;
|
| Line 50... |
Line 52... |
| 50 |
import android.view.MenuItem;
|
52 |
import android.view.MenuItem;
|
| 51 |
import android.view.View;
|
53 |
import android.view.View;
|
| 52 |
import android.view.ViewGroup;
|
54 |
import android.view.ViewGroup;
|
| 53 |
import android.webkit.CookieManager;
|
55 |
import android.webkit.CookieManager;
|
| 54 |
import android.webkit.CookieSyncManager;
|
56 |
import android.webkit.CookieSyncManager;
|
| - |
|
57 |
import android.webkit.DownloadListener;
|
| 55 |
import android.webkit.HttpAuthHandler;
|
58 |
import android.webkit.HttpAuthHandler;
|
| 56 |
import android.webkit.JavascriptInterface;
|
59 |
import android.webkit.JavascriptInterface;
|
| 57 |
import android.webkit.ValueCallback;
|
60 |
import android.webkit.ValueCallback;
|
| 58 |
import android.webkit.WebChromeClient;
|
61 |
import android.webkit.WebChromeClient;
|
| 59 |
import android.webkit.WebResourceError;
|
62 |
import android.webkit.WebResourceError;
|
| Line 70... |
Line 73... |
| 70 |
import com.google.android.gms.plus.Plus;
|
73 |
import com.google.android.gms.plus.Plus;
|
| 71 |
import com.google.firebase.iid.FirebaseInstanceId;
|
74 |
import com.google.firebase.iid.FirebaseInstanceId;
|
| 72 |
import com.kosalgeek.android.photoutil.CameraPhoto;
|
75 |
import com.kosalgeek.android.photoutil.CameraPhoto;
|
| 73 |
import com.kosalgeek.android.photoutil.GalleryPhoto;
|
76 |
import com.kosalgeek.android.photoutil.GalleryPhoto;
|
| 74 |
import com.kosalgeek.android.photoutil.ImageLoader;
|
77 |
import com.kosalgeek.android.photoutil.ImageLoader;
|
| - |
|
78 |
import com.saholic.profittill.BuildConfig;
|
| 75 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
79 |
import com.saholic.profittill.Constants.ProfitTillConstants;
|
| 76 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
80 |
import com.saholic.profittill.Database.OrderTransactionDetails;
|
| 77 |
import com.saholic.profittill.Network.NotificationCount;
|
81 |
import com.saholic.profittill.Network.NotificationCount;
|
| 78 |
import com.saholic.profittill.R;
|
82 |
import com.saholic.profittill.R;
|
| 79 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
83 |
import com.saholic.profittill.Utils.UtilityFunctions;
|
| Line 115... |
Line 119... |
| 115 |
import java.util.Map;
|
119 |
import java.util.Map;
|
| 116 |
import java.util.StringTokenizer;
|
120 |
import java.util.StringTokenizer;
|
| 117 |
import java.util.regex.Matcher;
|
121 |
import java.util.regex.Matcher;
|
| 118 |
import java.util.regex.Pattern;
|
122 |
import java.util.regex.Pattern;
|
| 119 |
|
123 |
|
| - |
|
124 |
import static android.content.Context.DOWNLOAD_SERVICE;
|
| - |
|
125 |
|
| 120 |
public class DealsHomeFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
126 |
public class DealsHomeFragment extends Fragment implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener {
|
| 121 |
|
127 |
|
| 122 |
private File storageDir;
|
128 |
private File storageDir;
|
| 123 |
File photoFile = null;
|
129 |
File photoFile = null;
|
| 124 |
|
130 |
|
| Line 173... |
Line 179... |
| 173 |
private ValueCallback<Uri[]> mUMA;
|
179 |
private ValueCallback<Uri[]> mUMA;
|
| 174 |
private final static int FCR=1;
|
180 |
private final static int FCR=1;
|
| 175 |
GalleryPhoto galleryPhoto;
|
181 |
GalleryPhoto galleryPhoto;
|
| 176 |
CameraPhoto cameraPhoto;
|
182 |
CameraPhoto cameraPhoto;
|
| 177 |
boolean doubleBackToExitPressedOnce = false;
|
183 |
boolean doubleBackToExitPressedOnce = false;
|
| 178 |
String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
|
184 |
// String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED";
|
| 179 |
|
185 |
|
| 180 |
@Override
|
186 |
@Override
|
| 181 |
public void onCreate(Bundle savedInstanceState) {
|
187 |
public void onCreate(Bundle savedInstanceState) {
|
| 182 |
super.onCreate(savedInstanceState);
|
188 |
super.onCreate(savedInstanceState);
|
| 183 |
setRetainInstance(true);
|
189 |
setRetainInstance(true);
|
| Line 227... |
Line 233... |
| 227 |
View rootView = inflater.inflate(R.layout.fragment_deals_home, container, false);
|
233 |
View rootView = inflater.inflate(R.layout.fragment_deals_home, container, false);
|
| 228 |
TestinAgent.init(getActivity());
|
234 |
TestinAgent.init(getActivity());
|
| 229 |
int InstanceId = DealsHomeFragment.class.hashCode();
|
235 |
int InstanceId = DealsHomeFragment.class.hashCode();
|
| 230 |
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
236 |
AppCompatActivity activity = (AppCompatActivity) getActivity();
|
| 231 |
ActionBar actionBar = activity.getSupportActionBar();
|
237 |
ActionBar actionBar = activity.getSupportActionBar();
|
| 232 |
actionBar.setBackgroundDrawable(new ColorDrawable(Color.WHITE));
|
238 |
actionBar.setBackgroundDrawable(new ColorDrawable(getResources().getColor(R.color.app_red)));
|
| 233 |
galleryPhoto = new GalleryPhoto(getActivity());
|
239 |
galleryPhoto = new GalleryPhoto(getActivity());
|
| 234 |
cameraPhoto = new CameraPhoto(getActivity());
|
240 |
cameraPhoto = new CameraPhoto(getActivity());
|
| 235 |
final Drawable upArrow = getResources().getDrawable(R.drawable.abc_ic_ab_back_mtrl_am_alpha);
|
241 |
final Drawable upArrow = getResources().getDrawable(R.drawable.com_mixpanel_android_arrowleft);
|
| 236 |
upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
242 |
// upArrow.setColorFilter(getResources().getColor(R.color.grey_black), PorterDuff.Mode.SRC_ATOP);
|
| 237 |
actionBar.setHomeAsUpIndicator(upArrow);
|
243 |
actionBar.setHomeAsUpIndicator(upArrow);
|
| 238 |
actionBar.setDisplayShowCustomEnabled(true);
|
244 |
actionBar.setDisplayShowCustomEnabled(true);
|
| 239 |
actionBar.setDisplayShowTitleEnabled(false);
|
245 |
actionBar.setDisplayShowTitleEnabled(false);
|
| 240 |
actionBar.setDisplayHomeAsUpEnabled(true);
|
246 |
actionBar.setDisplayHomeAsUpEnabled(true);
|
| 241 |
actionBar.setHomeButtonEnabled(true);
|
247 |
actionBar.setHomeButtonEnabled(true);
|
| Line 374... |
Line 380... |
| 374 |
startActivityForResult(chooserIntent, FCR);
|
380 |
startActivityForResult(chooserIntent, FCR);
|
| 375 |
return true;
|
381 |
return true;
|
| 376 |
}
|
382 |
}
|
| 377 |
});
|
383 |
});
|
| 378 |
webView.getSettings().setSavePassword(true);
|
384 |
webView.getSettings().setSavePassword(true);
|
| - |
|
385 |
webView.setDownloadListener(new DownloadListener() {
|
| - |
|
386 |
public void onDownloadStart(String url, String userAgent,
|
| - |
|
387 |
String contentDisposition, String mimetype,
|
| - |
|
388 |
long contentLength) {
|
| - |
|
389 |
DownloadManager.Request request = new DownloadManager.Request( Uri.parse(url));
|
| - |
|
390 |
request.allowScanningByMediaScanner();
|
| - |
|
391 |
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
|
| - |
|
392 |
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "smartdukaan.pdf");
|
| - |
|
393 |
DownloadManager dm = (DownloadManager) getActivity().getSystemService(DOWNLOAD_SERVICE);
|
| - |
|
394 |
dm.enqueue(request);
|
| - |
|
395 |
}
|
| - |
|
396 |
});
|
| 379 |
CookieManager cookieManager = CookieManager.getInstance();
|
397 |
CookieManager cookieManager = CookieManager.getInstance();
|
| 380 |
cookieManager.setAcceptCookie(true);
|
398 |
cookieManager.setAcceptCookie(true);
|
| 381 |
|
399 |
|
| 382 |
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
400 |
if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
| 383 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
401 |
webView.getSettings().setMixedContentMode(WebSettings.MIXED_CONTENT_ALWAYS_ALLOW);
|
| Line 459... |
Line 477... |
| 459 |
@Override
|
477 |
@Override
|
| 460 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
478 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
| 461 |
super.onViewCreated(view, savedInstanceState);
|
479 |
super.onViewCreated(view, savedInstanceState);
|
| 462 |
}
|
480 |
}
|
| 463 |
|
481 |
|
| 464 |
BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
482 |
/* BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
|
| 465 |
@Override
|
483 |
@Override
|
| 466 |
public void onReceive(Context context, Intent intent) {
|
484 |
public void onReceive(Context context, Intent intent) {
|
| 467 |
final Bundle bundle = intent.getExtras();
|
485 |
final Bundle bundle = intent.getExtras();
|
| 468 |
|
486 |
|
| 469 |
try {
|
487 |
try {
|
| Line 501... |
Line 519... |
| 501 |
catch (Exception e) {
|
519 |
catch (Exception e) {
|
| 502 |
e.printStackTrace();
|
520 |
e.printStackTrace();
|
| 503 |
|
521 |
|
| 504 |
}
|
522 |
}
|
| 505 |
}
|
523 |
}
|
| 506 |
};
|
524 |
};*/
|
| 507 |
|
525 |
|
| 508 |
JSONObject obj;
|
526 |
JSONObject obj;
|
| 509 |
|
527 |
|
| 510 |
@Override
|
528 |
@Override
|
| 511 |
public void onConnected(Bundle bundle) {
|
529 |
public void onConnected(Bundle bundle) {
|
| Line 544... |
Line 562... |
| 544 |
List<String> snapdealExceptionUrls = new ArrayList<>();
|
562 |
List<String> snapdealExceptionUrls = new ArrayList<>();
|
| 545 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls", ""), "|");
|
563 |
StringTokenizer st = new StringTokenizer(apiData.getString("snapdeal.exception.urls", ""), "|");
|
| 546 |
while (st.hasMoreTokens()) {
|
564 |
while (st.hasMoreTokens()) {
|
| 547 |
snapdealExceptionUrls.add(st.nextToken());
|
565 |
snapdealExceptionUrls.add(st.nextToken());
|
| 548 |
}
|
566 |
}
|
| 549 |
try {
|
- |
|
| 550 |
Log.d("Count", "Count " + apiData.getString("snapdeal.exception.count", "1"));
|
- |
|
| 551 |
for (String s : snapdealExceptionUrls) {
|
- |
|
| 552 |
if (url.contains(s)) {
|
- |
|
| 553 |
if (snapdealException <= Integer.parseInt(apiData.getString("snapdeal.exception.count", "1"))) {
|
- |
|
| 554 |
webView.reload();
|
- |
|
| 555 |
snapdealException += 1;
|
- |
|
| 556 |
}
|
- |
|
| 557 |
return false;
|
- |
|
| 558 |
}
|
- |
|
| 559 |
}
|
- |
|
| 560 |
} catch (Exception e) {
|
- |
|
| 561 |
e.printStackTrace();
|
- |
|
| 562 |
}
|
567 |
}
|
| 563 |
}
|
- |
|
| 564 |
if (apiData.getString("isRedirect", "false").equalsIgnoreCase("true")) {
|
568 |
if (apiData.getString("isRedirect", "false").equalsIgnoreCase("true")) {
|
| 565 |
List<String> browserRedirectUrl = new ArrayList<>();
|
569 |
List<String> browserRedirectUrl = new ArrayList<>();
|
| 566 |
StringTokenizer st = new StringTokenizer(apiData.getString("redirect.urls", ""), "|");
|
570 |
StringTokenizer st = new StringTokenizer(apiData.getString("redirect.urls", ""), "|");
|
| 567 |
while (st.hasMoreTokens()) {
|
571 |
while (st.hasMoreTokens()) {
|
| 568 |
browserRedirectUrl.add(st.nextToken());
|
572 |
browserRedirectUrl.add(st.nextToken());
|
| Line 642... |
Line 646... |
| 642 |
if (url.contains("mailto")) {
|
646 |
if (url.contains("mailto")) {
|
| 643 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
647 |
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
|
| 644 |
startActivity(intent);
|
648 |
startActivity(intent);
|
| 645 |
return true;
|
649 |
return true;
|
| 646 |
}
|
650 |
}
|
| - |
|
651 |
if ( url.endsWith(".pdf")) {
|
| - |
|
652 |
Intent intent = new Intent(Intent.ACTION_VIEW);
|
| - |
|
653 |
intent.setDataAndType(Uri.parse(url), "application/pdf");
|
| - |
|
654 |
try {
|
| - |
|
655 |
view.getContext().startActivity(intent);
|
| - |
|
656 |
} catch (ActivityNotFoundException e) {
|
| - |
|
657 |
e.printStackTrace();
|
| - |
|
658 |
//user does not have a pdf viewer installed
|
| - |
|
659 |
}
|
| - |
|
660 |
}
|
| 647 |
|
661 |
|
| 648 |
|
662 |
|
| 649 |
return false;
|
663 |
return false;
|
| 650 |
|
664 |
|
| 651 |
}
|
665 |
}
|
| Line 828... |
Line 842... |
| 828 |
@Override
|
842 |
@Override
|
| 829 |
public synchronized void onPageFinished(WebView view, String url) {
|
843 |
public synchronized void onPageFinished(WebView view, String url) {
|
| 830 |
super.onPageFinished(view, url);
|
844 |
super.onPageFinished(view, url);
|
| 831 |
|
845 |
|
| 832 |
if(url.contains(apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point"))){
|
846 |
if(url.contains(apiData.getString("Web_Uri","http://app.profitmandi.com/entry-point"))){
|
| 833 |
|
- |
|
| 834 |
|
- |
|
| 835 |
// if(url.contains(ProfitTillConstants.Web_Uri)){
|
847 |
// if(url.contains("http://192.168.120.52:4200/entry-point")){
|
| 836 |
StringBuffer commandsBuffer = new StringBuffer("javascript:");
|
848 |
StringBuffer commandsBuffer = new StringBuffer("javascript:");
|
| 837 |
commandsBuffer.append("document.getElementById('authToken').value ='" +userData.getString("token","")+ "';");
|
849 |
commandsBuffer.append("document.getElementById('authToken').value ='" +userData.getString("token","")+ "';");
|
| 838 |
commandsBuffer.append("document.getElementById('androidId').value ='" +UtilityFunctions.androidId(getActivity()) + "';");
|
850 |
commandsBuffer.append("document.getElementById('androidId').value ='" +UtilityFunctions.androidId(getActivity()) + "';");
|
| - |
|
851 |
commandsBuffer.append("document.getElementById('versionCode').value = '"+ BuildConfig.VERSION_CODE+"';");
|
| 839 |
String js1 =commandsBuffer.toString();
|
852 |
String js1 =commandsBuffer.toString();
|
| 840 |
if(Build.VERSION.SDK_INT >= 19){
|
853 |
if(Build.VERSION.SDK_INT >= 19){
|
| 841 |
view.evaluateJavascript(js1, new ValueCallback<String>() {
|
854 |
view.evaluateJavascript(js1, new ValueCallback<String>() {
|
| 842 |
@Override
|
855 |
@Override
|
| 843 |
public void onReceiveValue(String s) {
|
856 |
public void onReceiveValue(String s) {
|
| Line 853... |
Line 866... |
| 853 |
view.loadUrl(js2);
|
866 |
view.loadUrl(js2);
|
| 854 |
String js = ("javascript:window.localStorage.removeItem('android.otpReceived');");
|
867 |
String js = ("javascript:window.localStorage.removeItem('android.otpReceived');");
|
| 855 |
Log.d("storage",js);
|
868 |
Log.d("storage",js);
|
| 856 |
view.loadUrl(js);
|
869 |
view.loadUrl(js);
|
| 857 |
}
|
870 |
}
|
| 858 |
|
- |
|
| - |
|
871 |
//if(url.contains("http://192.168.120.52:4200/entry-point")|| url.contains("about:blank")){
|
| 859 |
if(url.contains(apiData.getString("domain","http://app.profitmandi.com "))|| url.contains("about:blank")){
|
872 |
if(url.contains(apiData.getString("domain","http://app.profitmandi.com "))|| url.contains("about:blank")){
|
| 860 |
// ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
873 |
// ((AppCompatActivity)getActivity()).getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
| 861 |
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
|
874 |
((AppCompatActivity)getActivity()).getSupportActionBar().hide();
|
| 862 |
}
|
875 |
}
|
| 863 |
else{
|
876 |
else{
|
| 864 |
((AppCompatActivity)getActivity()).getSupportActionBar().show();
|
877 |
((AppCompatActivity)getActivity()).getSupportActionBar().show();
|
| Line 1033... |
Line 1046... |
| 1033 |
}
|
1046 |
}
|
| 1034 |
else if (webView.getUrl().contains(apiData.getString("domain","http://app.profitmandi.com"))) {
|
1047 |
else if (webView.getUrl().contains(apiData.getString("domain","http://app.profitmandi.com"))) {
|
| 1035 |
//else if(webView.getUrl().contains(ProfitTillConstants.Web_Uri)){
|
1048 |
//else if(webView.getUrl().contains(ProfitTillConstants.Web_Uri)){
|
| 1036 |
if (doubleBackToExitPressedOnce) {
|
1049 |
if (doubleBackToExitPressedOnce) {
|
| 1037 |
new AlertDialog.Builder(getActivity())
|
1050 |
new AlertDialog.Builder(getActivity())
|
| 1038 |
.setIcon(R.drawable.symbol)
|
1051 |
.setIcon(R.drawable.exitsymbol)
|
| 1039 |
.setTitle("Exit!")
|
1052 |
.setTitle("Exit!")
|
| 1040 |
.setMessage("Are you sure you want to close?")
|
1053 |
.setMessage("Are you sure you want to close?")
|
| 1041 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
1054 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
| 1042 |
@Override
|
1055 |
@Override
|
| 1043 |
public void onClick(DialogInterface dialog, int which) {
|
1056 |
public void onClick(DialogInterface dialog, int which) {
|
| Line 1490... |
Line 1503... |
| 1490 |
try {
|
1503 |
try {
|
| 1491 |
String veb=webView.getUrl();
|
1504 |
String veb=webView.getUrl();
|
| 1492 |
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"))) {
|
1505 |
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"))) {
|
| 1493 |
if (doubleBackToExitPressedOnce) {
|
1506 |
if (doubleBackToExitPressedOnce) {
|
| 1494 |
new AlertDialog.Builder(getActivity())
|
1507 |
new AlertDialog.Builder(getActivity())
|
| 1495 |
.setIcon(R.drawable.symbol)
|
1508 |
.setIcon(R.drawable.exitsymbol)
|
| 1496 |
.setTitle("Exit!")
|
1509 |
.setTitle("Exit!")
|
| 1497 |
.setMessage("Are you sure you want to close?")
|
1510 |
.setMessage("Are you sure you want to close?")
|
| 1498 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
1511 |
.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
|
| 1499 |
@Override
|
1512 |
@Override
|
| 1500 |
public void onClick(DialogInterface dialog, int which) {
|
1513 |
public void onClick(DialogInterface dialog, int which) {
|
| Line 1725... |
Line 1738... |
| 1725 |
*/
|
1738 |
*/
|
| 1726 |
public javascriptInterface(WebView c) {
|
1739 |
public javascriptInterface(WebView c) {
|
| 1727 |
|
1740 |
|
| 1728 |
this.view=c;
|
1741 |
this.view=c;
|
| 1729 |
}
|
1742 |
}
|
| 1730 |
@JavascriptInterface
|
1743 |
/* @JavascriptInterface
|
| 1731 |
public void otpSent() {
|
1744 |
public void otpSent() {
|
| 1732 |
//Toast.makeText(getActivity(),"successfull",Toast.LENGTH_LONG).show();
|
1745 |
//Toast.makeText(getActivity(),"successfull",Toast.LENGTH_LONG).show();
|
| 1733 |
getActivity().registerReceiver(broadcastReceiver, new IntentFilter(SMS_RECEIVED));
|
1746 |
getActivity().registerReceiver(broadcastReceiver, new IntentFilter(SMS_RECEIVED));
|
| 1734 |
}
|
1747 |
}*/
|
| 1735 |
@JavascriptInterface
|
1748 |
@JavascriptInterface
|
| 1736 |
public void performClick(String strl) {
|
1749 |
public void performClick(String strl) {
|
| 1737 |
Toast.makeText(getActivity(), strl, Toast.LENGTH_SHORT).show();
|
1750 |
Toast.makeText(getActivity(), strl, Toast.LENGTH_SHORT).show();
|
| 1738 |
}
|
1751 |
}
|
| 1739 |
@JavascriptInterface
|
1752 |
@JavascriptInterface
|
| Line 1955... |
Line 1968... |
| 1955 |
protected String doInBackground(String... params) {
|
1968 |
protected String doInBackground(String... params) {
|
| 1956 |
try {
|
1969 |
try {
|
| 1957 |
HttpClient httpclient = new DefaultHttpClient();
|
1970 |
HttpClient httpclient = new DefaultHttpClient();
|
| 1958 |
HttpGet httpget=new HttpGet(apiData.getString("Web_Api_Tokendetail","http://app.profitmandi.com/apis/user/detail/token"));
|
1971 |
HttpGet httpget=new HttpGet(apiData.getString("Web_Api_Tokendetail","http://app.profitmandi.com/apis/user/detail/token"));
|
| 1959 |
// HttpGet httpget = new HttpGet(ProfitTillConstants.Web_Api + "/user/token-info");
|
1972 |
// HttpGet httpget = new HttpGet(ProfitTillConstants.Web_Api + "/user/token-info");
|
| - |
|
1973 |
// HttpGet httpget=new HttpGet("http://192.168.120.52:8080/profitmandi-web/user/detail/token");
|
| 1960 |
httpget.setHeader("Auth-Token", userData.getString("token", ""));
|
1974 |
httpget.setHeader("Auth-Token", userData.getString("token", ""));
|
| 1961 |
HttpResponse response = httpclient.execute(httpget);
|
1975 |
HttpResponse response = httpclient.execute(httpget);
|
| 1962 |
HttpEntity entity = response.getEntity();
|
1976 |
HttpEntity entity = response.getEntity();
|
| 1963 |
int status = response.getStatusLine().getStatusCode();
|
1977 |
int status = response.getStatusLine().getStatusCode();
|
| 1964 |
JSONObject jObjGmail = new JSONObject(EntityUtils.toString(entity));
|
1978 |
JSONObject jObjGmail = new JSONObject(EntityUtils.toString(entity));
|
| Line 2013... |
Line 2027... |
| 2013 |
|
2027 |
|
| 2014 |
@Override
|
2028 |
@Override
|
| 2015 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
2029 |
protected String doInBackground(ArrayList<NameValuePair>... arg0) {
|
| 2016 |
try {
|
2030 |
try {
|
| 2017 |
HttpClient httpclient = new DefaultHttpClient();
|
2031 |
HttpClient httpclient = new DefaultHttpClient();
|
| - |
|
2032 |
// HttpPost httppost = new HttpPost(apiData.getString("devices_info","http://192.168.120.52:8080/profitmandi-web/devices/add"));
|
| 2018 |
HttpPost httppost = new HttpPost(apiData.getString("devices_info","http://api.profittill.com/devices/add"));
|
2033 |
HttpPost httppost = new HttpPost(apiData.getString("devices_info","http://api.profittill.com/devices/add"));
|
| 2019 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Push_Url);
|
2034 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.Push_Url);
|
| 2020 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
2035 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
| 2021 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
2036 |
httppost.setEntity(new UrlEncodedFormEntity(arg0[0]));
|
| 2022 |
HttpResponse response = httpclient.execute(httppost);
|
2037 |
HttpResponse response = httpclient.execute(httppost);
|
| Line 2056... |
Line 2071... |
| 2056 |
HttpClient httpclient = new DefaultHttpClient();
|
2071 |
HttpClient httpclient = new DefaultHttpClient();
|
| 2057 |
HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url","http://api.profittill.com/gcm_users/add"));
|
2072 |
HttpPost httppost = new HttpPost(apiData.getString("gcm.push.url","http://api.profittill.com/gcm_users/add"));
|
| 2058 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.gcm_url);
|
2073 |
//HttpPost httppost = new HttpPost(ProfitTillConstants.gcm_url);
|
| 2059 |
ArrayList<NameValuePair> nameValuePairsGcm = new ArrayList<>();
|
2074 |
ArrayList<NameValuePair> nameValuePairsGcm = new ArrayList<>();
|
| 2060 |
TelephonyManager telephonyManager = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
2075 |
TelephonyManager telephonyManager = (TelephonyManager)getActivity().getSystemService(Context.TELEPHONY_SERVICE);
|
| 2061 |
nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid", regId));
|
- |
|
| 2062 |
nameValuePairsGcm.add(new BasicNameValuePair("imeinumber", telephonyManager.getDeviceId()));
|
2076 |
nameValuePairsGcm.add(new BasicNameValuePair("imeinumber", telephonyManager.getDeviceId()));
|
| - |
|
2077 |
nameValuePairsGcm.add(new BasicNameValuePair("gcm_regid", regId));
|
| 2063 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id", null)));
|
2078 |
nameValuePairsGcm.add(new BasicNameValuePair("user_id", userData.getString("id", null)));
|
| 2064 |
nameValuePairsGcm.add(new BasicNameValuePair("notification_type","fcm"));
|
2079 |
nameValuePairsGcm.add(new BasicNameValuePair("notification_type","fcm"));
|
| 2065 |
nameValuePairsGcm.add(new BasicNameValuePair("device_message", arg0[0]));
|
2080 |
nameValuePairsGcm.add(new BasicNameValuePair("device_message", arg0[0]));
|
| 2066 |
nameValuePairsGcm.add(new BasicNameValuePair("androidid", UtilityFunctions.androidId(getActivity())));
|
2081 |
nameValuePairsGcm.add(new BasicNameValuePair("androidid", UtilityFunctions.androidId(getActivity())));
|
| 2067 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|
2082 |
httppost.setHeader("Authorization", ProfitTillConstants.BASIC_AUTH);
|