Showing
7 changed files
with
95 additions
and
12 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("7000001025"), //6012049321, 6012049322, 6012049323 | 39 | + .setGuid("7000001018"), //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-cosbeta58' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta59i' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -53,17 +53,23 @@ import org.greenrobot.eventbus.Subscribe; | ... | @@ -53,17 +53,23 @@ import org.greenrobot.eventbus.Subscribe; |
53 | import org.json.JSONObject; | 53 | import org.json.JSONObject; |
54 | 54 | ||
55 | import java.security.SecureRandom; | 55 | import java.security.SecureRandom; |
56 | +import java.text.SimpleDateFormat; | ||
57 | +import java.util.Date; | ||
58 | +import java.util.Locale; | ||
56 | import java.util.concurrent.ThreadLocalRandom; | 59 | import java.util.concurrent.ThreadLocalRandom; |
57 | import java.util.concurrent.TimeUnit; | 60 | import java.util.concurrent.TimeUnit; |
58 | 61 | ||
59 | import ly.warp.sdk.Warply; | 62 | import ly.warp.sdk.Warply; |
60 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 63 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
61 | import ly.warp.sdk.io.models.CouponList; | 64 | import ly.warp.sdk.io.models.CouponList; |
65 | +import ly.warp.sdk.io.request.PacingCalculateRequest; | ||
62 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; | 66 | import ly.warp.sdk.io.request.WarplyUserCouponsRequest; |
63 | import ly.warp.sdk.services.EventQuestionnaireService; | 67 | import ly.warp.sdk.services.EventQuestionnaireService; |
64 | import ly.warp.sdk.services.PushEventsClickedWorkerService; | 68 | import ly.warp.sdk.services.PushEventsClickedWorkerService; |
69 | +import ly.warp.sdk.services.WarplyHealthService; | ||
65 | import ly.warp.sdk.utils.WarpJSONParser; | 70 | import ly.warp.sdk.utils.WarpJSONParser; |
66 | import ly.warp.sdk.utils.WarpUtils; | 71 | import ly.warp.sdk.utils.WarpUtils; |
72 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
67 | import ly.warp.sdk.utils.WarplyPreferences; | 73 | import ly.warp.sdk.utils.WarplyPreferences; |
68 | import ly.warp.sdk.utils.WarplyProperty; | 74 | import ly.warp.sdk.utils.WarplyProperty; |
69 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 75 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
... | @@ -120,6 +126,7 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -120,6 +126,7 @@ public class WarpViewActivity extends WarpBaseActivity { |
120 | super.onDestroy(); | 126 | super.onDestroy(); |
121 | if (metersHandler != null) | 127 | if (metersHandler != null) |
122 | metersHandler.removeCallbacksAndMessages(null); | 128 | metersHandler.removeCallbacksAndMessages(null); |
129 | + sendSteps(); | ||
123 | WarpUtils.setWebviewParams(this, new JSONObject()); | 130 | WarpUtils.setWebviewParams(this, new JSONObject()); |
124 | } | 131 | } |
125 | 132 | ||
... | @@ -144,9 +151,9 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -144,9 +151,9 @@ public class WarpViewActivity extends WarpBaseActivity { |
144 | setResult(RESULT_OK, new Intent()); | 151 | setResult(RESULT_OK, new Intent()); |
145 | finish(); | 152 | finish(); |
146 | } | 153 | } |
147 | - if (event.getCoupon() != null) { | 154 | +// if (event.getCoupon() != null) { |
148 | - WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); | 155 | +// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver); |
149 | - } | 156 | +// } |
150 | // if (event.getPacingCard() != null) | 157 | // if (event.getPacingCard() != null) |
151 | // finish(); | 158 | // finish(); |
152 | // if (event.getPacingService() != null) | 159 | // if (event.getPacingService() != null) |
... | @@ -286,4 +293,29 @@ public class WarpViewActivity extends WarpBaseActivity { | ... | @@ -286,4 +293,29 @@ public class WarpViewActivity extends WarpBaseActivity { |
286 | public static Handler getMetersHandler() { | 293 | public static Handler getMetersHandler() { |
287 | return metersHandler; | 294 | return metersHandler; |
288 | } | 295 | } |
296 | + | ||
297 | + private void sendSteps() { | ||
298 | + String date = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss", Locale.getDefault()).format(new Date()); | ||
299 | + | ||
300 | + if (WarpUtils.getStepsCounter(this) > 0) { | ||
301 | + WarplyManager.setPacingDetails(new PacingCalculateRequest() | ||
302 | + .setCounter(WarpUtils.getStepsCounter(this)) | ||
303 | + .setDate(date), | ||
304 | + new CallbackReceiver<JSONObject>() { | ||
305 | + @Override | ||
306 | + public void onSuccess(JSONObject result) { | ||
307 | + int status = result.optInt("status", 2); | ||
308 | + if (status == 1) { | ||
309 | + WarplyManagerHelper.mSteps = 0; | ||
310 | + WarpUtils.setStepsCounter(WarpViewActivity.this, 0); | ||
311 | + } | ||
312 | + } | ||
313 | + | ||
314 | + @Override | ||
315 | + public void onFailure(int errorCode) { | ||
316 | + WarpUtils.log("Warply Health Service error: " + String.valueOf(errorCode)); | ||
317 | + } | ||
318 | + }); | ||
319 | + } | ||
320 | + } | ||
289 | } | 321 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -34,6 +34,7 @@ import ly.warp.sdk.io.models.CouponsEventModel; | ... | @@ -34,6 +34,7 @@ import ly.warp.sdk.io.models.CouponsEventModel; |
34 | import ly.warp.sdk.io.models.HealthEventModel; | 34 | import ly.warp.sdk.io.models.HealthEventModel; |
35 | import ly.warp.sdk.io.request.PacingCalculateRequest; | 35 | import ly.warp.sdk.io.request.PacingCalculateRequest; |
36 | import ly.warp.sdk.utils.WarpUtils; | 36 | import ly.warp.sdk.utils.WarpUtils; |
37 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
37 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 38 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
38 | import ly.warp.sdk.utils.managers.WarplyManager; | 39 | import ly.warp.sdk.utils.managers.WarplyManager; |
39 | 40 | ||
... | @@ -54,7 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -54,7 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
54 | 55 | ||
55 | private SensorManager mSensorManager; | 56 | private SensorManager mSensorManager; |
56 | private Sensor mSensor; | 57 | private Sensor mSensor; |
57 | - private int mSteps = 0; | 58 | + // private int mSteps = 0; |
58 | private double mStepsAll = 0.0d; | 59 | private double mStepsAll = 0.0d; |
59 | private final int ACCEL_RING_SIZE = 50; | 60 | private final int ACCEL_RING_SIZE = 50; |
60 | private final int VEL_RING_SIZE = 10; | 61 | private final int VEL_RING_SIZE = 10; |
... | @@ -139,6 +140,8 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -139,6 +140,8 @@ public class WarplyHealthService extends Service implements SensorEventListener |
139 | unregisterStepSensor(); | 140 | unregisterStepSensor(); |
140 | mStepsAll = 0.0d; | 141 | mStepsAll = 0.0d; |
141 | WarpUtils.setStepsMetersCounter(this, 0.0d); | 142 | WarpUtils.setStepsMetersCounter(this, 0.0d); |
143 | + WarplyManagerHelper.mStepsWebview = 0; | ||
144 | + WarplyManagerHelper.mMetersWebview = 0.0d; | ||
142 | sendSteps(); | 145 | sendSteps(); |
143 | } | 146 | } |
144 | 147 | ||
... | @@ -208,13 +211,15 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -208,13 +211,15 @@ public class WarplyHealthService extends Service implements SensorEventListener |
208 | if (velocityEstimate > STEP_THRESHOLD | 211 | if (velocityEstimate > STEP_THRESHOLD |
209 | && oldVelocityEstimate <= STEP_THRESHOLD | 212 | && oldVelocityEstimate <= STEP_THRESHOLD |
210 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { | 213 | && (timeNs - lastStepTimeNs > STEP_DELAY_NS)) { |
211 | - mSteps++; | 214 | + WarplyManagerHelper.mSteps++; |
212 | mStepsAll++; | 215 | mStepsAll++; |
216 | + WarplyManagerHelper.mStepsWebview++; | ||
217 | + WarplyManagerHelper.mMetersWebview = (WarplyManagerHelper.mStepsWebview * 0.762); | ||
213 | HealthEventModel healthSteps = new HealthEventModel(); | 218 | HealthEventModel healthSteps = new HealthEventModel(); |
214 | healthSteps.setMeters((mStepsAll * 0.762)); | 219 | healthSteps.setMeters((mStepsAll * 0.762)); |
215 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); | 220 | EventBus.getDefault().post(new WarplyEventBusManager(healthSteps)); |
216 | WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); | 221 | WarpUtils.setStepsMetersCounter(this, (mStepsAll * 0.762)); |
217 | - WarpUtils.setStepsCounter(this, mSteps); | 222 | + WarpUtils.setStepsCounter(this, WarplyManagerHelper.mSteps); |
218 | 223 | ||
219 | lastStepTimeNs = timeNs; | 224 | lastStepTimeNs = timeNs; |
220 | } | 225 | } |
... | @@ -270,7 +275,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -270,7 +275,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
270 | public void onSuccess(JSONObject result) { | 275 | public void onSuccess(JSONObject result) { |
271 | int status = result.optInt("status", 2); | 276 | int status = result.optInt("status", 2); |
272 | if (status == 1) { | 277 | if (status == 1) { |
273 | - mSteps = 0; | 278 | + WarplyManagerHelper.mSteps = 0; |
274 | WarpUtils.setStepsCounter(WarplyHealthService.this, 0); | 279 | WarpUtils.setStepsCounter(WarplyHealthService.this, 0); |
275 | } | 280 | } |
276 | } | 281 | } | ... | ... |
... | @@ -103,6 +103,9 @@ public class WarplyManagerHelper { | ... | @@ -103,6 +103,9 @@ public class WarplyManagerHelper { |
103 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); | 103 | private static LoyaltyBadgeModel mLoyaltyBadge = new LoyaltyBadgeModel(); |
104 | private static float mDealsSum = 0.0f; | 104 | private static float mDealsSum = 0.0f; |
105 | private static MerchantList mMerchantList = new MerchantList(); | 105 | private static MerchantList mMerchantList = new MerchantList(); |
106 | + public static double mMetersWebview = 0.0d; | ||
107 | + public static int mStepsWebview = 0; | ||
108 | + public static int mSteps = 0; | ||
106 | 109 | ||
107 | // =========================================================== | 110 | // =========================================================== |
108 | // Methods for/from SuperClass/Interfaces | 111 | // Methods for/from SuperClass/Interfaces |
... | @@ -727,7 +730,8 @@ public class WarplyManagerHelper { | ... | @@ -727,7 +730,8 @@ public class WarplyManagerHelper { |
727 | */ | 730 | */ |
728 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { | 731 | public static void setCCMSLoyaltyCampaigns(ArrayList<LoyaltyContextualOfferModel> list) { |
729 | mCCMSList.clear(); | 732 | mCCMSList.clear(); |
730 | - mCCMSList.addAll(list); | 733 | +// mCCMSList.addAll(list); |
734 | + mCCMSList = list; | ||
731 | 735 | ||
732 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build(); | 736 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build(); |
733 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | 737 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | ... | ... |
... | @@ -1523,6 +1523,45 @@ public class WarplyManager { | ... | @@ -1523,6 +1523,45 @@ public class WarplyManager { |
1523 | // " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" + | 1523 | // " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" + |
1524 | // " },\n" + | 1524 | // " },\n" + |
1525 | // " {\n" + | 1525 | // " {\n" + |
1526 | +// " \"UACIOfferTrackingCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" + | ||
1527 | +// " \"businessAdditionalId\": \"\",\n" + | ||
1528 | +// " \"dataCategory\": \"Data\",\n" + | ||
1529 | +// " \"dataValue\": \"1\",\n" + | ||
1530 | +// " \"description\": \"5days1000 3744\",\n" + | ||
1531 | +// " \"discount\": \"None\",\n" + | ||
1532 | +// " \"duration\": \"5\",\n" + | ||
1533 | +// " \"eligibleAssets\": [],\n" + | ||
1534 | +// " \"giftType\": \"GB\",\n" + | ||
1535 | +// " \"giftValue\": \"1\",\n" + | ||
1536 | +// " \"id\": \"000003744\",\n" + | ||
1537 | +// " \"imageOfferUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_detailed_default.png\",\n" + | ||
1538 | +// " \"imageUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_store_default.png\",\n" + | ||
1539 | +// " \"loyaltyCampaignId\": \"NA\",\n" + | ||
1540 | +// " \"minsValue\": \"None\",\n" + | ||
1541 | +// " \"noOfRecurrance\": \"5\",\n" + | ||
1542 | +// " \"notificationMessage\": \"5days1000 3744\",\n" + | ||
1543 | +// " \"offerAudienceLevel\": \"guid\",\n" + | ||
1544 | +// " \"offerCode1\": \"000003744\",\n" + | ||
1545 | +// " \"offerName\": \"White_Label_5days1000 3744\",\n" + | ||
1546 | +// " \"price\": \"0\",\n" + | ||
1547 | +// " \"productType\": \"White Label\",\n" + | ||
1548 | +// " \"provDuration\": \"1.0\",\n" + | ||
1549 | +// " \"score\": \"50\",\n" + | ||
1550 | +// " \"sessionId\": \"COSMOTE_APP_BALANCES.6945251078.20220908115231\",\n" + | ||
1551 | +// " \"treatmentCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" + | ||
1552 | +// " \"validity\": \"0\",\n" + | ||
1553 | +// " \"wave\": \"1\",\n" + | ||
1554 | +// " \"voiceCategory\": \"None\",\n" + | ||
1555 | +// " \"validity\": \"5\",\n" + | ||
1556 | +// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" + | ||
1557 | +// " \"title\": \"White_Label_5days1000 3744\",\n" + | ||
1558 | +// " \"titleOffer\": \"5days1000 3744\",\n" + | ||
1559 | +// " \"termsAndConditions\": \"5days1000 3744\",\n" + | ||
1560 | +// " \"subtitle\": \"5days1000 3744\",\n" + | ||
1561 | +// " \"description\": \"Test6\",\n" + | ||
1562 | +// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" + | ||
1563 | +// " },\n" + | ||
1564 | +// " {\n" + | ||
1526 | // " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" + | 1565 | // " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" + |
1527 | // " \"businessAdditionalId\": \"\",\n" + | 1566 | // " \"businessAdditionalId\": \"\",\n" + |
1528 | // " \"dataCategory\": \"Data\",\n" + | 1567 | // " \"dataCategory\": \"Data\",\n" + | ... | ... |
... | @@ -70,6 +70,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel; | ... | @@ -70,6 +70,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel; |
70 | import ly.warp.sdk.io.models.WarplyPacingEventModel; | 70 | import ly.warp.sdk.io.models.WarplyPacingEventModel; |
71 | import ly.warp.sdk.services.WarplyHealthService; | 71 | import ly.warp.sdk.services.WarplyHealthService; |
72 | import ly.warp.sdk.utils.WarpUtils; | 72 | import ly.warp.sdk.utils.WarpUtils; |
73 | +import ly.warp.sdk.utils.WarplyManagerHelper; | ||
73 | import ly.warp.sdk.utils.WarplyProperty; | 74 | import ly.warp.sdk.utils.WarplyProperty; |
74 | import ly.warp.sdk.utils.WarplyUrlHandler; | 75 | import ly.warp.sdk.utils.WarplyUrlHandler; |
75 | import ly.warp.sdk.utils.constants.WarpConstants; | 76 | import ly.warp.sdk.utils.constants.WarpConstants; |
... | @@ -405,7 +406,7 @@ public class WarpView extends WebView { | ... | @@ -405,7 +406,7 @@ public class WarpView extends WebView { |
405 | EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); | 406 | EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); |
406 | } | 407 | } |
407 | } else if (parts[1].equals("couponRetrieved")) { | 408 | } else if (parts[1].equals("couponRetrieved")) { |
408 | - EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); | 409 | +// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); |
409 | } else if (parts[1].equals("couponShared")) { | 410 | } else if (parts[1].equals("couponShared")) { |
410 | // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); | 411 | // EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); |
411 | } /*else if (parts[2].equals("serviceDisabled")) { | 412 | } /*else if (parts[2].equals("serviceDisabled")) { |
... | @@ -514,11 +515,13 @@ public class WarpView extends WebView { | ... | @@ -514,11 +515,13 @@ public class WarpView extends WebView { |
514 | WarpViewActivity.getMetersHandler().postDelayed(new Runnable() { | 515 | WarpViewActivity.getMetersHandler().postDelayed(new Runnable() { |
515 | @Override | 516 | @Override |
516 | public void run() { | 517 | public void run() { |
517 | - String tempMeters = String.valueOf(WarpUtils.getStepsMetersCounter(getContext())); | 518 | + String tempMeters = String.valueOf(WarplyManagerHelper.mMetersWebview); |
518 | String scriptSourceMeters = "passMeters(" + tempMeters + ");"; | 519 | String scriptSourceMeters = "passMeters(" + tempMeters + ");"; |
519 | WarpView.this.evaluateJavascript(scriptSourceMeters, s -> { | 520 | WarpView.this.evaluateJavascript(scriptSourceMeters, s -> { |
520 | 521 | ||
521 | }); | 522 | }); |
523 | + WarplyManagerHelper.mStepsWebview = 0; | ||
524 | + WarplyManagerHelper.mMetersWebview = 0.0d; | ||
522 | WarpViewActivity.getMetersHandler().postDelayed(this, 1000); | 525 | WarpViewActivity.getMetersHandler().postDelayed(this, 1000); |
523 | } | 526 | } |
524 | }, 1000); | 527 | }, 1000); | ... | ... |
-
Please register or login to post a comment