campaign control changed
This commit is contained in:
@@ -93,6 +93,8 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
case R.id.addToCartButton:
|
||||
if(checkFields()){
|
||||
if(SessionHelper.isCustomerLoggedIn()){
|
||||
addProductToCart();
|
||||
/*
|
||||
if((campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_PIZZAPASS) && SessionHelper.isUserUsedPizzapassCampaign()) ||
|
||||
(campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_CHAMPAGNE) && SessionHelper.isUserUsedChampagneCampaign())){
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, cannotUseCampaignText);
|
||||
@@ -100,6 +102,7 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
else {
|
||||
addProductToCart();
|
||||
}
|
||||
*/
|
||||
}
|
||||
else {
|
||||
DialogHelper.showNeedToLoginDialog(R.string.need_to_login_for_shopping);
|
||||
@@ -332,12 +335,6 @@ public class CampaignProductDetailsActivity extends BaseActivity {
|
||||
response.body().isSuccess()){
|
||||
SharedPrefsHelper.setCartItemCount(response.body().getData().getProducts().size());
|
||||
SharedPrefsHelper.setCartTotalPrice(PriceHelper.removeCurrencyFromPrice(response.body().getData().getCartTotalModel().getText()));
|
||||
if(campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_PIZZAPASS)){
|
||||
SessionHelper.setUserUsedPizzapassCampaign(true);
|
||||
}
|
||||
else if(campaignModel.getCode().equals(ApiConstants.CAMPAIGN_CODE_CHAMPAGNE)){
|
||||
SessionHelper.setUserUsedChampagneCampaign(true);
|
||||
}
|
||||
|
||||
/*
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
|
||||
@@ -134,8 +134,6 @@ public class CreateOrderActivity extends BaseActivity {
|
||||
startActivity(mainActivityIntent);
|
||||
SharedPrefsHelper.setCartItemCount(0);
|
||||
SharedPrefsHelper.setCartTotalPrice("0");
|
||||
SharedPrefsHelper.setUserUsedPizzapassCampaign(false);
|
||||
SharedPrefsHelper.setUserUsedChampagneCampaign(false);
|
||||
finishAffinity();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.pizzapp.android.fragment;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -40,6 +41,7 @@ import ch.pizzapp.android.adapter.recycler.CartRecyclerAdapter;
|
||||
import ch.pizzapp.android.api.ApiEndPoints;
|
||||
import ch.pizzapp.android.api.ApiErrorUtils;
|
||||
import ch.pizzapp.android.api.ApiService;
|
||||
import ch.pizzapp.android.api.ResponseArray;
|
||||
import ch.pizzapp.android.api.ResponseObject;
|
||||
import ch.pizzapp.android.helper.DialogHelper;
|
||||
import ch.pizzapp.android.helper.PriceHelper;
|
||||
@@ -50,6 +52,7 @@ import ch.pizzapp.android.model.CampaignModel;
|
||||
import ch.pizzapp.android.model.RemoveProductFromCartResponseModel;
|
||||
import ch.pizzapp.android.model.cart.CartInfoModel;
|
||||
import ch.pizzapp.android.model.cart.CartProductModel;
|
||||
import ch.pizzapp.android.model.menu.MenuProductModel;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
@@ -84,6 +87,8 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
public static final java.lang.String FRAGMENT_NAME = "cartFragment";
|
||||
private int REQUEST_CODE_CAMPAIGN_PRODUCT_LIST = 7847;
|
||||
private String pizzapassCampaignCategoryId = "";
|
||||
private String champagneCampaignCategoryId = "";
|
||||
|
||||
private CartInfoModel cartInfoModel;
|
||||
private ArrayList<CartProductModel> cartProductList = new ArrayList<>();
|
||||
@@ -148,9 +153,17 @@ public class CartFragment extends BaseFragment {
|
||||
Double cartCurrentPrice = PriceHelper.stringToDouble(PriceHelper.removeCurrencyFromPrice(cartInfoModel.getCartTotalModel().getText()));
|
||||
|
||||
if(cartCurrentPrice >= storeMinimumPrice){
|
||||
Intent continueCartIntent = new Intent(BaseActivity.currentActivity, CreateOrderActivity.class);
|
||||
continueCartIntent.putExtra("cartInfoModel", cartInfoModel);
|
||||
startActivity(continueCartIntent);
|
||||
|
||||
if(!pizzapassCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForPizzapassOnContinueButtonClicked();
|
||||
}
|
||||
else if(!champagneCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForChampagneOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
openCreateOrderActivity();
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
String dialogText =
|
||||
@@ -196,7 +209,13 @@ public class CartFragment extends BaseFragment {
|
||||
mainActivity.setCartTotalLayoutVisibility(false);
|
||||
setCartTotalFields();
|
||||
fillAndNotifyAdapter();
|
||||
checkPizzapassCampaign();
|
||||
|
||||
if(cartInfoModel.getProducts().isEmpty()){
|
||||
DialogHelper.hideLoadingDialog();
|
||||
}
|
||||
else {
|
||||
checkPizzapassCampaign();
|
||||
}
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
@@ -227,8 +246,6 @@ public class CartFragment extends BaseFragment {
|
||||
setCartLayoutsVisibility();
|
||||
SharedPrefsHelper.setCartItemCount(0);
|
||||
SharedPrefsHelper.setCartTotalPrice("0");
|
||||
SharedPrefsHelper.setUserUsedPizzapassCampaign(false);
|
||||
SharedPrefsHelper.setUserUsedChampagneCampaign(false);
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
mainActivity.setCartItemCount();
|
||||
}
|
||||
@@ -355,17 +372,19 @@ public class CartFragment extends BaseFragment {
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()){
|
||||
|
||||
DialogHelper.showOneButtonDialogWithCallback(productRemovedFromCartText, new MaterialDialog.SingleButtonCallback() {
|
||||
@Override
|
||||
public void onClick(@NonNull MaterialDialog dialog, @NonNull DialogAction which) {
|
||||
SharedPrefsHelper.setCartItemCount(response.body().getData().getProducts().size());
|
||||
SharedPrefsHelper.setCartTotalPrice(PriceHelper.removeCurrencyFromPrice(response.body().getData().getCartTotalModel().getText()));
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
mainActivity.setCartItemCount();
|
||||
mainActivity.reopenCartFragment();
|
||||
}
|
||||
});
|
||||
|
||||
DialogHelper.showOneButtonDialogWithDismissListener(
|
||||
productRemovedFromCartText,
|
||||
new DialogInterface.OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dialogInterface) {
|
||||
SharedPrefsHelper.setCartItemCount(response.body().getData().getProducts().size());
|
||||
SharedPrefsHelper.setCartTotalPrice(PriceHelper.removeCurrencyFromPrice(response.body().getData().getCartTotalModel().getText()));
|
||||
MainActivity mainActivity = (MainActivity) getActivity();
|
||||
mainActivity.setCartItemCount();
|
||||
mainActivity.reopenCartFragment();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -417,17 +436,6 @@ public class CartFragment extends BaseFragment {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private void checkPizzapassCampaign(){
|
||||
ApiService
|
||||
.apiInterface
|
||||
@@ -440,6 +448,22 @@ public class CartFragment extends BaseFragment {
|
||||
if(response.isSuccessful() &&
|
||||
response.body() != null){
|
||||
|
||||
if(response.body().isSuccess()){
|
||||
|
||||
if(response.body().getData() == null){
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||
}
|
||||
else {
|
||||
pizzapassCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
getCampaignProducts(response.body().getData(), true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
checkChampagneCampaign();
|
||||
}
|
||||
|
||||
/*
|
||||
if(response.body().isSuccess() &&
|
||||
!SessionHelper.isUserUsedPizzapassCampaign()){
|
||||
DialogHelper.hideLoadingDialog();
|
||||
@@ -453,21 +477,9 @@ public class CartFragment extends BaseFragment {
|
||||
}
|
||||
else {
|
||||
checkChampagneCampaign();
|
||||
/*
|
||||
// dummy //
|
||||
CampaignModel campaignModel = new CampaignModel();
|
||||
campaignModel.setCategoryId("71");
|
||||
campaignModel.setName("Pizzapass");
|
||||
campaignModel.setCode("PIZZAPASS");
|
||||
campaignModel.setDescription("10 pizza alana 11. pizza bizden!");
|
||||
if(!SessionHelper.isUserUsedPizzapassCampaign()){
|
||||
showPizzapassCampaignDialog(campaignModel);
|
||||
}
|
||||
else {
|
||||
checkChampagneCampaign();
|
||||
}
|
||||
*/
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
else{
|
||||
DialogHelper.hideLoadingDialog();
|
||||
@@ -479,23 +491,6 @@ public class CartFragment extends BaseFragment {
|
||||
public void onFailure(Call<ResponseObject<CampaignModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
|
||||
/*
|
||||
// dummy //
|
||||
CampaignModel campaignModel = new CampaignModel();
|
||||
campaignModel.setCategoryId("71");
|
||||
campaignModel.setName("Pizzapass");
|
||||
campaignModel.setCode("PIZZAPASS");
|
||||
campaignModel.setDescription("10 pizza alana 11. pizza bizden!");
|
||||
if(!SessionHelper.isUserUsedPizzapassCampaign()){
|
||||
showPizzapassCampaignDialog(campaignModel);
|
||||
}
|
||||
else {
|
||||
checkChampagneCampaign();
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -537,6 +532,19 @@ public class CartFragment extends BaseFragment {
|
||||
if(response.isSuccessful() &&
|
||||
response.body() != null){
|
||||
|
||||
if(response.body().isSuccess()){
|
||||
|
||||
if(response.body().getData() == null){
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||
}
|
||||
else {
|
||||
champagneCampaignCategoryId = response.body().getData().getCategoryId();
|
||||
getCampaignProducts(response.body().getData(), false);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
if(response.body().isSuccess() && !SessionHelper.isUserUsedChampagneCampaign()){
|
||||
if(response.body().getData() == null){
|
||||
DialogHelper.showAlertDialog(BaseActivity.currentActivity, genericErrorText);
|
||||
@@ -546,6 +554,7 @@ public class CartFragment extends BaseFragment {
|
||||
showChampagneCampaignDialog(response.body().getData());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
||||
else{
|
||||
@@ -557,22 +566,6 @@ public class CartFragment extends BaseFragment {
|
||||
public void onFailure(Call<ResponseObject<CampaignModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
|
||||
/*
|
||||
// dummy //
|
||||
CampaignModel campaignModel = new CampaignModel();
|
||||
campaignModel.setCategoryId("72");
|
||||
//campaignModel.setCategoryId("71");
|
||||
campaignModel.setName("Champagne Campaign");
|
||||
campaignModel.setCode("CHAMPAGNE");
|
||||
campaignModel.setDescription("40 CHF ve üzeri alişverişlerde 5ML şampanya hediye!");
|
||||
if(!SessionHelper.isUserUsedChampagneCampaign()){
|
||||
showChampagneCampaignDialog(campaignModel);
|
||||
}
|
||||
else {
|
||||
checkDeliveryTime();
|
||||
}
|
||||
*/
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -599,4 +592,141 @@ public class CartFragment extends BaseFragment {
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
private void getCampaignProducts(final CampaignModel campaignModel, final boolean isForPizzapass){
|
||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
campaignModel.getCategoryId());
|
||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
||||
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
|
||||
if(isBasketContainsCampaignProduct(response.body().getData())){
|
||||
if(isForPizzapass){
|
||||
checkChampagneCampaign();
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
}
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
if(isForPizzapass){
|
||||
showPizzapassCampaignDialog(campaignModel);
|
||||
}
|
||||
else {
|
||||
showChampagneCampaignDialog(campaignModel);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<MenuProductModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getCampaignProductsForPizzapassOnContinueButtonClicked(){
|
||||
|
||||
DialogHelper.showLoadingDialog();
|
||||
|
||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
pizzapassCampaignCategoryId);
|
||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
||||
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
cartInfoModel.setPizzapassCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
|
||||
if(!champagneCampaignCategoryId.isEmpty()){
|
||||
getCampaignProductsForChampagneOnContinueButtonClicked();
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
openCreateOrderActivity();
|
||||
}
|
||||
}
|
||||
else {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<MenuProductModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void getCampaignProductsForChampagneOnContinueButtonClicked(){
|
||||
|
||||
DialogHelper.showLoadingDialog();
|
||||
|
||||
Call<ResponseArray<MenuProductModel>> call = ApiService.apiInterface.getProductsByCategory(
|
||||
SessionHelper.getSelectedStore().getStoreName(),
|
||||
champagneCampaignCategoryId);
|
||||
call.enqueue(new Callback<ResponseArray<MenuProductModel>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ResponseArray<MenuProductModel>> call, Response<ResponseArray<MenuProductModel>> response) {
|
||||
|
||||
DialogHelper.hideLoadingDialog();
|
||||
|
||||
if(response.isSuccessful() &&
|
||||
response.body().getData() != null &&
|
||||
response.body().isSuccess()) {
|
||||
cartInfoModel.setChampagneCampaignUsed(isBasketContainsCampaignProduct(response.body().getData()));
|
||||
openCreateOrderActivity();
|
||||
}
|
||||
else {
|
||||
ApiErrorUtils.parseError(response);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ResponseArray<MenuProductModel>> call, Throwable t) {
|
||||
DialogHelper.hideLoadingDialog();
|
||||
DialogHelper.showFailedDialog();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isBasketContainsCampaignProduct(ArrayList<MenuProductModel> campaignProductsList){
|
||||
|
||||
boolean isContains = false;
|
||||
|
||||
outerLoop:for(CartProductModel cartProductModel : cartProductList) {
|
||||
for(MenuProductModel campaignProductModel : campaignProductsList){
|
||||
if(cartProductModel.getProductId().equals(campaignProductModel.getId())){
|
||||
isContains = true;
|
||||
break outerLoop;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return isContains;
|
||||
}
|
||||
|
||||
private void openCreateOrderActivity(){
|
||||
Intent continueCartIntent = new Intent(BaseActivity.currentActivity, CreateOrderActivity.class);
|
||||
continueCartIntent.putExtra("cartInfoModel", cartInfoModel);
|
||||
startActivity(continueCartIntent);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -502,15 +502,11 @@ public class CreateOrderSummaryFragment extends CreateOrderBaseFragment {
|
||||
params.put("payment_method_title", createOrderActivity.getSelectedPaymentMethod().getTitle());
|
||||
params.put("payment_method_code", createOrderActivity.getSelectedPaymentMethod().getCode());
|
||||
params.put("comment", createOrderNote());
|
||||
params.put("is_pizza_pass_campaign", createOrderActivity.getCartInfo().isPizzapassCampaignUsed());
|
||||
params.put("is_champagne_campaign", createOrderActivity.getCartInfo().isChampagneCampaignUsed());
|
||||
if(paymentMethodNonce != null){
|
||||
params.put("payment_method_nonce", paymentMethodNonce);
|
||||
}
|
||||
if(SessionHelper.isUserUsedPizzapassCampaign()){
|
||||
params.put("is_pizza_pass_campaign", true);
|
||||
}
|
||||
if(SessionHelper.isUserUsedChampagneCampaign()){
|
||||
params.put("is_champagne_campaign", true);
|
||||
}
|
||||
return params;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package ch.pizzapp.android.helper;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.support.annotation.NonNull;
|
||||
@@ -239,6 +240,19 @@ public class DialogHelper {
|
||||
.show();
|
||||
}
|
||||
|
||||
public static void showOneButtonDialogWithDismissListener(String message,
|
||||
DialogInterface.OnDismissListener dismissListener){
|
||||
new MaterialDialog.Builder(BaseActivity.currentActivity)
|
||||
.title(R.string.app_name)
|
||||
.content(message)
|
||||
.titleColorRes(R.color.red)
|
||||
.contentColorRes(R.color.black)
|
||||
.positiveText(R.string.ok)
|
||||
.dismissListener(dismissListener)
|
||||
.typeface("Quicksand-Medium.ttf", "Quicksand-Regular.ttf")
|
||||
.show();
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public static void showPasswordResetDialog(final Context context) {
|
||||
|
||||
@@ -49,38 +49,6 @@ public class SessionHelper {
|
||||
SharedPrefsHelper.getSelectedStore().getStoreName().toLowerCase());
|
||||
}
|
||||
|
||||
public static void setUserSeenPizzapassCampaign(boolean isSeen){
|
||||
SharedPrefsHelper.setUserSeenPizzapassCampaign(isSeen);
|
||||
}
|
||||
|
||||
public static boolean isUserSeenPizzapassCampaign(){
|
||||
return SharedPrefsHelper.isUserSeenPizzapassCampaign();
|
||||
}
|
||||
|
||||
public static void setUserUsedPizzapassCampaign(boolean isUsed){
|
||||
SharedPrefsHelper.setUserUsedPizzapassCampaign(isUsed);
|
||||
}
|
||||
|
||||
public static boolean isUserUsedPizzapassCampaign(){
|
||||
return SharedPrefsHelper.isUserUsedPizzapassCampaign();
|
||||
}
|
||||
|
||||
public static void setUserSeenChampagneCampaign(boolean isUsed){
|
||||
SharedPrefsHelper.setUserSeenChampagneCampaign(isUsed);
|
||||
}
|
||||
|
||||
public static boolean isUserSeenChampagneCampaign(){
|
||||
return SharedPrefsHelper.isUserSeenChampagneCampaign();
|
||||
}
|
||||
|
||||
public static void setUserUsedChampagneCampaign(boolean isUsed){
|
||||
SharedPrefsHelper.setUserUsedChampagneCampaign(isUsed);
|
||||
}
|
||||
|
||||
public static boolean isUserUsedChampagneCampaign(){
|
||||
return SharedPrefsHelper.isUserUsedChampagneCampaign();
|
||||
}
|
||||
|
||||
public static void setSelectedStore(StoreModel storeModel){
|
||||
SharedPrefsHelper.saveSelectedStore(storeModel);
|
||||
}
|
||||
|
||||
@@ -35,10 +35,6 @@ public class SharedPrefsHelper {
|
||||
private static final String PREF_KEY_USER_LOG_IN_STATUS = SHARED_PREFS_NAME + "userLoginStatus";
|
||||
private static final String PREF_KEY_CART_ITEM_COUNT = SHARED_PREFS_NAME + "cartItemCount";
|
||||
private static final String PREF_KEY_CART_TOTAL_PRICE = SHARED_PREFS_NAME + "cartTotalPrice";
|
||||
private static final String PREF_KEY_USER_SEEN_PIZZAPASS_CAMPAIGN = SHARED_PREFS_NAME + "userSeenPizzapassCampaign";
|
||||
private static final String PREF_KEY_USER_USED_PIZZAPASS_CAMPAIGN = SHARED_PREFS_NAME + "userUsedPizzapassCampaign";
|
||||
private static final String PREF_KEY_USER_SEEN_CHAMPAGNE_CAMPAIGN = SHARED_PREFS_NAME + "userSeenChampagneCampaign";
|
||||
private static final String PREF_KEY_USER_USED_CHAMPAGNE_CAMPAIGN = SHARED_PREFS_NAME + "userUsedChampagneCampaign";
|
||||
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";
|
||||
|
||||
@@ -96,10 +92,6 @@ public class SharedPrefsHelper {
|
||||
editor.remove(PREF_KEY_CUSTOMER_TOKEN);
|
||||
editor.remove(PREF_KEY_CART_ITEM_COUNT);
|
||||
editor.remove(PREF_KEY_CART_TOTAL_PRICE);
|
||||
editor.remove(PREF_KEY_USER_SEEN_PIZZAPASS_CAMPAIGN);
|
||||
editor.remove(PREF_KEY_USER_USED_PIZZAPASS_CAMPAIGN);
|
||||
editor.remove(PREF_KEY_USER_SEEN_CHAMPAGNE_CAMPAIGN);
|
||||
editor.remove(PREF_KEY_USER_USED_CHAMPAGNE_CAMPAIGN);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
@@ -126,42 +118,6 @@ public class SharedPrefsHelper {
|
||||
return sharedPreferences.getBoolean(PREF_KEY_USER_LOG_IN_STATUS, false);
|
||||
}
|
||||
|
||||
public static void setUserSeenPizzapassCampaign(boolean isSeen){
|
||||
editor.putBoolean(PREF_KEY_USER_SEEN_PIZZAPASS_CAMPAIGN, isSeen);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean isUserSeenPizzapassCampaign(){
|
||||
return sharedPreferences.getBoolean(PREF_KEY_USER_SEEN_PIZZAPASS_CAMPAIGN, false);
|
||||
}
|
||||
|
||||
public static void setUserUsedPizzapassCampaign(boolean isUsed){
|
||||
editor.putBoolean(PREF_KEY_USER_USED_PIZZAPASS_CAMPAIGN, isUsed);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean isUserUsedPizzapassCampaign(){
|
||||
return sharedPreferences.getBoolean(PREF_KEY_USER_USED_PIZZAPASS_CAMPAIGN, false);
|
||||
}
|
||||
|
||||
public static void setUserSeenChampagneCampaign(boolean isSeen){
|
||||
editor.putBoolean(PREF_KEY_USER_SEEN_CHAMPAGNE_CAMPAIGN, isSeen);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean isUserSeenChampagneCampaign(){
|
||||
return sharedPreferences.getBoolean(PREF_KEY_USER_SEEN_CHAMPAGNE_CAMPAIGN, false);
|
||||
}
|
||||
|
||||
public static void setUserUsedChampagneCampaign(boolean isUsed){
|
||||
editor.putBoolean(PREF_KEY_USER_USED_CHAMPAGNE_CAMPAIGN, isUsed);
|
||||
editor.apply();
|
||||
}
|
||||
|
||||
public static boolean isUserUsedChampagneCampaign(){
|
||||
return sharedPreferences.getBoolean(PREF_KEY_USER_USED_CHAMPAGNE_CAMPAIGN, false);
|
||||
}
|
||||
|
||||
public static void setCartItemCount(int cartItemCount){
|
||||
editor.putInt(PREF_KEY_CART_ITEM_COUNT, cartItemCount);
|
||||
editor.apply();
|
||||
|
||||
@@ -13,6 +13,8 @@ public class CartInfoModel implements Serializable {
|
||||
|
||||
private ArrayList<CartProductModel> products;
|
||||
private ArrayList<CartTotalModel> totals;
|
||||
private boolean isPizzapassCampaignUsed;
|
||||
private boolean isChampagneCampaignUsed;
|
||||
|
||||
public ArrayList<CartProductModel> getProducts() {
|
||||
return products;
|
||||
@@ -60,4 +62,20 @@ public class CartInfoModel implements Serializable {
|
||||
CartProductModel.checkNull(products);
|
||||
|
||||
}
|
||||
|
||||
public boolean isPizzapassCampaignUsed() {
|
||||
return isPizzapassCampaignUsed;
|
||||
}
|
||||
|
||||
public void setPizzapassCampaignUsed(boolean pizzapassCampaignUsed) {
|
||||
isPizzapassCampaignUsed = pizzapassCampaignUsed;
|
||||
}
|
||||
|
||||
public boolean isChampagneCampaignUsed() {
|
||||
return isChampagneCampaignUsed;
|
||||
}
|
||||
|
||||
public void setChampagneCampaignUsed(boolean champagneCampaignUsed) {
|
||||
isChampagneCampaignUsed = champagneCampaignUsed;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user