Showing
18 changed files
with
997 additions
and
48 deletions
| ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { |
| 36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { |
| 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { |
| 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() |
| 39 | - .setGuid("6012049139"), //6012049321, 6012049322, 6012049323 | 39 | + .setGuid("6012049321"), //6012049321, 6012049322, 6012049323 |
| 40 | mLoginReceiver); | 40 | mLoginReceiver); |
| 41 | } else { | 41 | } else { |
| 42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
| ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
| 2 | 2 | ||
| 3 | ext { | 3 | ext { |
| 4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
| 5 | - PUBLISH_VERSION = '4.5.4-cosbeta44' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta45' |
| 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
| 7 | } | 7 | } |
| 8 | 8 | ... | ... |
| ... | @@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -58,7 +58,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 58 | private LinearLayout mLlShareButton; | 58 | private LinearLayout mLlShareButton; |
| 59 | private String mSender = ""; | 59 | private String mSender = ""; |
| 60 | private EditText mEdtReceiver; | 60 | private EditText mEdtReceiver; |
| 61 | - private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, mAlertDialogCouponAskSharing; | 61 | + private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, |
| 62 | + mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing; | ||
| 62 | 63 | ||
| 63 | // =========================================================== | 64 | // =========================================================== |
| 64 | // Methods for/from SuperClass/Interfaces | 65 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -205,6 +206,16 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 205 | .show(); | 206 | .show(); |
| 206 | } | 207 | } |
| 207 | 208 | ||
| 209 | + private void wrongNumberDialog(String message) { | ||
| 210 | + mAlertDialogWrongNumberSharing = new AlertDialog.Builder(this) | ||
| 211 | + .setTitle(R.string.cos_dlg_error_title) | ||
| 212 | + .setMessage(message) | ||
| 213 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
| 214 | + dialogPositive.dismiss(); | ||
| 215 | + }) | ||
| 216 | + .show(); | ||
| 217 | + } | ||
| 218 | + | ||
| 208 | private void errorSharingDialog2() { | 219 | private void errorSharingDialog2() { |
| 209 | mAlertDialogErrorSharing = new AlertDialog.Builder(this) | 220 | mAlertDialogErrorSharing = new AlertDialog.Builder(this) |
| 210 | .setTitle(R.string.cos_dlg_error_title) | 221 | .setTitle(R.string.cos_dlg_error_title) |
| ... | @@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -253,9 +264,12 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
| 253 | @Override | 264 | @Override |
| 254 | public void onSuccess(JSONObject result) { | 265 | public void onSuccess(JSONObject result) { |
| 255 | int status = result.optInt("status", 2); | 266 | int status = result.optInt("status", 2); |
| 267 | + String message = result.optString("msg", ""); | ||
| 256 | runOnUiThread(() -> { | 268 | runOnUiThread(() -> { |
| 257 | if (status == 1) | 269 | if (status == 1) |
| 258 | acceptSharingDialog(); | 270 | acceptSharingDialog(); |
| 271 | + else if (status == 4) | ||
| 272 | + wrongNumberDialog(message); | ||
| 259 | else | 273 | else |
| 260 | errorSharingDialog(); | 274 | errorSharingDialog(); |
| 261 | }); | 275 | }); | ... | ... |
| ... | @@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList; | ... | @@ -29,11 +29,13 @@ import ly.warp.sdk.io.models.CampaignList; |
| 29 | import ly.warp.sdk.io.models.Coupon; | 29 | import ly.warp.sdk.io.models.Coupon; |
| 30 | import ly.warp.sdk.io.models.CouponList; | 30 | import ly.warp.sdk.io.models.CouponList; |
| 31 | import ly.warp.sdk.io.models.Couponset; | 31 | import ly.warp.sdk.io.models.Couponset; |
| 32 | +import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | ||
| 32 | import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; | 33 | import ly.warp.sdk.io.request.WarplyGetCampaignsRequest; |
| 33 | import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; | 34 | import ly.warp.sdk.io.request.WarplyRedeemCouponRequest; |
| 34 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 35 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
| 35 | import ly.warp.sdk.services.EventCampaignService; | 36 | import ly.warp.sdk.services.EventCampaignService; |
| 36 | import ly.warp.sdk.services.EventService; | 37 | import ly.warp.sdk.services.EventService; |
| 38 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
| 37 | import ly.warp.sdk.utils.managers.WarplyManager; | 39 | import ly.warp.sdk.utils.managers.WarplyManager; |
| 38 | 40 | ||
| 39 | 41 | ||
| ... | @@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -56,6 +58,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 56 | private boolean mIsTermsPressed = false; | 58 | private boolean mIsTermsPressed = false; |
| 57 | private AlertDialog mAlertDialogCouponset; | 59 | private AlertDialog mAlertDialogCouponset; |
| 58 | private Campaign mLoyalty; | 60 | private Campaign mLoyalty; |
| 61 | + private LoyaltyContextualOfferModel mCcms = null; | ||
| 59 | 62 | ||
| 60 | // =========================================================== | 63 | // =========================================================== |
| 61 | // Methods for/from SuperClass/Interfaces | 64 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -68,6 +71,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 68 | 71 | ||
| 69 | mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); | 72 | mCouponset = (Couponset) getIntent().getSerializableExtra("couponset"); |
| 70 | mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); | 73 | mLoyalty = (Campaign) getIntent().getSerializableExtra("loyalty"); |
| 74 | + mCcms = (LoyaltyContextualOfferModel) getIntent().getSerializableExtra("ccms"); | ||
| 71 | 75 | ||
| 72 | mIvBack = findViewById(R.id.iv_couponset_info_back); | 76 | mIvBack = findViewById(R.id.iv_couponset_info_back); |
| 73 | mTvTerms = findViewById(R.id.tv_terms); | 77 | mTvTerms = findViewById(R.id.tv_terms); |
| ... | @@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -96,9 +100,37 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
| 96 | } | 100 | } |
| 97 | if (view.getId() == R.id.ll_get_gift) { | 101 | if (view.getId() == R.id.ll_get_gift) { |
| 98 | mPbLoading.setVisibility(View.VISIBLE); | 102 | mPbLoading.setVisibility(View.VISIBLE); |
| 103 | + if (mCcms == null) { | ||
| 99 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() | 104 | WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() |
| 100 | .setCouponsetUuid(mCouponset.getUuid()) | 105 | .setCouponsetUuid(mCouponset.getUuid()) |
| 101 | .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback); | 106 | .setCommunicationUuid(mLoyalty.getSessionUUID()), mRedeemCouponCallback); |
| 107 | + } else { | ||
| 108 | + WarplyManager.redeemCoupon(new WarplyRedeemCouponRequest() | ||
| 109 | + .setCouponsetUuid(mCouponset.getUuid()) | ||
| 110 | + .setCommunicationUuid(mLoyalty.getSessionUUID()) | ||
| 111 | + .setHasContextualOffer(true) | ||
| 112 | + .setUserMsisdn(WarplyManagerHelper.getConsumer().getMsisdn()) | ||
| 113 | + .setBusinessService(mCcms.getBusinessService()) | ||
| 114 | + .setOfferName(mCcms.getOfferName()) | ||
| 115 | + .setProductType(mCcms.getProductType()) | ||
| 116 | + .setProvDuration(mCcms.getProvDuration()) | ||
| 117 | + .setNoOfRecurrance(mCcms.getNoOfRecurrance()) | ||
| 118 | + .setPrice(mCcms.getPrice()) | ||
| 119 | + .setDiscount(mCcms.getDiscount()) | ||
| 120 | + .setVoiceCategory(mCcms.getVoiceCategory()) | ||
| 121 | + .setDataCategory(mCcms.getDataCategory()) | ||
| 122 | + .setMinsValue(mCcms.getMinsValue()) | ||
| 123 | + .setDataValue(mCcms.getDataValue()) | ||
| 124 | + .setProvStepValueMins(mCcms.getProvStepValueMins()) | ||
| 125 | + .setOfferAudienceLevel(mCcms.getOfferAudienceLevel()) | ||
| 126 | + .setUACIOfferTrackingCode(mCcms.getUACIOfferTrackingCode()) | ||
| 127 | + .setOfferCode1(mCcms.getOfferCode1()) | ||
| 128 | + .setScore(mCcms.getScore()) | ||
| 129 | + .setZone(mCcms.getZone()) | ||
| 130 | + .setWave(mCcms.getWave()) | ||
| 131 | + .setValidity(mCcms.getValidity()) | ||
| 132 | + .setTreatmentCode(mCcms.getTreatmentCode()), mRedeemCouponCallback); | ||
| 133 | + } | ||
| 102 | return; | 134 | return; |
| 103 | } | 135 | } |
| 104 | if (view.getId() == R.id.ll_terms_inner) { | 136 | if (view.getId() == R.id.ll_terms_inner) { | ... | ... |
| ... | @@ -4,6 +4,7 @@ import android.app.Activity; | ... | @@ -4,6 +4,7 @@ import android.app.Activity; |
| 4 | import android.content.Context; | 4 | import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | +import android.text.TextUtils; | ||
| 7 | import android.util.Log; | 8 | import android.util.Log; |
| 8 | import android.view.View; | 9 | import android.view.View; |
| 9 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
| ... | @@ -59,6 +60,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -59,6 +60,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 59 | // private HashSet<Campaign> mHashSetList = new HashSet<>(); | 60 | // private HashSet<Campaign> mHashSetList = new HashSet<>(); |
| 60 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); | 61 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); |
| 61 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); | 62 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); |
| 63 | + private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); | ||
| 62 | 64 | ||
| 63 | // =========================================================== | 65 | // =========================================================== |
| 64 | // Methods for/from SuperClass/Interfaces | 66 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -83,9 +85,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -83,9 +85,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 83 | mSeasonalList.addAll(mHashSetSeasonalList); | 85 | mSeasonalList.addAll(mHashSetSeasonalList); |
| 84 | } | 86 | } |
| 85 | 87 | ||
| 88 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 89 | + mContextualList.clear(); | ||
| 90 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 91 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
| 92 | + && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
| 93 | + mContextualList.add(ccmsItem); | ||
| 94 | + } | ||
| 95 | + } | ||
| 96 | + | ||
| 86 | mergeDatasets( | 97 | mergeDatasets( |
| 87 | mValuesList, | 98 | mValuesList, |
| 88 | - mSeasonalList | 99 | + mSeasonalList, |
| 100 | + mContextualList | ||
| 89 | ); | 101 | ); |
| 90 | 102 | ||
| 91 | mIvBack = findViewById(R.id.iv_list_close); | 103 | mIvBack = findViewById(R.id.iv_list_close); |
| ... | @@ -143,9 +155,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -143,9 +155,19 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 143 | mSeasonalList.addAll(mHashSetSeasonalList); | 155 | mSeasonalList.addAll(mHashSetSeasonalList); |
| 144 | } | 156 | } |
| 145 | 157 | ||
| 158 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 159 | + mContextualList.clear(); | ||
| 160 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 161 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
| 162 | + && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
| 163 | + mContextualList.add(ccmsItem); | ||
| 164 | + } | ||
| 165 | + } | ||
| 166 | + | ||
| 146 | mergeDatasets( | 167 | mergeDatasets( |
| 147 | mValuesList, | 168 | mValuesList, |
| 148 | - mSeasonalList | 169 | + mSeasonalList, |
| 170 | + mContextualList | ||
| 149 | ); | 171 | ); |
| 150 | 172 | ||
| 151 | runOnUiThread(() -> { | 173 | runOnUiThread(() -> { |
| ... | @@ -159,6 +181,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -159,6 +181,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 159 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); | 181 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); |
| 160 | 182 | ||
| 161 | if (dataItem.getCampaign().getType().equals("coupon")) { | 183 | if (dataItem.getCampaign().getType().equals("coupon")) { |
| 184 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 185 | + LoyaltyContextualOfferModel ccmsItem = null; | ||
| 186 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 187 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ||
| 188 | + ccmsItem = ccms; | ||
| 189 | + break; | ||
| 190 | + } | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | + if (ccmsItem != null) { | ||
| 194 | + try { | ||
| 195 | + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | ||
| 196 | + if (campaignSettings != null) { | ||
| 197 | + if (campaignSettings.has("couponset")) { | ||
| 198 | + String cpnUuid = campaignSettings.optString("couponset"); | ||
| 199 | + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | ||
| 200 | + if (cpns.getUuid().equals(cpnUuid)) { | ||
| 201 | + Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | ||
| 202 | + intent.putExtra("couponset", (Serializable) cpns); | ||
| 203 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | ||
| 204 | + intent.putExtra("ccms", ccmsItem); | ||
| 205 | + startActivity(intent); | ||
| 206 | + break; | ||
| 207 | + } | ||
| 208 | + } | ||
| 209 | + } else { | ||
| 210 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | ||
| 211 | + } | ||
| 212 | + } | ||
| 213 | + } catch (Exception exception) { | ||
| 214 | + exception.printStackTrace(); | ||
| 215 | + } | ||
| 216 | + | ||
| 217 | + return; | ||
| 218 | + } | ||
| 219 | + } | ||
| 220 | + | ||
| 162 | try { | 221 | try { |
| 163 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | 222 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); |
| 164 | if (campaignSettings != null) { | 223 | if (campaignSettings != null) { |
| ... | @@ -220,6 +279,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -220,6 +279,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 220 | seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); | 279 | seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); |
| 221 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); | 280 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); |
| 222 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); | 281 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); |
| 282 | + } else if (dataItem.getDataType() == 3) { | ||
| 283 | + | ||
| 223 | } | 284 | } |
| 224 | }) | 285 | }) |
| 225 | .doOnError(error -> { | 286 | .doOnError(error -> { |
| ... | @@ -253,6 +314,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -253,6 +314,43 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 253 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); | 314 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); |
| 254 | 315 | ||
| 255 | if (dataItem.getCampaign().getType().equals("coupon")) { | 316 | if (dataItem.getCampaign().getType().equals("coupon")) { |
| 317 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 318 | + LoyaltyContextualOfferModel ccmsItem = null; | ||
| 319 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 320 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ||
| 321 | + ccmsItem = ccms; | ||
| 322 | + break; | ||
| 323 | + } | ||
| 324 | + } | ||
| 325 | + | ||
| 326 | + if (ccmsItem != null) { | ||
| 327 | + try { | ||
| 328 | + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | ||
| 329 | + if (campaignSettings != null) { | ||
| 330 | + if (campaignSettings.has("couponset")) { | ||
| 331 | + String cpnUuid = campaignSettings.optString("couponset"); | ||
| 332 | + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | ||
| 333 | + if (cpns.getUuid().equals(cpnUuid)) { | ||
| 334 | + Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | ||
| 335 | + intent.putExtra("couponset", (Serializable) cpns); | ||
| 336 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | ||
| 337 | + intent.putExtra("ccms", ccmsItem); | ||
| 338 | + startActivity(intent); | ||
| 339 | + break; | ||
| 340 | + } | ||
| 341 | + } | ||
| 342 | + } else { | ||
| 343 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); | ||
| 344 | + } | ||
| 345 | + } | ||
| 346 | + } catch (Exception exception) { | ||
| 347 | + exception.printStackTrace(); | ||
| 348 | + } | ||
| 349 | + | ||
| 350 | + return; | ||
| 351 | + } | ||
| 352 | + } | ||
| 353 | + | ||
| 256 | try { | 354 | try { |
| 257 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | 355 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); |
| 258 | if (campaignSettings != null) { | 356 | if (campaignSettings != null) { |
| ... | @@ -313,6 +411,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -313,6 +411,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 313 | seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); | 411 | seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); |
| 314 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); | 412 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); |
| 315 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); | 413 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); |
| 414 | + } else if (dataItem.getDataType() == 3) { | ||
| 415 | + | ||
| 316 | } | 416 | } |
| 317 | }) | 417 | }) |
| 318 | .doOnError(error -> { | 418 | .doOnError(error -> { |
| ... | @@ -321,7 +421,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -321,7 +421,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 321 | } | 421 | } |
| 322 | } | 422 | } |
| 323 | 423 | ||
| 324 | - private void mergeDatasets(ArrayList<Campaign> campaignList, ArrayList<LoyaltyGiftsForYouPackage> seasonalList) { | 424 | + private void mergeDatasets(ArrayList<Campaign> campaignList, |
| 425 | + ArrayList<LoyaltyGiftsForYouPackage> seasonalList, | ||
| 426 | + ArrayList<LoyaltyContextualOfferModel> ccmsList) { | ||
| 325 | mData.clear(); | 427 | mData.clear(); |
| 326 | if (campaignList != null && campaignList.size() > 0) { | 428 | if (campaignList != null && campaignList.size() > 0) { |
| 327 | Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size())); | 429 | Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size())); |
| ... | @@ -344,6 +446,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -344,6 +446,18 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
| 344 | mData.add(data); | 446 | mData.add(data); |
| 345 | } | 447 | } |
| 346 | } | 448 | } |
| 449 | + | ||
| 450 | + if (ccmsList != null && ccmsList.size() > 0) { | ||
| 451 | + Log.v("CCMS", String.valueOf(ccmsList.size())); | ||
| 452 | + for (LoyaltyContextualOfferModel ccmsItem : ccmsList) { | ||
| 453 | + MergedGifts data = new MergedGifts(); | ||
| 454 | + data.setCampaign(null); | ||
| 455 | + data.setSeasonalList(null); | ||
| 456 | + data.setCCMS(ccmsItem); | ||
| 457 | + data.setDataType(3); | ||
| 458 | + mData.add(data); | ||
| 459 | + } | ||
| 460 | + } | ||
| 347 | } | 461 | } |
| 348 | 462 | ||
| 349 | private void filterItems() { | 463 | private void filterItems() { | ... | ... |
| ... | @@ -5,6 +5,7 @@ import android.content.Context; | ... | @@ -5,6 +5,7 @@ import android.content.Context; |
| 5 | import android.content.Intent; | 5 | import android.content.Intent; |
| 6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
| 7 | import android.os.Parcelable; | 7 | import android.os.Parcelable; |
| 8 | +import android.text.TextUtils; | ||
| 8 | import android.util.Log; | 9 | import android.util.Log; |
| 9 | import android.view.View; | 10 | import android.view.View; |
| 10 | import android.widget.ImageView; | 11 | import android.widget.ImageView; |
| ... | @@ -27,11 +28,16 @@ import ly.warp.sdk.R; | ... | @@ -27,11 +28,16 @@ import ly.warp.sdk.R; |
| 27 | import ly.warp.sdk.io.models.Campaign; | 28 | import ly.warp.sdk.io.models.Campaign; |
| 28 | import ly.warp.sdk.io.models.CampaignList; | 29 | import ly.warp.sdk.io.models.CampaignList; |
| 29 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 30 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
| 31 | +import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; | ||
| 30 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 32 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
| 33 | +import ly.warp.sdk.io.models.MergedGifts; | ||
| 34 | +import ly.warp.sdk.io.models.MergedMore; | ||
| 31 | import ly.warp.sdk.utils.WarpJSONParser; | 35 | import ly.warp.sdk.utils.WarpJSONParser; |
| 32 | import ly.warp.sdk.utils.WarpUtils; | 36 | import ly.warp.sdk.utils.WarpUtils; |
| 33 | import ly.warp.sdk.utils.WarplyManagerHelper; | 37 | import ly.warp.sdk.utils.WarplyManagerHelper; |
| 34 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 38 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
| 39 | +import ly.warp.sdk.views.adapters.MergedGiftsAdapter; | ||
| 40 | +import ly.warp.sdk.views.adapters.MergedMoreAdapter; | ||
| 35 | import ly.warp.sdk.views.adapters.MoreCampaignAdapter; | 41 | import ly.warp.sdk.views.adapters.MoreCampaignAdapter; |
| 36 | 42 | ||
| 37 | 43 | ||
| ... | @@ -49,9 +55,12 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -49,9 +55,12 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 49 | private RecyclerView mRecyclerMore; | 55 | private RecyclerView mRecyclerMore; |
| 50 | private TextView mTvTitle; | 56 | private TextView mTvTitle; |
| 51 | private MoreCampaignAdapter mAdapterMore; | 57 | private MoreCampaignAdapter mAdapterMore; |
| 58 | + private MergedMoreAdapter mAdapterMergedMore; | ||
| 52 | private LinearLayout mLlMorePopup; | 59 | private LinearLayout mLlMorePopup; |
| 53 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); | 60 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); |
| 54 | -// private HashSet<Campaign> mHashSetList = new HashSet<>(); | 61 | + // private HashSet<Campaign> mHashSetList = new HashSet<>(); |
| 62 | + private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); | ||
| 63 | + private ArrayList<MergedMore> mData = new ArrayList(); | ||
| 55 | 64 | ||
| 56 | // =========================================================== | 65 | // =========================================================== |
| 57 | // Methods for/from SuperClass/Interfaces | 66 | // Methods for/from SuperClass/Interfaces |
| ... | @@ -77,6 +86,20 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -77,6 +86,20 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 77 | 86 | ||
| 78 | filterItems(); | 87 | filterItems(); |
| 79 | 88 | ||
| 89 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 90 | + mContextualList.clear(); | ||
| 91 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 92 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
| 93 | + && ccmsItem.getZone().equals("COSMOTE_APP_MORE4U")) | ||
| 94 | + mContextualList.add(ccmsItem); | ||
| 95 | + } | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + mergeDatasets( | ||
| 99 | + mValuesList, | ||
| 100 | + mContextualList | ||
| 101 | + ); | ||
| 102 | + | ||
| 80 | initViews(); | 103 | initViews(); |
| 81 | } | 104 | } |
| 82 | 105 | ||
| ... | @@ -119,25 +142,42 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -119,25 +142,42 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 119 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 142 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { |
| 120 | filterItems(); | 143 | filterItems(); |
| 121 | 144 | ||
| 145 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 146 | + mContextualList.clear(); | ||
| 147 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 148 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
| 149 | + && ccmsItem.getZone().equals("COSMOTE_APP_MORE4U")) | ||
| 150 | + mContextualList.add(ccmsItem); | ||
| 151 | + } | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + mergeDatasets( | ||
| 155 | + mValuesList, | ||
| 156 | + mContextualList | ||
| 157 | + ); | ||
| 158 | + | ||
| 122 | runOnUiThread(() -> { | 159 | runOnUiThread(() -> { |
| 123 | - if (mValuesList != null && mValuesList.size() > 0) { | 160 | +// if (mValuesList != null && mValuesList.size() > 0) { |
| 124 | - Log.v("MORE_FOR_YOU", String.valueOf(mValuesList.size())); | 161 | + if (mData != null && mData.size() > 0) { |
| 125 | - mAdapterMore = new MoreCampaignAdapter(this, mValuesList); | 162 | +// mAdapterMore = new MoreCampaignAdapter(this, mValuesList); |
| 126 | - mRecyclerMore.setAdapter(mAdapterMore); | 163 | + mAdapterMergedMore = new MergedMoreAdapter(MoreForYouActivity.this, mData); |
| 127 | - mAdapterMore.getPositionClicks() | 164 | +// mRecyclerMore.setAdapter(mAdapterMore); |
| 128 | - .doOnNext(gift -> { | 165 | + mRecyclerMore.setAdapter(mAdapterMergedMore); |
| 129 | - WarpUtils.log("MFY_CLICK " + gift.toString()); | 166 | + mAdapterMergedMore.getPositionClicks() |
| 167 | + .doOnNext(dataItem -> { | ||
| 168 | + if (dataItem.getDataType() == 1) { | ||
| 169 | + WarpUtils.log("MFY_CLICK " + dataItem.getCampaign().toString()); | ||
| 130 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); | 170 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); |
| 131 | 171 | ||
| 132 | try { | 172 | try { |
| 133 | - JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); | 173 | + JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); |
| 134 | if (extraFields != null) { | 174 | if (extraFields != null) { |
| 135 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 175 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
| 136 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 176 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
| 137 | - if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 177 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
| 138 | Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); | 178 | Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); |
| 139 | intent.putExtra("ccms", ccms); | 179 | intent.putExtra("ccms", ccms); |
| 140 | - intent.putExtra("loyalty", (Serializable) gift); | 180 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); |
| 141 | startActivity(intent); | 181 | startActivity(intent); |
| 142 | break; | 182 | break; |
| 143 | } | 183 | } |
| ... | @@ -146,24 +186,27 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -146,24 +186,27 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 146 | } | 186 | } |
| 147 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 187 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
| 148 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 188 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
| 149 | - if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 189 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
| 150 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); | 190 | WarpUtils.log("CCMS_CLICK " + ccms.toString()); |
| 151 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms))); | 191 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); |
| 152 | break; | 192 | break; |
| 153 | } | 193 | } |
| 154 | } | 194 | } |
| 155 | } else { | 195 | } else { |
| 156 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(gift))); | 196 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
| 157 | } | 197 | } |
| 158 | } | 198 | } |
| 159 | } catch (Exception exception) { | 199 | } catch (Exception exception) { |
| 160 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(gift))); | 200 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
| 201 | + } | ||
| 202 | + } else if (dataItem.getDataType() == 2) { | ||
| 203 | + | ||
| 161 | } | 204 | } |
| 162 | }) | 205 | }) |
| 163 | .doOnError(error -> { | 206 | .doOnError(error -> { |
| 164 | }) | 207 | }) |
| 165 | .subscribe(); | 208 | .subscribe(); |
| 166 | - mAdapterMore.notifyDataSetChanged(); | 209 | + mAdapterMergedMore.notifyDataSetChanged(); |
| 167 | } else { | 210 | } else { |
| 168 | mRecyclerMore.setVisibility(View.GONE); | 211 | mRecyclerMore.setVisibility(View.GONE); |
| 169 | } | 212 | } |
| ... | @@ -182,24 +225,28 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -182,24 +225,28 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 182 | // if (WarpUtils.getMorePopup(this)) | 225 | // if (WarpUtils.getMorePopup(this)) |
| 183 | // mLlMorePopup.setVisibility(View.VISIBLE); | 226 | // mLlMorePopup.setVisibility(View.VISIBLE); |
| 184 | 227 | ||
| 185 | - if (mValuesList != null && mValuesList.size() > 0) { | 228 | +// if (mValuesList != null && mValuesList.size() > 0) { |
| 186 | - Log.v("MORE_FOR_YOU", String.valueOf(mValuesList.size())); | 229 | + if (mData != null && mData.size() > 0) { |
| 187 | mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 230 | mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
| 188 | - mAdapterMore = new MoreCampaignAdapter(this, mValuesList); | 231 | +// mAdapterMore = new MoreCampaignAdapter(this, mValuesList); |
| 189 | - mRecyclerMore.setAdapter(mAdapterMore); | 232 | + mAdapterMergedMore = new MergedMoreAdapter(MoreForYouActivity.this, mData); |
| 190 | - mAdapterMore.getPositionClicks() | 233 | +// mRecyclerMore.setAdapter(mAdapterMore); |
| 191 | - .doOnNext(gift -> { | 234 | + mRecyclerMore.setAdapter(mAdapterMergedMore); |
| 235 | + mAdapterMergedMore.getPositionClicks() | ||
| 236 | + .doOnNext(dataItem -> { | ||
| 237 | + if (dataItem.getDataType() == 1) { | ||
| 238 | + WarpUtils.log("MFY_CLICK " + dataItem.getCampaign().toString()); | ||
| 192 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); | 239 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); |
| 193 | 240 | ||
| 194 | try { | 241 | try { |
| 195 | - JSONObject extraFields = WarpJSONParser.getJSONFromString(gift.getExtraFields()); | 242 | + JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); |
| 196 | if (extraFields != null) { | 243 | if (extraFields != null) { |
| 197 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 244 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
| 198 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 245 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
| 199 | - if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 246 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
| 200 | Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); | 247 | Intent intent = new Intent(MoreForYouActivity.this, TelcoActivity.class); |
| 201 | intent.putExtra("ccms", ccms); | 248 | intent.putExtra("ccms", ccms); |
| 202 | - intent.putExtra("loyalty", (Serializable) gift); | 249 | + intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); |
| 203 | startActivity(intent); | 250 | startActivity(intent); |
| 204 | break; | 251 | break; |
| 205 | } | 252 | } |
| ... | @@ -208,27 +255,57 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -208,27 +255,57 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
| 208 | } | 255 | } |
| 209 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | 256 | if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { |
| 210 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 257 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
| 211 | - if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { | 258 | + if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
| 212 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms))); | 259 | + WarpUtils.log("CCMS_CLICK " + ccms.toString()); |
| 260 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); | ||
| 213 | break; | 261 | break; |
| 214 | } | 262 | } |
| 215 | } | 263 | } |
| 216 | } else { | 264 | } else { |
| 217 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(gift))); | 265 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
| 218 | } | 266 | } |
| 219 | } | 267 | } |
| 220 | } catch (Exception exception) { | 268 | } catch (Exception exception) { |
| 221 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(gift))); | 269 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign()))); |
| 270 | + } | ||
| 271 | + } else if (dataItem.getDataType() == 2) { | ||
| 272 | + | ||
| 222 | } | 273 | } |
| 223 | }) | 274 | }) |
| 224 | .doOnError(error -> { | 275 | .doOnError(error -> { |
| 225 | }) | 276 | }) |
| 226 | .subscribe(); | 277 | .subscribe(); |
| 278 | + mAdapterMergedMore.notifyDataSetChanged(); | ||
| 227 | } else { | 279 | } else { |
| 228 | mRecyclerMore.setVisibility(View.GONE); | 280 | mRecyclerMore.setVisibility(View.GONE); |
| 229 | } | 281 | } |
| 230 | } | 282 | } |
| 231 | 283 | ||
| 284 | + private void mergeDatasets(ArrayList<Campaign> campaignList, | ||
| 285 | + ArrayList<LoyaltyContextualOfferModel> ccmsList) { | ||
| 286 | + mData.clear(); | ||
| 287 | + if (campaignList != null && campaignList.size() > 0) { | ||
| 288 | + Log.v("MORE_FOR_YOU", String.valueOf(campaignList.size())); | ||
| 289 | + for (Campaign campaign : campaignList) { | ||
| 290 | + MergedMore data = new MergedMore(); | ||
| 291 | + data.setCampaign(campaign); | ||
| 292 | + data.setDataType(1); | ||
| 293 | + mData.add(data); | ||
| 294 | + } | ||
| 295 | + } | ||
| 296 | + | ||
| 297 | + if (ccmsList != null && ccmsList.size() > 0) { | ||
| 298 | + Log.v("CCMS", String.valueOf(ccmsList.size())); | ||
| 299 | + for (LoyaltyContextualOfferModel ccmsItem : ccmsList) { | ||
| 300 | + MergedMore data = new MergedMore(); | ||
| 301 | + data.setCampaign(null); | ||
| 302 | + data.setCCMS(ccmsItem); | ||
| 303 | + data.setDataType(2); | ||
| 304 | + mData.add(data); | ||
| 305 | + } | ||
| 306 | + } | ||
| 307 | + } | ||
| 308 | + | ||
| 232 | private void filterItems() { | 309 | private void filterItems() { |
| 233 | mValuesList.clear(); | 310 | mValuesList.clear(); |
| 234 | ArrayList<Campaign> gfyList = new ArrayList<>(); | 311 | ArrayList<Campaign> gfyList = new ArrayList<>(); | ... | ... |
| ... | @@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable { | ... | @@ -483,6 +483,138 @@ public class Consumer implements Parcelable, Serializable { |
| 483 | return sms_segmentation; | 483 | return sms_segmentation; |
| 484 | } | 484 | } |
| 485 | 485 | ||
| 486 | + public void setAckOptin(boolean ackOptin) { | ||
| 487 | + this.ackOptin = ackOptin; | ||
| 488 | + } | ||
| 489 | + | ||
| 490 | + public void setBillingInfo(JSONObject billingInfo) { | ||
| 491 | + this.billingInfo = billingInfo; | ||
| 492 | + } | ||
| 493 | + | ||
| 494 | + public void setBirthday(String birthday) { | ||
| 495 | + this.birthday = birthday; | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | + public void setBurntPoints(double burntPoints) { | ||
| 499 | + this.burntPoints = burntPoints; | ||
| 500 | + } | ||
| 501 | + | ||
| 502 | + public void setCompanyName(String companyName) { | ||
| 503 | + this.companyName = companyName; | ||
| 504 | + } | ||
| 505 | + | ||
| 506 | + public void setConsumerMetadata(JSONObject consumerMetadata) { | ||
| 507 | + this.consumerMetadata = consumerMetadata; | ||
| 508 | + } | ||
| 509 | + | ||
| 510 | + public void setDisplayName(String displayName) { | ||
| 511 | + this.displayName = displayName; | ||
| 512 | + } | ||
| 513 | + | ||
| 514 | + public void setEmail(String email) { | ||
| 515 | + this.email = email; | ||
| 516 | + } | ||
| 517 | + | ||
| 518 | + public void setFirstName(String firstName) { | ||
| 519 | + this.firstName = firstName; | ||
| 520 | + } | ||
| 521 | + | ||
| 522 | + public void setGender(String gender) { | ||
| 523 | + this.gender = gender; | ||
| 524 | + } | ||
| 525 | + | ||
| 526 | + public void setImageUrl(String imageUrl) { | ||
| 527 | + this.imageUrl = imageUrl; | ||
| 528 | + } | ||
| 529 | + | ||
| 530 | + public void setLanguage(String language) { | ||
| 531 | + this.language = language; | ||
| 532 | + } | ||
| 533 | + | ||
| 534 | + public void setLastName(String lastName) { | ||
| 535 | + this.lastName = lastName; | ||
| 536 | + } | ||
| 537 | + | ||
| 538 | + public void setLoyaltyId(String loyaltyId) { | ||
| 539 | + this.loyaltyId = loyaltyId; | ||
| 540 | + } | ||
| 541 | + | ||
| 542 | + public void setMsisdn(String msisdn) { | ||
| 543 | + this.msisdn = msisdn; | ||
| 544 | + } | ||
| 545 | + | ||
| 546 | + public void setNameday(String nameday) { | ||
| 547 | + this.nameday = nameday; | ||
| 548 | + } | ||
| 549 | + | ||
| 550 | + public void setNickname(String nickname) { | ||
| 551 | + this.nickname = nickname; | ||
| 552 | + } | ||
| 553 | + | ||
| 554 | + public void setOptin(JSONObject optin) { | ||
| 555 | + this.optin = optin; | ||
| 556 | + } | ||
| 557 | + | ||
| 558 | + public void setPasswordSet(boolean passwordSet) { | ||
| 559 | + this.passwordSet = passwordSet; | ||
| 560 | + } | ||
| 561 | + | ||
| 562 | + public void setProfileMetadata(String profileMetadata) { | ||
| 563 | + this.profileMetadata = profileMetadata; | ||
| 564 | + } | ||
| 565 | + | ||
| 566 | + public void setRedeemedPoints(double redeemedPoints) { | ||
| 567 | + this.redeemedPoints = redeemedPoints; | ||
| 568 | + } | ||
| 569 | + | ||
| 570 | + public void setRetrievedPoints(double retrievedPoints) { | ||
| 571 | + this.retrievedPoints = retrievedPoints; | ||
| 572 | + } | ||
| 573 | + | ||
| 574 | + public void setSalutation(String salutation) { | ||
| 575 | + this.salutation = salutation; | ||
| 576 | + } | ||
| 577 | + | ||
| 578 | + public void setSubscribe(boolean subscribe) { | ||
| 579 | + this.subscribe = subscribe; | ||
| 580 | + } | ||
| 581 | + | ||
| 582 | + public void setTags(JSONObject tags) { | ||
| 583 | + this.tags = tags; | ||
| 584 | + } | ||
| 585 | + | ||
| 586 | + public void setTaxId(String taxId) { | ||
| 587 | + this.taxId = taxId; | ||
| 588 | + } | ||
| 589 | + | ||
| 590 | + public void setUserPoints(double userPoints) { | ||
| 591 | + this.userPoints = userPoints; | ||
| 592 | + } | ||
| 593 | + | ||
| 594 | + public void setUuid(String uuid) { | ||
| 595 | + this.uuid = uuid; | ||
| 596 | + } | ||
| 597 | + | ||
| 598 | + public void setVerified(boolean verified) { | ||
| 599 | + this.verified = verified; | ||
| 600 | + } | ||
| 601 | + | ||
| 602 | + public void setNewsletter(boolean newsletter) { | ||
| 603 | + this.newsletter = newsletter; | ||
| 604 | + } | ||
| 605 | + | ||
| 606 | + public void setSms(boolean sms) { | ||
| 607 | + this.sms = sms; | ||
| 608 | + } | ||
| 609 | + | ||
| 610 | + public void setSegmentation(boolean segmentation) { | ||
| 611 | + this.segmentation = segmentation; | ||
| 612 | + } | ||
| 613 | + | ||
| 614 | + public void setSms_segmentation(boolean sms_segmentation) { | ||
| 615 | + this.sms_segmentation = sms_segmentation; | ||
| 616 | + } | ||
| 617 | + | ||
| 486 | @Override | 618 | @Override |
| 487 | public int describeContents() { | 619 | public int describeContents() { |
| 488 | return 0; | 620 | return 0; | ... | ... |
| ... | @@ -33,12 +33,12 @@ public class MergedGifts { | ... | @@ -33,12 +33,12 @@ public class MergedGifts { |
| 33 | private int dataType = 0; | 33 | private int dataType = 0; |
| 34 | private LoyaltyGiftsForYouPackage seasonalList; | 34 | private LoyaltyGiftsForYouPackage seasonalList; |
| 35 | private Campaign campaign; | 35 | private Campaign campaign; |
| 36 | + private LoyaltyContextualOfferModel ccms; | ||
| 36 | 37 | ||
| 37 | public void setDataType(int dataType) { | 38 | public void setDataType(int dataType) { |
| 38 | this.dataType = dataType; | 39 | this.dataType = dataType; |
| 39 | } | 40 | } |
| 40 | 41 | ||
| 41 | - | ||
| 42 | public void setCampaign(Campaign campaign) { | 42 | public void setCampaign(Campaign campaign) { |
| 43 | this.campaign = campaign; | 43 | this.campaign = campaign; |
| 44 | } | 44 | } |
| ... | @@ -58,4 +58,12 @@ public class MergedGifts { | ... | @@ -58,4 +58,12 @@ public class MergedGifts { |
| 58 | public Campaign getCampaign() { | 58 | public Campaign getCampaign() { |
| 59 | return campaign; | 59 | return campaign; |
| 60 | } | 60 | } |
| 61 | + | ||
| 62 | + public void setCCMS(LoyaltyContextualOfferModel ccmsItem) { | ||
| 63 | + this.ccms = ccmsItem; | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + public LoyaltyContextualOfferModel getCCMS() { | ||
| 67 | + return ccms; | ||
| 68 | + } | ||
| 61 | } | 69 | } | ... | ... |
| 1 | +/* | ||
| 2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
| 3 | + * | ||
| 4 | + * Redistribution and use in source and binary forms, without modification, are | ||
| 5 | + * permitted provided that the following conditions are met: | ||
| 6 | + * | ||
| 7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
| 8 | + * this list of conditions and the following disclaimer. | ||
| 9 | + * | ||
| 10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
| 11 | + * this list of conditions and the following disclaimer in the documentation | ||
| 12 | + * and/or other materials provided with the distribution. | ||
| 13 | + * | ||
| 14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
| 15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
| 16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
| 17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
| 18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
| 19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
| 20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
| 21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
| 22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
| 23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
| 24 | + */ | ||
| 25 | + | ||
| 26 | +package ly.warp.sdk.io.models; | ||
| 27 | + | ||
| 28 | +/** | ||
| 29 | + * Created by Panagiotis Triantafyllou on 10-Aug-22. | ||
| 30 | + */ | ||
| 31 | + | ||
| 32 | +public class MergedMore { | ||
| 33 | + private int dataType = 0; | ||
| 34 | + private Campaign campaign; | ||
| 35 | + private LoyaltyContextualOfferModel ccms; | ||
| 36 | + | ||
| 37 | + public void setDataType(int dataType) { | ||
| 38 | + this.dataType = dataType; | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + public void setCampaign(Campaign campaign) { | ||
| 42 | + this.campaign = campaign; | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + public int getDataType() { | ||
| 46 | + return dataType; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public Campaign getCampaign() { | ||
| 50 | + return campaign; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setCCMS(LoyaltyContextualOfferModel ccmsItem) { | ||
| 54 | + this.ccms = ccmsItem; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public LoyaltyContextualOfferModel getCCMS() { | ||
| 58 | + return ccms; | ||
| 59 | + } | ||
| 60 | +} |
| ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.io.request; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.io.request; |
| 2 | 2 | ||
| 3 | import android.util.Base64; | 3 | import android.util.Base64; |
| 4 | 4 | ||
| 5 | +import org.json.JSONArray; | ||
| 5 | import org.json.JSONException; | 6 | import org.json.JSONException; |
| 6 | import org.json.JSONObject; | 7 | import org.json.JSONObject; |
| 7 | 8 | ||
| ... | @@ -26,6 +27,21 @@ public class WarplyRedeemCouponRequest { | ... | @@ -26,6 +27,21 @@ public class WarplyRedeemCouponRequest { |
| 26 | private final String KEY_ACTION_VALUE = "retrieve_coupon"; | 27 | private final String KEY_ACTION_VALUE = "retrieve_coupon"; |
| 27 | private final String KEY_COUPONSET = "coupon_set"; | 28 | private final String KEY_COUPONSET = "coupon_set"; |
| 28 | private final String KEY_COMMUNICATION_UUID = "communication_uuid"; | 29 | private final String KEY_COMMUNICATION_UUID = "communication_uuid"; |
| 30 | + private final String KEY_EXTRA_DATA = "extra_data"; | ||
| 31 | + private final String KEY_USER_MSISDN = "user_msisdn"; | ||
| 32 | + private final String KEY_BUSINESS_SERVICE = "businessService"; | ||
| 33 | + private final String KEY_OFFER_NAME = "offerName"; | ||
| 34 | + private final String KEY_PRODUCT_TYPE = "productType"; | ||
| 35 | + private final String KEY_PROV_DURATION = "provDuration"; | ||
| 36 | + private final String KEY_NO_OF_RECURRANCE = "noOfRecurrance"; | ||
| 37 | + private final String KEY_PRICE = "price"; | ||
| 38 | + private final String KEY_DISCOUNT = "discount"; | ||
| 39 | + private final String KEY_VOICE_CATEGORY = "voiceCategory"; | ||
| 40 | + private final String KEY_DATA_CATEGORY = "dataCategory"; | ||
| 41 | + private final String KEY_MINS_VALUE = "minsValue"; | ||
| 42 | + private final String KEY_DATA_VALUE = "dataValue"; | ||
| 43 | + private final String KEY_PROV_STEP_VALUE_MINS = "provStepValueMins"; | ||
| 44 | + private final String KEY_PARAMETERS = "parameters"; | ||
| 29 | 45 | ||
| 30 | // =========================================================== | 46 | // =========================================================== |
| 31 | // Fields | 47 | // Fields |
| ... | @@ -35,6 +51,28 @@ public class WarplyRedeemCouponRequest { | ... | @@ -35,6 +51,28 @@ public class WarplyRedeemCouponRequest { |
| 35 | private long mCacheUpdateInterval = 0; | 51 | private long mCacheUpdateInterval = 0; |
| 36 | private String mCouponsetUuid = ""; | 52 | private String mCouponsetUuid = ""; |
| 37 | private String mCommunicationUuid = ""; | 53 | private String mCommunicationUuid = ""; |
| 54 | + private boolean mHasContextualOffer = false; | ||
| 55 | + private String mUserMsisdn = ""; | ||
| 56 | + private String mBusinessService = ""; | ||
| 57 | + private String mOfferName = ""; | ||
| 58 | + private String mProductType = ""; | ||
| 59 | + private String mProvDuration = ""; | ||
| 60 | + private String mNoOfRecurrance = ""; | ||
| 61 | + private String mPrice = ""; | ||
| 62 | + private String mDiscount = ""; | ||
| 63 | + private String mVoiceCategory = ""; | ||
| 64 | + private String mDataCategory = ""; | ||
| 65 | + private String mMinsValue = ""; | ||
| 66 | + private String mDataValue = ""; | ||
| 67 | + private String mProvStepValueMins = ""; | ||
| 68 | + private String mOfferAudienceLevel = ""; | ||
| 69 | + private String mUACIOfferTrackingCode = ""; | ||
| 70 | + private String mOfferCode1 = ""; | ||
| 71 | + private String mScore = ""; | ||
| 72 | + private String mZone = ""; | ||
| 73 | + private String mWave = ""; | ||
| 74 | + private String mValidity = ""; | ||
| 75 | + private String mTreatmentCode = ""; | ||
| 38 | 76 | ||
| 39 | // =========================================================== | 77 | // =========================================================== |
| 40 | // Constructor | 78 | // Constructor |
| ... | @@ -90,6 +128,116 @@ public class WarplyRedeemCouponRequest { | ... | @@ -90,6 +128,116 @@ public class WarplyRedeemCouponRequest { |
| 90 | return this; | 128 | return this; |
| 91 | } | 129 | } |
| 92 | 130 | ||
| 131 | + public WarplyRedeemCouponRequest setHasContextualOffer(boolean hasContextualOffer) { | ||
| 132 | + mHasContextualOffer = hasContextualOffer; | ||
| 133 | + return this; | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + public WarplyRedeemCouponRequest setUserMsisdn(String userMsisdn) { | ||
| 137 | + this.mUserMsisdn = userMsisdn; | ||
| 138 | + return this; | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + public WarplyRedeemCouponRequest setBusinessService(String businessService) { | ||
| 142 | + this.mBusinessService = businessService; | ||
| 143 | + return this; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public WarplyRedeemCouponRequest setOfferName(String offerName) { | ||
| 147 | + this.mOfferName = offerName; | ||
| 148 | + return this; | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + public WarplyRedeemCouponRequest setProductType(String productType) { | ||
| 152 | + this.mProductType = productType; | ||
| 153 | + return this; | ||
| 154 | + } | ||
| 155 | + | ||
| 156 | + public WarplyRedeemCouponRequest setProvDuration(String provDuration) { | ||
| 157 | + this.mProvDuration = provDuration; | ||
| 158 | + return this; | ||
| 159 | + } | ||
| 160 | + | ||
| 161 | + public WarplyRedeemCouponRequest setNoOfRecurrance(String noOfRecurrance) { | ||
| 162 | + this.mNoOfRecurrance = noOfRecurrance; | ||
| 163 | + return this; | ||
| 164 | + } | ||
| 165 | + | ||
| 166 | + public WarplyRedeemCouponRequest setPrice(String price) { | ||
| 167 | + this.mPrice = price; | ||
| 168 | + return this; | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + public WarplyRedeemCouponRequest setDiscount(String discount) { | ||
| 172 | + this.mDiscount = discount; | ||
| 173 | + return this; | ||
| 174 | + } | ||
| 175 | + | ||
| 176 | + public WarplyRedeemCouponRequest setVoiceCategory(String voiceCategory) { | ||
| 177 | + this.mVoiceCategory = voiceCategory; | ||
| 178 | + return this; | ||
| 179 | + } | ||
| 180 | + | ||
| 181 | + public WarplyRedeemCouponRequest setDataCategory(String dataCategory) { | ||
| 182 | + this.mDataCategory = dataCategory; | ||
| 183 | + return this; | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + public WarplyRedeemCouponRequest setMinsValue(String minsValue) { | ||
| 187 | + this.mMinsValue = minsValue; | ||
| 188 | + return this; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + public WarplyRedeemCouponRequest setDataValue(String dataValue) { | ||
| 192 | + this.mDataValue = dataValue; | ||
| 193 | + return this; | ||
| 194 | + } | ||
| 195 | + | ||
| 196 | + public WarplyRedeemCouponRequest setProvStepValueMins(String provStepValueMins) { | ||
| 197 | + this.mProvStepValueMins = provStepValueMins; | ||
| 198 | + return this; | ||
| 199 | + } | ||
| 200 | + | ||
| 201 | + public WarplyRedeemCouponRequest setOfferAudienceLevel(String offerAudienceLevel) { | ||
| 202 | + this.mOfferAudienceLevel = offerAudienceLevel; | ||
| 203 | + return this; | ||
| 204 | + } | ||
| 205 | + | ||
| 206 | + public WarplyRedeemCouponRequest setUACIOfferTrackingCode(String uaciOfferTrackingCode) { | ||
| 207 | + this.mUACIOfferTrackingCode = uaciOfferTrackingCode; | ||
| 208 | + return this; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | + public WarplyRedeemCouponRequest setOfferCode1(String offerCode1) { | ||
| 212 | + this.mOfferCode1 = offerCode1; | ||
| 213 | + return this; | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public WarplyRedeemCouponRequest setScore(String score) { | ||
| 217 | + this.mScore = score; | ||
| 218 | + return this; | ||
| 219 | + } | ||
| 220 | + | ||
| 221 | + public WarplyRedeemCouponRequest setZone(String zone) { | ||
| 222 | + this.mZone = zone; | ||
| 223 | + return this; | ||
| 224 | + } | ||
| 225 | + | ||
| 226 | + public WarplyRedeemCouponRequest setWave(String wave) { | ||
| 227 | + this.mWave = wave; | ||
| 228 | + return this; | ||
| 229 | + } | ||
| 230 | + | ||
| 231 | + public WarplyRedeemCouponRequest setValidity(String validity) { | ||
| 232 | + this.mValidity = validity; | ||
| 233 | + return this; | ||
| 234 | + } | ||
| 235 | + | ||
| 236 | + public WarplyRedeemCouponRequest setTreatmentCode(String treatmentCode) { | ||
| 237 | + this.mTreatmentCode = treatmentCode; | ||
| 238 | + return this; | ||
| 239 | + } | ||
| 240 | + | ||
| 93 | /** | 241 | /** |
| 94 | * Call this to get how often the cached data will be updated. | 242 | * Call this to get how often the cached data will be updated. |
| 95 | * | 243 | * |
| ... | @@ -153,6 +301,141 @@ public class WarplyRedeemCouponRequest { | ... | @@ -153,6 +301,141 @@ public class WarplyRedeemCouponRequest { |
| 153 | bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE); | 301 | bodyJsonObject.putOpt(KEY_ACTION, KEY_ACTION_VALUE); |
| 154 | bodyJsonObject.putOpt(KEY_COUPONSET, mCouponsetUuid); | 302 | bodyJsonObject.putOpt(KEY_COUPONSET, mCouponsetUuid); |
| 155 | bodyJsonObject.putOpt(KEY_COMMUNICATION_UUID, mCommunicationUuid); | 303 | bodyJsonObject.putOpt(KEY_COMMUNICATION_UUID, mCommunicationUuid); |
| 304 | + if (mHasContextualOffer) { | ||
| 305 | + JSONObject extraJson = new JSONObject(); | ||
| 306 | + extraJson.putOpt(KEY_USER_MSISDN, mUserMsisdn); | ||
| 307 | + extraJson.putOpt(KEY_BUSINESS_SERVICE, mBusinessService); | ||
| 308 | + extraJson.putOpt(KEY_OFFER_NAME, mOfferName); | ||
| 309 | + extraJson.putOpt(KEY_PRODUCT_TYPE, mProductType); | ||
| 310 | + extraJson.putOpt(KEY_PROV_DURATION, mProvDuration); | ||
| 311 | + extraJson.putOpt(KEY_NO_OF_RECURRANCE, mNoOfRecurrance); | ||
| 312 | + extraJson.putOpt(KEY_PRICE, mPrice); | ||
| 313 | + extraJson.putOpt(KEY_DISCOUNT, mDiscount); | ||
| 314 | + extraJson.putOpt(KEY_VOICE_CATEGORY, mVoiceCategory); | ||
| 315 | + extraJson.putOpt(KEY_DATA_CATEGORY, mDataCategory); | ||
| 316 | + extraJson.putOpt(KEY_MINS_VALUE, mMinsValue); | ||
| 317 | + extraJson.putOpt(KEY_DATA_VALUE, mDataValue); | ||
| 318 | + extraJson.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); | ||
| 319 | + extraJson.putOpt("InteractiveChannel", "COSMOTE_OMNI"); | ||
| 320 | + extraJson.putOpt("InteractionPoint", mZone); | ||
| 321 | + extraJson.putOpt("Session_ID", mCommunicationUuid); | ||
| 322 | + extraJson.putOpt("OfferAudienceLevel", mOfferAudienceLevel); | ||
| 323 | + extraJson.putOpt("MSISDN", mOfferAudienceLevel.equals("msisdn") ? mUserMsisdn : ""); | ||
| 324 | + extraJson.putOpt("GUID", ""); | ||
| 325 | + | ||
| 326 | + JSONArray parameters = new JSONArray(); | ||
| 327 | + JSONObject param1 = new JSONObject(); | ||
| 328 | + param1.putOpt("Name", "UACIOfferTrackingCode"); | ||
| 329 | + param1.putOpt("Value", mUACIOfferTrackingCode); | ||
| 330 | + param1.putOpt("Type", "string"); | ||
| 331 | + parameters.put(param1); | ||
| 332 | + | ||
| 333 | + JSONObject param2 = new JSONObject(); | ||
| 334 | + param2.putOpt("Name", "UACICustomLoggerTableName"); | ||
| 335 | + param2.putOpt("Value", "VW_WHITELIST"); | ||
| 336 | + param2.putOpt("Type", "string"); | ||
| 337 | + parameters.put(param2); | ||
| 338 | + | ||
| 339 | + JSONObject param3 = new JSONObject(); | ||
| 340 | + param3.putOpt("Name", "MSISDN"); | ||
| 341 | + param3.putOpt("Value", mUserMsisdn); | ||
| 342 | + param3.putOpt("Type", "string"); | ||
| 343 | + parameters.put(param3); | ||
| 344 | + | ||
| 345 | + JSONObject param4 = new JSONObject(); | ||
| 346 | + param4.putOpt("Name", "OFFERCODE1"); | ||
| 347 | + param4.putOpt("Value", mOfferCode1); | ||
| 348 | + param4.putOpt("Type", "string"); | ||
| 349 | + parameters.put(param4); | ||
| 350 | + | ||
| 351 | + JSONObject param5 = new JSONObject(); | ||
| 352 | + param5.putOpt("Name", "SCORE"); | ||
| 353 | + param5.putOpt("Value", mScore); | ||
| 354 | + param5.putOpt("Type", "INT"); | ||
| 355 | + parameters.put(param5); | ||
| 356 | + | ||
| 357 | + JSONObject param6 = new JSONObject(); | ||
| 358 | + param6.putOpt("Name", "PREDICATE"); | ||
| 359 | + param6.putOpt("Value", "0"); | ||
| 360 | + param6.putOpt("Type", "string"); | ||
| 361 | + parameters.put(param6); | ||
| 362 | + | ||
| 363 | + JSONObject param7 = new JSONObject(); | ||
| 364 | + param7.putOpt("Name", "ZONE"); | ||
| 365 | + param7.putOpt("Value", mZone); | ||
| 366 | + param7.putOpt("Type", "string"); | ||
| 367 | + parameters.put(param7); | ||
| 368 | + | ||
| 369 | + JSONObject param8 = new JSONObject(); | ||
| 370 | + param8.putOpt("Name", "APPLICATIONNAME"); | ||
| 371 | + param8.putOpt("Value", mZone); | ||
| 372 | + param8.putOpt("Type", "string"); | ||
| 373 | + parameters.put(param8); | ||
| 374 | + | ||
| 375 | + JSONObject param9 = new JSONObject(); | ||
| 376 | + param9.putOpt("Name", "Session_ID"); | ||
| 377 | + param9.putOpt("Value", mCommunicationUuid); | ||
| 378 | + param9.putOpt("Type", "string"); | ||
| 379 | + parameters.put(param9); | ||
| 380 | + | ||
| 381 | + JSONObject param10 = new JSONObject(); | ||
| 382 | + param10.putOpt("Name", "CAMPAIGN_CODE"); | ||
| 383 | + param10.putOpt("Value", "MCC_00006"); | ||
| 384 | + param10.putOpt("Type", "string"); | ||
| 385 | + parameters.put(param10); | ||
| 386 | + | ||
| 387 | + JSONObject param11 = new JSONObject(); | ||
| 388 | + param11.putOpt("Name", "CAMPAIGN_TYPE"); | ||
| 389 | + param11.putOpt("Value", "Inbound"); | ||
| 390 | + param11.putOpt("Type", "string"); | ||
| 391 | + parameters.put(param11); | ||
| 392 | + | ||
| 393 | + JSONObject param12 = new JSONObject(); | ||
| 394 | + param12.putOpt("Name", "UACIResponseTypeCode"); | ||
| 395 | + param12.putOpt("Value", "CON"); | ||
| 396 | + param12.putOpt("Type", "string"); | ||
| 397 | + parameters.put(param12); | ||
| 398 | + | ||
| 399 | + JSONObject param13 = new JSONObject(); | ||
| 400 | + param13.putOpt("Name", "CHANNEL"); | ||
| 401 | + param13.putOpt("Value", "ONE_APP"); | ||
| 402 | + param13.putOpt("Type", "string"); | ||
| 403 | + parameters.put(param13); | ||
| 404 | + | ||
| 405 | + JSONObject param14 = new JSONObject(); | ||
| 406 | + param14.putOpt("Name", "WAVE"); | ||
| 407 | + param14.putOpt("Value", mWave); | ||
| 408 | + param14.putOpt("Type", "string"); | ||
| 409 | + parameters.put(param14); | ||
| 410 | + | ||
| 411 | + JSONObject param15 = new JSONObject(); | ||
| 412 | + param15.putOpt("Name", "RESPONSECHANNEL"); | ||
| 413 | + param15.putOpt("Value", "ONE_APP"); | ||
| 414 | + param15.putOpt("Type", "string"); | ||
| 415 | + parameters.put(param15); | ||
| 416 | + | ||
| 417 | + JSONObject param16 = new JSONObject(); | ||
| 418 | + param16.putOpt("Name", "VALIDITY"); | ||
| 419 | + param16.putOpt("Value", mValidity); | ||
| 420 | + param16.putOpt("Type", "INT"); | ||
| 421 | + parameters.put(param16); | ||
| 422 | + | ||
| 423 | + JSONObject param17 = new JSONObject(); | ||
| 424 | + param17.putOpt("Name", "TREATMENT_CODE"); | ||
| 425 | + param17.putOpt("Value", mTreatmentCode); | ||
| 426 | + param17.putOpt("Type", "string"); | ||
| 427 | + parameters.put(param17); | ||
| 428 | + | ||
| 429 | + JSONObject param18 = new JSONObject(); | ||
| 430 | + param18.putOpt("Name", "EventName"); | ||
| 431 | + param18.putOpt("Value", "INTEREST_P"); | ||
| 432 | + param18.putOpt("Type", "string"); | ||
| 433 | + parameters.put(param18); | ||
| 434 | + | ||
| 435 | + extraJson.putOpt(KEY_PARAMETERS, parameters); | ||
| 436 | + | ||
| 437 | + bodyJsonObject.putOpt(KEY_EXTRA_DATA, extraJson); | ||
| 438 | + } | ||
| 156 | } catch (JSONException e) { | 439 | } catch (JSONException e) { |
| 157 | if (WarpConstants.DEBUG) | 440 | if (WarpConstants.DEBUG) |
| 158 | e.printStackTrace(); | 441 | e.printStackTrace(); | ... | ... |
| ... | @@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker { | ... | @@ -30,7 +30,7 @@ public class EventQuestionnaireService extends Worker { |
| 30 | WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | 30 | WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { |
| 31 | @Override | 31 | @Override |
| 32 | public void onSuccess(Consumer result) { | 32 | public void onSuccess(Consumer result) { |
| 33 | - WarplyManagerHelper.setConsumer(result); | 33 | + WarplyManagerHelper.setConsumerInternal(result); |
| 34 | 34 | ||
| 35 | WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | 35 | WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { |
| 36 | @Override | 36 | @Override | ... | ... |
| ... | @@ -45,6 +45,7 @@ import java.util.HashMap; | ... | @@ -45,6 +45,7 @@ import java.util.HashMap; |
| 45 | import ly.warp.sdk.R; | 45 | import ly.warp.sdk.R; |
| 46 | import ly.warp.sdk.Warply; | 46 | import ly.warp.sdk.Warply; |
| 47 | import ly.warp.sdk.activities.CouponsetInfoActivity; | 47 | import ly.warp.sdk.activities.CouponsetInfoActivity; |
| 48 | +import ly.warp.sdk.activities.GiftsForYouActivity; | ||
| 48 | import ly.warp.sdk.activities.TelcoActivity; | 49 | import ly.warp.sdk.activities.TelcoActivity; |
| 49 | import ly.warp.sdk.activities.WarpViewActivity; | 50 | import ly.warp.sdk.activities.WarpViewActivity; |
| 50 | import ly.warp.sdk.db.WarplyDBHelper; | 51 | import ly.warp.sdk.db.WarplyDBHelper; |
| ... | @@ -83,6 +84,7 @@ public class WarplyManagerHelper { | ... | @@ -83,6 +84,7 @@ public class WarplyManagerHelper { |
| 83 | // =========================================================== | 84 | // =========================================================== |
| 84 | 85 | ||
| 85 | private static Consumer mConsumer = new Consumer(); | 86 | private static Consumer mConsumer = new Consumer(); |
| 87 | + private static Consumer mConsumerInternal = new Consumer(); | ||
| 86 | private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); | 88 | private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>(); |
| 87 | private static CouponList mCouponList = new CouponList(); | 89 | private static CouponList mCouponList = new CouponList(); |
| 88 | private static CouponList mCouponListExpired = new CouponList(); | 90 | private static CouponList mCouponListExpired = new CouponList(); |
| ... | @@ -94,7 +96,7 @@ public class WarplyManagerHelper { | ... | @@ -94,7 +96,7 @@ public class WarplyManagerHelper { |
| 94 | private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); | 96 | private static ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); |
| 95 | private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>(); | 97 | private static ArrayList<LoyaltyContextualOfferModel> mCCMSList = new ArrayList<>(); |
| 96 | private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing, | 98 | private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing, |
| 97 | - mAlertDialogReturnSharing, mAlertDialogErrorSharing; | 99 | + mAlertDialogReturnSharing, mAlertDialogErrorSharing, mAlertDialogErrorUsedSharing, mAlertDialogErrorExpiredSharing; |
| 98 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); | 100 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); |
| 99 | private static float mDealsSum = 0.0f; | 101 | private static float mDealsSum = 0.0f; |
| 100 | private static MerchantList mMerchantList = new MerchantList(); | 102 | private static MerchantList mMerchantList = new MerchantList(); |
| ... | @@ -165,6 +167,10 @@ public class WarplyManagerHelper { | ... | @@ -165,6 +167,10 @@ public class WarplyManagerHelper { |
| 165 | returnSharingDialog(context, modalText); | 167 | returnSharingDialog(context, modalText); |
| 166 | } | 168 | } |
| 167 | } | 169 | } |
| 170 | + } else if (status == 4) { | ||
| 171 | + errorExpiredDialog(context); | ||
| 172 | + } else if (status == 5) { | ||
| 173 | + errorUsedDialog(context); | ||
| 168 | } else | 174 | } else |
| 169 | errorSharingDialog(context); | 175 | errorSharingDialog(context); |
| 170 | } | 176 | } |
| ... | @@ -295,6 +301,32 @@ public class WarplyManagerHelper { | ... | @@ -295,6 +301,32 @@ public class WarplyManagerHelper { |
| 295 | } | 301 | } |
| 296 | 302 | ||
| 297 | /** | 303 | /** |
| 304 | + * Expired dialog | ||
| 305 | + */ | ||
| 306 | + private static void errorExpiredDialog(Context context) { | ||
| 307 | + mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context) | ||
| 308 | + .setTitle(R.string.cos_dlg_error_title) | ||
| 309 | + .setMessage(R.string.cos_dlg_error_expired) | ||
| 310 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
| 311 | + dialogPositive.dismiss(); | ||
| 312 | + }) | ||
| 313 | + .show(); | ||
| 314 | + } | ||
| 315 | + | ||
| 316 | + /** | ||
| 317 | + * Used dialog | ||
| 318 | + */ | ||
| 319 | + private static void errorUsedDialog(Context context) { | ||
| 320 | + mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context) | ||
| 321 | + .setTitle(R.string.cos_dlg_error_title) | ||
| 322 | + .setMessage(R.string.cos_dlg_error_used) | ||
| 323 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
| 324 | + dialogPositive.dismiss(); | ||
| 325 | + }) | ||
| 326 | + .show(); | ||
| 327 | + } | ||
| 328 | + | ||
| 329 | + /** | ||
| 298 | * Open CCMS campaign | 330 | * Open CCMS campaign |
| 299 | */ | 331 | */ |
| 300 | public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { | 332 | public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { |
| ... | @@ -606,6 +638,43 @@ public class WarplyManagerHelper { | ... | @@ -606,6 +638,43 @@ public class WarplyManagerHelper { |
| 606 | public static void handleLoyaltyCampaigns(Context context, Campaign item) { | 638 | public static void handleLoyaltyCampaigns(Context context, Campaign item) { |
| 607 | if (item != null) { | 639 | if (item != null) { |
| 608 | if (item.getType().equals("coupon")) { | 640 | if (item.getType().equals("coupon")) { |
| 641 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
| 642 | + LoyaltyContextualOfferModel ccmsItem = null; | ||
| 643 | + for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
| 644 | + if (ccms.getLoyaltyCampaignId().equals(item.getSessionUUID())) { | ||
| 645 | + ccmsItem = ccms; | ||
| 646 | + break; | ||
| 647 | + } | ||
| 648 | + } | ||
| 649 | + | ||
| 650 | + if (ccmsItem != null) { | ||
| 651 | + try { | ||
| 652 | + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings()); | ||
| 653 | + if (campaignSettings != null) { | ||
| 654 | + if (campaignSettings.has("couponset")) { | ||
| 655 | + String cpnUuid = campaignSettings.optString("couponset"); | ||
| 656 | + for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | ||
| 657 | + if (cpns.getUuid().equals(cpnUuid)) { | ||
| 658 | + Intent intent = new Intent(context, CouponsetInfoActivity.class); | ||
| 659 | + intent.putExtra("couponset", (Serializable) cpns); | ||
| 660 | + intent.putExtra("loyalty", (Serializable) item); | ||
| 661 | + intent.putExtra("ccms", ccmsItem); | ||
| 662 | + context.startActivity(intent); | ||
| 663 | + break; | ||
| 664 | + } | ||
| 665 | + } | ||
| 666 | + } else { | ||
| 667 | + context.startActivity(WarpViewActivity.createIntentFromURL(context, WarplyManagerHelper.constructCampaignUrl(item))); | ||
| 668 | + } | ||
| 669 | + } | ||
| 670 | + } catch (Exception exception) { | ||
| 671 | + exception.printStackTrace(); | ||
| 672 | + } | ||
| 673 | + | ||
| 674 | + return; | ||
| 675 | + } | ||
| 676 | + } | ||
| 677 | + | ||
| 609 | try { | 678 | try { |
| 610 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings()); | 679 | JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings()); |
| 611 | if (campaignSettings != null) { | 680 | if (campaignSettings != null) { |
| ... | @@ -790,10 +859,22 @@ public class WarplyManagerHelper { | ... | @@ -790,10 +859,22 @@ public class WarplyManagerHelper { |
| 790 | return mDfyCoupons; | 859 | return mDfyCoupons; |
| 791 | } | 860 | } |
| 792 | 861 | ||
| 862 | + public static Consumer getConsumerInternal() { | ||
| 863 | + return mConsumerInternal; | ||
| 864 | + } | ||
| 865 | + | ||
| 866 | + public static void setConsumerInternal(Consumer consumer) { | ||
| 867 | + mConsumerInternal = consumer; | ||
| 868 | + } | ||
| 869 | + | ||
| 793 | public static Consumer getConsumer() { | 870 | public static Consumer getConsumer() { |
| 794 | return mConsumer; | 871 | return mConsumer; |
| 795 | } | 872 | } |
| 796 | 873 | ||
| 874 | + public static void setConsumer(Consumer consumer) { | ||
| 875 | + mConsumer = consumer; | ||
| 876 | + } | ||
| 877 | + | ||
| 797 | public static HashMap<String, CampaignList> getUniqueCampaignList() { | 878 | public static HashMap<String, CampaignList> getUniqueCampaignList() { |
| 798 | return mUniqueCampaignList; | 879 | return mUniqueCampaignList; |
| 799 | } | 880 | } |
| ... | @@ -816,10 +897,6 @@ public class WarplyManagerHelper { | ... | @@ -816,10 +897,6 @@ public class WarplyManagerHelper { |
| 816 | return mCouponListExpired; | 897 | return mCouponListExpired; |
| 817 | } | 898 | } |
| 818 | 899 | ||
| 819 | - public static void setConsumer(Consumer consumer) { | ||
| 820 | - mConsumer = consumer; | ||
| 821 | - } | ||
| 822 | - | ||
| 823 | public static void setUniqueCampaignList(CampaignList campaignList) { | 900 | public static void setUniqueCampaignList(CampaignList campaignList) { |
| 824 | mCampaignList.clear(); | 901 | mCampaignList.clear(); |
| 825 | mCampaignList.addAll(campaignList); | 902 | mCampaignList.addAll(campaignList); | ... | ... |
| ... | @@ -802,7 +802,7 @@ public class WarplyManager { | ... | @@ -802,7 +802,7 @@ public class WarplyManager { |
| 802 | getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | 802 | getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { |
| 803 | @Override | 803 | @Override |
| 804 | public void onSuccess(Consumer result) { | 804 | public void onSuccess(Consumer result) { |
| 805 | - WarplyManagerHelper.setConsumer(result); | 805 | + WarplyManagerHelper.setConsumerInternal(result); |
| 806 | if (result != null) { | 806 | if (result != null) { |
| 807 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | 807 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); |
| 808 | if (profMetadata != null) { | 808 | if (profMetadata != null) { |
| ... | @@ -1383,8 +1383,8 @@ public class WarplyManager { | ... | @@ -1383,8 +1383,8 @@ public class WarplyManager { |
| 1383 | campaignLoyaltyList.clear(); | 1383 | campaignLoyaltyList.clear(); |
| 1384 | for (Campaign camp : mNewCampaignList) { | 1384 | for (Campaign camp : mNewCampaignList) { |
| 1385 | if (camp.getOfferCategory().equals("questionnaire")) { | 1385 | if (camp.getOfferCategory().equals("questionnaire")) { |
| 1386 | - if (WarplyManagerHelper.getConsumer() != null) { | 1386 | + if (WarplyManagerHelper.getConsumerInternal() != null) { |
| 1387 | - JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumer().getProfileMetadata()); | 1387 | + JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); |
| 1388 | if (profMetadata != null) { | 1388 | if (profMetadata != null) { |
| 1389 | if (!profMetadata.has("answered")) { | 1389 | if (!profMetadata.has("answered")) { |
| 1390 | try { | 1390 | try { |
| ... | @@ -2278,7 +2278,7 @@ public class WarplyManager { | ... | @@ -2278,7 +2278,7 @@ public class WarplyManager { |
| 2278 | getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | 2278 | getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { |
| 2279 | @Override | 2279 | @Override |
| 2280 | public void onSuccess(Consumer result) { | 2280 | public void onSuccess(Consumer result) { |
| 2281 | - WarplyManagerHelper.setConsumer(result); | 2281 | + WarplyManagerHelper.setConsumerInternal(result); |
| 2282 | if (result != null) { | 2282 | if (result != null) { |
| 2283 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | 2283 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); |
| 2284 | if (profMetadata != null) { | 2284 | if (profMetadata != null) { | ... | ... |
| ... | @@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. | ... | @@ -126,6 +126,23 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. |
| 126 | // holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | 126 | // holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); |
| 127 | // | 127 | // |
| 128 | // holder.tvCouponValue.setText(mergedgiftsItem.getDiscount()); | 128 | // holder.tvCouponValue.setText(mergedgiftsItem.getDiscount()); |
| 129 | + } else if (mergedgiftsItem != null && mergedgiftsItem.getDataType() == 3) { | ||
| 130 | + if (!TextUtils.isEmpty(mergedgiftsItem.getCCMS().getImageUrl())) { | ||
| 131 | + Glide.with(mContext) | ||
| 132 | +// .setDefaultRequestOptions( | ||
| 133 | +// RequestOptions | ||
| 134 | +// .placeholderOf(R.drawable.ic_default_contact_photo) | ||
| 135 | +// .error(R.drawable.ic_default_contact_photo)) | ||
| 136 | + .load(mergedgiftsItem.getCCMS().getImageUrl()) | ||
| 137 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 138 | + .into(holder.ivMergedGiftsLogo); | ||
| 139 | + } else { | ||
| 140 | + Glide.with(mContext) | ||
| 141 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 142 | + .into(holder.ivMergedGiftsLogo); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + holder.tvMergedGiftsTitle.setText(mergedgiftsItem.getCCMS().getTitle()); | ||
| 129 | } | 146 | } |
| 130 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); | 147 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedgiftsItem)); |
| 131 | } | 148 | } | ... | ... |
| 1 | +package ly.warp.sdk.views.adapters; | ||
| 2 | + | ||
| 3 | +import android.content.Context; | ||
| 4 | +import android.text.TextUtils; | ||
| 5 | +import android.view.LayoutInflater; | ||
| 6 | +import android.view.View; | ||
| 7 | +import android.view.ViewGroup; | ||
| 8 | +import android.widget.ImageView; | ||
| 9 | +import android.widget.TextView; | ||
| 10 | + | ||
| 11 | +import androidx.recyclerview.widget.RecyclerView; | ||
| 12 | + | ||
| 13 | +import com.bumptech.glide.Glide; | ||
| 14 | +import com.bumptech.glide.load.engine.DiskCacheStrategy; | ||
| 15 | +import com.bumptech.glide.load.resource.bitmap.CenterCrop; | ||
| 16 | +import com.bumptech.glide.load.resource.bitmap.RoundedCorners; | ||
| 17 | + | ||
| 18 | +import java.util.ArrayList; | ||
| 19 | +import java.util.Date; | ||
| 20 | +import java.util.concurrent.TimeUnit; | ||
| 21 | + | ||
| 22 | +import io.reactivex.Observable; | ||
| 23 | +import io.reactivex.subjects.PublishSubject; | ||
| 24 | +import ly.warp.sdk.R; | ||
| 25 | +import ly.warp.sdk.io.models.MergedMore; | ||
| 26 | + | ||
| 27 | +public class MergedMoreAdapter extends RecyclerView.Adapter<MergedMoreAdapter.MergedMoreViewHolder> { | ||
| 28 | + | ||
| 29 | + private Context mContext; | ||
| 30 | + private ArrayList<MergedMore> mMergedMore; | ||
| 31 | + private final PublishSubject<MergedMore> onClickSubject = PublishSubject.create(); | ||
| 32 | + | ||
| 33 | + public MergedMoreAdapter(Context mContext, ArrayList<MergedMore> mergedmore) { | ||
| 34 | + this.mContext = mContext; | ||
| 35 | + this.mMergedMore = mergedmore; | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + public class MergedMoreViewHolder extends RecyclerView.ViewHolder { | ||
| 39 | + private ImageView ivCampaignTitle, ivIsNew; | ||
| 40 | + private TextView tvCampaignTitle, tvCampaignSubtitle, tvCampaignMessage; | ||
| 41 | + | ||
| 42 | + public MergedMoreViewHolder(View view) { | ||
| 43 | + super(view); | ||
| 44 | + ivCampaignTitle = view.findViewById(R.id.iv_campaign_logo); | ||
| 45 | + tvCampaignTitle = view.findViewById(R.id.tv_campaign_title); | ||
| 46 | + ivIsNew = view.findViewById(R.id.iv_campaign_new); | ||
| 47 | + tvCampaignSubtitle = view.findViewById(R.id.tv_campaign_subtitle); | ||
| 48 | + tvCampaignMessage = view.findViewById(R.id.tv_campaign_message); | ||
| 49 | + } | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public int getItemCount() { | ||
| 54 | + if (mMergedMore == null) | ||
| 55 | + return 0; | ||
| 56 | + else | ||
| 57 | + return mMergedMore.size(); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + | ||
| 61 | + public MergedMore getItem(int id) { | ||
| 62 | + return mMergedMore.get(id); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public void updateData(ArrayList<MergedMore> mergedmore) { | ||
| 66 | + mMergedMore.clear(); | ||
| 67 | + mMergedMore.addAll(mergedmore); | ||
| 68 | + notifyDataSetChanged(); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public MergedMoreViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { | ||
| 74 | + View itemView; | ||
| 75 | + itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.item_profile_recycler_vertical, parent, false); | ||
| 76 | + return new MergedMoreViewHolder(itemView); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @Override | ||
| 80 | + public void onBindViewHolder(final MergedMoreViewHolder holder, int position) { | ||
| 81 | + MergedMore mergedmoreItem = mMergedMore.get(position); | ||
| 82 | + if (mergedmoreItem != null && mergedmoreItem.getDataType() == 1) { | ||
| 83 | + if (!TextUtils.isEmpty(mergedmoreItem.getCampaign().getLogoUrl())) { | ||
| 84 | + Glide.with(mContext) | ||
| 85 | + .load(mergedmoreItem.getCampaign().getLogoUrl()) | ||
| 86 | + .transform(new CenterCrop(), new RoundedCorners(4)) | ||
| 87 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 88 | + .into(holder.ivCampaignTitle); | ||
| 89 | + } else { | ||
| 90 | + Glide.with(mContext) | ||
| 91 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 92 | + .into(holder.ivCampaignTitle); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + holder.tvCampaignTitle.setText(mergedmoreItem.getCampaign().getTitle()); | ||
| 96 | + holder.tvCampaignSubtitle.setText(mergedmoreItem.getCampaign().getSubtitle()); | ||
| 97 | + holder.tvCampaignMessage.setText(mergedmoreItem.getCampaign().getMessage()); | ||
| 98 | + if (mergedmoreItem.getCampaign().getIsNew()) | ||
| 99 | + holder.ivIsNew.setVisibility(View.VISIBLE); | ||
| 100 | + else | ||
| 101 | + holder.ivIsNew.setVisibility(View.GONE); | ||
| 102 | + } else if (mergedmoreItem != null && mergedmoreItem.getDataType() == 2) { | ||
| 103 | + if (!TextUtils.isEmpty(mergedmoreItem.getCCMS().getImageUrl())) { | ||
| 104 | + Glide.with(mContext) | ||
| 105 | + .load(mergedmoreItem.getCCMS().getImageUrl()) | ||
| 106 | + .transform(new CenterCrop(), new RoundedCorners(4)) | ||
| 107 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
| 108 | + .into(holder.ivCampaignTitle); | ||
| 109 | + } else { | ||
| 110 | + Glide.with(mContext) | ||
| 111 | + .load(R.drawable.ic_cosmote_logo_horizontal_grey) | ||
| 112 | + .into(holder.ivCampaignTitle); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + holder.tvCampaignTitle.setText(mergedmoreItem.getCCMS().getTitle()); | ||
| 116 | + holder.tvCampaignSubtitle.setText(mergedmoreItem.getCCMS().getSubtitle()); | ||
| 117 | + holder.tvCampaignMessage.setText(mergedmoreItem.getCCMS().getMessage()); | ||
| 118 | + holder.ivIsNew.setVisibility(View.GONE); | ||
| 119 | + } | ||
| 120 | + holder.itemView.setOnClickListener(v -> onClickSubject.onNext(mergedmoreItem)); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + public Observable<MergedMore> getPositionClicks() { | ||
| 124 | + return onClickSubject.cache(); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + private long getDifferenceDays(Date d1, Date d2) { | ||
| 128 | + long diff = d2.getTime() - d1.getTime(); | ||
| 129 | + return TimeUnit.DAYS.convert(diff, TimeUnit.MILLISECONDS); | ||
| 130 | + } | ||
| 131 | +} |
| ... | @@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte | ... | @@ -95,12 +95,12 @@ public class SharedCouponAdapter extends RecyclerView.Adapter<SharedCouponAdapte |
| 95 | if (couponItem.getSharingType().equals("sent")) { | 95 | if (couponItem.getSharingType().equals("sent")) { |
| 96 | holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver); | 96 | holder.tvCouponLabel.setText(R.string.cos_shared_coupon_receiver); |
| 97 | if (extraFields != null && extraFields.has("receiver_msisdn")) { | 97 | if (extraFields != null && extraFields.has("receiver_msisdn")) { |
| 98 | - holder.tvCouponLabel.setText(extraFields.optString("receiver_msisdn")); | 98 | + holder.tvCouponPhone.setText(extraFields.optString("receiver_msisdn")); |
| 99 | } | 99 | } |
| 100 | } else if (couponItem.getSharingType().equals("received")) { | 100 | } else if (couponItem.getSharingType().equals("received")) { |
| 101 | holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender); | 101 | holder.tvCouponLabel.setText(R.string.cos_shared_coupon_sender); |
| 102 | if (extraFields != null && extraFields.has("sender_msisdn")) { | 102 | if (extraFields != null && extraFields.has("sender_msisdn")) { |
| 103 | - holder.tvCouponLabel.setText(extraFields.optString("sender_msisdn")); | 103 | + holder.tvCouponPhone.setText(extraFields.optString("sender_msisdn")); |
| 104 | } | 104 | } |
| 105 | } | 105 | } |
| 106 | 106 | ... | ... |
| ... | @@ -413,6 +413,7 @@ | ... | @@ -413,6 +413,7 @@ |
| 413 | android:layout_width="match_parent" | 413 | android:layout_width="match_parent" |
| 414 | android:layout_height="wrap_content" | 414 | android:layout_height="wrap_content" |
| 415 | android:layout_marginHorizontal="32dp" | 415 | android:layout_marginHorizontal="32dp" |
| 416 | + android:layout_marginTop="24dp" | ||
| 416 | android:gravity="center" | 417 | android:gravity="center" |
| 417 | android:orientation="vertical" | 418 | android:orientation="vertical" |
| 418 | android:visibility="gone"> | 419 | android:visibility="gone"> | ... | ... |
| ... | @@ -123,6 +123,9 @@ | ... | @@ -123,6 +123,9 @@ |
| 123 | <string name="cos_value2">%1$s</string> | 123 | <string name="cos_value2">%1$s</string> |
| 124 | <string name="cos_show_barcode">Εμφάνιση barcode</string> | 124 | <string name="cos_show_barcode">Εμφάνιση barcode</string> |
| 125 | <string name="cos_hide_barcode">Απόκρυψη barcode</string> | 125 | <string name="cos_hide_barcode">Απόκρυψη barcode</string> |
| 126 | + <string name="cos_wrong_number_dlg">Το κινητό που καταχώρησες δεν είναι COSMOTE. Παρακαλούμε καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string> | ||
| 127 | + <string name="cos_dlg_error_expired">Το δώρο έχει λήξει</string> | ||
| 128 | + <string name="cos_dlg_error_used">Το δώρο έχει ήδη χρησιμοποιηθεί</string> | ||
| 126 | 129 | ||
| 127 | <string-array name="coupons_array"> | 130 | <string-array name="coupons_array"> |
| 128 | <item>Κουπόνια</item> | 131 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment