Showing
12 changed files
with
195 additions
and
73 deletions
... | @@ -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-cosbeta18' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta19' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -96,8 +96,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -96,8 +96,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
96 | mTvTitle.setText(getIntent().getStringExtra("title")); | 96 | mTvTitle.setText(getIntent().getStringExtra("title")); |
97 | mIvPopupClose.setOnClickListener(this); | 97 | mIvPopupClose.setOnClickListener(this); |
98 | 98 | ||
99 | - if (WarpUtils.getGiftsPopup(this)) | 99 | +// if (WarpUtils.getGiftsPopup(this)) |
100 | - mLlGiftsPopup.setVisibility(View.VISIBLE); | 100 | +// mLlGiftsPopup.setVisibility(View.VISIBLE); |
101 | 101 | ||
102 | if (mData != null && mData.size() > 0) { | 102 | if (mData != null && mData.size() > 0) { |
103 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 103 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
... | @@ -114,7 +114,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -114,7 +114,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
114 | String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString("loyaltyCampaignId"); | 114 | String value = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()).optString("loyaltyCampaignId"); |
115 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 115 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
116 | if (ccms.getLoyaltyCampaignId().equals(value)) { | 116 | if (ccms.getLoyaltyCampaignId().equals(value)) { |
117 | - startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms.getSessionId()))); | 117 | + startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms))); |
118 | return; | 118 | return; |
119 | } | 119 | } |
120 | } | 120 | } | ... | ... |
... | @@ -13,6 +13,9 @@ import androidx.constraintlayout.widget.ConstraintLayout; | ... | @@ -13,6 +13,9 @@ import androidx.constraintlayout.widget.ConstraintLayout; |
13 | import androidx.recyclerview.widget.LinearLayoutManager; | 13 | import androidx.recyclerview.widget.LinearLayoutManager; |
14 | import androidx.recyclerview.widget.RecyclerView; | 14 | import androidx.recyclerview.widget.RecyclerView; |
15 | 15 | ||
16 | +import com.bumptech.glide.Glide; | ||
17 | +import com.bumptech.glide.load.engine.DiskCacheStrategy; | ||
18 | + | ||
16 | import org.greenrobot.eventbus.EventBus; | 19 | import org.greenrobot.eventbus.EventBus; |
17 | 20 | ||
18 | import java.io.Serializable; | 21 | import java.io.Serializable; |
... | @@ -43,17 +46,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -43,17 +46,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
43 | // Fields | 46 | // Fields |
44 | // =========================================================== | 47 | // =========================================================== |
45 | 48 | ||
46 | - private ImageView mIvBack, mIvDealsLogo; | 49 | + private ImageView mIvBack, mIvDealsLogo, mIvProfilePhoto; |
47 | private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll, | 50 | private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll, |
48 | mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate; | 51 | mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate; |
49 | private ConstraintLayout mClDealsBanner, mClDealsView, | 52 | private ConstraintLayout mClDealsBanner, mClDealsView, |
50 | mClGiftsBanner; | 53 | mClGiftsBanner; |
51 | private LinearLayout mLlQuestionnaire, mLlUserBadge; | 54 | private LinearLayout mLlQuestionnaire, mLlUserBadge; |
52 | - float couponValue = 0.0f, couponDfyValue = 0.0f; | 55 | + private float couponDfyValue = 0.0f; |
53 | - int couponCount = 0; | ||
54 | private RecyclerView mRecyclerCoupons; | 56 | private RecyclerView mRecyclerCoupons; |
55 | private ActiveCouponAdapter mAdapterCoupons; | 57 | private ActiveCouponAdapter mAdapterCoupons; |
56 | - private CouponList cpnlist = new CouponList(); | ||
57 | 58 | ||
58 | // =========================================================== | 59 | // =========================================================== |
59 | // Methods for/from SuperClass/Interfaces | 60 | // Methods for/from SuperClass/Interfaces |
... | @@ -79,6 +80,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -79,6 +80,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
79 | mTvActiveDate = findViewById(R.id.tv_active_deals_date_text); | 80 | mTvActiveDate = findViewById(R.id.tv_active_deals_date_text); |
80 | mIvDealsLogo = findViewById(R.id.dfy_logo); | 81 | mIvDealsLogo = findViewById(R.id.dfy_logo); |
81 | mClDealsView = findViewById(R.id.cl_mygifts); | 82 | mClDealsView = findViewById(R.id.cl_mygifts); |
83 | + mIvProfilePhoto = findViewById(R.id.iv_profile_photo); | ||
82 | 84 | ||
83 | if (WarplyManagerHelper.getActiveDFYCoupons() != null) { | 85 | if (WarplyManagerHelper.getActiveDFYCoupons() != null) { |
84 | Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() { | 86 | Collections.sort(WarplyManagerHelper.getActiveDFYCoupons(), new Comparator<ActiveDFYCouponModel>() { |
... | @@ -87,33 +89,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -87,33 +89,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
87 | } | 89 | } |
88 | }); | 90 | }); |
89 | 91 | ||
90 | - for (ActiveDFYCouponModel dfycoupon : WarplyManagerHelper.getActiveDFYCoupons()) { | 92 | +// for (ActiveDFYCouponModel dfycoupon : WarplyManagerHelper.getActiveDFYCoupons()) { |
91 | - try { | 93 | +// try { |
92 | - couponDfyValue += Float.parseFloat(dfycoupon.getValue()); | 94 | +// couponDfyValue += Float.parseFloat(dfycoupon.getValue()); |
93 | - } catch (NumberFormatException e) { | 95 | +// } catch (NumberFormatException e) { |
94 | - | 96 | +// |
95 | - } | 97 | +// } |
96 | - } | 98 | +// } |
97 | } | 99 | } |
98 | 100 | ||
99 | - if (WarplyManagerHelper.getCouponList() != null) { | 101 | + mRecyclerCoupons = findViewById(R.id.rv_active_coupons); |
100 | - for (Coupon coupon : WarplyManagerHelper.getCouponList()) { | 102 | + mRecyclerCoupons.setNestedScrollingEnabled(false); |
101 | - if (coupon.getStatus() == 1) { | 103 | + mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
102 | - try { | ||
103 | - cpnlist.add(coupon); | ||
104 | - couponCount += 1; | ||
105 | - couponValue += Float.parseFloat(coupon.getDiscount()); | ||
106 | - } catch (NumberFormatException e) { | ||
107 | - cpnlist.remove(coupon); | ||
108 | - couponCount -= 1; | ||
109 | - } | ||
110 | - } | ||
111 | - } | ||
112 | - | ||
113 | - mRecyclerCoupons = findViewById(R.id.rv_active_coupons); | ||
114 | - mRecyclerCoupons.setNestedScrollingEnabled(false); | ||
115 | - mRecyclerCoupons.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
116 | - } | ||
117 | 104 | ||
118 | initViews(); | 105 | initViews(); |
119 | } | 106 | } |
... | @@ -149,22 +136,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -149,22 +136,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
149 | // =========================================================== | 136 | // =========================================================== |
150 | 137 | ||
151 | private void initViews() { | 138 | private void initViews() { |
152 | - mAdapterCoupons = new ActiveCouponAdapter(this, cpnlist); | 139 | + if (WarplyManagerHelper.getCouponList() != null) { |
153 | - mRecyclerCoupons.setAdapter(mAdapterCoupons); | 140 | + mAdapterCoupons = new ActiveCouponAdapter(this, WarplyManagerHelper.getCouponList()); |
154 | - mAdapterCoupons.getPositionClicks() | 141 | + mRecyclerCoupons.setAdapter(mAdapterCoupons); |
155 | - .doOnNext(coupon -> { | 142 | + mAdapterCoupons.getPositionClicks() |
156 | - Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); | 143 | + .doOnNext(coupon -> { |
157 | - intent.putExtra("coupon", (Serializable) coupon); | 144 | + Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); |
158 | - startActivity(intent); | 145 | + intent.putExtra("coupon", (Serializable) coupon); |
159 | - }) | 146 | + startActivity(intent); |
160 | - .doOnError(error -> { | 147 | + }) |
161 | - }) | 148 | + .doOnError(error -> { |
162 | - .subscribe(); | 149 | + }) |
163 | - | 150 | + .subscribe(); |
164 | - mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(couponValue))); | 151 | + } |
165 | - mTvGiftsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(couponValue), String.valueOf(couponCount))); | 152 | + |
166 | - mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(couponDfyValue))); | 153 | + mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()))); |
167 | - mTvDealsValueAll.setText(String.format(getString(R.string.cos_deals_win_title_cos), String.valueOf(couponDfyValue))); | 154 | + mTvGiftsValueAll.setText(String.format(getString(R.string.cos_deals_win_title), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))); |
155 | + mTvDealsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(/*couponDfyValue*/ WarplyManagerHelper.getDealsCouponsSum()))); | ||
156 | + mTvDealsValueAll.setText(String.format(getString(R.string.cos_deals_win_title_cos), String.valueOf(/*couponDfyValue*/WarplyManagerHelper.getDealsCouponsSum()))); | ||
168 | if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) { | 157 | if (WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() > 0) { |
169 | mTvActiveCode.setText(WarplyManagerHelper.getActiveDFYCoupons().get(0).getCode()); | 158 | mTvActiveCode.setText(WarplyManagerHelper.getActiveDFYCoupons().get(0).getCode()); |
170 | 159 | ||
... | @@ -189,6 +178,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -189,6 +178,17 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
189 | mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), | 178 | mTvUsername.setText(String.format(getResources().getString(R.string.cos_profile_loyalty_name), |
190 | WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName())); | 179 | WarplyManagerHelper.getConsumer().getFirstName(), WarplyManagerHelper.getConsumer().getLastName())); |
191 | 180 | ||
181 | + if (!TextUtils.isEmpty(WarplyManagerHelper.getConsumer().getImageUrl()) && !WarplyManagerHelper.getConsumer().getImageUrl().equals("null")) { | ||
182 | + Glide.with(this) | ||
183 | + .load(WarplyManagerHelper.getConsumer().getImageUrl()) | ||
184 | + .diskCacheStrategy(DiskCacheStrategy.DATA) | ||
185 | + .into(mIvProfilePhoto); | ||
186 | + } else { | ||
187 | + Glide.with(this) | ||
188 | + .load(R.drawable.ic_default_photo) | ||
189 | + .into(mIvProfilePhoto); | ||
190 | + } | ||
191 | + | ||
192 | if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag())) { | 192 | if (!TextUtils.isEmpty(WarplyManagerHelper.getUserTag())) { |
193 | mTvUserBadge.setText(WarplyManagerHelper.getUserTag()); | 193 | mTvUserBadge.setText(WarplyManagerHelper.getUserTag()); |
194 | mLlQuestionnaire.setVisibility(View.GONE); | 194 | mLlQuestionnaire.setVisibility(View.GONE); | ... | ... |
... | @@ -81,8 +81,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -81,8 +81,8 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
81 | mTvTitle.setText(getIntent().getStringExtra("title")); | 81 | mTvTitle.setText(getIntent().getStringExtra("title")); |
82 | mIvPopupClose.setOnClickListener(this); | 82 | mIvPopupClose.setOnClickListener(this); |
83 | 83 | ||
84 | - if (WarpUtils.getMorePopup(this)) | 84 | +// if (WarpUtils.getMorePopup(this)) |
85 | - mLlMorePopup.setVisibility(View.VISIBLE); | 85 | +// mLlMorePopup.setVisibility(View.VISIBLE); |
86 | 86 | ||
87 | if (WarplyManagerHelper.getUniqueCampaignList().get("more_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("more_for_you").size() > 0) { | 87 | if (WarplyManagerHelper.getUniqueCampaignList().get("more_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("more_for_you").size() > 0) { |
88 | mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 88 | mRecyclerMore.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ... | ... |
... | @@ -81,8 +81,6 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -81,8 +81,6 @@ public class WarpViewActivity extends WarpBaseActivity { |
81 | @Override | 81 | @Override |
82 | public void onCreate(Bundle savedInstanceState) { | 82 | public void onCreate(Bundle savedInstanceState) { |
83 | super.onCreate(savedInstanceState); | 83 | super.onCreate(savedInstanceState); |
84 | -// setContentView(R.layout.activity_loyalty_wallet); | ||
85 | - | ||
86 | WarplySessionManager.onCreateActivity(this); | 84 | WarplySessionManager.onCreateActivity(this); |
87 | initViews(); | 85 | initViews(); |
88 | Warply.getInitializer(this).init(); | 86 | Warply.getInitializer(this).init(); | ... | ... |
... | @@ -111,15 +111,35 @@ public class VolleyTransformer implements Listener<JSONObject>, ErrorListener { | ... | @@ -111,15 +111,35 @@ public class VolleyTransformer implements Listener<JSONObject>, ErrorListener { |
111 | 111 | ||
112 | if (mListener == null) | 112 | if (mListener == null) |
113 | return; | 113 | return; |
114 | - WarpUtils.log("**************** WARPLY Reponse *****************"); | 114 | + WarpUtils.log("**************** WARPLY Response *****************"); |
115 | WarpUtils.verbose("[WARP Trace] HTTP Web Id: " | 115 | WarpUtils.verbose("[WARP Trace] HTTP Web Id: " |
116 | + WarpUtils.getWebId(Warply.INSTANCE.mContext.get())); | 116 | + WarpUtils.getWebId(Warply.INSTANCE.mContext.get())); |
117 | WarpUtils.verbose("[WARP Trace] HTTP API Key: " | 117 | WarpUtils.verbose("[WARP Trace] HTTP API Key: " |
118 | + WarplyProperty.getAppUuid(Warply.INSTANCE.mContext.get())); | 118 | + WarplyProperty.getAppUuid(Warply.INSTANCE.mContext.get())); |
119 | if (response != null) { | 119 | if (response != null) { |
120 | try { | 120 | try { |
121 | - WarpUtils.log("[WARP Trace] Request: " + response.toString(2)); | 121 | +// WarpUtils.log("[WARP Trace] Request: " + response.toString(2)); |
122 | - } catch (JSONException e) { | 122 | + |
123 | + WarpUtils.log("[WARP Trace] Response: "); | ||
124 | +// if (response.toString().length() > 4000) { | ||
125 | +// for (int i = 0; i < response.toString().length(); i += 4000) { | ||
126 | +// if (i + 4000 < response.toString().length()) | ||
127 | +// WarpUtils.log(response.toString().substring(i, i + 4000)); | ||
128 | +// else | ||
129 | +// WarpUtils.log(response.toString().substring(i, response.toString().length())); | ||
130 | +// } | ||
131 | + for (int i = 0, length = response.toString().length(); i < length; i++) { | ||
132 | + int newline = response.toString().indexOf('\n', i); | ||
133 | + newline = newline != -1 ? newline : length; | ||
134 | + do { | ||
135 | + int end = Math.min(newline, i + 4000); | ||
136 | + WarpUtils.log(response.toString().substring(i, end)); | ||
137 | + i = end; | ||
138 | + } while (i < newline); | ||
139 | + } | ||
140 | +// } else | ||
141 | +// WarpUtils.log("[WARP Trace] Request: " + response.toString(2)); | ||
142 | + } catch (/*JSONException*/ Exception e) { | ||
123 | WarpUtils.warn( | 143 | WarpUtils.warn( |
124 | "[WARP Trace] Failed conversting JSON to string", e); | 144 | "[WARP Trace] Failed conversting JSON to string", e); |
125 | } | 145 | } | ... | ... |
... | @@ -81,6 +81,7 @@ public class WarplyManagerHelper { | ... | @@ -81,6 +81,7 @@ public class WarplyManagerHelper { |
81 | private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing, | 81 | private static AlertDialog mAlertDialogSharing, mAlertDialogAcceptSharing, mAlertDialogRejectSharing, |
82 | mAlertDialogReturnSharing, mAlertDialogErrorSharing; | 82 | mAlertDialogReturnSharing, mAlertDialogErrorSharing; |
83 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); | 83 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); |
84 | + private static float mDealsSum = 0.0f; | ||
84 | 85 | ||
85 | // =========================================================== | 86 | // =========================================================== |
86 | // Methods for/from SuperClass/Interfaces | 87 | // Methods for/from SuperClass/Interfaces |
... | @@ -251,7 +252,8 @@ public class WarplyManagerHelper { | ... | @@ -251,7 +252,8 @@ public class WarplyManagerHelper { |
251 | /** | 252 | /** |
252 | * Open CCMS campaign | 253 | * Open CCMS campaign |
253 | */ | 254 | */ |
254 | - public static String constructCcmsUrl(Campaign item, String sessionId) { | 255 | + public static String constructCcmsUrl(Campaign item, LoyaltyContextualOfferModel ccmsItem) { |
256 | + Log.v("CCMS_PRESSED", ccmsItem.getId() + " " + ccmsItem.getOfferName()); | ||
255 | item.setNew(false); | 257 | item.setNew(false); |
256 | String url = item.getIndexUrl() | 258 | String url = item.getIndexUrl() |
257 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) | 259 | + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) |
... | @@ -262,7 +264,94 @@ public class WarplyManagerHelper { | ... | @@ -262,7 +264,94 @@ public class WarplyManagerHelper { |
262 | + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token") | 264 | + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token") |
263 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") | 265 | + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") |
264 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") | 266 | + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") |
265 | - + "&session_id=" + sessionId; | 267 | + + "&Session_ID=" + ccmsItem.getSessionId() |
268 | + + "&businessService=" | ||
269 | + + "&offerName=" + ccmsItem.getOfferName() | ||
270 | + + "&productType=" + ccmsItem.getProductType() | ||
271 | + + "&provDuration=" + ccmsItem.getProvDuration() | ||
272 | + + "&noOfRecurrance=" + ccmsItem.getNoOfRecurrance() | ||
273 | + + "&price=" + ccmsItem.getPrice() | ||
274 | + + "&discount=" + ccmsItem.getDiscount() | ||
275 | + + "&voiceCategory=" + ccmsItem.getVoiceCategory() | ||
276 | + + "&dataCategory=" + ccmsItem.getDataCategory() | ||
277 | + + "&minsValue=" + ccmsItem.getMinsValue() | ||
278 | + + "&dataValue=" + ccmsItem.getDataValue() | ||
279 | + + "&provStepValueMins=" + ccmsItem.getProvStepValueMins() | ||
280 | + + "&UACIOfferTrackingCode=" | ||
281 | + + "&MSISDN=" | ||
282 | + + "&OFFERCODE1=" | ||
283 | + + "&SCORE=" | ||
284 | + + "&ZONE=" | ||
285 | + + "&WAVE=" | ||
286 | + + "&VALIDITY=" | ||
287 | + + "&TREATMENT_CODE=" | ||
288 | + + "&GUID=" | ||
289 | + + "&OfferAudienceLevel="; | ||
290 | + | ||
291 | + | ||
292 | +// if (mConsumer != null) | ||
293 | +// url = url + "&auth_token=" + (mConsumer.getUuid()); | ||
294 | +// else | ||
295 | +// url = url + "&auth_token="; | ||
296 | + | ||
297 | + return url; | ||
298 | + } | ||
299 | + | ||
300 | + /** | ||
301 | + * Open CCMS campaign | ||
302 | + */ | ||
303 | + public static String constructCcmsUrl(LoyaltyContextualOfferModel item, String sessionId) { | ||
304 | + String url = ""; | ||
305 | + if (item != null) { | ||
306 | + if (mUniqueCampaignList != null && mUniqueCampaignList.get("gifts_for_you") != null && mUniqueCampaignList.get("gifts_for_you").size() > 0) { | ||
307 | + for (Campaign camp : mUniqueCampaignList.get("gifts_for_you")) { | ||
308 | + try { | ||
309 | + String key = WarpJSONParser.getJSONFromString(camp.getExtraFields()).keys().next(); | ||
310 | + if (!TextUtils.isEmpty(key) && key.equals("loyaltyCampaignId")) { | ||
311 | + String keyValue = WarpJSONParser.getJSONFromString(camp.getExtraFields()).optString(key); | ||
312 | + if (keyValue.equals(item.getLoyaltyCampaignId())) { | ||
313 | + Log.v("CCMS_PRESSED", item.getId() + " " + item.getOfferName()); | ||
314 | + url = camp.getIndexUrl() | ||
315 | + + "?web_id=" + WarpUtils.getWebId(Warply.getWarplyContext()) | ||
316 | + + "&app_uuid=" + WarplyProperty.getAppUuid(Warply.getWarplyContext()) | ||
317 | + + "&api_key=" + WarpUtils.getApiKey(Warply.getWarplyContext()) | ||
318 | + + "&session_uuid=" + camp.getSessionUUID() | ||
319 | + + "&access_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("access_token") | ||
320 | + + "&refresh_token=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getAuthValue("refresh_token") | ||
321 | + + "&client_id=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_id") | ||
322 | + + "&client_secret=" + WarplyDBHelper.getInstance(Warply.getWarplyContext()).getClientValue("client_secret") | ||
323 | + + "&Session_ID=" + sessionId //item.getSessionId() | ||
324 | + + "&businessService=" | ||
325 | + + "&offerName=" + item.getOfferName() | ||
326 | + + "&productType=" + item.getProductType() | ||
327 | + + "&provDuration=" + item.getProvDuration() | ||
328 | + + "&noOfRecurrance=" + item.getNoOfRecurrance() | ||
329 | + + "&price=" + item.getPrice() | ||
330 | + + "&discount=" + item.getDiscount() | ||
331 | + + "&voiceCategory=" + item.getVoiceCategory() | ||
332 | + + "&dataCategory=" + item.getDataCategory() | ||
333 | + + "&minsValue=" + item.getMinsValue() | ||
334 | + + "&dataValue=" + item.getDataValue() | ||
335 | + + "&provStepValueMins=" + item.getProvStepValueMins() | ||
336 | + + "&UACIOfferTrackingCode=" | ||
337 | + + "&MSISDN=" | ||
338 | + + "&OFFERCODE1=" | ||
339 | + + "&SCORE=" | ||
340 | + + "&ZONE=" | ||
341 | + + "&WAVE=" | ||
342 | + + "&VALIDITY=" | ||
343 | + + "&TREATMENT_CODE=" | ||
344 | + + "&GUID=" | ||
345 | + + "&OfferAudienceLevel="; | ||
346 | + break; | ||
347 | + } | ||
348 | + } | ||
349 | + } catch (Exception exception) { | ||
350 | + Log.v("WarplyManagerHelper_CCMS_Error", exception.toString()); | ||
351 | + } | ||
352 | + } | ||
353 | + } | ||
354 | + } | ||
266 | 355 | ||
267 | // if (mConsumer != null) | 356 | // if (mConsumer != null) |
268 | // url = url + "&auth_token=" + (mConsumer.getUuid()); | 357 | // url = url + "&auth_token=" + (mConsumer.getUuid()); |
... | @@ -427,15 +516,17 @@ public class WarplyManagerHelper { | ... | @@ -427,15 +516,17 @@ public class WarplyManagerHelper { |
427 | 516 | ||
428 | public static void setUniqueCampaignList(CampaignList campaignList) { | 517 | public static void setUniqueCampaignList(CampaignList campaignList) { |
429 | mCampaignList = campaignList; | 518 | mCampaignList = campaignList; |
430 | - for (Campaign campaign : campaignList) { | 519 | + if (campaignList != null) { |
431 | - if (mUniqueCampaignList.containsKey(campaign.getOfferCategory().trim())) { | 520 | + for (Campaign campaign : campaignList) { |
432 | - CampaignList tempCampaignList = (CampaignList) mUniqueCampaignList.get(campaign.getOfferCategory().trim()); | 521 | + if (mUniqueCampaignList.containsKey(campaign.getOfferCategory().trim())) { |
433 | - tempCampaignList.add(campaign); | 522 | + CampaignList tempCampaignList = (CampaignList) mUniqueCampaignList.get(campaign.getOfferCategory().trim()); |
434 | - mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); | 523 | + tempCampaignList.add(campaign); |
435 | - } else { | 524 | + mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); |
436 | - CampaignList tempCampaignList = new CampaignList(); | 525 | + } else { |
437 | - tempCampaignList.add(campaign); | 526 | + CampaignList tempCampaignList = new CampaignList(); |
438 | - mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); | 527 | + tempCampaignList.add(campaign); |
528 | + mUniqueCampaignList.put(campaign.getOfferCategory().trim(), tempCampaignList); | ||
529 | + } | ||
439 | } | 530 | } |
440 | } | 531 | } |
441 | } | 532 | } |
... | @@ -468,7 +559,7 @@ public class WarplyManagerHelper { | ... | @@ -468,7 +559,7 @@ public class WarplyManagerHelper { |
468 | badge.setCouponCount(couponCount); | 559 | badge.setCouponCount(couponCount); |
469 | badge.setValue(couponValue); | 560 | badge.setValue(couponValue); |
470 | mLoyaltyBadge = badge; | 561 | mLoyaltyBadge = badge; |
471 | - mCouponList = couponList; | 562 | + mCouponList = cpnlist; |
472 | } | 563 | } |
473 | 564 | ||
474 | public static LoyaltyBadgeModel getLoyaltyBadge() { | 565 | public static LoyaltyBadgeModel getLoyaltyBadge() { |
... | @@ -483,6 +574,14 @@ public class WarplyManagerHelper { | ... | @@ -483,6 +574,14 @@ public class WarplyManagerHelper { |
483 | mCouponsetsList = couponsets; | 574 | mCouponsetsList = couponsets; |
484 | } | 575 | } |
485 | 576 | ||
577 | + public static float getDealsCouponsSum() { | ||
578 | + return mDealsSum; | ||
579 | + } | ||
580 | + | ||
581 | + public static void setDealsCouponsSum(float sum) { | ||
582 | + mDealsSum = sum; | ||
583 | + } | ||
584 | + | ||
486 | // =========================================================== | 585 | // =========================================================== |
487 | // Inner and Anonymous Classes | 586 | // Inner and Anonymous Classes |
488 | // =========================================================== | 587 | // =========================================================== | ... | ... |
... | @@ -37,6 +37,7 @@ import android.net.http.SslError; | ... | @@ -37,6 +37,7 @@ import android.net.http.SslError; |
37 | import android.os.Build; | 37 | import android.os.Build; |
38 | 38 | ||
39 | import androidx.core.content.ContextCompat; | 39 | import androidx.core.content.ContextCompat; |
40 | +import androidx.work.WorkManager; | ||
40 | 41 | ||
41 | import android.text.TextUtils; | 42 | import android.text.TextUtils; |
42 | import android.util.AttributeSet; | 43 | import android.util.AttributeSet; |
... | @@ -66,6 +67,7 @@ import ly.warp.sdk.io.models.CouponEventModel; | ... | @@ -66,6 +67,7 @@ import ly.warp.sdk.io.models.CouponEventModel; |
66 | import ly.warp.sdk.io.models.QuestionnaireEventModel; | 67 | import ly.warp.sdk.io.models.QuestionnaireEventModel; |
67 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; | 68 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; |
68 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; | 69 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; |
70 | +import ly.warp.sdk.services.UpdateUserLocationService; | ||
69 | import ly.warp.sdk.utils.WarpUtils; | 71 | import ly.warp.sdk.utils.WarpUtils; |
70 | import ly.warp.sdk.utils.WarplyProperty; | 72 | import ly.warp.sdk.utils.WarplyProperty; |
71 | import ly.warp.sdk.utils.WarplyUrlHandler; | 73 | import ly.warp.sdk.utils.WarplyUrlHandler; |
... | @@ -385,9 +387,10 @@ public class WarpView extends WebView { | ... | @@ -385,9 +387,10 @@ public class WarpView extends WebView { |
385 | questionnaireEvent.setParameter(parts[2]); | 387 | questionnaireEvent.setParameter(parts[2]); |
386 | WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]); | 388 | WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]); |
387 | EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); | 389 | EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); |
388 | - } else if (parts[1].equals("event:couponRetrieved")) { | 390 | + } else if (parts[1].equals("couponRetrieved")) { |
389 | - EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); | 391 | +// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); |
390 | } else if (parts[2].equals("serviceDisabled")) { | 392 | } else if (parts[2].equals("serviceDisabled")) { |
393 | +// WorkManager.getInstance(Warply.getWarplyContext()).cancelAllWorkByTag(UpdateUserLocationService.TAG); | ||
391 | WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel(); | 394 | WarplyPacingCardServiceEnabledModel pacingService = new WarplyPacingCardServiceEnabledModel(); |
392 | pacingService.setEnabled(false); | 395 | pacingService.setEnabled(false); |
393 | EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); | 396 | EventBus.getDefault().post(new WarplyEventBusManager(pacingService)); |
... | @@ -404,7 +407,9 @@ public class WarpView extends WebView { | ... | @@ -404,7 +407,9 @@ public class WarpView extends WebView { |
404 | pacingVisible.setVisible(false); | 407 | pacingVisible.setVisible(false); |
405 | EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); | 408 | EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); |
406 | } else if (parts[1].equals("request") || parts[1].equals("response")) { | 409 | } else if (parts[1].equals("request") || parts[1].equals("response")) { |
410 | + WarpUtils.log("**************** WARPLY Webview Log START *****************"); | ||
407 | WarpUtils.verbose(parts[2]); | 411 | WarpUtils.verbose(parts[2]); |
412 | + WarpUtils.log("**************** WARPLY Webview Log END *****************"); | ||
408 | } | 413 | } |
409 | } | 414 | } |
410 | } | 415 | } | ... | ... |
22.4 KB
... | @@ -85,8 +85,8 @@ | ... | @@ -85,8 +85,8 @@ |
85 | android:layout_width="wrap_content" | 85 | android:layout_width="wrap_content" |
86 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
87 | android:layout_gravity="center" | 87 | android:layout_gravity="center" |
88 | - android:gravity="center" | ||
89 | android:layout_marginHorizontal="40dp" | 88 | android:layout_marginHorizontal="40dp" |
89 | + android:gravity="center" | ||
90 | android:text="@string/cos_popup_gifts_subtitle" | 90 | android:text="@string/cos_popup_gifts_subtitle" |
91 | android:textColor="@android:color/white" | 91 | android:textColor="@android:color/white" |
92 | android:textSize="16sp" /> | 92 | android:textSize="16sp" /> | ... | ... |
... | @@ -98,7 +98,7 @@ | ... | @@ -98,7 +98,7 @@ |
98 | android:id="@+id/iv_profile_photo" | 98 | android:id="@+id/iv_profile_photo" |
99 | android:layout_width="70dp" | 99 | android:layout_width="70dp" |
100 | android:layout_height="70dp" | 100 | android:layout_height="70dp" |
101 | - android:src="@drawable/profile_photo" | 101 | + android:src="@drawable/ic_default_photo" |
102 | app:layout_constraintBottom_toBottomOf="parent" | 102 | app:layout_constraintBottom_toBottomOf="parent" |
103 | app:layout_constraintLeft_toLeftOf="parent" | 103 | app:layout_constraintLeft_toLeftOf="parent" |
104 | app:layout_constraintTop_toTopOf="parent" /> | 104 | app:layout_constraintTop_toTopOf="parent" /> | ... | ... |
... | @@ -85,8 +85,8 @@ | ... | @@ -85,8 +85,8 @@ |
85 | android:layout_width="wrap_content" | 85 | android:layout_width="wrap_content" |
86 | android:layout_height="wrap_content" | 86 | android:layout_height="wrap_content" |
87 | android:layout_gravity="center" | 87 | android:layout_gravity="center" |
88 | - android:gravity="center" | ||
89 | android:layout_marginHorizontal="40dp" | 88 | android:layout_marginHorizontal="40dp" |
89 | + android:gravity="center" | ||
90 | android:text="@string/cos_popup_more_subtitle" | 90 | android:text="@string/cos_popup_more_subtitle" |
91 | android:textColor="@android:color/white" | 91 | android:textColor="@android:color/white" |
92 | android:textSize="16sp" /> | 92 | android:textSize="16sp" /> | ... | ... |
-
Please register or login to post a comment