Showing
27 changed files
with
412 additions
and
92 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("7000001315"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons | 39 | + .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons |
40 | mLoginReceiver); | 40 | mLoginReceiver); |
41 | } else { | 41 | } else { |
42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
... | @@ -168,6 +168,8 @@ | ... | @@ -168,6 +168,8 @@ |
168 | <service | 168 | <service |
169 | android:name="ly.warp.sdk.services.WarplyHealthService" | 169 | android:name="ly.warp.sdk.services.WarplyHealthService" |
170 | android:exported="false" | 170 | android:exported="false" |
171 | + android:stopWithTask="false" | ||
172 | + android:process=":warplyHealthService" | ||
171 | android:permission="android.permission.BIND_JOB_SERVICE" /> | 173 | android:permission="android.permission.BIND_JOB_SERVICE" /> |
172 | 174 | ||
173 | <service | 175 | <service | ... | ... |
... | @@ -130,14 +130,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -130,14 +130,14 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
130 | TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode); | 130 | TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode); |
131 | ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow); | 131 | ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow); |
132 | barcodeButtonTitle.setText(getString(R.string.cos_show_barcode)); | 132 | barcodeButtonTitle.setText(getString(R.string.cos_show_barcode)); |
133 | - barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark)); | 133 | + barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); |
134 | mIsBarcodeShown = false; | 134 | mIsBarcodeShown = false; |
135 | } else { | 135 | } else { |
136 | mLlBarcodeContainer.setVisibility(View.VISIBLE); | 136 | mLlBarcodeContainer.setVisibility(View.VISIBLE); |
137 | TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode); | 137 | TextView barcodeButtonTitle = mLlBarcodeShown.findViewById(R.id.tv_barcode); |
138 | ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow); | 138 | ImageView barcodeButtonArrow = mLlBarcodeShown.findViewById(R.id.iv_barcode_arrow); |
139 | barcodeButtonTitle.setText(getString(R.string.cos_hide_barcode)); | 139 | barcodeButtonTitle.setText(getString(R.string.cos_hide_barcode)); |
140 | - barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark)); | 140 | + barcodeButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); |
141 | mIsBarcodeShown = true; | 141 | mIsBarcodeShown = true; |
142 | } | 142 | } |
143 | return; | 143 | return; |
... | @@ -146,12 +146,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -146,12 +146,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
146 | if (mIsTermsShown) { | 146 | if (mIsTermsShown) { |
147 | mTvTermsValue.setVisibility(View.GONE); | 147 | mTvTermsValue.setVisibility(View.GONE); |
148 | ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); | 148 | ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); |
149 | - termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark)); | 149 | + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); |
150 | mIsTermsShown = false; | 150 | mIsTermsShown = false; |
151 | } else { | 151 | } else { |
152 | mTvTermsValue.setVisibility(View.VISIBLE); | 152 | mTvTermsValue.setVisibility(View.VISIBLE); |
153 | ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); | 153 | ImageView termsButtonArrow = mLlTerms.findViewById(R.id.iv_terms_arrow); |
154 | - termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark)); | 154 | + termsButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); |
155 | mIsTermsShown = true; | 155 | mIsTermsShown = true; |
156 | } | 156 | } |
157 | } | 157 | } |
... | @@ -226,8 +226,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -226,8 +226,12 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
226 | tempCoupon += "0"; | 226 | tempCoupon += "0"; |
227 | } | 227 | } |
228 | 228 | ||
229 | - for (int i = mCoupon.getCoupon().length() - 1; i >= 0; i--) { | 229 | + try { |
230 | - result = result + Integer.parseInt(String.valueOf((mCoupon.getCoupon()).charAt(i))) * (1 + (2 * (i % 2))); | 230 | + for (int i = mCoupon.getCoupon().length() - 1; i >= 0; i--) { |
231 | + result = result + Integer.parseInt(String.valueOf((mCoupon.getCoupon()).charAt(i))) * (1 + (2 * (i % 2))); | ||
232 | + } | ||
233 | + } catch (Exception e) { | ||
234 | + e.printStackTrace(); | ||
231 | } | 235 | } |
232 | 236 | ||
233 | tempCoupon = tempCoupon + (10 - (result % 10)) % 10; | 237 | tempCoupon = tempCoupon + (10 - (result % 10)) % 10; | ... | ... |
... | @@ -144,11 +144,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -144,11 +144,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
144 | if (mIsTermsPressed) { | 144 | if (mIsTermsPressed) { |
145 | mIsTermsPressed = false; | 145 | mIsTermsPressed = false; |
146 | mTvTermsValue.setVisibility(View.GONE); | 146 | mTvTermsValue.setVisibility(View.GONE); |
147 | - mIvTermsArrow.setImageDrawable(getDrawable(R.drawable.ic_down_dark)); | 147 | + mIvTermsArrow.setImageDrawable(getDrawable(R.drawable.ic_down_dark_new)); |
148 | } else { | 148 | } else { |
149 | mIsTermsPressed = true; | 149 | mIsTermsPressed = true; |
150 | mTvTermsValue.setVisibility(View.VISIBLE); | 150 | mTvTermsValue.setVisibility(View.VISIBLE); |
151 | - mIvTermsArrow.setImageDrawable(getDrawable(R.drawable.ic_up_dark)); | 151 | + mIvTermsArrow.setImageDrawable(getDrawable(R.drawable.ic_up_dark_new)); |
152 | } | 152 | } |
153 | } | 153 | } |
154 | } | 154 | } |
... | @@ -264,6 +264,14 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -264,6 +264,14 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
264 | dialogPositive.dismiss(); | 264 | dialogPositive.dismiss(); |
265 | }) | 265 | }) |
266 | .show(); | 266 | .show(); |
267 | + } else if (status == 6) { | ||
268 | + mAlertDialogCouponset = new AlertDialog.Builder(this) | ||
269 | + .setTitle(R.string.cos_dlg_coupon_depleted_title) | ||
270 | + .setMessage(R.string.cos_dlg_coupon_depleted_message) | ||
271 | + .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | ||
272 | + dialogPositive.dismiss(); | ||
273 | + }) | ||
274 | + .show(); | ||
267 | } else { | 275 | } else { |
268 | mAlertDialogCouponset = new AlertDialog.Builder(this) | 276 | mAlertDialogCouponset = new AlertDialog.Builder(this) |
269 | .setTitle(R.string.cos_dlg_error_title) | 277 | .setTitle(R.string.cos_dlg_error_title) | ... | ... |
... | @@ -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.os.Handler; | ||
7 | import android.text.TextUtils; | 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; |
... | @@ -68,6 +69,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -68,6 +69,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
68 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); | 69 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); |
69 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); | 70 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); |
70 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); | 71 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); |
72 | + private int mTimer = 0; | ||
73 | + private Handler mSecondsHandler; | ||
71 | 74 | ||
72 | // =========================================================== | 75 | // =========================================================== |
73 | // Methods for/from SuperClass/Interfaces | 76 | // Methods for/from SuperClass/Interfaces |
... | @@ -77,13 +80,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -77,13 +80,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
77 | public void onCreate(Bundle savedInstanceState) { | 80 | public void onCreate(Bundle savedInstanceState) { |
78 | super.onCreate(savedInstanceState); | 81 | super.onCreate(savedInstanceState); |
79 | setContentView(R.layout.activity_gifts_for_you); | 82 | setContentView(R.layout.activity_gifts_for_you); |
80 | - | 83 | + mSecondsHandler = new Handler(); |
81 | -// if (WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you") != null && WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you").size() > 0) { | ||
82 | -// mHashSetList.addAll(WarplyManagerHelper.getUniqueCampaignList().get("gifts_for_you")); | ||
83 | -// mValuesList.clear(); | ||
84 | -// mValuesList.addAll(mHashSetList); | ||
85 | -// } | ||
86 | - | ||
87 | filterItems(); | 84 | filterItems(); |
88 | 85 | ||
89 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | 86 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { |
... | @@ -92,8 +89,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -92,8 +89,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
92 | mSeasonalList.clear(); | 89 | mSeasonalList.clear(); |
93 | mSeasonalList.addAll(mHashSetSeasonalList); | 90 | mSeasonalList.addAll(mHashSetSeasonalList); |
94 | } | 91 | } |
95 | - WarpUtils.log("GFY_SEASONAL_LIST_COUNT: " + String.valueOf(mSeasonalList.size())); | ||
96 | - WarpUtils.log("GFY_SEASONAL_LIST_JSON: " + String.valueOf(mSeasonalList.toString())); | ||
97 | 92 | ||
98 | if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | 93 | if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { |
99 | mContextualList.clear(); | 94 | mContextualList.clear(); |
... | @@ -103,8 +98,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -103,8 +98,6 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
103 | mContextualList.add(ccmsItem); | 98 | mContextualList.add(ccmsItem); |
104 | } | 99 | } |
105 | } | 100 | } |
106 | - WarpUtils.log("GFY_CCMS_LIST_COUNT: " + String.valueOf(mContextualList.size())); | ||
107 | - WarpUtils.log("GFY_CCMS_LIST_JSON: " + String.valueOf(mContextualList.toString())); | ||
108 | 101 | ||
109 | mergeDatasets( | 102 | mergeDatasets( |
110 | mSeasonalList, | 103 | mSeasonalList, |
... | @@ -125,6 +118,33 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -125,6 +118,33 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
125 | @Override | 118 | @Override |
126 | public void onResume() { | 119 | public void onResume() { |
127 | super.onResume(); | 120 | super.onResume(); |
121 | + mTimer = 0; | ||
122 | + mSecondsHandler.post(new Runnable() { | ||
123 | + @Override | ||
124 | + public void run() { | ||
125 | + mTimer++; | ||
126 | + mSecondsHandler.postDelayed(this, 1000); | ||
127 | + } | ||
128 | + }); | ||
129 | + } | ||
130 | + | ||
131 | + @Override | ||
132 | + public void onDestroy() { | ||
133 | + super.onDestroy(); | ||
134 | + } | ||
135 | + | ||
136 | + @Override | ||
137 | + public void onPause() { | ||
138 | + super.onPause(); | ||
139 | + if (mSecondsHandler != null) { | ||
140 | + mSecondsHandler.removeCallbacksAndMessages(null); | ||
141 | + | ||
142 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
143 | + analyticsEvent.setEventName("time_spent_on_loyalty_sdk"); | ||
144 | + analyticsEvent.setParameter("name", "GiftsForYou"); | ||
145 | + analyticsEvent.setParameter("seconds", String.valueOf(mTimer)); | ||
146 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
147 | + } | ||
128 | } | 148 | } |
129 | 149 | ||
130 | @Override | 150 | @Override |
... | @@ -191,7 +211,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -191,7 +211,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
191 | mValuesList | 211 | mValuesList |
192 | ); | 212 | ); |
193 | 213 | ||
194 | - runOnUiThread(this::initViews2); | 214 | + runOnUiThread(this::initViews); |
195 | } | 215 | } |
196 | } | 216 | } |
197 | 217 | ||
... | @@ -209,8 +229,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -209,8 +229,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
209 | if (mData != null && mData.size() > 0) { | 229 | if (mData != null && mData.size() > 0) { |
210 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 230 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
211 | mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); | 231 | mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); |
212 | - mAdapterMergedGifts.setHasStableIds(true); | 232 | +// mAdapterMergedGifts.setHasStableIds(true); |
213 | - mRecyclerMergedGifts.setItemAnimator(null); | 233 | +// mRecyclerMergedGifts.setItemAnimator(null); |
214 | mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); | 234 | mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); |
215 | mAdapterMergedGifts.getPositionClicks() | 235 | mAdapterMergedGifts.getPositionClicks() |
216 | .doOnNext(dataItem -> { | 236 | .doOnNext(dataItem -> { |
... | @@ -301,6 +321,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -301,6 +321,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
301 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 321 | if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
302 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | 322 | for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { |
303 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | 323 | if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { |
324 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
325 | + analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ||
326 | + analyticsEvent.setParameter("name", ccms.getTitle()); | ||
327 | + analyticsEvent.setParameter("type", "gift"); | ||
328 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
329 | + | ||
304 | WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | 330 | WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); |
305 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | 331 | Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); |
306 | intent.putExtra("ccms", ccms); | 332 | intent.putExtra("ccms", ccms); |
... | @@ -332,6 +358,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -332,6 +358,12 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
332 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); | 358 | seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); |
333 | seasonalCLick.setContext(GiftsForYouActivity.this); | 359 | seasonalCLick.setContext(GiftsForYouActivity.this); |
334 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); | 360 | EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); |
361 | + | ||
362 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
363 | + analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ||
364 | + analyticsEvent.setParameter("name", dataItem.getSeasonalList().getTitle()); | ||
365 | + analyticsEvent.setParameter("type", "seasonal"); | ||
366 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
335 | } else if (dataItem.getDataType() == 3) { | 367 | } else if (dataItem.getDataType() == 3) { |
336 | LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | 368 | LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); |
337 | analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | 369 | analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ... | ... |
... | @@ -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.graphics.Typeface; | 5 | import android.graphics.Typeface; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | +import android.os.Handler; | ||
7 | import android.text.SpannableStringBuilder; | 8 | import android.text.SpannableStringBuilder; |
8 | import android.text.Spanned; | 9 | import android.text.Spanned; |
9 | import android.view.View; | 10 | import android.view.View; |
... | @@ -16,6 +17,8 @@ import androidx.core.content.ContextCompat; | ... | @@ -16,6 +17,8 @@ import androidx.core.content.ContextCompat; |
16 | import androidx.recyclerview.widget.LinearLayoutManager; | 17 | import androidx.recyclerview.widget.LinearLayoutManager; |
17 | import androidx.recyclerview.widget.RecyclerView; | 18 | import androidx.recyclerview.widget.RecyclerView; |
18 | 19 | ||
20 | +import org.greenrobot.eventbus.EventBus; | ||
21 | + | ||
19 | import java.util.ArrayList; | 22 | import java.util.ArrayList; |
20 | 23 | ||
21 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; | 24 | import io.github.inflationx.calligraphy3.CalligraphyTypefaceSpan; |
... | @@ -26,11 +29,13 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; | ... | @@ -26,11 +29,13 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; |
26 | import ly.warp.sdk.io.models.Coupon; | 29 | import ly.warp.sdk.io.models.Coupon; |
27 | import ly.warp.sdk.io.models.CouponList; | 30 | import ly.warp.sdk.io.models.CouponList; |
28 | import ly.warp.sdk.io.models.Couponset; | 31 | import ly.warp.sdk.io.models.Couponset; |
32 | +import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | ||
29 | import ly.warp.sdk.io.models.SharingCoupon; | 33 | import ly.warp.sdk.io.models.SharingCoupon; |
30 | import ly.warp.sdk.io.models.SharingList; | 34 | import ly.warp.sdk.io.models.SharingList; |
31 | import ly.warp.sdk.io.request.WarplySharingHistoryRequest; | 35 | import ly.warp.sdk.io.request.WarplySharingHistoryRequest; |
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; |
38 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
34 | import ly.warp.sdk.utils.managers.WarplyManager; | 39 | import ly.warp.sdk.utils.managers.WarplyManager; |
35 | import ly.warp.sdk.views.adapters.ExpiredCouponAdapter; | 40 | import ly.warp.sdk.views.adapters.ExpiredCouponAdapter; |
36 | import ly.warp.sdk.views.adapters.SharedCouponAdapter; | 41 | import ly.warp.sdk.views.adapters.SharedCouponAdapter; |
... | @@ -54,6 +59,8 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis | ... | @@ -54,6 +59,8 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis |
54 | private LinearLayout mLlExpiredTab, mLlSharedTab, mLlShowMoreExpired, mLlShowMoreShared; | 59 | private LinearLayout mLlExpiredTab, mLlSharedTab, mLlShowMoreExpired, mLlShowMoreShared; |
55 | private RelativeLayout mRlExpiredView, mRlSharedView; | 60 | private RelativeLayout mRlExpiredView, mRlSharedView; |
56 | private SharingList mSharedCoupons = new SharingList(); | 61 | private SharingList mSharedCoupons = new SharingList(); |
62 | + private int mTimer = 0; | ||
63 | + private Handler mSecondsHandler; | ||
57 | 64 | ||
58 | // =========================================================== | 65 | // =========================================================== |
59 | // Methods for/from SuperClass/Interfaces | 66 | // Methods for/from SuperClass/Interfaces |
... | @@ -63,6 +70,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis | ... | @@ -63,6 +70,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis |
63 | public void onCreate(Bundle savedInstanceState) { | 70 | public void onCreate(Bundle savedInstanceState) { |
64 | super.onCreate(savedInstanceState); | 71 | super.onCreate(savedInstanceState); |
65 | setContentView(R.layout.activity_loyalty_analysis); | 72 | setContentView(R.layout.activity_loyalty_analysis); |
73 | + mSecondsHandler = new Handler(); | ||
66 | 74 | ||
67 | mIvBack = findViewById(R.id.iv_loyalty_analysis_close); | 75 | mIvBack = findViewById(R.id.iv_loyalty_analysis_close); |
68 | mTvCouponsValueAll = findViewById(R.id.tv_expired_coupons_title); | 76 | mTvCouponsValueAll = findViewById(R.id.tv_expired_coupons_title); |
... | @@ -83,6 +91,15 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis | ... | @@ -83,6 +91,15 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis |
83 | @Override | 91 | @Override |
84 | public void onResume() { | 92 | public void onResume() { |
85 | super.onResume(); | 93 | super.onResume(); |
94 | + mTimer = 0; | ||
95 | + mSecondsHandler.post(new Runnable() { | ||
96 | + @Override | ||
97 | + public void run() { | ||
98 | + mTimer++; | ||
99 | + mSecondsHandler.postDelayed(this, 1000); | ||
100 | + } | ||
101 | + }); | ||
102 | + | ||
86 | mSharedCoupons.clear(); | 103 | mSharedCoupons.clear(); |
87 | 104 | ||
88 | new Thread(() -> { | 105 | new Thread(() -> { |
... | @@ -95,6 +112,25 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis | ... | @@ -95,6 +112,25 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis |
95 | } | 112 | } |
96 | 113 | ||
97 | @Override | 114 | @Override |
115 | + public void onDestroy() { | ||
116 | + super.onDestroy(); | ||
117 | + } | ||
118 | + | ||
119 | + @Override | ||
120 | + public void onPause() { | ||
121 | + super.onPause(); | ||
122 | + if (mSecondsHandler != null) { | ||
123 | + mSecondsHandler.removeCallbacksAndMessages(null); | ||
124 | + | ||
125 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
126 | + analyticsEvent.setEventName("time_spent_on_loyalty_sdk"); | ||
127 | + analyticsEvent.setParameter("name", "GiftsCalculator"); | ||
128 | + analyticsEvent.setParameter("seconds", String.valueOf(mTimer)); | ||
129 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
130 | + } | ||
131 | + } | ||
132 | + | ||
133 | + @Override | ||
98 | public void onClick(View view) { | 134 | public void onClick(View view) { |
99 | if (view.getId() == R.id.iv_loyalty_analysis_close) { | 135 | if (view.getId() == R.id.iv_loyalty_analysis_close) { |
100 | onBackPressed(); | 136 | onBackPressed(); | ... | ... |
... | @@ -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.os.Handler; | ||
7 | import android.text.SpannableStringBuilder; | 8 | import android.text.SpannableStringBuilder; |
8 | import android.text.Spanned; | 9 | import android.text.Spanned; |
9 | import android.text.TextUtils; | 10 | import android.text.TextUtils; |
... | @@ -75,6 +76,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -75,6 +76,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
75 | private ActiveCouponAdapter mAdapterCoupons; | 76 | private ActiveCouponAdapter mAdapterCoupons; |
76 | private AlertDialog mAlertDialogNonTelco; | 77 | private AlertDialog mAlertDialogNonTelco; |
77 | private ScrollView mScActiveCodes, mSvLoyaltyWallet; | 78 | private ScrollView mScActiveCodes, mSvLoyaltyWallet; |
79 | + private int mTimer = 0; | ||
80 | + private Handler mSecondsHandler; | ||
78 | 81 | ||
79 | // =========================================================== | 82 | // =========================================================== |
80 | // Methods for/from SuperClass/Interfaces | 83 | // Methods for/from SuperClass/Interfaces |
... | @@ -84,6 +87,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -84,6 +87,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
84 | public void onCreate(Bundle savedInstanceState) { | 87 | public void onCreate(Bundle savedInstanceState) { |
85 | super.onCreate(savedInstanceState); | 88 | super.onCreate(savedInstanceState); |
86 | setContentView(R.layout.activity_loyalty_wallet); | 89 | setContentView(R.layout.activity_loyalty_wallet); |
90 | + mSecondsHandler = new Handler(); | ||
87 | 91 | ||
88 | mIvBack = findViewById(R.id.iv_back); | 92 | mIvBack = findViewById(R.id.iv_back); |
89 | mTvUsername = findViewById(R.id.tv_profile_name); | 93 | mTvUsername = findViewById(R.id.tv_profile_name); |
... | @@ -183,8 +187,35 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie | ... | @@ -183,8 +187,35 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie |
183 | } | 187 | } |
184 | 188 | ||
185 | @Override | 189 | @Override |
190 | + public void onDestroy() { | ||
191 | + super.onDestroy(); | ||
192 | + } | ||
193 | + | ||
194 | + @Override | ||
186 | public void onResume() { | 195 | public void onResume() { |
187 | super.onResume(); | 196 | super.onResume(); |
197 | + mTimer = 0; | ||
198 | + mSecondsHandler.post(new Runnable() { | ||
199 | + @Override | ||
200 | + public void run() { | ||
201 | + mTimer++; | ||
202 | + mSecondsHandler.postDelayed(this, 1000); | ||
203 | + } | ||
204 | + }); | ||
205 | + } | ||
206 | + | ||
207 | + @Override | ||
208 | + public void onPause() { | ||
209 | + super.onPause(); | ||
210 | + if (mSecondsHandler != null) { | ||
211 | + mSecondsHandler.removeCallbacksAndMessages(null); | ||
212 | + | ||
213 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
214 | + analyticsEvent.setEventName("time_spent_on_loyalty_sdk"); | ||
215 | + analyticsEvent.setParameter("name", "MyRewards"); | ||
216 | + analyticsEvent.setParameter("seconds", String.valueOf(mTimer)); | ||
217 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
218 | + } | ||
188 | } | 219 | } |
189 | 220 | ||
190 | @Override | 221 | @Override | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -19,6 +19,7 @@ import com.bumptech.glide.Glide; | ... | @@ -19,6 +19,7 @@ import com.bumptech.glide.Glide; |
19 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 19 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
20 | import com.google.android.material.bottomsheet.BottomSheetDialog; | 20 | import com.google.android.material.bottomsheet.BottomSheetDialog; |
21 | 21 | ||
22 | +import org.greenrobot.eventbus.EventBus; | ||
22 | import org.json.JSONArray; | 23 | import org.json.JSONArray; |
23 | import org.json.JSONException; | 24 | import org.json.JSONException; |
24 | import org.json.JSONObject; | 25 | import org.json.JSONObject; |
... | @@ -29,8 +30,10 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; | ... | @@ -29,8 +30,10 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver; |
29 | import ly.warp.sdk.io.models.Campaign; | 30 | import ly.warp.sdk.io.models.Campaign; |
30 | import ly.warp.sdk.io.models.Consumer; | 31 | import ly.warp.sdk.io.models.Consumer; |
31 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 32 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
33 | +import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | ||
32 | import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; | 34 | import ly.warp.sdk.io.request.CosmoteSubmitOrderRequest; |
33 | import ly.warp.sdk.io.request.WarplyConsumerRequest; | 35 | import ly.warp.sdk.io.request.WarplyConsumerRequest; |
36 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
34 | import ly.warp.sdk.utils.managers.WarplyManager; | 37 | import ly.warp.sdk.utils.managers.WarplyManager; |
35 | 38 | ||
36 | 39 | ||
... | @@ -111,12 +114,12 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -111,12 +114,12 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
111 | if (mIsSeeMoreShown) { | 114 | if (mIsSeeMoreShown) { |
112 | mTvSeeMoreValue.setVisibility(View.GONE); | 115 | mTvSeeMoreValue.setVisibility(View.GONE); |
113 | ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); | 116 | ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); |
114 | - seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_down_dark)); | 117 | + seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_down_dark_new)); |
115 | mIsSeeMoreShown = false; | 118 | mIsSeeMoreShown = false; |
116 | } else { | 119 | } else { |
117 | mTvSeeMoreValue.setVisibility(View.VISIBLE); | 120 | mTvSeeMoreValue.setVisibility(View.VISIBLE); |
118 | ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); | 121 | ImageView seeMoreButtonArrow = mLlSeeMore.findViewById(R.id.iv_see_more_arrow); |
119 | - seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_arrow_up_dark)); | 122 | + seeMoreButtonArrow.setImageDrawable(ContextCompat.getDrawable(this, R.drawable.ic_up_dark_new)); |
120 | mIsSeeMoreShown = true; | 123 | mIsSeeMoreShown = true; |
121 | } | 124 | } |
122 | } | 125 | } |
... | @@ -266,6 +269,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -266,6 +269,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
266 | } | 269 | } |
267 | 270 | ||
268 | private void errorActivatingDialog() { | 271 | private void errorActivatingDialog() { |
272 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
273 | + analyticsEvent.setEventName("loyalty_offer_activated"); | ||
274 | + analyticsEvent.setParameter("name", mCCMS.getTitle()); | ||
275 | + analyticsEvent.setParameter("type", "gift"); | ||
276 | + analyticsEvent.setParameter("successful", "false"); | ||
277 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
278 | + | ||
269 | mAlertDialogErrorActivating = new AlertDialog.Builder(this) | 279 | mAlertDialogErrorActivating = new AlertDialog.Builder(this) |
270 | .setTitle(R.string.cos_dlg_error_title) | 280 | .setTitle(R.string.cos_dlg_error_title) |
271 | .setMessage(R.string.cos_dlg_error_subtitle) | 281 | .setMessage(R.string.cos_dlg_error_subtitle) |
... | @@ -276,6 +286,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -276,6 +286,13 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
276 | } | 286 | } |
277 | 287 | ||
278 | private void successActivatingDialog() { | 288 | private void successActivatingDialog() { |
289 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
290 | + analyticsEvent.setEventName("loyalty_offer_activated"); | ||
291 | + analyticsEvent.setParameter("name", mCCMS.getTitle()); | ||
292 | + analyticsEvent.setParameter("type", "gift"); | ||
293 | + analyticsEvent.setParameter("successful", "true"); | ||
294 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
295 | + | ||
279 | mAlertDialogSuccessActivating = new AlertDialog.Builder(this) | 296 | mAlertDialogSuccessActivating = new AlertDialog.Builder(this) |
280 | .setTitle(R.string.cos_dlg_activate_success_title) | 297 | .setTitle(R.string.cos_dlg_activate_success_title) |
281 | .setMessage(R.string.cos_dlg_activate_success_subtitle) | 298 | .setMessage(R.string.cos_dlg_activate_success_subtitle) | ... | ... |
... | @@ -63,6 +63,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -63,6 +63,8 @@ public class Coupon implements Parcelable, Serializable { |
63 | private static final String COUPONSET_UUID = "couponset_uuid"; | 63 | private static final String COUPONSET_UUID = "couponset_uuid"; |
64 | private static final String MERCHANT_UUID = "merchant_uuid"; | 64 | private static final String MERCHANT_UUID = "merchant_uuid"; |
65 | private static final String INNER_TEXT = "inner_text"; | 65 | private static final String INNER_TEXT = "inner_text"; |
66 | + private static final String FINAL_PRICE = "final_price"; | ||
67 | + private static final String DISCOUNT_TYPE = "discount_type"; | ||
66 | 68 | ||
67 | /* Member variables of the Campaign object */ | 69 | /* Member variables of the Campaign object */ |
68 | 70 | ||
... | @@ -83,6 +85,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -83,6 +85,8 @@ public class Coupon implements Parcelable, Serializable { |
83 | private String merchantUuid = ""; | 85 | private String merchantUuid = ""; |
84 | private String innerText = ""; | 86 | private String innerText = ""; |
85 | private Date expirationDate = new Date(); | 87 | private Date expirationDate = new Date(); |
88 | + private String discount_type = ""; | ||
89 | + private double final_price = 0.0d; | ||
86 | 90 | ||
87 | /** | 91 | /** |
88 | * Basic constructor used to create an object from a String, representing a | 92 | * Basic constructor used to create an object from a String, representing a |
... | @@ -118,6 +122,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -118,6 +122,8 @@ public class Coupon implements Parcelable, Serializable { |
118 | this.couponsetUuid = json.optString(COUPONSET_UUID); | 122 | this.couponsetUuid = json.optString(COUPONSET_UUID); |
119 | this.merchantUuid = json.optString(MERCHANT_UUID); | 123 | this.merchantUuid = json.optString(MERCHANT_UUID); |
120 | this.innerText = json.optString(INNER_TEXT); | 124 | this.innerText = json.optString(INNER_TEXT); |
125 | + this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); | ||
126 | + this.final_price = json.optDouble(FINAL_PRICE); | ||
121 | } | 127 | } |
122 | } | 128 | } |
123 | 129 | ||
... | @@ -137,6 +143,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -137,6 +143,8 @@ public class Coupon implements Parcelable, Serializable { |
137 | this.couponsetUuid = source.readString(); | 143 | this.couponsetUuid = source.readString(); |
138 | this.merchantUuid = source.readString(); | 144 | this.merchantUuid = source.readString(); |
139 | this.innerText = source.readString(); | 145 | this.innerText = source.readString(); |
146 | + this.discount_type = source.readString(); | ||
147 | + this.final_price = source.readDouble(); | ||
140 | } | 148 | } |
141 | 149 | ||
142 | @Override | 150 | @Override |
... | @@ -156,6 +164,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -156,6 +164,8 @@ public class Coupon implements Parcelable, Serializable { |
156 | dest.writeString(this.couponsetUuid); | 164 | dest.writeString(this.couponsetUuid); |
157 | dest.writeString(this.merchantUuid); | 165 | dest.writeString(this.merchantUuid); |
158 | dest.writeString(this.innerText); | 166 | dest.writeString(this.innerText); |
167 | + dest.writeString(this.discount_type); | ||
168 | + dest.writeDouble(this.final_price); | ||
159 | } | 169 | } |
160 | 170 | ||
161 | /** | 171 | /** |
... | @@ -182,6 +192,8 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -182,6 +192,8 @@ public class Coupon implements Parcelable, Serializable { |
182 | jObj.putOpt(COUPONSET_UUID, this.couponsetUuid); | 192 | jObj.putOpt(COUPONSET_UUID, this.couponsetUuid); |
183 | jObj.putOpt(MERCHANT_UUID, this.merchantUuid); | 193 | jObj.putOpt(MERCHANT_UUID, this.merchantUuid); |
184 | jObj.putOpt(INNER_TEXT, this.innerText); | 194 | jObj.putOpt(INNER_TEXT, this.innerText); |
195 | + jObj.putOpt(DISCOUNT_TYPE, this.discount_type); | ||
196 | + jObj.putOpt(FINAL_PRICE, this.final_price); | ||
185 | } catch (JSONException e) { | 197 | } catch (JSONException e) { |
186 | if (WarpConstants.DEBUG) { | 198 | if (WarpConstants.DEBUG) { |
187 | e.printStackTrace(); | 199 | e.printStackTrace(); |
... | @@ -357,6 +369,22 @@ public class Coupon implements Parcelable, Serializable { | ... | @@ -357,6 +369,22 @@ public class Coupon implements Parcelable, Serializable { |
357 | this.expirationDate = expirationDate; | 369 | this.expirationDate = expirationDate; |
358 | } | 370 | } |
359 | 371 | ||
372 | + public String getDiscount_type() { | ||
373 | + return discount_type; | ||
374 | + } | ||
375 | + | ||
376 | + public void setDiscount_type(String discount_type) { | ||
377 | + this.discount_type = discount_type; | ||
378 | + } | ||
379 | + | ||
380 | + public double getFinal_price() { | ||
381 | + return final_price; | ||
382 | + } | ||
383 | + | ||
384 | + public void setFinal_price(double final_price) { | ||
385 | + this.final_price = final_price; | ||
386 | + } | ||
387 | + | ||
360 | @Override | 388 | @Override |
361 | public int describeContents() { | 389 | public int describeContents() { |
362 | return 0; | 390 | return 0; | ... | ... |
... | @@ -74,6 +74,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -74,6 +74,8 @@ public class Couponset implements Parcelable, Serializable { |
74 | private static final String AVAILABILITY = "availability"; | 74 | private static final String AVAILABILITY = "availability"; |
75 | private static final String MERCHANT_UUID = "merchant_uuid"; | 75 | private static final String MERCHANT_UUID = "merchant_uuid"; |
76 | private static final String INNER_TEXT = "inner_text"; | 76 | private static final String INNER_TEXT = "inner_text"; |
77 | + private static final String FINAL_PRICE = "final_price"; | ||
78 | + private static final String DISCOUNT_TYPE = "discount_type"; | ||
77 | 79 | ||
78 | 80 | ||
79 | /* Member variables of the Campaign object */ | 81 | /* Member variables of the Campaign object */ |
... | @@ -104,6 +106,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -104,6 +106,8 @@ public class Couponset implements Parcelable, Serializable { |
104 | private int availability = 0; | 106 | private int availability = 0; |
105 | private String merchantUuid = ""; | 107 | private String merchantUuid = ""; |
106 | private String innerText = ""; | 108 | private String innerText = ""; |
109 | + private String discount_type = ""; | ||
110 | + private double final_price = 0.0d; | ||
107 | 111 | ||
108 | /** | 112 | /** |
109 | * Basic constructor used to create an object from a String, representing a | 113 | * Basic constructor used to create an object from a String, representing a |
... | @@ -156,6 +160,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -156,6 +160,8 @@ public class Couponset implements Parcelable, Serializable { |
156 | this.availability = json.optInt(AVAILABILITY); | 160 | this.availability = json.optInt(AVAILABILITY); |
157 | this.merchantUuid = json.optString(MERCHANT_UUID); | 161 | this.merchantUuid = json.optString(MERCHANT_UUID); |
158 | this.innerText = json.optString(INNER_TEXT); | 162 | this.innerText = json.optString(INNER_TEXT); |
163 | + this.discount_type = json.isNull(DISCOUNT_TYPE) ? "" : json.optString(DISCOUNT_TYPE); | ||
164 | + this.final_price = json.isNull(FINAL_PRICE) ? 0.0d : json.optDouble(FINAL_PRICE); | ||
159 | } | 165 | } |
160 | } | 166 | } |
161 | 167 | ||
... | @@ -184,6 +190,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -184,6 +190,8 @@ public class Couponset implements Parcelable, Serializable { |
184 | this.availability = source.readInt(); | 190 | this.availability = source.readInt(); |
185 | this.merchantUuid = source.readString(); | 191 | this.merchantUuid = source.readString(); |
186 | this.innerText = source.readString(); | 192 | this.innerText = source.readString(); |
193 | + this.discount_type = source.readString(); | ||
194 | + this.final_price = source.readDouble(); | ||
187 | } | 195 | } |
188 | 196 | ||
189 | @Override | 197 | @Override |
... | @@ -212,6 +220,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -212,6 +220,8 @@ public class Couponset implements Parcelable, Serializable { |
212 | dest.writeInt(this.availability); | 220 | dest.writeInt(this.availability); |
213 | dest.writeString(this.merchantUuid); | 221 | dest.writeString(this.merchantUuid); |
214 | dest.writeString(this.innerText); | 222 | dest.writeString(this.innerText); |
223 | + dest.writeString(this.discount_type); | ||
224 | + dest.writeDouble(this.final_price); | ||
215 | } | 225 | } |
216 | 226 | ||
217 | /** | 227 | /** |
... | @@ -248,6 +258,8 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -248,6 +258,8 @@ public class Couponset implements Parcelable, Serializable { |
248 | jObj.putOpt(AVAILABILITY, this.availability); | 258 | jObj.putOpt(AVAILABILITY, this.availability); |
249 | jObj.putOpt(MERCHANT_UUID, this.merchantUuid); | 259 | jObj.putOpt(MERCHANT_UUID, this.merchantUuid); |
250 | jObj.putOpt(INNER_TEXT, this.innerText); | 260 | jObj.putOpt(INNER_TEXT, this.innerText); |
261 | + jObj.putOpt(DISCOUNT_TYPE, this.discount_type); | ||
262 | + jObj.putOpt(FINAL_PRICE, this.final_price); | ||
251 | } catch (JSONException e) { | 263 | } catch (JSONException e) { |
252 | if (WarpConstants.DEBUG) { | 264 | if (WarpConstants.DEBUG) { |
253 | e.printStackTrace(); | 265 | e.printStackTrace(); |
... | @@ -391,6 +403,14 @@ public class Couponset implements Parcelable, Serializable { | ... | @@ -391,6 +403,14 @@ public class Couponset implements Parcelable, Serializable { |
391 | return innerText; | 403 | return innerText; |
392 | } | 404 | } |
393 | 405 | ||
406 | + public String getDiscount_type() { | ||
407 | + return discount_type; | ||
408 | + } | ||
409 | + | ||
410 | + public double getFinal_price() { | ||
411 | + return final_price; | ||
412 | + } | ||
413 | + | ||
394 | @Override | 414 | @Override |
395 | public int describeContents() { | 415 | public int describeContents() { |
396 | return 0; | 416 | return 0; | ... | ... |
1 | package ly.warp.sdk.services; | 1 | package ly.warp.sdk.services; |
2 | 2 | ||
3 | +import android.app.AlarmManager; | ||
3 | import android.app.Notification; | 4 | import android.app.Notification; |
4 | import android.app.NotificationChannel; | 5 | import android.app.NotificationChannel; |
5 | import android.app.NotificationManager; | 6 | import android.app.NotificationManager; |
... | @@ -14,6 +15,7 @@ import android.hardware.SensorEventListener; | ... | @@ -14,6 +15,7 @@ import android.hardware.SensorEventListener; |
14 | import android.hardware.SensorManager; | 15 | import android.hardware.SensorManager; |
15 | import android.os.Build; | 16 | import android.os.Build; |
16 | import android.os.IBinder; | 17 | import android.os.IBinder; |
18 | +import android.os.SystemClock; | ||
17 | 19 | ||
18 | import androidx.annotation.Nullable; | 20 | import androidx.annotation.Nullable; |
19 | import androidx.annotation.RequiresApi; | 21 | import androidx.annotation.RequiresApi; |
... | @@ -104,8 +106,9 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -104,8 +106,9 @@ public class WarplyHealthService extends Service implements SensorEventListener |
104 | // b.setContentText(getString(R.string.cos_steps_for_good_notification_subtitle)); | 106 | // b.setContentText(getString(R.string.cos_steps_for_good_notification_subtitle)); |
105 | b.setStyle(new NotificationCompat.BigTextStyle().bigText(getString(R.string.cos_steps_for_good_notification_subtitle))); | 107 | b.setStyle(new NotificationCompat.BigTextStyle().bigText(getString(R.string.cos_steps_for_good_notification_subtitle))); |
106 | b.setContentIntent(pbIntent); | 108 | b.setContentIntent(pbIntent); |
107 | - b.setAutoCancel(true); | 109 | + b.setAutoCancel(false); |
108 | b.setOngoing(true); | 110 | b.setOngoing(true); |
111 | + b.setCategory(Notification.CATEGORY_SERVICE); | ||
109 | b.setSmallIcon(R.drawable.ic_launcher); | 112 | b.setSmallIcon(R.drawable.ic_launcher); |
110 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notificationManager != null) { | 113 | if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && notificationManager != null) { |
111 | NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT); | 114 | NotificationChannel notificationChannel = new NotificationChannel(STEPS_CHANNEL_ID, "steps_notification_channel", NotificationManager.IMPORTANCE_DEFAULT); |
... | @@ -147,6 +150,22 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -147,6 +150,22 @@ public class WarplyHealthService extends Service implements SensorEventListener |
147 | sendSteps(); | 150 | sendSteps(); |
148 | } | 151 | } |
149 | 152 | ||
153 | +// @Override | ||
154 | +// public void onTaskRemoved(Intent rootIntent) { | ||
155 | +// Intent restartServiceIntent = new Intent(getApplicationContext(), WarplyHealthService.class); | ||
156 | +// restartServiceIntent.setPackage(getPackageName()); | ||
157 | +// | ||
158 | +// PendingIntent restartServicePendingIntent = PendingIntent.getService(getApplicationContext(), 2002, restartServiceIntent, PendingIntent.FLAG_ONE_SHOT); | ||
159 | +// AlarmManager alarmService = (AlarmManager) getApplicationContext().getSystemService(Context.ALARM_SERVICE); | ||
160 | +// alarmService.set( | ||
161 | +// AlarmManager.ELAPSED_REALTIME, | ||
162 | +// SystemClock.elapsedRealtime() + 1000, | ||
163 | +// restartServicePendingIntent | ||
164 | +// ); | ||
165 | +// | ||
166 | +// super.onTaskRemoved(rootIntent); | ||
167 | +// } | ||
168 | + | ||
150 | @Nullable | 169 | @Nullable |
151 | @Override | 170 | @Override |
152 | public IBinder onBind(Intent intent) { | 171 | public IBinder onBind(Intent intent) { | ... | ... |
... | @@ -750,6 +750,12 @@ public class WarplyManagerHelper { | ... | @@ -750,6 +750,12 @@ public class WarplyManagerHelper { |
750 | } | 750 | } |
751 | } else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | 751 | } else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { |
752 | if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { | 752 | if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) { |
753 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
754 | + analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ||
755 | + analyticsEvent.setParameter("name", item.getTitle()); | ||
756 | + analyticsEvent.setParameter("type", "gift"); | ||
757 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
758 | + | ||
753 | WarplyManager.getSingleCampaign(camp.getSessionUUID()); | 759 | WarplyManager.getSingleCampaign(camp.getSessionUUID()); |
754 | Intent intent = new Intent(context, TelcoActivity.class); | 760 | Intent intent = new Intent(context, TelcoActivity.class); |
755 | intent.putExtra("ccms", item); | 761 | intent.putExtra("ccms", item); |
... | @@ -979,55 +985,57 @@ public class WarplyManagerHelper { | ... | @@ -979,55 +985,57 @@ public class WarplyManagerHelper { |
979 | } | 985 | } |
980 | 986 | ||
981 | public static void setTrackersEnabled(boolean isEnabled) { | 987 | public static void setTrackersEnabled(boolean isEnabled) { |
982 | - JSONObject obj = new JSONObject(); | 988 | +// WarpUtils.setTrackersEnabled(); |
983 | - try { | ||
984 | - obj.putOpt("trackers_enabled", isEnabled); | ||
985 | - } catch (JSONException e) { | ||
986 | - e.printStackTrace(); | ||
987 | - } | ||
988 | - | ||
989 | - WarplyManager.editConsumer(new WarplyEditConsumerRequest() | ||
990 | - .setHasProfileMetadata(true) | ||
991 | - .setProfileMetadata(obj), new CallbackReceiver<JSONObject>() { | ||
992 | - @Override | ||
993 | - public void onSuccess(JSONObject result) { | ||
994 | - WarpUtils.log("EDIT CONSUMER SUCCESS"); | ||
995 | - WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | ||
996 | - @Override | ||
997 | - public void onSuccess(Consumer result) { | ||
998 | - WarplyManagerHelper.setConsumerInternal(result); | ||
999 | - | ||
1000 | - if (result != null) { | ||
1001 | - JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
1002 | - if (profMetadata != null && profMetadata.has("nonTelco")) { | ||
1003 | - WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | ||
1004 | - } else { | ||
1005 | - WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); | ||
1006 | - } | ||
1007 | - } | ||
1008 | - | ||
1009 | - if (result != null) { | ||
1010 | - JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
1011 | - if (profMetadata != null) { | ||
1012 | - if (profMetadata.has("badge")) { | ||
1013 | - WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); | ||
1014 | - } | ||
1015 | - } | ||
1016 | - } | ||
1017 | - } | ||
1018 | - | ||
1019 | - @Override | ||
1020 | - public void onFailure(int errorCode) { | ||
1021 | - | ||
1022 | - } | ||
1023 | - }); | ||
1024 | - } | ||
1025 | 989 | ||
1026 | - @Override | 990 | +// JSONObject obj = new JSONObject(); |
1027 | - public void onFailure(int errorCode) { | 991 | +// try { |
1028 | - WarpUtils.log("EDIT CONSUMER FAILED"); | 992 | +// obj.putOpt("trackers_enabled", isEnabled); |
1029 | - } | 993 | +// } catch (JSONException e) { |
1030 | - }); | 994 | +// e.printStackTrace(); |
995 | +// } | ||
996 | +// | ||
997 | +// WarplyManager.editConsumer(new WarplyEditConsumerRequest() | ||
998 | +// .setHasProfileMetadata(true) | ||
999 | +// .setProfileMetadata(obj), new CallbackReceiver<JSONObject>() { | ||
1000 | +// @Override | ||
1001 | +// public void onSuccess(JSONObject result) { | ||
1002 | +// WarpUtils.log("EDIT CONSUMER SUCCESS"); | ||
1003 | +// WarplyManager.getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() { | ||
1004 | +// @Override | ||
1005 | +// public void onSuccess(Consumer result) { | ||
1006 | +// WarplyManagerHelper.setConsumerInternal(result); | ||
1007 | +// | ||
1008 | +// if (result != null) { | ||
1009 | +// JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
1010 | +// if (profMetadata != null && profMetadata.has("nonTelco")) { | ||
1011 | +// WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | ||
1012 | +// } else { | ||
1013 | +// WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); | ||
1014 | +// } | ||
1015 | +// } | ||
1016 | +// | ||
1017 | +// if (result != null) { | ||
1018 | +// JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | ||
1019 | +// if (profMetadata != null) { | ||
1020 | +// if (profMetadata.has("badge")) { | ||
1021 | +// WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); | ||
1022 | +// } | ||
1023 | +// } | ||
1024 | +// } | ||
1025 | +// } | ||
1026 | +// | ||
1027 | +// @Override | ||
1028 | +// public void onFailure(int errorCode) { | ||
1029 | +// | ||
1030 | +// } | ||
1031 | +// }); | ||
1032 | +// } | ||
1033 | +// | ||
1034 | +// @Override | ||
1035 | +// public void onFailure(int errorCode) { | ||
1036 | +// WarpUtils.log("EDIT CONSUMER FAILED"); | ||
1037 | +// } | ||
1038 | +// }); | ||
1031 | } | 1039 | } |
1032 | 1040 | ||
1033 | /** | 1041 | /** |
... | @@ -1174,7 +1182,8 @@ public class WarplyManagerHelper { | ... | @@ -1174,7 +1182,8 @@ public class WarplyManagerHelper { |
1174 | cpnlistExpired.add(coupon); | 1182 | cpnlistExpired.add(coupon); |
1175 | try { | 1183 | try { |
1176 | couponCount += 1; | 1184 | couponCount += 1; |
1177 | - couponValue += Float.parseFloat(coupon.getDiscount()); | 1185 | +// couponValue += Float.parseFloat(coupon.getDiscount()); |
1186 | + couponValue += (float) coupon.getFinal_price(); | ||
1178 | } catch (NumberFormatException e) { | 1187 | } catch (NumberFormatException e) { |
1179 | couponCount -= 1; | 1188 | couponCount -= 1; |
1180 | } | 1189 | } | ... | ... |
... | @@ -25,7 +25,10 @@ | ... | @@ -25,7 +25,10 @@ |
25 | 25 | ||
26 | package ly.warp.sdk.utils.managers; | 26 | package ly.warp.sdk.utils.managers; |
27 | 27 | ||
28 | +import android.app.ActivityManager; | ||
28 | import android.content.Context; | 29 | import android.content.Context; |
30 | +import android.content.Intent; | ||
31 | +import android.os.Build; | ||
29 | import android.os.Handler; | 32 | import android.os.Handler; |
30 | import android.os.Looper; | 33 | import android.os.Looper; |
31 | import android.util.Log; | 34 | import android.util.Log; |
... | @@ -91,6 +94,7 @@ import ly.warp.sdk.io.models.SharingList; | ... | @@ -91,6 +94,7 @@ import ly.warp.sdk.io.models.SharingList; |
91 | import ly.warp.sdk.io.models.TagsCategoriesList; | 94 | import ly.warp.sdk.io.models.TagsCategoriesList; |
92 | import ly.warp.sdk.io.models.TagsList; | 95 | import ly.warp.sdk.io.models.TagsList; |
93 | import ly.warp.sdk.io.models.TransactionsList; | 96 | import ly.warp.sdk.io.models.TransactionsList; |
97 | +import ly.warp.sdk.io.models.WarplyPacingEventModel; | ||
94 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 98 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; |
95 | import ly.warp.sdk.io.request.CosmotePostEventRequest; | 99 | import ly.warp.sdk.io.request.CosmotePostEventRequest; |
96 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 100 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; |
... | @@ -138,6 +142,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest; | ... | @@ -138,6 +142,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest; |
138 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; | 142 | import ly.warp.sdk.io.request.WarplyVerifyOTPRequest; |
139 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; | 143 | import ly.warp.sdk.io.request.WarplyVerifyTicketRequest; |
140 | import ly.warp.sdk.services.EventCampaignService; | 144 | import ly.warp.sdk.services.EventCampaignService; |
145 | +import ly.warp.sdk.services.WarplyHealthService; | ||
141 | import ly.warp.sdk.utils.WarpJSONParser; | 146 | import ly.warp.sdk.utils.WarpJSONParser; |
142 | import ly.warp.sdk.utils.WarpUtils; | 147 | import ly.warp.sdk.utils.WarpUtils; |
143 | import ly.warp.sdk.utils.WarplyManagerHelper; | 148 | import ly.warp.sdk.utils.WarplyManagerHelper; |
... | @@ -836,6 +841,21 @@ public class WarplyManager { | ... | @@ -836,6 +841,21 @@ public class WarplyManager { |
836 | if (profMetadata.has("badge")) { | 841 | if (profMetadata.has("badge")) { |
837 | WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); | 842 | WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); |
838 | } | 843 | } |
844 | + | ||
845 | + if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { | ||
846 | + if (!isMyServiceRunning(WarplyHealthService.class)) { | ||
847 | + Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); | ||
848 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
849 | + Warply.getWarplyContext().startForegroundService(stepsServiceIntent); | ||
850 | + } else { | ||
851 | + Warply.getWarplyContext().startService(stepsServiceIntent); | ||
852 | + } | ||
853 | + | ||
854 | + WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); | ||
855 | + pacingVisible.setVisible(true); | ||
856 | + EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); | ||
857 | + } | ||
858 | + } | ||
839 | } | 859 | } |
840 | } | 860 | } |
841 | } | 861 | } |
... | @@ -2288,6 +2308,8 @@ public class WarplyManager { | ... | @@ -2288,6 +2308,8 @@ public class WarplyManager { |
2288 | coupon.setName(couponset.getName()); | 2308 | coupon.setName(couponset.getName()); |
2289 | coupon.setMerchantUuid(couponset.getMerchantUuid()); | 2309 | coupon.setMerchantUuid(couponset.getMerchantUuid()); |
2290 | coupon.setInnerText(couponset.getInnerText()); | 2310 | coupon.setInnerText(couponset.getInnerText()); |
2311 | + coupon.setDiscount_type(couponset.getDiscount_type()); | ||
2312 | + coupon.setFinal_price(couponset.getFinal_price()); | ||
2291 | mCouponList.add(coupon); | 2313 | mCouponList.add(coupon); |
2292 | } | 2314 | } |
2293 | } | 2315 | } |
... | @@ -2405,6 +2427,21 @@ public class WarplyManager { | ... | @@ -2405,6 +2427,21 @@ public class WarplyManager { |
2405 | if (profMetadata.has("badge")) { | 2427 | if (profMetadata.has("badge")) { |
2406 | WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); | 2428 | WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge")); |
2407 | } | 2429 | } |
2430 | + | ||
2431 | + if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) { | ||
2432 | + if (!isMyServiceRunning(WarplyHealthService.class)) { | ||
2433 | + Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); | ||
2434 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
2435 | + Warply.getWarplyContext().startForegroundService(stepsServiceIntent); | ||
2436 | + } else { | ||
2437 | + Warply.getWarplyContext().startService(stepsServiceIntent); | ||
2438 | + } | ||
2439 | + | ||
2440 | + WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); | ||
2441 | + pacingVisible.setVisible(true); | ||
2442 | + EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible)); | ||
2443 | + } | ||
2444 | + } | ||
2408 | } | 2445 | } |
2409 | } | 2446 | } |
2410 | } | 2447 | } |
... | @@ -2622,4 +2659,14 @@ public class WarplyManager { | ... | @@ -2622,4 +2659,14 @@ public class WarplyManager { |
2622 | } | 2659 | } |
2623 | }, null); | 2660 | }, null); |
2624 | } | 2661 | } |
2662 | + | ||
2663 | + private static boolean isMyServiceRunning(Class<?> serviceClass) { | ||
2664 | + ActivityManager manager = (ActivityManager) Warply.getWarplyContext().getSystemService(Context.ACTIVITY_SERVICE); | ||
2665 | + for (ActivityManager.RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) { | ||
2666 | + if (serviceClass.getName().equals(service.service.getClassName())) { | ||
2667 | + return true; | ||
2668 | + } | ||
2669 | + } | ||
2670 | + return false; | ||
2671 | + } | ||
2625 | } | 2672 | } | ... | ... |
... | @@ -437,7 +437,12 @@ public class WarpView extends WebView { | ... | @@ -437,7 +437,12 @@ public class WarpView extends WebView { |
437 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | 437 | EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); |
438 | 438 | ||
439 | Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); | 439 | Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class); |
440 | - Warply.getWarplyContext().startService(stepsServiceIntent); | 440 | +// Warply.getWarplyContext().startService(stepsServiceIntent); |
441 | + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { | ||
442 | + Warply.getWarplyContext().startForegroundService(stepsServiceIntent); | ||
443 | + } else { | ||
444 | + Warply.getWarplyContext().startService(stepsServiceIntent); | ||
445 | + } | ||
441 | 446 | ||
442 | WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); | 447 | WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel(); |
443 | pacingVisible.setVisible(true); | 448 | pacingVisible.setVisible(true); |
... | @@ -454,6 +459,51 @@ public class WarpView extends WebView { | ... | @@ -454,6 +459,51 @@ public class WarpView extends WebView { |
454 | WarpUtils.log("**************** WARPLY Webview Log START *****************"); | 459 | WarpUtils.log("**************** WARPLY Webview Log START *****************"); |
455 | WarpUtils.log(message); | 460 | WarpUtils.log(message); |
456 | WarpUtils.log("**************** WARPLY Webview Log END *****************"); | 461 | WarpUtils.log("**************** WARPLY Webview Log END *****************"); |
462 | + } else if (parts[1].equals("loyalty_questionnaire_selected")) { | ||
463 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
464 | + analyticsEvent.setEventName(parts[1]); | ||
465 | + analyticsEvent.setParameter("completed", "true"); | ||
466 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
467 | + } else if (parts[1].equals("loyalty_questionnaire_answer_again") || parts[1].equals("loyalty_questionnaire_answers_deleted")) { | ||
468 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
469 | + analyticsEvent.setEventName(parts[1]); | ||
470 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
471 | + } else if (parts[1].equals("loyalty_questionnaire_later")) { | ||
472 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
473 | + analyticsEvent.setEventName("loyalty_questionnaire_selected"); | ||
474 | + analyticsEvent.setParameter("completed", "false"); | ||
475 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
476 | + } else if (parts[1].equals("loyalty_sdk_offer_selected")) { | ||
477 | + try { | ||
478 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
479 | + analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ||
480 | + analyticsEvent.setParameter("name", parts[2]); | ||
481 | + analyticsEvent.setParameter("type", parts[3]); | ||
482 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
483 | + } catch (Exception e) { | ||
484 | + e.printStackTrace(); | ||
485 | + } | ||
486 | + } else if (parts[1].equals("loyalty_offer_activated")) { | ||
487 | + try { | ||
488 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
489 | + analyticsEvent.setEventName("loyalty_sdk_offer_selected"); | ||
490 | + analyticsEvent.setParameter("name", parts[2]); | ||
491 | + analyticsEvent.setParameter("type", parts[3]); | ||
492 | + analyticsEvent.setParameter("successful", parts[4]); | ||
493 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
494 | + } catch (Exception e) { | ||
495 | + e.printStackTrace(); | ||
496 | + } | ||
497 | + } else if (parts[1].equals("time_spent_on_loyalty_sdk")) { | ||
498 | + try { | ||
499 | + LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel(); | ||
500 | + analyticsEvent.setEventName("time_spent_on_loyalty_sdk"); | ||
501 | + analyticsEvent.setParameter("name", parts[2]); | ||
502 | + analyticsEvent.setParameter("seconds", parts[3]); | ||
503 | + EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent)); | ||
504 | + } catch (Exception e) { | ||
505 | + e.printStackTrace(); | ||
506 | + } | ||
457 | } | 507 | } |
458 | } | 508 | } |
459 | } | 509 | } | ... | ... |
... | @@ -174,7 +174,19 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte | ... | @@ -174,7 +174,19 @@ public class ActiveCouponAdapter extends RecyclerView.Adapter<ActiveCouponAdapte |
174 | else | 174 | else |
175 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); | 175 | holder.tvCouponDate.setText(String.format(mContext.getString(R.string.cos_coupon_date), simpleDateFormat.format(newDate != null ? newDate : ""))); |
176 | 176 | ||
177 | - holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | 177 | + if (TextUtils.isEmpty(couponItem.getDiscount_type())) { |
178 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
179 | + } else { | ||
180 | + if (couponItem.getDiscount_type().equals("value")) { | ||
181 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
182 | + } else if (couponItem.getDiscount_type().equals("percentage")) { | ||
183 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.percentage)); | ||
184 | + } else if (couponItem.getDiscount_type().equals("plus_one")) { | ||
185 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.plus_one)); | ||
186 | + } else { | ||
187 | + holder.tvCouponValue.setText(couponItem.getDiscount() + mContext.getResources().getString(R.string.euro)); | ||
188 | + } | ||
189 | + } | ||
178 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); | 190 | holder.itemView.setOnClickListener(v -> onClickSubject.onNext(couponItem)); |
179 | } | 191 | } |
180 | } | 192 | } | ... | ... |
... | @@ -67,8 +67,7 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. | ... | @@ -67,8 +67,7 @@ public class MergedGiftsAdapter extends RecyclerView.Adapter<MergedGiftsAdapter. |
67 | 67 | ||
68 | @Override | 68 | @Override |
69 | public long getItemId(int position) { | 69 | public long getItemId(int position) { |
70 | -// return super.getItemId(position); | 70 | + return super.getItemId(position); |
71 | - return Double.valueOf(Math.random()).longValue(); | ||
72 | } | 71 | } |
73 | 72 | ||
74 | public MergedGifts getItem(int id) { | 73 | public MergedGifts getItem(int id) { | ... | ... |
... | @@ -59,8 +59,7 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd | ... | @@ -59,8 +59,7 @@ public class MoreContextualAdapter extends RecyclerView.Adapter<MoreContextualAd |
59 | 59 | ||
60 | @Override | 60 | @Override |
61 | public long getItemId(int position) { | 61 | public long getItemId(int position) { |
62 | -// return super.getItemId(position); | 62 | + return super.getItemId(position); |
63 | - return Double.valueOf(Math.random()).longValue(); | ||
64 | } | 63 | } |
65 | 64 | ||
66 | public LoyaltyContextualOfferModel getItem(int id) { | 65 | public LoyaltyContextualOfferModel getItem(int id) { | ... | ... |
2.58 KB
972 Bytes
935 Bytes
... | @@ -3,8 +3,10 @@ | ... | @@ -3,8 +3,10 @@ |
3 | xmlns:app="http://schemas.android.com/apk/res-auto" | 3 | xmlns:app="http://schemas.android.com/apk/res-auto" |
4 | xmlns:tools="http://schemas.android.com/tools" | 4 | xmlns:tools="http://schemas.android.com/tools" |
5 | android:layout_width="match_parent" | 5 | android:layout_width="match_parent" |
6 | - android:layout_height="140dp" | 6 | + android:layout_height="130dp" |
7 | - android:background="@drawable/ic_coupon_background"> | 7 | + android:layout_marginVertical="4dp" |
8 | + android:layout_marginHorizontal="4dp" | ||
9 | + android:background="@drawable/ic_coupon_background_new"> | ||
8 | 10 | ||
9 | <androidx.constraintlayout.widget.Guideline | 11 | <androidx.constraintlayout.widget.Guideline |
10 | android:id="@+id/gl_vertical_72_percent" | 12 | android:id="@+id/gl_vertical_72_percent" |
... | @@ -79,7 +81,7 @@ | ... | @@ -79,7 +81,7 @@ |
79 | android:id="@+id/tv_active_coupons_description" | 81 | android:id="@+id/tv_active_coupons_description" |
80 | android:layout_width="0dp" | 82 | android:layout_width="0dp" |
81 | android:layout_height="wrap_content" | 83 | android:layout_height="wrap_content" |
82 | - android:layout_marginStart="24dp" | 84 | + android:layout_marginStart="8dp" |
83 | android:layout_marginEnd="32dp" | 85 | android:layout_marginEnd="32dp" |
84 | fontPath="fonts/pf_square_sans_pro_medium.ttf" | 86 | fontPath="fonts/pf_square_sans_pro_medium.ttf" |
85 | android:maxLines="4" | 87 | android:maxLines="4" | ... | ... |
... | @@ -222,7 +222,7 @@ | ... | @@ -222,7 +222,7 @@ |
222 | android:layout_width="14dp" | 222 | android:layout_width="14dp" |
223 | android:layout_height="14dp" | 223 | android:layout_height="14dp" |
224 | android:layout_marginStart="6dp" | 224 | android:layout_marginStart="6dp" |
225 | - android:src="@drawable/ic_down_dark" /> | 225 | + android:src="@drawable/ic_down_dark_new" /> |
226 | </LinearLayout> | 226 | </LinearLayout> |
227 | </LinearLayout> | 227 | </LinearLayout> |
228 | 228 | ||
... | @@ -309,7 +309,7 @@ | ... | @@ -309,7 +309,7 @@ |
309 | fontPath="fonts/pf_square_sans_pro_regular.ttf" | 309 | fontPath="fonts/pf_square_sans_pro_regular.ttf" |
310 | android:layout_width="wrap_content" | 310 | android:layout_width="wrap_content" |
311 | android:layout_height="wrap_content" | 311 | android:layout_height="wrap_content" |
312 | - android:text="Όροι χρήσης" | 312 | + android:text="@string/cos_coupon_terms_title" |
313 | android:textColor="@color/grey" | 313 | android:textColor="@color/grey" |
314 | android:textSize="16sp" /> | 314 | android:textSize="16sp" /> |
315 | 315 | ||
... | @@ -318,7 +318,7 @@ | ... | @@ -318,7 +318,7 @@ |
318 | android:layout_width="14dp" | 318 | android:layout_width="14dp" |
319 | android:layout_height="14dp" | 319 | android:layout_height="14dp" |
320 | android:layout_marginStart="6dp" | 320 | android:layout_marginStart="6dp" |
321 | - android:src="@drawable/ic_down_dark" /> | 321 | + android:src="@drawable/ic_down_dark_new" /> |
322 | </LinearLayout> | 322 | </LinearLayout> |
323 | 323 | ||
324 | <TextView | 324 | <TextView | ... | ... |
... | @@ -133,7 +133,7 @@ | ... | @@ -133,7 +133,7 @@ |
133 | android:layout_height="16dp" | 133 | android:layout_height="16dp" |
134 | android:layout_alignParentEnd="true" | 134 | android:layout_alignParentEnd="true" |
135 | android:layout_centerVertical="true" | 135 | android:layout_centerVertical="true" |
136 | - android:src="@drawable/ic_arrow_down_dark" /> | 136 | + android:src="@drawable/ic_down_dark_new" /> |
137 | </RelativeLayout> | 137 | </RelativeLayout> |
138 | 138 | ||
139 | <View | 139 | <View | ... | ... |
... | @@ -153,8 +153,8 @@ | ... | @@ -153,8 +153,8 @@ |
153 | android:layout_width="wrap_content" | 153 | android:layout_width="wrap_content" |
154 | android:layout_height="wrap_content" | 154 | android:layout_height="wrap_content" |
155 | android:text="@string/cos_coupon_terms_title" | 155 | android:text="@string/cos_coupon_terms_title" |
156 | - android:textColor="#415564" | 156 | + android:textColor="@color/grey" |
157 | - android:textSize="15sp" /> | 157 | + android:textSize="16sp" /> |
158 | 158 | ||
159 | <ImageView | 159 | <ImageView |
160 | android:id="@+id/iv_terms_arrow" | 160 | android:id="@+id/iv_terms_arrow" |
... | @@ -162,7 +162,7 @@ | ... | @@ -162,7 +162,7 @@ |
162 | android:layout_height="14dp" | 162 | android:layout_height="14dp" |
163 | android:layout_marginStart="6dp" | 163 | android:layout_marginStart="6dp" |
164 | android:layout_marginTop="2dp" | 164 | android:layout_marginTop="2dp" |
165 | - android:src="@drawable/ic_down_dark" /> | 165 | + android:src="@drawable/ic_down_dark_new" /> |
166 | </LinearLayout> | 166 | </LinearLayout> |
167 | 167 | ||
168 | <TextView | 168 | <TextView |
... | @@ -172,6 +172,7 @@ | ... | @@ -172,6 +172,7 @@ |
172 | android:layout_height="wrap_content" | 172 | android:layout_height="wrap_content" |
173 | android:layout_below="@+id/ll_terms_inner" | 173 | android:layout_below="@+id/ll_terms_inner" |
174 | android:layout_marginTop="16dp" | 174 | android:layout_marginTop="16dp" |
175 | + android:layout_marginHorizontal="64dp" | ||
175 | android:textColor="@color/grey" | 176 | android:textColor="@color/grey" |
176 | android:visibility="gone" | 177 | android:visibility="gone" |
177 | tools:text="@string/cos_coupon_date" | 178 | tools:text="@string/cos_coupon_date" | ... | ... |
... | @@ -207,7 +207,7 @@ | ... | @@ -207,7 +207,7 @@ |
207 | android:layout_width="14dp" | 207 | android:layout_width="14dp" |
208 | android:layout_height="14dp" | 208 | android:layout_height="14dp" |
209 | android:layout_marginStart="6dp" | 209 | android:layout_marginStart="6dp" |
210 | - android:src="@drawable/ic_down_dark" /> | 210 | + android:src="@drawable/ic_down_dark_new" /> |
211 | </LinearLayout> | 211 | </LinearLayout> |
212 | 212 | ||
213 | <TextView | 213 | <TextView | ... | ... |
... | @@ -58,6 +58,8 @@ | ... | @@ -58,6 +58,8 @@ |
58 | <string name="cos_annual">12Μηνο</string> | 58 | <string name="cos_annual">12Μηνο</string> |
59 | <string name="cos_analysis2">Αναλυτικά:</string> | 59 | <string name="cos_analysis2">Αναλυτικά:</string> |
60 | <string name="euro">€</string> | 60 | <string name="euro">€</string> |
61 | + <string name="percentage">%</string> | ||
62 | + <string name="plus_one">1+1</string> | ||
61 | <string name="cos_profile_questionnaire">Ερωτηματολόγιο</string> | 63 | <string name="cos_profile_questionnaire">Ερωτηματολόγιο</string> |
62 | <string name="cos_active_all_coupons">Ενεργά κουπόνια</string> | 64 | <string name="cos_active_all_coupons">Ενεργά κουπόνια</string> |
63 | <string name="cos_active_all_rewards">Όλα τα δώρα μου</string> | 65 | <string name="cos_active_all_rewards">Όλα τα δώρα μου</string> |
... | @@ -140,6 +142,8 @@ | ... | @@ -140,6 +142,8 @@ |
140 | <string name="cos_comma">,</string> | 142 | <string name="cos_comma">,</string> |
141 | <string name="cos_dlg_non_telco_title">Αδυναμία ενεργοποίησης</string> | 143 | <string name="cos_dlg_non_telco_title">Αδυναμία ενεργοποίησης</string> |
142 | <string name="cos_share_no_assets">Για την αποστολή του δώρου σου χρειάζεται να έχεις κινητό COSMOTE.</string> | 144 | <string name="cos_share_no_assets">Για την αποστολή του δώρου σου χρειάζεται να έχεις κινητό COSMOTE.</string> |
145 | + <string name="cos_dlg_coupon_depleted_title">H προσφορά δεν είναι πλέον διαθέσιμη</string> | ||
146 | + <string name="cos_dlg_coupon_depleted_message">Μείνε συντονισμένος για νέες προσφορές και κουπόνια.</string> | ||
143 | 147 | ||
144 | <string-array name="coupons_array"> | 148 | <string-array name="coupons_array"> |
145 | <item>Κουπόνια</item> | 149 | <item>Κουπόνια</item> | ... | ... |
-
Please register or login to post a comment