| Line 104... |
Line 104... |
| 104 |
String saholicUrl;
|
104 |
String saholicUrl;
|
| 105 |
JSONObject jSaholic;
|
105 |
JSONObject jSaholic;
|
| 106 |
JSONArray jsArraySaholic;
|
106 |
JSONArray jsArraySaholic;
|
| 107 |
String snapdealJavascriptUrl;
|
107 |
String snapdealJavascriptUrl;
|
| 108 |
String type1;
|
108 |
String type1;
|
| - |
|
109 |
ArrayList<String> orderSuccessUrlList;
|
| 109 |
public GoogleApiClient mGoogleApiClient;
|
110 |
public GoogleApiClient mGoogleApiClient;
|
| 110 |
@Override
|
111 |
@Override
|
| 111 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
112 |
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
| 112 |
Bundle savedInstanceState) {
|
113 |
Bundle savedInstanceState) {
|
| 113 |
|
114 |
|
| Line 125... |
Line 126... |
| 125 |
amazonapiSettingsEditor = amazonData.edit();
|
126 |
amazonapiSettingsEditor = amazonData.edit();
|
| 126 |
flipkartDataEditor = flipkartData.edit();
|
127 |
flipkartDataEditor = flipkartData.edit();
|
| 127 |
affliateUrl=getArguments().getString("key");
|
128 |
affliateUrl=getArguments().getString("key");
|
| 128 |
orderDetails = new OrderTransactionDetails(getActivity());
|
129 |
orderDetails = new OrderTransactionDetails(getActivity());
|
| 129 |
|
130 |
|
| - |
|
131 |
orderSuccessUrlList = new ArrayList<String>();
|
| - |
|
132 |
String issues =apiData.getString("list.order.success.url","snapdeal.com/purchaseMobileComplete?code=|flipkart.com/orderresponse?reference_id=|amazon.in/gp/buy/spc/handlers/static-submit-decoupled.html|amazon.in/gp/buy/thankyou/handlers|m.saholic.com/pay-success?paymentId=|shopclues.com/orderconfirmation|");
|
| - |
|
133 |
StringTokenizer st2 = new StringTokenizer(issues, "|");
|
| - |
|
134 |
|
| - |
|
135 |
while (st2.hasMoreElements()) {
|
| - |
|
136 |
orderSuccessUrlList.add(st2.nextToken());
|
| - |
|
137 |
}
|
| 130 |
|
138 |
|
| 131 |
if(isInternetOn()) {
|
139 |
if(isInternetOn()) {
|
| 132 |
if(orderDetails.countTotalRecords()>0){
|
140 |
if(orderDetails.countTotalRecords()>0){
|
| 133 |
sendQueuedResponse();
|
141 |
sendQueuedResponse();
|
| 134 |
}
|
142 |
}
|
| Line 148... |
Line 156... |
| 148 |
pageLoad =apiData.getString("profitmandi.pageloads.pattern","");
|
156 |
pageLoad =apiData.getString("profitmandi.pageloads.pattern","");
|
| 149 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
157 |
StringTokenizer st1 = new StringTokenizer(pageLoad,"|");
|
| 150 |
while(st1.hasMoreTokens()){
|
158 |
while(st1.hasMoreTokens()){
|
| 151 |
pageLoadList.add( st1.nextToken());
|
159 |
pageLoadList.add( st1.nextToken());
|
| 152 |
}
|
160 |
}
|
| 153 |
//pageLoadList.add("tag");
|
- |
|
| 154 |
WebClientClass webViewClient = new WebClientClass();
|
161 |
WebClientClass webViewClient = new WebClientClass();
|
| 155 |
webView = (WebView) rootView.findViewById(R.id.webView);
|
162 |
webView = (WebView) rootView.findViewById(R.id.webView);
|
| 156 |
webView.setClickable(true);
|
163 |
webView.setClickable(true);
|
| 157 |
webView.setFocusableInTouchMode(true);
|
164 |
webView.setFocusableInTouchMode(true);
|
| 158 |
webView.getSettings().setDomStorageEnabled(true);
|
165 |
webView.getSettings().setDomStorageEnabled(true);
|
| Line 170... |
Line 177... |
| 170 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
177 |
cookieManager1.setAcceptThirdPartyCookies(webView, true);
|
| 171 |
}
|
178 |
}
|
| 172 |
if(Uri.parse(getArguments().getString("key")).getHost().contains("api.profittill")) {
|
179 |
if(Uri.parse(getArguments().getString("key")).getHost().contains("api.profittill")) {
|
| 173 |
userDataEditor.putString("saholic.data",UtilityFunctions.clearCookiesNew(getArguments().getString("key"),getActivity())).commit();
|
180 |
userDataEditor.putString("saholic.data",UtilityFunctions.clearCookiesNew(getArguments().getString("key"),getActivity())).commit();
|
| 174 |
}
|
181 |
}
|
| 175 |
webView.loadUrl(getArguments().getString("key"));
|
182 |
String url = getArguments().getString("key");
|
| - |
|
183 |
if(Uri.parse(url).getHost().equalsIgnoreCase(ProfitTillConstants.DOMAIN)) {
|
| - |
|
184 |
CookieSyncManager.createInstance(getActivity());
|
| - |
|
185 |
CookieManager cookieManager1 = CookieManager.getInstance();
|
| - |
|
186 |
cookieManager1.setCookie(url, "token=" + userData.getString("token", ""));
|
| - |
|
187 |
cookieManager1.setCookie(url, "walletAuthentication=true");
|
| - |
|
188 |
cookieManager1.setCookie(url, "shopcluesActive=true");
|
| - |
|
189 |
}
|
| - |
|
190 |
webView.loadUrl(url);
|
| 176 |
webView.setWebViewClient(webViewClient);
|
191 |
webView.setWebViewClient(webViewClient);
|
| 177 |
|
192 |
|
| 178 |
}
|
193 |
}
|
| 179 |
else{
|
194 |
else{
|
| 180 |
SearchFragment nextFrag= new SearchFragment();
|
195 |
SearchFragment nextFrag= new SearchFragment();
|
| 181 |
Bundle args = new Bundle();
|
196 |
Bundle args = new Bundle();
|
| Line 193... |
Line 208... |
| 193 |
@Override
|
208 |
@Override
|
| 194 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
209 |
public void onViewCreated(View view, Bundle savedInstanceState) {
|
| 195 |
super.onViewCreated(view, savedInstanceState);
|
210 |
super.onViewCreated(view, savedInstanceState);
|
| 196 |
}
|
211 |
}
|
| 197 |
|
212 |
|
| 198 |
|
- |
|
| 199 |
|
- |
|
| 200 |
|
- |
|
| 201 |
JSONObject obj;
|
213 |
JSONObject obj;
|
| 202 |
|
214 |
|
| 203 |
@Override
|
215 |
@Override
|
| 204 |
public void onConnected(Bundle bundle) {
|
216 |
public void onConnected(Bundle bundle) {
|
| 205 |
|
217 |
|
| Line 217... |
Line 229... |
| 217 |
public class WebClientClass extends WebViewClient {
|
229 |
public class WebClientClass extends WebViewClient {
|
| 218 |
ProgressDialog pd = null;
|
230 |
ProgressDialog pd = null;
|
| 219 |
ProgressDialog pd1 = null;
|
231 |
ProgressDialog pd1 = null;
|
| 220 |
ProgressDialog pd2 = null;
|
232 |
ProgressDialog pd2 = null;
|
| 221 |
|
233 |
|
| - |
|
234 |
|
| 222 |
@Override
|
235 |
@Override
|
| 223 |
public void onReceivedHttpAuthRequest(WebView view,
|
236 |
public void onReceivedHttpAuthRequest(WebView view,
|
| 224 |
HttpAuthHandler handler, String host, String realm) {
|
237 |
HttpAuthHandler handler, String host, String realm) {
|
| 225 |
|
238 |
|
| 226 |
handler.proceed("dtr", "dtr18Feb2015");
|
239 |
handler.proceed("dtr", "dtr18Feb2015");
|
| 227 |
}
|
240 |
}
|
| 228 |
|
241 |
|
| 229 |
@Override
|
242 |
@Override
|
| 230 |
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
243 |
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
| 231 |
|
244 |
|
| 232 |
if(url.contains(apiData.getString("wallet.auth","api.profittill.com/special/native/login"))){
|
245 |
if(url.contains(apiData.getString("wallet.auth","api.profittill.com/special/native/login")) || userData.getString("id","").isEmpty()){
|
| 233 |
//Toast.makeText(getActivity(),apiData.getString("wallet.error", "Error while logging in to the wallet. Please log in again"), Toast.LENGTH_SHORT).show();
|
246 |
//Toast.makeText(getActivity(),apiData.getString("wallet.error", "Error while logging in to the wallet. Please log in again"), Toast.LENGTH_SHORT).show();
|
| 234 |
android.webkit.CookieManager cookieManager = android.webkit.CookieManager.getInstance();
|
247 |
android.webkit.CookieManager cookieManager = android.webkit.CookieManager.getInstance();
|
| 235 |
android.webkit.CookieSyncManager.createInstance(getActivity());
|
248 |
android.webkit.CookieSyncManager.createInstance(getActivity());
|
| 236 |
cookieManager.removeAllCookie();
|
249 |
cookieManager.removeAllCookie();
|
| 237 |
AlertDialog alert;
|
250 |
AlertDialog alert;
|
| Line 299... |
Line 312... |
| 299 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
312 |
public synchronized void onPageStarted(final WebView view, String url, Bitmap favicon) {
|
| 300 |
super.onPageStarted(view, url, favicon);
|
313 |
super.onPageStarted(view, url, favicon);
|
| 301 |
final CharSequence[] items = {" Don't show me again "};
|
314 |
final CharSequence[] items = {" Don't show me again "};
|
| 302 |
final ArrayList seletedItems=new ArrayList();
|
315 |
final ArrayList seletedItems=new ArrayList();
|
| 303 |
try {
|
316 |
try {
|
| - |
|
317 |
if(Uri.parse(url).getHost().equalsIgnoreCase(ProfitTillConstants.DOMAIN)) {
|
| 304 |
CookieSyncManager.createInstance(getActivity());
|
318 |
CookieSyncManager.createInstance(getActivity());
|
| 305 |
CookieManager cookieManager = CookieManager.getInstance();
|
319 |
CookieManager cookieManager = CookieManager.getInstance();
|
| 306 |
cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
|
320 |
cookieManager.setCookie(url, "token=" + userData.getString("token", ""));
|
| 307 |
cookieManager.setCookie(url, "walletAuthentication=true");
|
321 |
cookieManager.setCookie(url, "walletAuthentication=true");
|
| - |
|
322 |
cookieManager.setCookie(url, "shopcluesActive=true");
|
| - |
|
323 |
}
|
| 308 |
if(url.contains("dl.flipkart.com/dl/")){
|
324 |
if(url.contains("dl.flipkart.com/dl/")){
|
| 309 |
flipkartUrl=url;
|
325 |
flipkartUrl=url;
|
| 310 |
|
326 |
|
| 311 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
327 |
if(flipkartData.getInt("showagainflag",0)<3) {
|
| 312 |
AlertDialog dialog;
|
328 |
AlertDialog dialog;
|
| Line 415... |
Line 431... |
| 415 |
pd.show();
|
431 |
pd.show();
|
| 416 |
/*parseCookieString(CookieManager.getInstance().getCookie(".saholic.com"),".saholic.com");
|
432 |
/*parseCookieString(CookieManager.getInstance().getCookie(".saholic.com"),".saholic.com");
|
| 417 |
Log.d("Cookie","Cookie Overloaded");
|
433 |
Log.d("Cookie","Cookie Overloaded");
|
| 418 |
parseCookieString(CookieManager.getInstance().getCookie("m.saholic.com"));*/
|
434 |
parseCookieString(CookieManager.getInstance().getCookie("m.saholic.com"));*/
|
| 419 |
}
|
435 |
}
|
| 420 |
getDisplayActionBar(url);
|
436 |
//getDisplayActionBar(url);
|
| - |
|
437 |
getOrderSuccessUrlConfirmation(url);
|
| 421 |
if (displayActionBar) {
|
438 |
if (displayActionBar) {
|
| 422 |
pd1 = new ProgressDialog(getActivity());
|
439 |
pd1 = new ProgressDialog(getActivity());
|
| 423 |
pd1.setTitle("Please wait");
|
440 |
pd1.setTitle("Please wait");
|
| 424 |
pd1.setMessage("Loading..");
|
441 |
pd1.setMessage("Loading..");
|
| 425 |
pd1.show();
|
442 |
pd1.show();
|
| Line 465... |
Line 482... |
| 465 |
}
|
482 |
}
|
| 466 |
|
483 |
|
| 467 |
@Override
|
484 |
@Override
|
| 468 |
public synchronized void onPageFinished(WebView view, String url) {
|
485 |
public synchronized void onPageFinished(WebView view, String url) {
|
| 469 |
super.onPageFinished(view, url);
|
486 |
super.onPageFinished(view, url);
|
| 470 |
Log.d("Progress " , "Progress Finish" + view.getProgress());
|
- |
|
| 471 |
try {
|
487 |
try {
|
| 472 |
|
488 |
|
| 473 |
if (url.contains(apiData.getString("mobile.website.url", "")) || url.equalsIgnoreCase("http://api.profittill.com/categorydeals")) {
|
489 |
if (url.contains(apiData.getString("mobile.website.url", "")) || url.equalsIgnoreCase("http://api.profittill.com/categorydeals")) {
|
| 474 |
pd.dismiss();
|
490 |
pd.dismiss();
|
| 475 |
}
|
491 |
}
|
| Line 701... |
Line 717... |
| 701 |
|
717 |
|
| 702 |
}
|
718 |
}
|
| 703 |
|
719 |
|
| 704 |
public void storeSubTagId(String url){
|
720 |
public void storeSubTagId(String url){
|
| 705 |
|
721 |
|
| 706 |
if(url.contains(apiData.getString("store.subtag.snapdeal",null)) || url.contains(apiData.getString("store.subtag.flipkart",null)) || url.contains(apiData.getString("store.subtag.amazon",null)))
|
722 |
if(url.contains(apiData.getString("store.subtag.snapdeal",null)) || url.contains(apiData.getString("store.subtag.flipkart",null)) || url.contains(apiData.getString("store.subtag.amazon",null)) || url.contains(apiData.getString("store.subtag.shopclues","UID")))
|
| 707 |
{
|
723 |
{
|
| 708 |
|
- |
|
| 709 |
StringTokenizer st2 = new StringTokenizer(url, "&");
|
724 |
StringTokenizer st2 = new StringTokenizer(url, "&");
|
| 710 |
while (st2.hasMoreElements()) {
|
725 |
while (st2.hasMoreElements()) {
|
| 711 |
String token=st2.nextToken();
|
726 |
String token=st2.nextToken();
|
| 712 |
if(token.contains(apiData.getString("store.subtag.snapdeal",null)) || token.contains(apiData.getString("store.subtag.flipkart",null)) || token.contains(apiData.getString("store.subtag.amazon",null)) ){
|
727 |
if(token.contains(apiData.getString("store.subtag.snapdeal",null)) || token.contains(apiData.getString("store.subtag.flipkart",null)) || token.contains(apiData.getString("store.subtag.amazon",null)) || token.contains(apiData.getString("store.subtag.shopclues","UID")) ){
|
| 713 |
System.out.println("True");
|
- |
|
| 714 |
String subtagId=userData.getString("subtag","null");
|
728 |
String subtagId=userData.getString("subtag","null");
|
| 715 |
if(subtagId==null){
|
729 |
if(subtagId==null){
|
| 716 |
userDataEditor.putString("subtag",token.split("=")[1]);
|
730 |
userDataEditor.putString("subtag",token.split("=")[1]);
|
| 717 |
userDataEditor.commit();
|
731 |
userDataEditor.commit();
|
| 718 |
}
|
732 |
}
|
| Line 720... |
Line 734... |
| 720 |
userDataEditor.remove("subtag");
|
734 |
userDataEditor.remove("subtag");
|
| 721 |
userDataEditor.commit();
|
735 |
userDataEditor.commit();
|
| 722 |
userDataEditor.putString("subtag",token.split("=")[1]);
|
736 |
userDataEditor.putString("subtag",token.split("=")[1]);
|
| 723 |
userDataEditor.commit();
|
737 |
userDataEditor.commit();
|
| 724 |
}
|
738 |
}
|
| 725 |
|
- |
|
| 726 |
}
|
739 |
}
|
| 727 |
else
|
740 |
else
|
| 728 |
continue;
|
741 |
continue;
|
| 729 |
}
|
742 |
}
|
| 730 |
}
|
743 |
}
|
| Line 758... |
Line 771... |
| 758 |
displayActionBar = false;
|
771 |
displayActionBar = false;
|
| 759 |
}
|
772 |
}
|
| 760 |
return;
|
773 |
return;
|
| 761 |
}
|
774 |
}
|
| 762 |
|
775 |
|
| - |
|
776 |
public void getOrderSuccessUrlConfirmation(String url) throws Exception{
|
| - |
|
777 |
for(String s:orderSuccessUrlList){
|
| - |
|
778 |
if(url.contains(s)){
|
| - |
|
779 |
displayActionBar=true;
|
| - |
|
780 |
String storeID = getStoreId(url);
|
| - |
|
781 |
if(storeID==null){
|
| - |
|
782 |
Log.e("Deals Page Activity", "Null value returned for storeID");
|
| - |
|
783 |
}
|
| - |
|
784 |
else{
|
| - |
|
785 |
nameValuePairsRawHtml=new ArrayList<NameValuePair>();
|
| - |
|
786 |
nameValuePairsRawHtml.add(new BasicNameValuePair("user_id",userData.getString("id",null)));
|
| - |
|
787 |
nameValuePairsRawHtml.add(new BasicNameValuePair("store_id",storeID));
|
| - |
|
788 |
nameValuePairsRawHtml.add(new BasicNameValuePair("order_url",url));
|
| - |
|
789 |
nameValuePairsRawHtml.add(new BasicNameValuePair("sub_tag",userData.getString("subtag","")));
|
| - |
|
790 |
}
|
| - |
|
791 |
break;
|
| - |
|
792 |
}
|
| - |
|
793 |
else{
|
| - |
|
794 |
displayActionBar = false;
|
| - |
|
795 |
}
|
| - |
|
796 |
}
|
| - |
|
797 |
return;
|
| - |
|
798 |
}
|
| 763 |
|
799 |
|
| 764 |
public String getStoreId(String url){
|
800 |
public String getStoreId(String url){
|
| 765 |
if(url.contains("snapdeal")){
|
801 |
/* if(url.contains("snapdeal")){
|
| 766 |
pageRedirect=Integer.parseInt(apiData.getString("pageredirect.snapdeal","0"));
|
802 |
pageRedirect=Integer.parseInt(apiData.getString("pageredirect.snapdeal","0"));
|
| 767 |
return apiData.getString("store.code.snapdeal",null);
|
803 |
return apiData.getString("store.code.snapdeal",null);
|
| 768 |
}
|
804 |
}
|
| 769 |
else if(url.contains("flipkart")){
|
805 |
else if(url.contains("flipkart")){
|
| 770 |
pageRedirect=Integer.parseInt(apiData.getString("pageredirect.flipkart","0"));
|
806 |
pageRedirect=Integer.parseInt(apiData.getString("pageredirect.flipkart","0"));
|
| Line 775... |
Line 811... |
| 775 |
return apiData.getString("store.code.amazon",null);
|
811 |
return apiData.getString("store.code.amazon",null);
|
| 776 |
}
|
812 |
}
|
| 777 |
else if(url.contains("saholic")){
|
813 |
else if(url.contains("saholic")){
|
| 778 |
return apiData.getString("store.code.spice",null);
|
814 |
return apiData.getString("store.code.spice",null);
|
| 779 |
}
|
815 |
}
|
| - |
|
816 |
else if(url.contains("shopclues")){
|
| 780 |
return null;
|
817 |
return "7";
|
| - |
|
818 |
}*/
|
| - |
|
819 |
return UtilityFunctions.getNewStoreId(UtilityFunctions.generateStoreMap(apiData.getString("stores.code","amazon=1,flipkart=2,snapdeal=3,saholic=4,shopclues=5,")),url);
|
| 781 |
}
|
820 |
}
|
| 782 |
|
821 |
|
| 783 |
class pushData extends AsyncTask<String, Integer, String> {
|
822 |
class pushData extends AsyncTask<String, Integer, String> {
|
| 784 |
|
823 |
|
| 785 |
@Override
|
824 |
@Override
|