Showing
8 changed files
with
168 additions
and
53 deletions
| ... | @@ -140,7 +140,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | ... | @@ -140,7 +140,7 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe | 
| 140 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); | 140 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("Coupon").concat(":").concat(coupon.getName())); | 
| 141 | Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); | 141 | Intent intent = new Intent(ActiveCouponsActivity.this, CouponInfoActivity.class); | 
| 142 | intent.putExtra("coupon", coupon.getCoupon()); | 142 | intent.putExtra("coupon", coupon.getCoupon()); | 
| 143 | - intent.putExtra("isFromWallet", false); | 143 | + intent.putExtra("isFromWallet", true); | 
| 144 | startActivity(intent); | 144 | startActivity(intent); | 
| 145 | } | 145 | } | 
| 146 | }) | 146 | }) | ... | ... | 
| ... | @@ -320,7 +320,9 @@ public class ContextualActivity extends Activity implements View.OnClickListener | ... | @@ -320,7 +320,9 @@ public class ContextualActivity extends Activity implements View.OnClickListener | 
| 320 | // runOnUiThread(() -> { | 320 | // runOnUiThread(() -> { | 
| 321 | if (status == 1) { | 321 | if (status == 1) { | 
| 322 | successActivatingDialog(); | 322 | successActivatingDialog(); | 
| 323 | - WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | 323 | + /* New Addition start */ | 
| 324 | + WarplyManager.getUserCouponsWithCouponsetsInternal(mUserCouponsReceiver); | ||
| 325 | + /* New Addition end */ | ||
| 324 | WarplyManager.getCampaigns(mCampaignsCallback); | 326 | WarplyManager.getCampaigns(mCampaignsCallback); | 
| 325 | } else | 327 | } else | 
| 326 | errorActivatingDialog(); | 328 | errorActivatingDialog(); | ... | ... | 
| ... | @@ -32,7 +32,6 @@ import ly.warp.sdk.R; | ... | @@ -32,7 +32,6 @@ import ly.warp.sdk.R; | 
| 32 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 32 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| 33 | import ly.warp.sdk.io.models.Consumer; | 33 | import ly.warp.sdk.io.models.Consumer; | 
| 34 | import ly.warp.sdk.io.models.Coupon; | 34 | import ly.warp.sdk.io.models.Coupon; | 
| 35 | -import ly.warp.sdk.io.models.CouponList; | ||
| 36 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 35 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 
| 37 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 36 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 
| 38 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 37 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 
| ... | @@ -66,6 +65,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -66,6 +65,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | 
| 66 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, | 65 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, | 
| 67 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets; | 66 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets; | 
| 68 | private boolean mIsFromWallet = false, mIsActiveUnified = false; | 67 | private boolean mIsFromWallet = false, mIsActiveUnified = false; | 
| 68 | + private RelativeLayout mPbLoading; | ||
| 69 | 69 | ||
| 70 | // =========================================================== | 70 | // =========================================================== | 
| 71 | // Methods for/from SuperClass/Interfaces | 71 | // Methods for/from SuperClass/Interfaces | 
| ... | @@ -106,6 +106,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -106,6 +106,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | 
| 106 | mFontHeader = findViewById(R.id.textView3); | 106 | mFontHeader = findViewById(R.id.textView3); | 
| 107 | mFontDescription = findViewById(R.id.textView14); | 107 | mFontDescription = findViewById(R.id.textView14); | 
| 108 | mFontButtonShare = findViewById(R.id.button_share); | 108 | mFontButtonShare = findViewById(R.id.button_share); | 
| 109 | + mPbLoading = findViewById(R.id.pb_loading); | ||
| 110 | + mPbLoading.setOnTouchListener((v, event) -> true); | ||
| 109 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvCouponTitle); | 111 | WarpUtils.renderCustomFont(this, R.font.bt_cosmo_bold, mFontHeader, mTvCouponTitle); | 
| 110 | WarpUtils.renderCustomFont(this, R.font.peridot_regular, mFontDescription, mTvPhoneHeader, mEdtReceiver); | 112 | WarpUtils.renderCustomFont(this, R.font.peridot_regular, mFontDescription, mTvPhoneHeader, mEdtReceiver); | 
| 111 | WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mFontButtonShare); | 113 | WarpUtils.renderCustomFont(this, R.font.peridot_semi_bold, mFontButtonShare); | 
| ... | @@ -310,6 +312,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -310,6 +312,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | 
| 310 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") | 312 | WarplyAnalyticsManager.logTrackersEvent(this, "click", ("ShareCoupon") | 
| 311 | .concat(":") | 313 | .concat(":") | 
| 312 | .concat(mCoupon.getCouponsetDetails().getName())); | 314 | .concat(mCoupon.getCouponsetDetails().getName())); | 
| 315 | + mPbLoading.setVisibility(View.VISIBLE); | ||
| 313 | 316 | ||
| 314 | new Thread(() -> { | 317 | new Thread(() -> { | 
| 315 | if (!Thread.currentThread().isInterrupted()) { | 318 | if (!Thread.currentThread().isInterrupted()) { | 
| ... | @@ -346,12 +349,22 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -346,12 +349,22 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | 
| 346 | public void onSuccess(JSONObject result) { | 349 | public void onSuccess(JSONObject result) { | 
| 347 | int status = result.optInt("status", 2); | 350 | int status = result.optInt("status", 2); | 
| 348 | String message = result.optString("msg", ""); | 351 | String message = result.optString("msg", ""); | 
| 349 | - if (status == 1) | 352 | + if (status == 1) { | 
| 350 | - WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | 353 | + /* New Addition start */ | 
| 354 | +// WarplyManager.getUserCouponsWithCouponsetsInternal(mUserCouponsReceiver); | ||
| 355 | + WarplyManagerHelper.removeCouponItem(mCoupon); | ||
| 356 | + /* New Addition end */ | ||
| 357 | + } | ||
| 358 | + | ||
| 351 | runOnUiThread(() -> { | 359 | runOnUiThread(() -> { | 
| 352 | - if (status == 1) | 360 | + mPbLoading.setVisibility(View.GONE); | 
| 361 | + if (status == 1) { | ||
| 362 | + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | ||
| 363 | + couponsChanged.setChanged(true); | ||
| 364 | + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | ||
| 365 | + | ||
| 353 | acceptSharingDialog(); | 366 | acceptSharingDialog(); | 
| 354 | - else if (status == 4) | 367 | + } else if (status == 4) | 
| 355 | wrongNumberDialog(message); | 368 | wrongNumberDialog(message); | 
| 356 | else | 369 | else | 
| 357 | errorSharingDialog(); | 370 | errorSharingDialog(); | 
| ... | @@ -361,23 +374,26 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -361,23 +374,26 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | 
| 361 | @Override | 374 | @Override | 
| 362 | public void onFailure(int errorCode) { | 375 | public void onFailure(int errorCode) { | 
| 363 | Log.v("COUPON_SHARE", String.valueOf(errorCode)); | 376 | Log.v("COUPON_SHARE", String.valueOf(errorCode)); | 
| 364 | - runOnUiThread(() -> errorSharingDialog()); | 377 | + runOnUiThread(() -> { | 
| 378 | + mPbLoading.setVisibility(View.GONE); | ||
| 379 | + errorSharingDialog(); | ||
| 380 | + }); | ||
| 365 | } | 381 | } | 
| 366 | }; | 382 | }; | 
| 367 | 383 | ||
| 368 | - private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 384 | +// private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 
| 369 | - @Override | 385 | +// @Override | 
| 370 | - public void onSuccess(CouponList result) { | 386 | +// public void onSuccess(CouponList result) { | 
| 371 | - WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 387 | +// WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 
| 372 | - couponsChanged.setChanged(true); | 388 | +// couponsChanged.setChanged(true); | 
| 373 | - EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | 389 | +// EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | 
| 374 | - } | 390 | +// } | 
| 375 | - | 391 | +// | 
| 376 | - @Override | 392 | +// @Override | 
| 377 | - public void onFailure(int errorCode) { | 393 | +// public void onFailure(int errorCode) { | 
| 378 | - | 394 | +// | 
| 379 | - } | 395 | +// } | 
| 380 | - }; | 396 | +// }; | 
| 381 | 397 | ||
| 382 | // =========================================================== | 398 | // =========================================================== | 
| 383 | // Inner and Anonymous Classes | 399 | // Inner and Anonymous Classes | ... | ... | 
| ... | @@ -8,7 +8,7 @@ import android.text.method.LinkMovementMethod; | ... | @@ -8,7 +8,7 @@ import android.text.method.LinkMovementMethod; | 
| 8 | import android.view.View; | 8 | import android.view.View; | 
| 9 | import android.widget.ImageView; | 9 | import android.widget.ImageView; | 
| 10 | import android.widget.LinearLayout; | 10 | import android.widget.LinearLayout; | 
| 11 | -import android.widget.ProgressBar; | 11 | +import android.widget.RelativeLayout; | 
| 12 | import android.widget.TextView; | 12 | import android.widget.TextView; | 
| 13 | 13 | ||
| 14 | import androidx.appcompat.app.AlertDialog; | 14 | import androidx.appcompat.app.AlertDialog; | 
| ... | @@ -28,10 +28,10 @@ import ly.warp.sdk.R; | ... | @@ -28,10 +28,10 @@ import ly.warp.sdk.R; | 
| 28 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 28 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 
| 29 | import ly.warp.sdk.io.models.Campaign; | 29 | import ly.warp.sdk.io.models.Campaign; | 
| 30 | import ly.warp.sdk.io.models.Coupon; | 30 | import ly.warp.sdk.io.models.Coupon; | 
| 31 | -import ly.warp.sdk.io.models.CouponList; | ||
| 32 | import ly.warp.sdk.io.models.Couponset; | 31 | import ly.warp.sdk.io.models.Couponset; | 
| 33 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 32 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 
| 34 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 33 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 
| 34 | +import ly.warp.sdk.io.models.Merchant; | ||
| 35 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 35 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 
| 36 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 36 | import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | 
| 37 | import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; | 37 | import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; | 
| ... | @@ -58,7 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -58,7 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | 
| 58 | mFontHeader, mFontButtonGetIt; | 58 | mFontHeader, mFontButtonGetIt; | 
| 59 | private Couponset mCouponset; | 59 | private Couponset mCouponset; | 
| 60 | private LinearLayout mLlRedeem, mLlTerms; | 60 | private LinearLayout mLlRedeem, mLlTerms; | 
| 61 | - private ProgressBar mPbLoading; | 61 | + private RelativeLayout mPbLoading; | 
| 62 | private Coupon mCoupon; | 62 | private Coupon mCoupon; | 
| 63 | private boolean mIsTermsPressed = false, mIsGiftPressed = false; | 63 | private boolean mIsTermsPressed = false, mIsGiftPressed = false; | 
| 64 | private AlertDialog mAlertDialogCouponset; | 64 | private AlertDialog mAlertDialogCouponset; | 
| ... | @@ -100,6 +100,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -100,6 +100,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | 
| 100 | mIvCouponsetPhoto = findViewById(R.id.imageView6); | 100 | mIvCouponsetPhoto = findViewById(R.id.imageView6); | 
| 101 | mLlRedeem = findViewById(R.id.ll_get_gift); | 101 | mLlRedeem = findViewById(R.id.ll_get_gift); | 
| 102 | mPbLoading = findViewById(R.id.pb_loading); | 102 | mPbLoading = findViewById(R.id.pb_loading); | 
| 103 | + mPbLoading.setOnTouchListener((v, event) -> true); | ||
| 103 | mLlTerms = findViewById(R.id.ll_terms_inner); | 104 | mLlTerms = findViewById(R.id.ll_terms_inner); | 
| 104 | mTvTermsValue = findViewById(R.id.tv_terms_value); | 105 | mTvTermsValue = findViewById(R.id.tv_terms_value); | 
| 105 | mIvTermsArrow = findViewById(R.id.iv_terms_arrow); | 106 | mIvTermsArrow = findViewById(R.id.iv_terms_arrow); | 
| ... | @@ -238,13 +239,40 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -238,13 +239,40 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | 
| 238 | 239 | ||
| 239 | mCoupon = new Coupon(result.optJSONObject("result")); | 240 | mCoupon = new Coupon(result.optJSONObject("result")); | 
| 240 | if (mCouponset != null) { | 241 | if (mCouponset != null) { | 
| 242 | + /* New Addition start */ | ||
| 243 | + Merchant merchant = new Merchant(); | ||
| 244 | + for (Merchant mer : WarplyManagerHelper.getMerchantList()) { | ||
| 245 | + if (mer.getUuid().equals(mCouponset.getMerchantUuid())) { | ||
| 246 | + merchant = mer; | ||
| 247 | + break; | ||
| 248 | + } | ||
| 249 | + } | ||
| 250 | + /* New Addition end */ | ||
| 251 | + | ||
| 241 | mCoupon.setDescription(mCouponset.getShortDescription()); | 252 | mCoupon.setDescription(mCouponset.getShortDescription()); | 
| 242 | mCoupon.setImage(mCouponset.getImgPreview()); | 253 | mCoupon.setImage(mCouponset.getImgPreview()); | 
| 243 | mCoupon.setName(mCouponset.getName()); | 254 | mCoupon.setName(mCouponset.getName()); | 
| 255 | + /* New Addition start */ | ||
| 256 | + mCoupon.setDiscount(mCouponset.getDiscount()); | ||
| 257 | + mCoupon.setCouponsetUuid(mCouponset.getUuid()); | ||
| 258 | + mCoupon.setMerchantUuid(mCouponset.getMerchantUuid()); | ||
| 259 | + mCoupon.setStatus(1); | ||
| 260 | + mCoupon.setCouponsetDetails(mCouponset); | ||
| 261 | + mCoupon.setMerchantDetails(merchant); | ||
| 262 | + /* New Addition end */ | ||
| 244 | } | 263 | } | 
| 245 | showDialog(true, 1); | 264 | showDialog(true, 1); | 
| 246 | - WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | 265 | + /* New Addition start */ | 
| 266 | +// WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); | ||
| 267 | + /* New Addition end */ | ||
| 268 | + WarplyManagerHelper.addCouponItem(mCoupon); | ||
| 247 | WarplyManager.getCampaigns(mCampaignsCallback); | 269 | WarplyManager.getCampaigns(mCampaignsCallback); | 
| 270 | + | ||
| 271 | + /* New Addition start */ | ||
| 272 | + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | ||
| 273 | + couponsChanged.setChanged(true); | ||
| 274 | + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | ||
| 275 | + /* New Addition end */ | ||
| 248 | } else { | 276 | } else { | 
| 249 | showDialog(false, status); | 277 | showDialog(false, status); | 
| 250 | } | 278 | } | 
| ... | @@ -363,19 +391,19 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -363,19 +391,19 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | 
| 363 | // Inner and Anonymous Classes | 391 | // Inner and Anonymous Classes | 
| 364 | // =========================================================== | 392 | // =========================================================== | 
| 365 | 393 | ||
| 366 | - private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 394 | +// private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() { | 
| 367 | - @Override | 395 | +// @Override | 
| 368 | - public void onSuccess(CouponList result) { | 396 | +// public void onSuccess(CouponList result) { | 
| 369 | - WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 397 | +// WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 
| 370 | - couponsChanged.setChanged(true); | 398 | +// couponsChanged.setChanged(true); | 
| 371 | - EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | 399 | +// EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | 
| 372 | - } | 400 | +// } | 
| 373 | - | 401 | +// | 
| 374 | - @Override | 402 | +// @Override | 
| 375 | - public void onFailure(int errorCode) { | 403 | +// public void onFailure(int errorCode) { | 
| 376 | - | 404 | +// | 
| 377 | - } | 405 | +// } | 
| 378 | - }; | 406 | +// }; | 
| 379 | 407 | ||
| 380 | private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 408 | private CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { | 
| 381 | @Override | 409 | @Override | ... | ... | 
| ... | @@ -45,6 +45,8 @@ import org.json.JSONObject; | ... | @@ -45,6 +45,8 @@ import org.json.JSONObject; | 
| 45 | import java.util.ArrayList; | 45 | import java.util.ArrayList; | 
| 46 | import java.util.Collections; | 46 | import java.util.Collections; | 
| 47 | import java.util.HashMap; | 47 | import java.util.HashMap; | 
| 48 | +import java.util.HashSet; | ||
| 49 | +import java.util.Iterator; | ||
| 48 | import java.util.Map; | 50 | import java.util.Map; | 
| 49 | import java.util.concurrent.ExecutorService; | 51 | import java.util.concurrent.ExecutorService; | 
| 50 | import java.util.concurrent.Executors; | 52 | import java.util.concurrent.Executors; | 
| ... | @@ -301,7 +303,7 @@ public class WarplyManagerHelper { | ... | @@ -301,7 +303,7 @@ public class WarplyManagerHelper { | 
| 301 | public void onSuccess(JSONObject result) { | 303 | public void onSuccess(JSONObject result) { | 
| 302 | int status = result.optInt("status", 2); | 304 | int status = result.optInt("status", 2); | 
| 303 | if (status == 1) { | 305 | if (status == 1) { | 
| 304 | - WarplyManager.getUserCouponsWithCouponsets(new CallbackReceiver<CouponList>() { | 306 | + WarplyManager.getUserCouponsWithCouponsetsInternal(new CallbackReceiver<CouponList>() { | 
| 305 | @Override | 307 | @Override | 
| 306 | public void onSuccess(CouponList result) { | 308 | public void onSuccess(CouponList result) { | 
| 307 | WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 309 | WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 
| ... | @@ -445,7 +447,7 @@ public class WarplyManagerHelper { | ... | @@ -445,7 +447,7 @@ public class WarplyManagerHelper { | 
| 445 | public void onSuccess(JSONObject result) { | 447 | public void onSuccess(JSONObject result) { | 
| 446 | int status = result.optInt("status", 2); | 448 | int status = result.optInt("status", 2); | 
| 447 | if (status == 1) { | 449 | if (status == 1) { | 
| 448 | - WarplyManager.getUserCouponsWithCouponsets(new CallbackReceiver<CouponList>() { | 450 | + WarplyManager.getUserCouponsWithCouponsetsInternal(new CallbackReceiver<CouponList>() { | 
| 449 | @Override | 451 | @Override | 
| 450 | public void onSuccess(CouponList result) { | 452 | public void onSuccess(CouponList result) { | 
| 451 | WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 453 | WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | 
| ... | @@ -1253,6 +1255,18 @@ public class WarplyManagerHelper { | ... | @@ -1253,6 +1255,18 @@ public class WarplyManagerHelper { | 
| 1253 | return mCouponList; | 1255 | return mCouponList; | 
| 1254 | } | 1256 | } | 
| 1255 | 1257 | ||
| 1258 | + public static void addCouponItem(Coupon cpn) { | ||
| 1259 | + if (mCouponList != null) { | ||
| 1260 | + mCouponList.add(cpn); | ||
| 1261 | + } | ||
| 1262 | + } | ||
| 1263 | + | ||
| 1264 | + public static void removeCouponItem(Coupon cpn) { | ||
| 1265 | + if (mCouponList != null && !mCouponList.isEmpty()) { | ||
| 1266 | + mCouponList.remove(cpn); | ||
| 1267 | + } | ||
| 1268 | + } | ||
| 1269 | + | ||
| 1256 | public static CouponList getCouponExpiredList() { | 1270 | public static CouponList getCouponExpiredList() { | 
| 1257 | if (mCouponListExpired != null && mCouponListExpired.size() > 0) { | 1271 | if (mCouponListExpired != null && mCouponListExpired.size() > 0) { | 
| 1258 | WarpUtils.log("GET_COUPON_EXPIRED_LIST size: " + String.valueOf(mCouponListExpired.size())); | 1272 | WarpUtils.log("GET_COUPON_EXPIRED_LIST size: " + String.valueOf(mCouponListExpired.size())); | ... | ... | 
| ... | @@ -27,8 +27,6 @@ package ly.warp.sdk.utils.managers; | ... | @@ -27,8 +27,6 @@ package ly.warp.sdk.utils.managers; | 
| 27 | 27 | ||
| 28 | import android.app.ActivityManager; | 28 | import android.app.ActivityManager; | 
| 29 | import android.content.Context; | 29 | import android.content.Context; | 
| 30 | -import android.content.Intent; | ||
| 31 | -import android.os.Build; | ||
| 32 | import android.os.Handler; | 30 | import android.os.Handler; | 
| 33 | import android.os.Looper; | 31 | import android.os.Looper; | 
| 34 | import android.text.TextUtils; | 32 | import android.text.TextUtils; | 
| ... | @@ -112,7 +110,6 @@ import ly.warp.sdk.io.models.TransactionsList; | ... | @@ -112,7 +110,6 @@ import ly.warp.sdk.io.models.TransactionsList; | 
| 112 | import ly.warp.sdk.io.models.TripMetrics; | 110 | import ly.warp.sdk.io.models.TripMetrics; | 
| 113 | import ly.warp.sdk.io.models.UnifiedCampaignModel; | 111 | import ly.warp.sdk.io.models.UnifiedCampaignModel; | 
| 114 | import ly.warp.sdk.io.models.UnifiedCoupon; | 112 | import ly.warp.sdk.io.models.UnifiedCoupon; | 
| 115 | -import ly.warp.sdk.io.models.WarplyPacingEventModel; | ||
| 116 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 113 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 
| 117 | import ly.warp.sdk.io.request.CosmotePostEventRequest; | 114 | import ly.warp.sdk.io.request.CosmotePostEventRequest; | 
| 118 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 115 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 
| ... | @@ -127,7 +124,6 @@ import ly.warp.sdk.io.request.WarplyChangePasswordRequest; | ... | @@ -127,7 +124,6 @@ import ly.warp.sdk.io.request.WarplyChangePasswordRequest; | 
| 127 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 124 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 
| 128 | import ly.warp.sdk.io.request.WarplyContactRequest; | 125 | import ly.warp.sdk.io.request.WarplyContactRequest; | 
| 129 | import ly.warp.sdk.io.request.WarplyContentRequest; | 126 | import ly.warp.sdk.io.request.WarplyContentRequest; | 
| 130 | -import ly.warp.sdk.io.request.WarplyCosmoteUserRequest; | ||
| 131 | import ly.warp.sdk.io.request.WarplyDeleteAddressRequest; | 127 | import ly.warp.sdk.io.request.WarplyDeleteAddressRequest; | 
| 132 | import ly.warp.sdk.io.request.WarplyDeleteCardRequest; | 128 | import ly.warp.sdk.io.request.WarplyDeleteCardRequest; | 
| 133 | import ly.warp.sdk.io.request.WarplyEditAddressRequest; | 129 | import ly.warp.sdk.io.request.WarplyEditAddressRequest; | 
| ... | @@ -162,10 +158,8 @@ import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | ... | @@ -162,10 +158,8 @@ import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 
| 162 | import ly.warp.sdk.io.volley.ApiClient; | 158 | import ly.warp.sdk.io.volley.ApiClient; | 
| 163 | import ly.warp.sdk.io.volley.ApiService; | 159 | import ly.warp.sdk.io.volley.ApiService; | 
| 164 | import ly.warp.sdk.services.EventCampaignService; | 160 | import ly.warp.sdk.services.EventCampaignService; | 
| 165 | -import ly.warp.sdk.services.EventCouponsService; | ||
| 166 | import ly.warp.sdk.services.EventRewardsCouponsService; | 161 | import ly.warp.sdk.services.EventRewardsCouponsService; | 
| 167 | import ly.warp.sdk.services.EventUnifiedCouponsService; | 162 | import ly.warp.sdk.services.EventUnifiedCouponsService; | 
| 168 | -import ly.warp.sdk.services.WarplyHealthService; | ||
| 169 | import ly.warp.sdk.utils.WarpJSONParser; | 163 | import ly.warp.sdk.utils.WarpJSONParser; | 
| 170 | import ly.warp.sdk.utils.WarpUtils; | 164 | import ly.warp.sdk.utils.WarpUtils; | 
| 171 | import ly.warp.sdk.utils.WarplyDeviceInfoCollector; | 165 | import ly.warp.sdk.utils.WarplyDeviceInfoCollector; | 
| ... | @@ -1908,6 +1902,42 @@ public class WarplyManager { | ... | @@ -1908,6 +1902,42 @@ public class WarplyManager { | 
| 1908 | }, executorService); | 1902 | }, executorService); | 
| 1909 | } | 1903 | } | 
| 1910 | 1904 | ||
| 1905 | + public static void getUserCouponsWithCouponsetsInternal(final CallbackReceiver<CouponList> receiver) { | ||
| 1906 | + WarpUtils.log("************* WARPLY User Coupons Request ********************"); | ||
| 1907 | + WarpUtils.log("[WARP Trace] WARPLY User Coupons Request is active"); | ||
| 1908 | + WarpUtils.log("**************************************************"); | ||
| 1909 | + | ||
| 1910 | + ApiService service = ApiClient.getRetrofitInstance().create(ApiService.class); | ||
| 1911 | + ListeningExecutorService executorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(3)); | ||
| 1912 | + | ||
| 1913 | + SettableFuture<CouponList> futureUniversal = SettableFuture.create(); | ||
| 1914 | + ListenableFuture<CouponList> futureCoupons = getCouponsUniversalRetro(service, 0, futureUniversal); | ||
| 1915 | + | ||
| 1916 | + ListenableFuture<List<Object>> allResultsFuture = Futures.allAsList(futureCoupons); | ||
| 1917 | + ListenableFuture<CouponList> mergedResultFuture = Futures.transformAsync( | ||
| 1918 | + allResultsFuture, | ||
| 1919 | + results -> { | ||
| 1920 | + CouponList resultCoupons = (CouponList) results.get(0); | ||
| 1921 | + return executorService.submit(() -> resultCoupons); | ||
| 1922 | + }, | ||
| 1923 | + executorService | ||
| 1924 | + ); | ||
| 1925 | + | ||
| 1926 | + Futures.addCallback(mergedResultFuture, new FutureCallback<CouponList>() { | ||
| 1927 | + @Override | ||
| 1928 | + public void onSuccess(CouponList mergedResult) { | ||
| 1929 | + executorService.shutdownNow(); | ||
| 1930 | + new Handler(Looper.getMainLooper()).post(() -> receiver.onSuccess(mergedResult)); | ||
| 1931 | + } | ||
| 1932 | + | ||
| 1933 | + @Override | ||
| 1934 | + public void onFailure(Throwable throwable) { | ||
| 1935 | + executorService.shutdownNow(); | ||
| 1936 | + new Handler(Looper.getMainLooper()).post(() -> receiver.onFailure(2)); | ||
| 1937 | + } | ||
| 1938 | + }, executorService); | ||
| 1939 | + } | ||
| 1940 | + | ||
| 1911 | public static void getCampaigns(final CallbackReceiver<ArrayList<Campaign>> receiver) { | 1941 | public static void getCampaigns(final CallbackReceiver<ArrayList<Campaign>> receiver) { | 
| 1912 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | 1942 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | 
| 1913 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | 1943 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | ... | ... | 
| ... | @@ -192,4 +192,22 @@ | ... | @@ -192,4 +192,22 @@ | 
| 192 | </androidx.constraintlayout.widget.ConstraintLayout> | 192 | </androidx.constraintlayout.widget.ConstraintLayout> | 
| 193 | </androidx.constraintlayout.widget.ConstraintLayout> | 193 | </androidx.constraintlayout.widget.ConstraintLayout> | 
| 194 | </ScrollView> | 194 | </ScrollView> | 
| 195 | + | ||
| 196 | + <RelativeLayout | ||
| 197 | + android:id="@+id/pb_loading" | ||
| 198 | + android:layout_width="match_parent" | ||
| 199 | + android:layout_height="match_parent" | ||
| 200 | + android:layout_centerInParent="true" | ||
| 201 | + android:background="@android:color/transparent" | ||
| 202 | + android:visibility="gone" | ||
| 203 | + tools:visibility="visible"> | ||
| 204 | + | ||
| 205 | + <ProgressBar | ||
| 206 | + android:layout_width="48dp" | ||
| 207 | + android:layout_height="48dp" | ||
| 208 | + android:layout_centerInParent="true" | ||
| 209 | + android:indeterminate="true" | ||
| 210 | + android:indeterminateTint="@color/cos_green5" | ||
| 211 | + android:indeterminateTintMode="src_atop" /> | ||
| 212 | + </RelativeLayout> | ||
| 195 | </RelativeLayout> | 213 | </RelativeLayout> | ... | ... | 
| ... | @@ -150,14 +150,21 @@ | ... | @@ -150,14 +150,21 @@ | 
| 150 | </LinearLayout> | 150 | </LinearLayout> | 
| 151 | </ScrollView> | 151 | </ScrollView> | 
| 152 | 152 | ||
| 153 | - <ProgressBar | 153 | + <RelativeLayout | 
| 154 | android:id="@+id/pb_loading" | 154 | android:id="@+id/pb_loading" | 
| 155 | - android:layout_width="48dp" | 155 | + android:layout_width="match_parent" | 
| 156 | - android:layout_height="48dp" | 156 | + android:layout_height="match_parent" | 
| 157 | android:layout_centerInParent="true" | 157 | android:layout_centerInParent="true" | 
| 158 | - android:indeterminate="true" | 158 | + android:background="@android:color/transparent" | 
| 159 | - android:indeterminateTint="@color/cos_green5" | ||
| 160 | - android:indeterminateTintMode="src_atop" | ||
| 161 | android:visibility="gone" | 159 | android:visibility="gone" | 
| 162 | - tools:visibility="visible" /> | 160 | + tools:visibility="visible"> | 
| 161 | + | ||
| 162 | + <ProgressBar | ||
| 163 | + android:layout_width="48dp" | ||
| 164 | + android:layout_height="48dp" | ||
| 165 | + android:layout_centerInParent="true" | ||
| 166 | + android:indeterminate="true" | ||
| 167 | + android:indeterminateTint="@color/cos_green5" | ||
| 168 | + android:indeterminateTintMode="src_atop" /> | ||
| 169 | + </RelativeLayout> | ||
| 163 | </RelativeLayout> | 170 | </RelativeLayout> | ... | ... | 
- 
Please register or login to post a comment