Showing
5 changed files
with
76 additions
and
27 deletions
... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' | ... | @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' |
2 | 2 | ||
3 | ext { | 3 | ext { |
4 | PUBLISH_GROUP_ID = 'ly.warp' | 4 | PUBLISH_GROUP_ID = 'ly.warp' |
5 | - PUBLISH_VERSION = '4.5.4-cosbeta79' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta80' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -160,8 +160,34 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -160,8 +160,34 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
160 | @Override | 160 | @Override |
161 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 161 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
162 | if (requestCode == 1004) { | 162 | if (requestCode == 1004) { |
163 | - OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 163 | +// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); |
164 | - WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork); | 164 | +// WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork); |
165 | + | ||
166 | + filterItems(); | ||
167 | + | ||
168 | + if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | ||
169 | + mHashSetSeasonalList.clear(); | ||
170 | + mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | ||
171 | + mSeasonalList.clear(); | ||
172 | + mSeasonalList.addAll(mHashSetSeasonalList); | ||
173 | + } | ||
174 | + | ||
175 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
176 | + mContextualList.clear(); | ||
177 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
178 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
179 | + && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
180 | + mContextualList.add(ccmsItem); | ||
181 | + } | ||
182 | + } | ||
183 | + | ||
184 | + mergeDatasets( | ||
185 | + mSeasonalList, | ||
186 | + mContextualList, | ||
187 | + mValuesList | ||
188 | + ); | ||
189 | + | ||
190 | + initViews2(); | ||
165 | } | 191 | } |
166 | } | 192 | } |
167 | 193 | ... | ... |
... | @@ -181,8 +181,34 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -181,8 +181,34 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
181 | @Override | 181 | @Override |
182 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { | 182 | protected void onActivityResult(int requestCode, int resultCode, Intent data) { |
183 | if (requestCode == 1003) { | 183 | if (requestCode == 1003) { |
184 | - OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 184 | +// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); |
185 | - WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork); | 185 | +// WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork); |
186 | + | ||
187 | + // filterItems(); | ||
188 | + | ||
189 | + /** New Implementation */ | ||
190 | + filterItemsNew(); | ||
191 | + /** New Implementation */ | ||
192 | + | ||
193 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
194 | + mContextualList.clear(); | ||
195 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
196 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
197 | + && ccmsItem.getZone().equals("COSMOTE_APP_MORE4U")) | ||
198 | + mContextualList.add(ccmsItem); | ||
199 | + } | ||
200 | + } | ||
201 | + | ||
202 | +// mergeDatasets( | ||
203 | +// mValuesList, | ||
204 | +// mContextualList | ||
205 | +// ); | ||
206 | + | ||
207 | +// initViews2(); | ||
208 | + | ||
209 | + /** New Implementation */ | ||
210 | + initViewsNew2(); | ||
211 | + /** New Implementation */ | ||
186 | } | 212 | } |
187 | } | 213 | } |
188 | 214 | ... | ... |
... | @@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
57 | private final int ACCEL_RING_SIZE = 50; | 57 | private final int ACCEL_RING_SIZE = 50; |
58 | private final int VEL_RING_SIZE = 10; | 58 | private final int VEL_RING_SIZE = 10; |
59 | // change this threshold according to your sensitivity preferences | 59 | // change this threshold according to your sensitivity preferences |
60 | - private final float STEP_THRESHOLD = 60f; // default 40, cosmote default 20 | 60 | + private final float STEP_THRESHOLD = 20f; // default 40, cosmote default 20 |
61 | private final int STEP_DELAY_NS = 250000000; | 61 | private final int STEP_DELAY_NS = 250000000; |
62 | private int accelRingCounter = 0; | 62 | private int accelRingCounter = 0; |
63 | private float[] accelRingX = new float[ACCEL_RING_SIZE]; | 63 | private float[] accelRingX = new float[ACCEL_RING_SIZE]; | ... | ... |
... | @@ -1364,21 +1364,20 @@ public class WarplyManager { | ... | @@ -1364,21 +1364,20 @@ public class WarplyManager { |
1364 | }); | 1364 | }); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | - public static void getCampaigns(WarplyGetCampaignsRequest request, final CallbackReceiver<CampaignList> receiver) { | 1367 | + public static void getCampaigns(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) { |
1368 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | 1368 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); |
1369 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | 1369 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); |
1370 | WarpUtils.log("**************************************************"); | 1370 | WarpUtils.log("**************************************************"); |
1371 | 1371 | ||
1372 | - Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<CampaignList>() { | 1372 | + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { |
1373 | @Override | 1373 | @Override |
1374 | - public void onSuccess(CampaignList result) { | 1374 | + public void onSuccess(ArrayList<Campaign> result) { |
1375 | // receiver.onSuccess(result); | 1375 | // receiver.onSuccess(result); |
1376 | mNewCampaignList.clear(); | 1376 | mNewCampaignList.clear(); |
1377 | - ArrayList<Campaign> tempCamps = new ArrayList<Campaign>(result); | 1377 | + mNewCampaignList.addAll(result); |
1378 | - mNewCampaignList.addAll(tempCamps); | 1378 | + getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() { |
1379 | - getCampaignsPersonalized(request, new CallbackReceiver<CampaignList>() { | ||
1380 | @Override | 1379 | @Override |
1381 | - public void onSuccess(CampaignList resultPersonalized) { | 1380 | + public void onSuccess(ArrayList<Campaign> resultPersonalized) { |
1382 | receiver.onSuccess(resultPersonalized); | 1381 | receiver.onSuccess(resultPersonalized); |
1383 | } | 1382 | } |
1384 | 1383 | ||
... | @@ -1397,18 +1396,17 @@ public class WarplyManager { | ... | @@ -1397,18 +1396,17 @@ public class WarplyManager { |
1397 | request.getSignature())); | 1396 | request.getSignature())); |
1398 | } | 1397 | } |
1399 | 1398 | ||
1400 | - public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<CampaignList> receiver) { | 1399 | + public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) { |
1401 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | 1400 | WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); |
1402 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | 1401 | WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); |
1403 | WarpUtils.log("**************************************************"); | 1402 | WarpUtils.log("**************************************************"); |
1404 | 1403 | ||
1405 | - Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<CampaignList>() { | 1404 | + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { |
1406 | @Override | 1405 | @Override |
1407 | - public void onSuccess(CampaignList result) { | 1406 | + public void onSuccess(ArrayList<Campaign> result) { |
1408 | - ArrayList<Campaign> tempCamps = new ArrayList<Campaign>(result); | 1407 | + mNewCampaignList.addAll(result); |
1409 | - mNewCampaignList.addAll(tempCamps); | ||
1410 | Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); | 1408 | Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); |
1411 | - CampaignList campaignLoyaltyList = new CampaignList(); | 1409 | + ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>(); |
1412 | campaignLoyaltyList.clear(); | 1410 | campaignLoyaltyList.clear(); |
1413 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); | 1411 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); |
1414 | campaignCarouselList.clear(); | 1412 | campaignCarouselList.clear(); |
... | @@ -2027,11 +2025,10 @@ public class WarplyManager { | ... | @@ -2027,11 +2025,10 @@ public class WarplyManager { |
2027 | // } | 2025 | // } |
2028 | // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); | 2026 | // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); |
2029 | 2027 | ||
2030 | - CampaignList tempAllCamps = new CampaignList(); | ||
2031 | Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); | 2028 | Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); |
2032 | - tempAllCamps.clear(); | 2029 | + campaignLoyaltyList.clear(); |
2033 | - tempAllCamps.addAll(set); | 2030 | + campaignLoyaltyList.addAll(set); |
2034 | - receiver.onSuccess(tempAllCamps); //result, //campaignLoyaltyList | 2031 | + receiver.onSuccess(campaignLoyaltyList); //result |
2035 | } | 2032 | } |
2036 | 2033 | ||
2037 | @Override | 2034 | @Override |
... | @@ -2594,9 +2591,9 @@ public class WarplyManager { | ... | @@ -2594,9 +2591,9 @@ public class WarplyManager { |
2594 | new CallbackReceiver<JSONObject>() { | 2591 | new CallbackReceiver<JSONObject>() { |
2595 | @Override | 2592 | @Override |
2596 | public void onSuccess(JSONObject result) { | 2593 | public void onSuccess(JSONObject result) { |
2597 | - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | 2594 | + getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() { |
2598 | @Override | 2595 | @Override |
2599 | - public void onSuccess(CampaignList result) { | 2596 | + public void onSuccess(ArrayList<Campaign> result) { |
2600 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 2597 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); |
2601 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | 2598 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); |
2602 | } | 2599 | } |
... | @@ -2610,9 +2607,9 @@ public class WarplyManager { | ... | @@ -2610,9 +2607,9 @@ public class WarplyManager { |
2610 | 2607 | ||
2611 | @Override | 2608 | @Override |
2612 | public void onFailure(int errorCode) { | 2609 | public void onFailure(int errorCode) { |
2613 | - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() { | 2610 | + getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() { |
2614 | @Override | 2611 | @Override |
2615 | - public void onSuccess(CampaignList result) { | 2612 | + public void onSuccess(ArrayList<Campaign> result) { |
2616 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); | 2613 | OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build(); |
2617 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); | 2614 | WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork); |
2618 | } | 2615 | } | ... | ... |
-
Please register or login to post a comment