set cookie for paypal problem
This commit is contained in:
BIN
.idea/caches/build_file_checksums.ser
generated
BIN
.idea/caches/build_file_checksums.ser
generated
Binary file not shown.
@@ -22,8 +22,8 @@ android {
|
|||||||
applicationId "ch.pizzacucina.android"
|
applicationId "ch.pizzacucina.android"
|
||||||
minSdkVersion 16
|
minSdkVersion 16
|
||||||
targetSdkVersion 28
|
targetSdkVersion 28
|
||||||
versionCode 7 // play store'daki version --> canlı: 0 - dahili test: 17
|
versionCode 8 // play store'daki version --> canlı: 0 - dahili test: 17
|
||||||
versionName "1.07" // play store'daki version --> canlı: 0.00 - dahili test: 1.17
|
versionName "1.08" // play store'daki version --> canlı: 0.00 - dahili test: 1.17
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
manifestPlaceholders = [
|
manifestPlaceholders = [
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":7,"versionName":"1.07","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
[{"outputType":{"type":"APK"},"apkData":{"type":"MAIN","splits":[],"versionCode":8,"versionName":"1.08","enabled":true,"outputFile":"app-release.apk","fullName":"release","baseName":"release"},"path":"app-release.apk","properties":{}}]
|
||||||
@@ -68,7 +68,7 @@ public class SplashActivity extends BaseActivity {
|
|||||||
//DisplayHelper.changeStatusColor();
|
//DisplayHelper.changeStatusColor();
|
||||||
if(NetworkHelper.isNetworkAvailable()){
|
if(NetworkHelper.isNetworkAvailable()){
|
||||||
registerNotificationTag();
|
registerNotificationTag();
|
||||||
getStoreList();
|
getSessionId();
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
DialogHelper.showNoNetworkDialog();
|
DialogHelper.showNoNetworkDialog();
|
||||||
@@ -108,8 +108,33 @@ public class SplashActivity extends BaseActivity {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getStoreList(){
|
private void getSessionId(){
|
||||||
DialogHelper.showLoadingDialog();
|
DialogHelper.showLoadingDialog();
|
||||||
|
Call<ResponseObject<String>> call = ApiService.apiInterface.getSessionId();
|
||||||
|
call.enqueue(new Callback<ResponseObject<String>>() {
|
||||||
|
@Override
|
||||||
|
public void onResponse(Call<ResponseObject<String>> call, Response<ResponseObject<String>> response) {
|
||||||
|
if(response.isSuccessful() &&
|
||||||
|
response.body().getData() != null &&
|
||||||
|
response.body().isSuccess() && !response.body().getData().isEmpty()){
|
||||||
|
SessionHelper.saveSessionId(response.body().getData());
|
||||||
|
getStoreList();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
DialogHelper.hideLoadingDialog();
|
||||||
|
ApiErrorUtils.parseError(response);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onFailure(Call<ResponseObject<String>> call, Throwable t) {
|
||||||
|
DialogHelper.hideLoadingDialog();
|
||||||
|
DialogHelper.showFailedDialog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void getStoreList(){
|
||||||
Call<ResponseArray<StoreModel>> call = ApiService.apiInterface.getStoreList();
|
Call<ResponseArray<StoreModel>> call = ApiService.apiInterface.getStoreList();
|
||||||
call.enqueue(new Callback<ResponseArray<StoreModel>>() {
|
call.enqueue(new Callback<ResponseArray<StoreModel>>() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ public class ApiEndPoints {
|
|||||||
|
|
||||||
public static final String API_GET_STORE_LIST = "pizza/servicemagazabelirle.php";
|
public static final String API_GET_STORE_LIST = "pizza/servicemagazabelirle.php";
|
||||||
public static final String API_GET_CAMPAIGN_BANNERS = "pizzacucina" + PREFIX + "getCampaignBanners" + SUFFIX;
|
public static final String API_GET_CAMPAIGN_BANNERS = "pizzacucina" + PREFIX + "getCampaignBanners" + SUFFIX;
|
||||||
|
public static final String API_GET_SESSION_ID = "pizzacucina" + PREFIX + "getSessionId" + SUFFIX;
|
||||||
|
|
||||||
public static final String API_GET_ALL_CATEGORIES = PREFIX + "getAllCategories" + SUFFIX;
|
public static final String API_GET_ALL_CATEGORIES = PREFIX + "getAllCategories" + SUFFIX;
|
||||||
public static final String API_GET_IGNORED_CATEGORY_IDS= PREFIX + "getIgnoredCategory" + SUFFIX;
|
public static final String API_GET_IGNORED_CATEGORY_IDS= PREFIX + "getIgnoredCategory" + SUFFIX;
|
||||||
|
|||||||
@@ -228,6 +228,9 @@ public interface ApiInterface {
|
|||||||
@GET(ApiEndPoints.API_GET_STORE_LIST)
|
@GET(ApiEndPoints.API_GET_STORE_LIST)
|
||||||
Call<ResponseArray<StoreModel>> getStoreList();
|
Call<ResponseArray<StoreModel>> getStoreList();
|
||||||
|
|
||||||
|
@GET(ApiEndPoints.API_GET_SESSION_ID)
|
||||||
|
Call<ResponseObject<String>> getSessionId();
|
||||||
|
|
||||||
@GET("{storeName}" + ApiEndPoints.API_GET_DELIVERY_TIME_OF_STORE)
|
@GET("{storeName}" + ApiEndPoints.API_GET_DELIVERY_TIME_OF_STORE)
|
||||||
Call<ResponseObject<StoreShiftModel>> getDeliveryTimeOfStore(@Path("storeName") String storeName,
|
Call<ResponseObject<StoreShiftModel>> getDeliveryTimeOfStore(@Path("storeName") String storeName,
|
||||||
@Query("shipping_method_code") String shippingMethodCode);
|
@Query("shipping_method_code") String shippingMethodCode);
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import java.io.IOException;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import ch.pizzacucina.android.BuildConfig;
|
import ch.pizzacucina.android.BuildConfig;
|
||||||
|
import ch.pizzacucina.android.helper.SessionHelper;
|
||||||
import okhttp3.Interceptor;
|
import okhttp3.Interceptor;
|
||||||
import okhttp3.OkHttpClient;
|
import okhttp3.OkHttpClient;
|
||||||
import okhttp3.Request;
|
import okhttp3.Request;
|
||||||
@@ -44,6 +45,14 @@ public class ApiService {
|
|||||||
Request.Builder builder = chain.request().newBuilder();
|
Request.Builder builder = chain.request().newBuilder();
|
||||||
builder.addHeader("Content-Type", "application/json");
|
builder.addHeader("Content-Type", "application/json");
|
||||||
|
|
||||||
|
String url = chain.request().url().toString();
|
||||||
|
if(!url.contains("getSessionId") && !SessionHelper.getSessionId().isEmpty()){
|
||||||
|
builder.addHeader("session_id", SessionHelper.getSessionId());
|
||||||
|
//String cookie = "language=de-DE; currency=CHF; PHPSESSID=" + SessionHelper.getSessionId() + ";";
|
||||||
|
String cookie = "PHPSESSID=" + SessionHelper.getSessionId() + ";";
|
||||||
|
builder.addHeader("Cookie", cookie);
|
||||||
|
}
|
||||||
|
|
||||||
Request request = builder.build();
|
Request request = builder.build();
|
||||||
return chain.proceed(request);
|
return chain.proceed(request);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,14 @@ public class SessionHelper {
|
|||||||
SharedPrefsHelper.saveSelectedCoupon(couponModel);
|
SharedPrefsHelper.saveSelectedCoupon(couponModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getSessionId(){
|
||||||
|
return SharedPrefsHelper.getSessionId();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void saveSessionId(String sessionId){
|
||||||
|
SharedPrefsHelper.saveSessionId(sessionId);
|
||||||
|
}
|
||||||
|
|
||||||
public static CheckCouponModel getSelectedCoupon(){
|
public static CheckCouponModel getSelectedCoupon(){
|
||||||
return SharedPrefsHelper.getSelectedCoupon();
|
return SharedPrefsHelper.getSelectedCoupon();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public class SharedPrefsHelper {
|
|||||||
private static final String PREF_KEY_USER_SELECTED_STORE = SHARED_PREFS_NAME + "selectedStore";
|
private static final String PREF_KEY_USER_SELECTED_STORE = SHARED_PREFS_NAME + "selectedStore";
|
||||||
private static final String PREF_KEY_IS_FIRST_TIME = SHARED_PREFS_NAME + "isFirstTime";
|
private static final String PREF_KEY_IS_FIRST_TIME = SHARED_PREFS_NAME + "isFirstTime";
|
||||||
private static final String PREF_KEY_SELECTED_COUPON = SHARED_PREFS_NAME + "selectedCoupon";
|
private static final String PREF_KEY_SELECTED_COUPON = SHARED_PREFS_NAME + "selectedCoupon";
|
||||||
|
private static final String PREF_KEY_SESSION_ID = SHARED_PREFS_NAME + "sessionId";
|
||||||
|
|
||||||
private static SharedPreferences sharedPreferences =
|
private static SharedPreferences sharedPreferences =
|
||||||
BaseActivity.currentActivity
|
BaseActivity.currentActivity
|
||||||
@@ -93,6 +94,7 @@ public class SharedPrefsHelper {
|
|||||||
editor.remove(PREF_KEY_CART_ITEM_COUNT);
|
editor.remove(PREF_KEY_CART_ITEM_COUNT);
|
||||||
editor.remove(PREF_KEY_CART_TOTAL_PRICE);
|
editor.remove(PREF_KEY_CART_TOTAL_PRICE);
|
||||||
editor.remove(PREF_KEY_SELECTED_COUPON);
|
editor.remove(PREF_KEY_SELECTED_COUPON);
|
||||||
|
editor.remove(PREF_KEY_SESSION_ID);
|
||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -186,6 +188,19 @@ public class SharedPrefsHelper {
|
|||||||
editor.apply();
|
editor.apply();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void saveSessionId(String sessionId){
|
||||||
|
editor.putString(PREF_KEY_SESSION_ID, sessionId);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getSessionId(){
|
||||||
|
return sharedPreferences.getString(PREF_KEY_SESSION_ID, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void clearSessionId(){
|
||||||
|
editor.remove(PREF_KEY_SESSION_ID);
|
||||||
|
editor.apply();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user