Showing
26 changed files
with
394 additions
and
27 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("6012049321"), //6012049321, 6012049322, 6012049323 | 39 | + .setGuid("6012049139"), //6012049321, 6012049322, 6012049323 |
40 | mLoginReceiver); | 40 | mLoginReceiver); |
41 | } else { | 41 | } else { |
42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4-cosbeta56' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta57' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -128,6 +128,11 @@ | ... | @@ -128,6 +128,11 @@ |
128 | android:permission="android.permission.BIND_JOB_SERVICE" /> | 128 | android:permission="android.permission.BIND_JOB_SERVICE" /> |
129 | 129 | ||
130 | <service | 130 | <service |
131 | + android:name="ly.warp.sdk.services.EventCouponsService" | ||
132 | + android:exported="false" | ||
133 | + android:permission="android.permission.BIND_JOB_SERVICE" /> | ||
134 | + | ||
135 | + <service | ||
131 | android:name="ly.warp.sdk.services.EventCampaignService" | 136 | android:name="ly.warp.sdk.services.EventCampaignService" |
132 | android:exported="false" | 137 | android:exported="false" |
133 | android:permission="android.permission.BIND_JOB_SERVICE" /> | 138 | android:permission="android.permission.BIND_JOB_SERVICE" /> | ... | ... |
... | @@ -167,6 +167,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener | ... | @@ -167,6 +167,7 @@ public class ContextualActivity extends Activity implements View.OnClickListener |
167 | WarplyManager.submitOrder(new CosmoteSubmitOrderRequest() | 167 | WarplyManager.submitOrder(new CosmoteSubmitOrderRequest() |
168 | .setCommunicationUuid("") | 168 | .setCommunicationUuid("") |
169 | .setUserMsisdn(mSender) | 169 | .setUserMsisdn(mSender) |
170 | + .setSessionId(mCCMS.getSessionId()) | ||
170 | .setBusinessService(mCCMS.getBusinessService()) | 171 | .setBusinessService(mCCMS.getBusinessService()) |
171 | .setOfferName(mCCMS.getOfferName()) | 172 | .setOfferName(mCCMS.getOfferName()) |
172 | .setProductType(mCCMS.getProductType()) | 173 | .setProductType(mCCMS.getProductType()) | ... | ... |
... | @@ -15,6 +15,8 @@ import android.widget.LinearLayout; | ... | @@ -15,6 +15,8 @@ import android.widget.LinearLayout; |
15 | import android.widget.TextView; | 15 | import android.widget.TextView; |
16 | 16 | ||
17 | import androidx.core.content.ContextCompat; | 17 | import androidx.core.content.ContextCompat; |
18 | +import androidx.work.OneTimeWorkRequest; | ||
19 | +import androidx.work.WorkManager; | ||
18 | 20 | ||
19 | import com.bumptech.glide.Glide; | 21 | import com.bumptech.glide.Glide; |
20 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 22 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
... | @@ -31,6 +33,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ... | @@ -31,6 +33,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
31 | import ly.warp.sdk.R; | 33 | import ly.warp.sdk.R; |
32 | import ly.warp.sdk.io.models.Coupon; | 34 | import ly.warp.sdk.io.models.Coupon; |
33 | import ly.warp.sdk.io.models.Couponset; | 35 | import ly.warp.sdk.io.models.Couponset; |
36 | +import ly.warp.sdk.services.EventCouponsService; | ||
34 | import ly.warp.sdk.utils.WarplyManagerHelper; | 37 | import ly.warp.sdk.utils.WarplyManagerHelper; |
35 | 38 | ||
36 | 39 | ||
... | @@ -50,7 +53,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -50,7 +53,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
50 | private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms; | 53 | private LinearLayout mLlGiftIt, mLlShops, mLlBarcodeShown, mLlBarcodeContainer, mLlTerms; |
51 | private Coupon mCoupon; | 54 | private Coupon mCoupon; |
52 | private Couponset mCouponset; | 55 | private Couponset mCouponset; |
53 | - private boolean mIsBarcodeShown = false, mIsTermsShown = false; | 56 | + private boolean mIsBarcodeShown = false, mIsTermsShown = false, mIsFromWallet = false; |
54 | 57 | ||
55 | // =========================================================== | 58 | // =========================================================== |
56 | // Methods for/from SuperClass/Interfaces | 59 | // Methods for/from SuperClass/Interfaces |
... | @@ -62,6 +65,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -62,6 +65,7 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
62 | setContentView(R.layout.activity_coupon_info); | 65 | setContentView(R.layout.activity_coupon_info); |
63 | 66 | ||
64 | mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); | 67 | mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); |
68 | + mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false); | ||
65 | 69 | ||
66 | mIvBack = findViewById(R.id.iv_coupon_info_back); | 70 | mIvBack = findViewById(R.id.iv_coupon_info_back); |
67 | mTvTerms = findViewById(R.id.tv_terms); | 71 | mTvTerms = findViewById(R.id.tv_terms); |
... | @@ -88,6 +92,17 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -88,6 +92,17 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
88 | } | 92 | } |
89 | 93 | ||
90 | @Override | 94 | @Override |
95 | + protected void onActivityResult(int requestCode, int resultCode, Intent data) { | ||
96 | + if (requestCode == 1001) { | ||
97 | + if (resultCode == RESULT_OK) { | ||
98 | + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCouponsService.class).build(); | ||
99 | + WorkManager.getInstance(this).enqueue(mywork); | ||
100 | + onBackPressed(); | ||
101 | + } | ||
102 | + } | ||
103 | + } | ||
104 | + | ||
105 | + @Override | ||
91 | public void onClick(View view) { | 106 | public void onClick(View view) { |
92 | if (view.getId() == R.id.iv_coupon_info_back) { | 107 | if (view.getId() == R.id.iv_coupon_info_back) { |
93 | onBackPressed(); | 108 | onBackPressed(); |
... | @@ -96,7 +111,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener | ... | @@ -96,7 +111,11 @@ public class CouponInfoActivity extends Activity implements View.OnClickListener |
96 | if (view.getId() == R.id.ll_gift_it) { | 111 | if (view.getId() == R.id.ll_gift_it) { |
97 | Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); | 112 | Intent intent = new Intent(CouponInfoActivity.this, CouponShareActivity.class); |
98 | intent.putExtra("coupon", (Serializable) mCoupon); | 113 | intent.putExtra("coupon", (Serializable) mCoupon); |
99 | - startActivity(intent); | 114 | + intent.putExtra("isFromWallet", mIsFromWallet); |
115 | + if (!mIsFromWallet) | ||
116 | + startActivity(intent); | ||
117 | + else | ||
118 | + startActivityForResult(intent, 1001); | ||
100 | return; | 119 | return; |
101 | } | 120 | } |
102 | if (view.getId() == R.id.ll_shops) { | 121 | if (view.getId() == R.id.ll_shops) { | ... | ... |
... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; | ... | @@ -2,6 +2,7 @@ package ly.warp.sdk.activities; |
2 | 2 | ||
3 | import android.app.Activity; | 3 | import android.app.Activity; |
4 | import android.content.Context; | 4 | import android.content.Context; |
5 | +import android.content.Intent; | ||
5 | import android.os.Bundle; | 6 | import android.os.Bundle; |
6 | import android.text.TextUtils; | 7 | import android.text.TextUtils; |
7 | import android.util.Log; | 8 | import android.util.Log; |
... | @@ -58,6 +59,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -58,6 +59,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
58 | private EditText mEdtReceiver; | 59 | private EditText mEdtReceiver; |
59 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, | 60 | private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, |
60 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing; | 61 | mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing; |
62 | + private boolean mIsFromWallet = false; | ||
61 | 63 | ||
62 | // =========================================================== | 64 | // =========================================================== |
63 | // Methods for/from SuperClass/Interfaces | 65 | // Methods for/from SuperClass/Interfaces |
... | @@ -69,6 +71,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -69,6 +71,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
69 | setContentView(R.layout.activity_coupon_share); | 71 | setContentView(R.layout.activity_coupon_share); |
70 | 72 | ||
71 | mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); | 73 | mCoupon = (Coupon) getIntent().getSerializableExtra("coupon"); |
74 | + mIsFromWallet = getIntent().getBooleanExtra("isFromWallet", false); | ||
72 | 75 | ||
73 | mIvBack = findViewById(R.id.iv_coupon_share_back); | 76 | mIvBack = findViewById(R.id.iv_coupon_share_back); |
74 | mTvCouponTitle = findViewById(R.id.textView13); | 77 | mTvCouponTitle = findViewById(R.id.textView13); |
... | @@ -190,6 +193,10 @@ public class CouponShareActivity extends Activity implements View.OnClickListene | ... | @@ -190,6 +193,10 @@ public class CouponShareActivity extends Activity implements View.OnClickListene |
190 | .setMessage(R.string.cos_dlg_positive_coupon_text) | 193 | .setMessage(R.string.cos_dlg_positive_coupon_text) |
191 | .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { | 194 | .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { |
192 | dialogPositive.dismiss(); | 195 | dialogPositive.dismiss(); |
196 | + if (mIsFromWallet) { | ||
197 | + setResult(RESULT_OK, new Intent()); | ||
198 | + onBackPressed(); | ||
199 | + } | ||
193 | }) | 200 | }) |
194 | .show(); | 201 | .show(); |
195 | } | 202 | } | ... | ... |
... | @@ -109,6 +109,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe | ... | @@ -109,6 +109,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe |
109 | .setCouponsetUuid(mCouponset.getUuid()) | 109 | .setCouponsetUuid(mCouponset.getUuid()) |
110 | .setCommunicationUuid(mLoyalty.getSessionUUID()) | 110 | .setCommunicationUuid(mLoyalty.getSessionUUID()) |
111 | .setHasContextualOffer(true) | 111 | .setHasContextualOffer(true) |
112 | + .setSessionId(mCcms.getSessionId()) | ||
112 | .setUserMsisdn(WarplyManagerHelper.getConsumer().getMsisdn()) //TODO: where to find the msisdn?? | 113 | .setUserMsisdn(WarplyManagerHelper.getConsumer().getMsisdn()) //TODO: where to find the msisdn?? |
113 | .setBusinessService(mCcms.getBusinessService()) | 114 | .setBusinessService(mCcms.getBusinessService()) |
114 | .setOfferName(mCcms.getOfferName()) | 115 | .setOfferName(mCcms.getOfferName()) | ... | ... |
... | @@ -80,6 +80,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -80,6 +80,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
80 | filterItems(); | 80 | filterItems(); |
81 | 81 | ||
82 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | 82 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { |
83 | + mHashSetSeasonalList.clear(); | ||
83 | mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | 84 | mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); |
84 | mSeasonalList.clear(); | 85 | mSeasonalList.clear(); |
85 | mSeasonalList.addAll(mHashSetSeasonalList); | 86 | mSeasonalList.addAll(mHashSetSeasonalList); |
... | @@ -150,6 +151,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -150,6 +151,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
150 | filterItems(); | 151 | filterItems(); |
151 | 152 | ||
152 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | 153 | if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { |
154 | + mHashSetSeasonalList.clear(); | ||
153 | mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | 155 | mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); |
154 | mSeasonalList.clear(); | 156 | mSeasonalList.clear(); |
155 | mSeasonalList.addAll(mHashSetSeasonalList); | 157 | mSeasonalList.addAll(mHashSetSeasonalList); | ... | ... |
... | @@ -21,6 +21,7 @@ import com.bumptech.glide.Glide; | ... | @@ -21,6 +21,7 @@ import com.bumptech.glide.Glide; |
21 | import com.bumptech.glide.load.engine.DiskCacheStrategy; | 21 | import com.bumptech.glide.load.engine.DiskCacheStrategy; |
22 | 22 | ||
23 | import org.greenrobot.eventbus.EventBus; | 23 | import org.greenrobot.eventbus.EventBus; |
24 | +import org.greenrobot.eventbus.Subscribe; | ||
24 | 25 | ||
25 | import java.io.Serializable; | 26 | import java.io.Serializable; |
26 | import java.text.ParseException; | 27 | import java.text.ParseException; |
... | @@ -36,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; | ... | @@ -36,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
36 | import ly.warp.sdk.R; | 37 | import ly.warp.sdk.R; |
37 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 38 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; |
38 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; | 39 | import ly.warp.sdk.io.models.ActiveDFYCouponModel; |
40 | +import ly.warp.sdk.io.models.CouponList; | ||
39 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 41 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
40 | import ly.warp.sdk.utils.WarpUtils; | 42 | import ly.warp.sdk.utils.WarpUtils; |
41 | import ly.warp.sdk.utils.WarplyManagerHelper; | 43 | import ly.warp.sdk.utils.WarplyManagerHelper; |
... | @@ -118,6 +120,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -118,6 +120,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
118 | } | 120 | } |
119 | 121 | ||
120 | @Override | 122 | @Override |
123 | + protected void onStart() { | ||
124 | + super.onStart(); | ||
125 | + EventBus.getDefault().register(this); | ||
126 | + } | ||
127 | + | ||
128 | + @Override | ||
129 | + protected void onStop() { | ||
130 | + super.onStop(); | ||
131 | + EventBus.getDefault().unregister(this); | ||
132 | + } | ||
133 | + | ||
134 | + @Override | ||
121 | public void onResume() { | 135 | public void onResume() { |
122 | super.onResume(); | 136 | super.onResume(); |
123 | } | 137 | } |
... | @@ -167,6 +181,35 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -167,6 +181,35 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
167 | } | 181 | } |
168 | } | 182 | } |
169 | 183 | ||
184 | + @Subscribe() | ||
185 | + public void onMessageEvent(WarplyEventBusManager event) { | ||
186 | + if (event.getCouponsAdded() != null) { | ||
187 | + CouponList tempCouponList = new CouponList(); | ||
188 | + tempCouponList.clear(); | ||
189 | + tempCouponList.addAll(WarplyManagerHelper.getCouponList()); | ||
190 | + runOnUiThread(() -> { | ||
191 | + if (tempCouponList != null && tempCouponList.size() > 0) { | ||
192 | + mAdapterCoupons = new ActiveCouponAdapter(this, tempCouponList); | ||
193 | + mRecyclerCoupons.setAdapter(mAdapterCoupons); | ||
194 | + mAdapterCoupons.getPositionClicks() | ||
195 | + .doOnNext(coupon -> { | ||
196 | + Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); | ||
197 | + intent.putExtra("coupon", (Serializable) coupon); | ||
198 | + intent.putExtra("isFromWallet", true); | ||
199 | + startActivityForResult(intent, 1002); | ||
200 | + }) | ||
201 | + .doOnError(error -> { | ||
202 | + }) | ||
203 | + .subscribe(); | ||
204 | + mAdapterCoupons.notifyDataSetChanged(); | ||
205 | + } else { | ||
206 | + mRecyclerCoupons.setVisibility(View.GONE); | ||
207 | + mTvActiveCouponsHeader.setVisibility(View.GONE); | ||
208 | + } | ||
209 | + }); | ||
210 | + } | ||
211 | + } | ||
212 | + | ||
170 | @Override | 213 | @Override |
171 | protected void attachBaseContext(Context newBase) { | 214 | protected void attachBaseContext(Context newBase) { |
172 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); | 215 | super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase)); |
... | @@ -188,7 +231,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { | ... | @@ -188,7 +231,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener { |
188 | .doOnNext(coupon -> { | 231 | .doOnNext(coupon -> { |
189 | Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); | 232 | Intent intent = new Intent(LoyaltyWallet.this, CouponInfoActivity.class); |
190 | intent.putExtra("coupon", (Serializable) coupon); | 233 | intent.putExtra("coupon", (Serializable) coupon); |
191 | - startActivity(intent); | 234 | + intent.putExtra("isFromWallet", true); |
235 | + startActivityForResult(intent, 1002); | ||
192 | }) | 236 | }) |
193 | .doOnError(error -> { | 237 | .doOnError(error -> { |
194 | }) | 238 | }) | ... | ... |
... | @@ -204,6 +204,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { | ... | @@ -204,6 +204,7 @@ public class TelcoActivity extends Activity implements View.OnClickListener { |
204 | WarplyManager.submitOrder(new CosmoteSubmitOrderRequest() | 204 | WarplyManager.submitOrder(new CosmoteSubmitOrderRequest() |
205 | .setCommunicationUuid(mLoyalty.getSessionUUID()) | 205 | .setCommunicationUuid(mLoyalty.getSessionUUID()) |
206 | .setUserMsisdn(mSender) | 206 | .setUserMsisdn(mSender) |
207 | + .setSessionId(mCCMS.getSessionId()) | ||
207 | .setBusinessService(mCCMS.getBusinessService()) | 208 | .setBusinessService(mCCMS.getBusinessService()) |
208 | .setOfferName(mCCMS.getOfferName()) | 209 | .setOfferName(mCCMS.getOfferName()) |
209 | .setProductType(mCCMS.getProductType()) | 210 | .setProductType(mCCMS.getProductType()) | ... | ... |
... | @@ -33,6 +33,7 @@ import android.content.Intent; | ... | @@ -33,6 +33,7 @@ import android.content.Intent; |
33 | import android.graphics.Color; | 33 | import android.graphics.Color; |
34 | import android.os.Build; | 34 | import android.os.Build; |
35 | import android.os.Bundle; | 35 | import android.os.Bundle; |
36 | +import android.os.Handler; | ||
36 | import android.text.TextUtils; | 37 | import android.text.TextUtils; |
37 | import android.view.KeyEvent; | 38 | import android.view.KeyEvent; |
38 | import android.view.View; | 39 | import android.view.View; |
... | @@ -78,6 +79,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -78,6 +79,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
78 | // =========================================================== | 79 | // =========================================================== |
79 | 80 | ||
80 | private WarpView mWarpView; | 81 | private WarpView mWarpView; |
82 | + private static Handler metersHandler = new Handler(); | ||
81 | 83 | ||
82 | // =========================================================== | 84 | // =========================================================== |
83 | // Methods for/from SuperClass/Interfaces | 85 | // Methods for/from SuperClass/Interfaces |
... | @@ -116,6 +118,8 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -116,6 +118,8 @@ public class WarpViewActivity extends WarpBaseActivity { |
116 | @Override | 118 | @Override |
117 | protected void onDestroy() { | 119 | protected void onDestroy() { |
118 | super.onDestroy(); | 120 | super.onDestroy(); |
121 | + if (metersHandler != null) | ||
122 | + metersHandler.removeCallbacksAndMessages(null); | ||
119 | WarpUtils.setWebviewParams(this, new JSONObject()); | 123 | WarpUtils.setWebviewParams(this, new JSONObject()); |
120 | } | 124 | } |
121 | 125 | ||
... | @@ -278,4 +282,8 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -278,4 +282,8 @@ public class WarpViewActivity extends WarpBaseActivity { |
278 | 282 | ||
279 | } | 283 | } |
280 | }; | 284 | }; |
285 | + | ||
286 | + public static Handler getMetersHandler() { | ||
287 | + return metersHandler; | ||
288 | + } | ||
281 | } | 289 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by Panagiotis Triantafyllou on 05-Sept-22. | ||
31 | + */ | ||
32 | + | ||
33 | +public class CouponsEventModel { | ||
34 | + private boolean success; | ||
35 | + | ||
36 | + public CouponsEventModel() { | ||
37 | + this.success = true; | ||
38 | + } | ||
39 | + | ||
40 | + public boolean isSuccess() { | ||
41 | + return success; | ||
42 | + } | ||
43 | + | ||
44 | + public void setSuccess(boolean success) { | ||
45 | + this.success = success; | ||
46 | + } | ||
47 | +} |
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by Panagiotis Triantafyllou on 05-Sept-22. | ||
31 | + */ | ||
32 | + | ||
33 | +public class HealthEventModel { | ||
34 | + private double steps; | ||
35 | + | ||
36 | + public HealthEventModel() { | ||
37 | + this.steps = 0.0d; | ||
38 | + } | ||
39 | + | ||
40 | + public double getSteps() { | ||
41 | + return steps; | ||
42 | + } | ||
43 | + | ||
44 | + public void setSteps(double steps) { | ||
45 | + this.steps = steps; | ||
46 | + } | ||
47 | +} |
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyCouponsChangedEventModel.java
0 → 100644
1 | +/* | ||
2 | + * Copyright 2010-2013 Warply Ltd. All rights reserved. | ||
3 | + * | ||
4 | + * Redistribution and use in source and binary forms, without modification, are | ||
5 | + * permitted provided that the following conditions are met: | ||
6 | + * | ||
7 | + * 1. Redistributions of source code must retain the above copyright notice, | ||
8 | + * this list of conditions and the following disclaimer. | ||
9 | + * | ||
10 | + * 2. Redistributions in binary form must reproduce the above copyright notice, | ||
11 | + * this list of conditions and the following disclaimer in the documentation | ||
12 | + * and/or other materials provided with the distribution. | ||
13 | + * | ||
14 | + * THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR | ||
15 | + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | ||
16 | + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO | ||
17 | + * EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, | ||
18 | + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | ||
19 | + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, | ||
20 | + * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
21 | + * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
22 | + * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, | ||
23 | + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
24 | + */ | ||
25 | + | ||
26 | +package ly.warp.sdk.io.models; | ||
27 | + | ||
28 | + | ||
29 | +/** | ||
30 | + * Created by Panagiotis Triantafyllou on 06-Sept-22. | ||
31 | + */ | ||
32 | + | ||
33 | +public class WarplyCouponsChangedEventModel { | ||
34 | + private boolean changed; | ||
35 | + | ||
36 | + public WarplyCouponsChangedEventModel() { | ||
37 | + this.changed = true; | ||
38 | + } | ||
39 | + | ||
40 | + public boolean isChanged() { | ||
41 | + return changed; | ||
42 | + } | ||
43 | + | ||
44 | + public void setChanged(boolean changed) { | ||
45 | + this.changed = changed; | ||
46 | + } | ||
47 | +} |
... | @@ -73,6 +73,7 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -73,6 +73,7 @@ public class CosmoteSubmitOrderRequest { |
73 | private String mWave = ""; | 73 | private String mWave = ""; |
74 | private String mValidity = ""; | 74 | private String mValidity = ""; |
75 | private String mTreatmentCode = ""; | 75 | private String mTreatmentCode = ""; |
76 | + private String mSessionId = ""; | ||
76 | 77 | ||
77 | // =========================================================== | 78 | // =========================================================== |
78 | // Constructor | 79 | // Constructor |
... | @@ -228,6 +229,11 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -228,6 +229,11 @@ public class CosmoteSubmitOrderRequest { |
228 | return this; | 229 | return this; |
229 | } | 230 | } |
230 | 231 | ||
232 | + public CosmoteSubmitOrderRequest setSessionId(String sessionId) { | ||
233 | + this.mSessionId = sessionId; | ||
234 | + return this; | ||
235 | + } | ||
236 | + | ||
231 | /** | 237 | /** |
232 | * Call this to get how often the cached data will be updated. | 238 | * Call this to get how often the cached data will be updated. |
233 | * | 239 | * |
... | @@ -309,7 +315,7 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -309,7 +315,7 @@ public class CosmoteSubmitOrderRequest { |
309 | extraData.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); | 315 | extraData.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); |
310 | extraData.putOpt("InteractiveChannel", "COSMOTE_OMNI"); | 316 | extraData.putOpt("InteractiveChannel", "COSMOTE_OMNI"); |
311 | extraData.putOpt("InteractionPoint", mZone); | 317 | extraData.putOpt("InteractionPoint", mZone); |
312 | - extraData.putOpt("Session_ID", mCommunicationUuid); | 318 | + extraData.putOpt("Session_ID", mSessionId); |
313 | extraData.putOpt("OfferAudienceLevel", mOfferAudienceLevel); | 319 | extraData.putOpt("OfferAudienceLevel", mOfferAudienceLevel); |
314 | extraData.putOpt("MSISDN", mOfferAudienceLevel.equals("msisdn") ? mUserMsisdn : ""); | 320 | extraData.putOpt("MSISDN", mOfferAudienceLevel.equals("msisdn") ? mUserMsisdn : ""); |
315 | extraData.putOpt("GUID", ""); | 321 | extraData.putOpt("GUID", ""); |
... | @@ -365,7 +371,7 @@ public class CosmoteSubmitOrderRequest { | ... | @@ -365,7 +371,7 @@ public class CosmoteSubmitOrderRequest { |
365 | 371 | ||
366 | JSONObject param9 = new JSONObject(); | 372 | JSONObject param9 = new JSONObject(); |
367 | param9.putOpt("Name", "Session_ID"); | 373 | param9.putOpt("Name", "Session_ID"); |
368 | - param9.putOpt("Value", mCommunicationUuid); | 374 | + param9.putOpt("Value", mSessionId); |
369 | param9.putOpt("Type", "string"); | 375 | param9.putOpt("Type", "string"); |
370 | parameters.put(param9); | 376 | parameters.put(param9); |
371 | 377 | ... | ... |
... | @@ -73,6 +73,7 @@ public class WarplyRedeemCouponRequest { | ... | @@ -73,6 +73,7 @@ public class WarplyRedeemCouponRequest { |
73 | private String mWave = ""; | 73 | private String mWave = ""; |
74 | private String mValidity = ""; | 74 | private String mValidity = ""; |
75 | private String mTreatmentCode = ""; | 75 | private String mTreatmentCode = ""; |
76 | + private String mSessionId = ""; | ||
76 | 77 | ||
77 | // =========================================================== | 78 | // =========================================================== |
78 | // Constructor | 79 | // Constructor |
... | @@ -238,6 +239,11 @@ public class WarplyRedeemCouponRequest { | ... | @@ -238,6 +239,11 @@ public class WarplyRedeemCouponRequest { |
238 | return this; | 239 | return this; |
239 | } | 240 | } |
240 | 241 | ||
242 | + public WarplyRedeemCouponRequest setSessionId(String sessionId) { | ||
243 | + this.mSessionId = sessionId; | ||
244 | + return this; | ||
245 | + } | ||
246 | + | ||
241 | /** | 247 | /** |
242 | * Call this to get how often the cached data will be updated. | 248 | * Call this to get how often the cached data will be updated. |
243 | * | 249 | * |
... | @@ -318,7 +324,7 @@ public class WarplyRedeemCouponRequest { | ... | @@ -318,7 +324,7 @@ public class WarplyRedeemCouponRequest { |
318 | extraJson.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); | 324 | extraJson.putOpt(KEY_PROV_STEP_VALUE_MINS, mProvStepValueMins); |
319 | extraJson.putOpt("InteractiveChannel", "COSMOTE_OMNI"); | 325 | extraJson.putOpt("InteractiveChannel", "COSMOTE_OMNI"); |
320 | extraJson.putOpt("InteractionPoint", mZone); | 326 | extraJson.putOpt("InteractionPoint", mZone); |
321 | - extraJson.putOpt("Session_ID", mCommunicationUuid); | 327 | + extraJson.putOpt("Session_ID", mSessionId); |
322 | extraJson.putOpt("OfferAudienceLevel", mOfferAudienceLevel); | 328 | extraJson.putOpt("OfferAudienceLevel", mOfferAudienceLevel); |
323 | extraJson.putOpt("MSISDN", mOfferAudienceLevel.equals("msisdn") ? mUserMsisdn : ""); | 329 | extraJson.putOpt("MSISDN", mOfferAudienceLevel.equals("msisdn") ? mUserMsisdn : ""); |
324 | extraJson.putOpt("GUID", ""); | 330 | extraJson.putOpt("GUID", ""); |
... | @@ -374,7 +380,7 @@ public class WarplyRedeemCouponRequest { | ... | @@ -374,7 +380,7 @@ public class WarplyRedeemCouponRequest { |
374 | 380 | ||
375 | JSONObject param9 = new JSONObject(); | 381 | JSONObject param9 = new JSONObject(); |
376 | param9.putOpt("Name", "Session_ID"); | 382 | param9.putOpt("Name", "Session_ID"); |
377 | - param9.putOpt("Value", mCommunicationUuid); | 383 | + param9.putOpt("Value", mSessionId); |
378 | param9.putOpt("Type", "string"); | 384 | param9.putOpt("Type", "string"); |
379 | parameters.put(param9); | 385 | parameters.put(param9); |
380 | 386 | ... | ... |
1 | +package ly.warp.sdk.services; | ||
2 | + | ||
3 | +import android.content.Context; | ||
4 | + | ||
5 | +import androidx.annotation.NonNull; | ||
6 | +import androidx.work.Worker; | ||
7 | +import androidx.work.WorkerParameters; | ||
8 | + | ||
9 | +import org.greenrobot.eventbus.EventBus; | ||
10 | + | ||
11 | +import ly.warp.sdk.io.models.CouponsEventModel; | ||
12 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
13 | + | ||
14 | +/** | ||
15 | + * Created by Panagiotis Triantafyllou on 05/Sept/2022. | ||
16 | + */ | ||
17 | +public class EventCouponsService extends Worker { | ||
18 | + | ||
19 | + public EventCouponsService(@NonNull Context context, @NonNull WorkerParameters workerParams) { | ||
20 | + super(context, workerParams); | ||
21 | + } | ||
22 | + | ||
23 | + @NonNull | ||
24 | + @Override | ||
25 | + public Result doWork() { | ||
26 | + CouponsEventModel couponsAdded = new CouponsEventModel(); | ||
27 | + EventBus.getDefault().post(new WarplyEventBusManager(couponsAdded)); | ||
28 | + | ||
29 | + return Result.success(); | ||
30 | + } | ||
31 | +} |
... | @@ -38,10 +38,10 @@ public class EventQuestionnaireService extends Worker { | ... | @@ -38,10 +38,10 @@ public class EventQuestionnaireService extends Worker { |
38 | 38 | ||
39 | if (result != null) { | 39 | if (result != null) { |
40 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | 40 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); |
41 | - if (profMetadata != null) { | 41 | + if (profMetadata != null && profMetadata.has("nonTelco")) { |
42 | - if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) { | 42 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); |
43 | - WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | 43 | + } else { |
44 | - } | 44 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); |
45 | } | 45 | } |
46 | } | 46 | } |
47 | 47 | ... | ... |
... | @@ -19,6 +19,7 @@ import androidx.annotation.Nullable; | ... | @@ -19,6 +19,7 @@ import androidx.annotation.Nullable; |
19 | import androidx.annotation.RequiresApi; | 19 | import androidx.annotation.RequiresApi; |
20 | import androidx.core.app.NotificationCompat; | 20 | import androidx.core.app.NotificationCompat; |
21 | 21 | ||
22 | +import org.greenrobot.eventbus.EventBus; | ||
22 | import org.json.JSONObject; | 23 | import org.json.JSONObject; |
23 | 24 | ||
24 | import java.text.SimpleDateFormat; | 25 | import java.text.SimpleDateFormat; |
... | @@ -28,8 +29,12 @@ import java.util.Locale; | ... | @@ -28,8 +29,12 @@ import java.util.Locale; |
28 | import ly.warp.sdk.R; | 29 | import ly.warp.sdk.R; |
29 | import ly.warp.sdk.activities.BaseFragmentActivity; | 30 | import ly.warp.sdk.activities.BaseFragmentActivity; |
30 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 31 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
32 | +import ly.warp.sdk.io.callbacks.WarplyHealthCallback; | ||
33 | +import ly.warp.sdk.io.models.CouponsEventModel; | ||
34 | +import ly.warp.sdk.io.models.HealthEventModel; | ||
31 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 35 | import ly.warp.sdk.io.request.PacingCalculateRequest; |
32 | import ly.warp.sdk.utils.WarpUtils; | 36 | import ly.warp.sdk.utils.WarpUtils; |
37 | +import ly.warp.sdk.utils.managers.WarplyEventBusManager; | ||
33 | import ly.warp.sdk.utils.managers.WarplyManager; | 38 | import ly.warp.sdk.utils.managers.WarplyManager; |
34 | 39 | ||
35 | /** | 40 | /** |
... | @@ -50,6 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -50,6 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
50 | private SensorManager mSensorManager; | 55 | private SensorManager mSensorManager; |
51 | private Sensor mSensor; | 56 | private Sensor mSensor; |
52 | private int mSteps = 0; | 57 | private int mSteps = 0; |
58 | + private double mStepsAll = 0.0d; | ||
53 | private final int ACCEL_RING_SIZE = 50; | 59 | private final int ACCEL_RING_SIZE = 50; |
54 | private final int VEL_RING_SIZE = 10; | 60 | private final int VEL_RING_SIZE = 10; |
55 | // change this threshold according to your sensitivity preferences | 61 | // change this threshold according to your sensitivity preferences |
... | @@ -114,7 +120,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -114,7 +120,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
114 | while (true) { | 120 | while (true) { |
115 | sendSteps(); | 121 | sendSteps(); |
116 | try { | 122 | try { |
117 | - Thread.sleep(10000); //900000 | 123 | + Thread.sleep(900000); |
118 | } catch (InterruptedException e) { | 124 | } catch (InterruptedException e) { |
119 | e.printStackTrace(); | 125 | e.printStackTrace(); |
120 | } | 126 | } |
... | @@ -131,6 +137,8 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -131,6 +137,8 @@ public class WarplyHealthService extends Service implements SensorEventListener |
131 | super.onDestroy(); | 137 | super.onDestroy(); |
132 | 138 | ||
133 | unregisterStepSensor(); | 139 | unregisterStepSensor(); |
140 | + mStepsAll = 0.0d; | ||
141 | + WarpUtils.setStepsMetersCounter(this, 0.0d); | ||
134 | sendSteps(); | 142 | sendSteps(); |
135 | } | 143 | } |
136 | 144 | ||
... | @@ -201,6 +209,11 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -201,6 +209,11 @@ public class WarplyHealthService extends Service implements SensorEventListener |
201 | && oldVelocityEstimate <= STEP_THRESHOLD | 209 | && oldVelocityEstimate <= STEP_THRESHOLD |
202 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { | 210 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { |
203 | mSteps++; | 211 | mSteps++; |
212 | + mStepsAll++; | ||
213 | + HealthEventModel healthSteps = new HealthEventModel(); | ||
214 | + healthSteps.setSteps((mStepsAll * 0.762)); | ||
215 | + EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); | ||
216 | + WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); | ||
204 | WarpUtils.setStepsCounter(this, mSteps); | 217 | WarpUtils.setStepsCounter(this, mSteps); |
205 | 218 | ||
206 | lastStepTimeNs = timeNs; | 219 | lastStepTimeNs = timeNs; | ... | ... |
... | @@ -139,6 +139,8 @@ public class WarpUtils { | ... | @@ -139,6 +139,8 @@ public class WarpUtils { |
139 | + "steps_counter"; | 139 | + "steps_counter"; |
140 | private static final String PREFERENCES_KEY_USER_NON_TELCO = PREFERENCES_PREFIX | 140 | private static final String PREFERENCES_KEY_USER_NON_TELCO = PREFERENCES_PREFIX |
141 | + "user_non_telco"; | 141 | + "user_non_telco"; |
142 | + private static final String PREFERENCES_STEPS_METERS_COUNTER = PREFERENCES_PREFIX | ||
143 | + + "steps_meters_counter"; | ||
142 | 144 | ||
143 | private static SharedPreferences _prefs; | 145 | private static SharedPreferences _prefs; |
144 | 146 | ||
... | @@ -624,6 +626,17 @@ public class WarpUtils { | ... | @@ -624,6 +626,17 @@ public class WarpUtils { |
624 | return prefs.getInt(PREFERENCES_STEPS_COUNTER, 0); | 626 | return prefs.getInt(PREFERENCES_STEPS_COUNTER, 0); |
625 | } | 627 | } |
626 | 628 | ||
629 | + public static void setStepsMetersCounter(Context context, double counter) { | ||
630 | + SharedPreferences.Editor editor = getPreferences(context).edit(); | ||
631 | + editor.putLong(PREFERENCES_STEPS_METERS_COUNTER, Double.doubleToRawLongBits(counter)); | ||
632 | + editor.apply(); | ||
633 | + } | ||
634 | + | ||
635 | + public static double getStepsMetersCounter(Context context) { | ||
636 | + SharedPreferences prefs = getPreferences(context); | ||
637 | + return Double.longBitsToDouble(prefs.getLong(PREFERENCES_STEPS_METERS_COUNTER, 0)); | ||
638 | + } | ||
639 | + | ||
627 | public static JSONObject getDeviceInfoObject(Context context) { | 640 | public static JSONObject getDeviceInfoObject(Context context) { |
628 | SharedPreferences prefs = getPreferences(context); | 641 | SharedPreferences prefs = getPreferences(context); |
629 | try { | 642 | try { | ... | ... |
... | @@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.MerchantList; | ... | @@ -67,6 +67,7 @@ import ly.warp.sdk.io.models.MerchantList; |
67 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 67 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; |
68 | import ly.warp.sdk.io.request.CosmoteSharingRequest; | 68 | import ly.warp.sdk.io.request.CosmoteSharingRequest; |
69 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; | 69 | import ly.warp.sdk.io.request.WarplyIntegrationRequest; |
70 | +import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | ||
70 | import ly.warp.sdk.services.EventService; | 71 | import ly.warp.sdk.services.EventService; |
71 | import ly.warp.sdk.utils.managers.WarplyManager; | 72 | import ly.warp.sdk.utils.managers.WarplyManager; |
72 | 73 | ||
... | @@ -198,9 +199,20 @@ public class WarplyManagerHelper { | ... | @@ -198,9 +199,20 @@ public class WarplyManagerHelper { |
198 | @Override | 199 | @Override |
199 | public void onSuccess(JSONObject result) { | 200 | public void onSuccess(JSONObject result) { |
200 | int status = result.optInt("status", 2); | 201 | int status = result.optInt("status", 2); |
201 | - if (status == 1) | 202 | + if (status == 1) { |
203 | + WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), new CallbackReceiver<CouponList>() { | ||
204 | + @Override | ||
205 | + public void onSuccess(CouponList result) { | ||
206 | + | ||
207 | + } | ||
208 | + | ||
209 | + @Override | ||
210 | + public void onFailure(int errorCode) { | ||
211 | + | ||
212 | + } | ||
213 | + }); | ||
202 | acceptSharingDialog(context); | 214 | acceptSharingDialog(context); |
203 | - else | 215 | + } else |
204 | errorSharingDialog(context); | 216 | errorSharingDialog(context); |
205 | } | 217 | } |
206 | 218 | ... | ... |
... | @@ -5,12 +5,15 @@ import java.util.HashMap; | ... | @@ -5,12 +5,15 @@ import java.util.HashMap; |
5 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; | 5 | import ly.warp.sdk.io.models.ActiveDFYCouponEventModel; |
6 | import ly.warp.sdk.io.models.ContexualEventModel; | 6 | import ly.warp.sdk.io.models.ContexualEventModel; |
7 | import ly.warp.sdk.io.models.CouponEventModel; | 7 | import ly.warp.sdk.io.models.CouponEventModel; |
8 | +import ly.warp.sdk.io.models.CouponsEventModel; | ||
9 | +import ly.warp.sdk.io.models.HealthEventModel; | ||
8 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 10 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
9 | import ly.warp.sdk.io.models.LoyaltyEventModel; | 11 | import ly.warp.sdk.io.models.LoyaltyEventModel; |
10 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; | 12 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; |
11 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | 13 | import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; |
12 | import ly.warp.sdk.io.models.QuestionnaireEventModel; | 14 | import ly.warp.sdk.io.models.QuestionnaireEventModel; |
13 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; | 15 | import ly.warp.sdk.io.models.WarplyCCMSEnabledModel; |
16 | +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | ||
14 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; | 17 | import ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel; |
15 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; | 18 | import ly.warp.sdk.io.models.WarplyPacingCardEventModel; |
16 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; | 19 | import ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel; |
... | @@ -34,7 +37,10 @@ public class WarplyEventBusManager { | ... | @@ -34,7 +37,10 @@ public class WarplyEventBusManager { |
34 | private CouponEventModel coupon; | 37 | private CouponEventModel coupon; |
35 | private ActiveDFYCouponEventModel activeCoupon; | 38 | private ActiveDFYCouponEventModel activeCoupon; |
36 | private ContexualEventModel ccmsAdded; | 39 | private ContexualEventModel ccmsAdded; |
40 | + private CouponsEventModel couponsAdded; | ||
37 | private LoyaltyEventModel campaignsAdded; | 41 | private LoyaltyEventModel campaignsAdded; |
42 | + private HealthEventModel healthAdded; | ||
43 | + private WarplyCouponsChangedEventModel couponsChanged; | ||
38 | 44 | ||
39 | public WarplyEventBusManager() { | 45 | public WarplyEventBusManager() { |
40 | 46 | ||
... | @@ -52,6 +58,14 @@ public class WarplyEventBusManager { | ... | @@ -52,6 +58,14 @@ public class WarplyEventBusManager { |
52 | this.ccmsAdded = ccmsAdded; | 58 | this.ccmsAdded = ccmsAdded; |
53 | } | 59 | } |
54 | 60 | ||
61 | + public WarplyEventBusManager(CouponsEventModel couponsAdded) { | ||
62 | + this.couponsAdded = couponsAdded; | ||
63 | + } | ||
64 | + | ||
65 | + public WarplyEventBusManager(HealthEventModel healthAdded) { | ||
66 | + this.healthAdded = healthAdded; | ||
67 | + } | ||
68 | + | ||
55 | public WarplyEventBusManager(LoyaltyEventModel campaignsAdded) { | 69 | public WarplyEventBusManager(LoyaltyEventModel campaignsAdded) { |
56 | this.campaignsAdded = campaignsAdded; | 70 | this.campaignsAdded = campaignsAdded; |
57 | } | 71 | } |
... | @@ -60,6 +74,10 @@ public class WarplyEventBusManager { | ... | @@ -60,6 +74,10 @@ public class WarplyEventBusManager { |
60 | this.coupon = coupon; | 74 | this.coupon = coupon; |
61 | } | 75 | } |
62 | 76 | ||
77 | + public WarplyEventBusManager(WarplyCouponsChangedEventModel couponsChanged) { | ||
78 | + this.couponsChanged = couponsChanged; | ||
79 | + } | ||
80 | + | ||
63 | public WarplyEventBusManager(ActiveDFYCouponEventModel activeCoupon) { | 81 | public WarplyEventBusManager(ActiveDFYCouponEventModel activeCoupon) { |
64 | this.activeCoupon = activeCoupon; | 82 | this.activeCoupon = activeCoupon; |
65 | } | 83 | } |
... | @@ -174,7 +192,19 @@ public class WarplyEventBusManager { | ... | @@ -174,7 +192,19 @@ public class WarplyEventBusManager { |
174 | return ccmsAdded; | 192 | return ccmsAdded; |
175 | } | 193 | } |
176 | 194 | ||
195 | + public CouponsEventModel getCouponsAdded() { | ||
196 | + return couponsAdded; | ||
197 | + } | ||
198 | + | ||
177 | public LoyaltyEventModel getCampaignsAdded() { | 199 | public LoyaltyEventModel getCampaignsAdded() { |
178 | return campaignsAdded; | 200 | return campaignsAdded; |
179 | } | 201 | } |
202 | + | ||
203 | + public HealthEventModel getHealthAdded() { | ||
204 | + return healthAdded; | ||
205 | + } | ||
206 | + | ||
207 | + public WarplyCouponsChangedEventModel getCouponsChanged() { | ||
208 | + return couponsChanged; | ||
209 | + } | ||
180 | } | 210 | } | ... | ... |
... | @@ -32,6 +32,7 @@ import android.util.Log; | ... | @@ -32,6 +32,7 @@ import android.util.Log; |
32 | 32 | ||
33 | import androidx.appcompat.app.AlertDialog; | 33 | import androidx.appcompat.app.AlertDialog; |
34 | 34 | ||
35 | +import org.greenrobot.eventbus.EventBus; | ||
35 | import org.json.JSONArray; | 36 | import org.json.JSONArray; |
36 | import org.json.JSONException; | 37 | import org.json.JSONException; |
37 | import org.json.JSONObject; | 38 | import org.json.JSONObject; |
... | @@ -83,6 +84,7 @@ import ly.warp.sdk.io.models.SharingList; | ... | @@ -83,6 +84,7 @@ import ly.warp.sdk.io.models.SharingList; |
83 | import ly.warp.sdk.io.models.TagsCategoriesList; | 84 | import ly.warp.sdk.io.models.TagsCategoriesList; |
84 | import ly.warp.sdk.io.models.TagsList; | 85 | import ly.warp.sdk.io.models.TagsList; |
85 | import ly.warp.sdk.io.models.TransactionsList; | 86 | import ly.warp.sdk.io.models.TransactionsList; |
87 | +import ly.warp.sdk.io.models.WarplyCouponsChangedEventModel; | ||
86 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; | 88 | import ly.warp.sdk.io.request.CosmoteCouponSharingRequest; |
87 | import ly.warp.sdk.io.request.CosmotePostEventRequest; | 89 | import ly.warp.sdk.io.request.CosmotePostEventRequest; |
88 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; | 90 | import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; |
... | @@ -812,10 +814,10 @@ public class WarplyManager { | ... | @@ -812,10 +814,10 @@ public class WarplyManager { |
812 | 814 | ||
813 | if (result != null) { | 815 | if (result != null) { |
814 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | 816 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); |
815 | - if (profMetadata != null) { | 817 | + if (profMetadata != null && profMetadata.has("nonTelco")) { |
816 | - if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) { | 818 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); |
817 | - WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | 819 | + } else { |
818 | - } | 820 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); |
819 | } | 821 | } |
820 | } | 822 | } |
821 | 823 | ||
... | @@ -2235,6 +2237,9 @@ public class WarplyManager { | ... | @@ -2235,6 +2237,9 @@ public class WarplyManager { |
2235 | mActiveCouponList.add(coupon); | 2237 | mActiveCouponList.add(coupon); |
2236 | } | 2238 | } |
2237 | 2239 | ||
2240 | + WarplyCouponsChangedEventModel couponsChanged = new WarplyCouponsChangedEventModel(); | ||
2241 | + couponsChanged.setChanged(true); | ||
2242 | + EventBus.getDefault().post(new WarplyEventBusManager(couponsChanged)); | ||
2238 | receiver.onSuccess(mActiveCouponList); | 2243 | receiver.onSuccess(mActiveCouponList); |
2239 | } | 2244 | } |
2240 | 2245 | ||
... | @@ -2316,10 +2321,10 @@ public class WarplyManager { | ... | @@ -2316,10 +2321,10 @@ public class WarplyManager { |
2316 | 2321 | ||
2317 | if (result != null) { | 2322 | if (result != null) { |
2318 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); | 2323 | JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata()); |
2319 | - if (profMetadata != null) { | 2324 | + if (profMetadata != null && profMetadata.has("nonTelco")) { |
2320 | - if (profMetadata.has("nonTelco") && profMetadata.optBoolean("nonTelco")) { | 2325 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); |
2321 | - WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco")); | 2326 | + } else { |
2322 | - } | 2327 | + WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); |
2323 | } | 2328 | } |
2324 | } | 2329 | } |
2325 | 2330 | ... | ... |
... | @@ -35,6 +35,7 @@ import android.content.pm.ApplicationInfo; | ... | @@ -35,6 +35,7 @@ import android.content.pm.ApplicationInfo; |
35 | import android.net.Uri; | 35 | import android.net.Uri; |
36 | import android.net.http.SslError; | 36 | import android.net.http.SslError; |
37 | import android.os.Build; | 37 | import android.os.Build; |
38 | +import android.os.Handler; | ||
38 | import android.text.TextUtils; | 39 | import android.text.TextUtils; |
39 | import android.util.AttributeSet; | 40 | import android.util.AttributeSet; |
40 | import android.webkit.GeolocationPermissions.Callback; | 41 | import android.webkit.GeolocationPermissions.Callback; |
... | @@ -63,6 +64,7 @@ import java.util.Map; | ... | @@ -63,6 +64,7 @@ import java.util.Map; |
63 | import java.util.concurrent.TimeUnit; | 64 | import java.util.concurrent.TimeUnit; |
64 | 65 | ||
65 | import ly.warp.sdk.Warply; | 66 | import ly.warp.sdk.Warply; |
67 | +import ly.warp.sdk.activities.WarpViewActivity; | ||
66 | import ly.warp.sdk.io.models.CouponEventModel; | 68 | import ly.warp.sdk.io.models.CouponEventModel; |
67 | import ly.warp.sdk.io.models.QuestionnaireEventModel; | 69 | import ly.warp.sdk.io.models.QuestionnaireEventModel; |
68 | import ly.warp.sdk.io.models.WarplyPacingEventModel; | 70 | import ly.warp.sdk.io.models.WarplyPacingEventModel; |
... | @@ -508,6 +510,19 @@ public class WarpView extends WebView { | ... | @@ -508,6 +510,19 @@ public class WarpView extends WebView { |
508 | view.evaluateJavascript(scriptSource, s -> { | 510 | view.evaluateJavascript(scriptSource, s -> { |
509 | 511 | ||
510 | }); | 512 | }); |
513 | + | ||
514 | + WarpViewActivity.getMetersHandler().postDelayed(new Runnable() { | ||
515 | + @Override | ||
516 | + public void run() { | ||
517 | + String tempMeters = String.valueOf(WarpUtils.getStepsMetersCounter(getContext())); | ||
518 | + String scriptSourceMeters = "passMeters(" + tempMeters + ");"; | ||
519 | + WarpView.this.evaluateJavascript(scriptSourceMeters, s -> { | ||
520 | + | ||
521 | + }); | ||
522 | + WarpViewActivity.getMetersHandler().postDelayed(this, 1000); | ||
523 | + } | ||
524 | + }, 1000); | ||
525 | + | ||
511 | if (url.contains("about:blank")) { | 526 | if (url.contains("about:blank")) { |
512 | WarpView.this.clearHistory(); | 527 | WarpView.this.clearHistory(); |
513 | } | 528 | } | ... | ... |
... | @@ -20,6 +20,13 @@ | ... | @@ -20,6 +20,13 @@ |
20 | android:background="@drawable/selector_cos_campaign"> | 20 | android:background="@drawable/selector_cos_campaign"> |
21 | 21 | ||
22 | <androidx.constraintlayout.widget.Guideline | 22 | <androidx.constraintlayout.widget.Guideline |
23 | + android:id="@+id/gl_vertical_54_percent" | ||
24 | + android:layout_width="wrap_content" | ||
25 | + android:layout_height="wrap_content" | ||
26 | + android:orientation="vertical" | ||
27 | + app:layout_constraintGuide_percent="0.54" /> | ||
28 | + | ||
29 | + <androidx.constraintlayout.widget.Guideline | ||
23 | android:id="@+id/gl_vertical_80_percent" | 30 | android:id="@+id/gl_vertical_80_percent" |
24 | android:layout_width="wrap_content" | 31 | android:layout_width="wrap_content" |
25 | android:layout_height="wrap_content" | 32 | android:layout_height="wrap_content" |
... | @@ -30,10 +37,10 @@ | ... | @@ -30,10 +37,10 @@ |
30 | android:id="@+id/iv_campaign_logo" | 37 | android:id="@+id/iv_campaign_logo" |
31 | android:layout_width="0dp" | 38 | android:layout_width="0dp" |
32 | android:layout_height="0dp" | 39 | android:layout_height="0dp" |
33 | - android:scaleType="centerCrop" | 40 | + android:scaleType="centerInside" |
34 | app:layout_constraintBottom_toBottomOf="parent" | 41 | app:layout_constraintBottom_toBottomOf="parent" |
35 | app:layout_constraintEnd_toEndOf="parent" | 42 | app:layout_constraintEnd_toEndOf="parent" |
36 | - app:layout_constraintStart_toStartOf="parent" | 43 | + app:layout_constraintStart_toEndOf="@+id/gl_vertical_54_percent" |
37 | app:layout_constraintTop_toTopOf="parent" | 44 | app:layout_constraintTop_toTopOf="parent" |
38 | tools:src="@drawable/ic_cosmote_logo_horizontal_grey" /> | 45 | tools:src="@drawable/ic_cosmote_logo_horizontal_grey" /> |
39 | 46 | ... | ... |
... | @@ -13,7 +13,7 @@ | ... | @@ -13,7 +13,7 @@ |
13 | <string name="cos_profile_type">Traveller</string> | 13 | <string name="cos_profile_type">Traveller</string> |
14 | <string name="header_add">Προσθήκη</string> | 14 | <string name="header_add">Προσθήκη</string> |
15 | <string name="cos_profile_reward">My Loyalty\nWallet</string> | 15 | <string name="cos_profile_reward">My Loyalty\nWallet</string> |
16 | - <string name="cos_profile_title">For You</string> | 16 | + <string name="cos_profile_title">Tα προνόμιά μου</string> |
17 | <string name="cos_deals_title">Deals for You</string> | 17 | <string name="cos_deals_title">Deals for You</string> |
18 | <string name="cos_profile_more">Δες περισσότερα</string> | 18 | <string name="cos_profile_more">Δες περισσότερα</string> |
19 | <string name="cos_gifts_title">GIFTS for YOU</string> | 19 | <string name="cos_gifts_title">GIFTS for YOU</string> | ... | ... |
-
Please register or login to post a comment