Panagiotis Triantafyllou

minor fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta79'
PUBLISH_VERSION = '4.5.4-cosbeta80'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -160,8 +160,34 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1004) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork);
// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
// WorkManager.getInstance(GiftsForYouActivity.this).enqueue(mywork);
filterItems();
if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) {
mHashSetSeasonalList.clear();
mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList());
mSeasonalList.clear();
mSeasonalList.addAll(mHashSetSeasonalList);
}
if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
mContextualList.clear();
for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
&& ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U"))
mContextualList.add(ccmsItem);
}
}
mergeDatasets(
mSeasonalList,
mContextualList,
mValuesList
);
initViews2();
}
}
......
......@@ -181,8 +181,34 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (requestCode == 1003) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork);
// OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
// WorkManager.getInstance(MoreForYouActivity.this).enqueue(mywork);
// filterItems();
/** New Implementation */
filterItemsNew();
/** New Implementation */
if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) {
mContextualList.clear();
for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA"))
&& ccmsItem.getZone().equals("COSMOTE_APP_MORE4U"))
mContextualList.add(ccmsItem);
}
}
// mergeDatasets(
// mValuesList,
// mContextualList
// );
// initViews2();
/** New Implementation */
initViewsNew2();
/** New Implementation */
}
}
......
......@@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private final int ACCEL_RING_SIZE = 50;
private final int VEL_RING_SIZE = 10;
// change this threshold according to your sensitivity preferences
private final float STEP_THRESHOLD = 60f; // default 40, cosmote default 20
private final float STEP_THRESHOLD = 20f; // default 40, cosmote default 20
private final int STEP_DELAY_NS = 250000000;
private int accelRingCounter = 0;
private float[] accelRingX = new float[ACCEL_RING_SIZE];
......
......@@ -1364,21 +1364,20 @@ public class WarplyManager {
});
}
public static void getCampaigns(WarplyGetCampaignsRequest request, final CallbackReceiver<CampaignList> receiver) {
public static void getCampaigns(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) {
WarpUtils.log("************* WARPLY Get Campaigns Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active");
WarpUtils.log("**************************************************");
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<CampaignList>() {
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
// receiver.onSuccess(result);
mNewCampaignList.clear();
ArrayList<Campaign> tempCamps = new ArrayList<Campaign>(result);
mNewCampaignList.addAll(tempCamps);
getCampaignsPersonalized(request, new CallbackReceiver<CampaignList>() {
mNewCampaignList.addAll(result);
getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList resultPersonalized) {
public void onSuccess(ArrayList<Campaign> resultPersonalized) {
receiver.onSuccess(resultPersonalized);
}
......@@ -1397,18 +1396,17 @@ public class WarplyManager {
request.getSignature()));
}
public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<CampaignList> receiver) {
public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) {
WarpUtils.log("************* WARPLY Get Campaigns Request ********************");
WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active");
WarpUtils.log("**************************************************");
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<CampaignList>() {
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
ArrayList<Campaign> tempCamps = new ArrayList<Campaign>(result);
mNewCampaignList.addAll(tempCamps);
public void onSuccess(ArrayList<Campaign> result) {
mNewCampaignList.addAll(result);
Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting()));
CampaignList campaignLoyaltyList = new CampaignList();
ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>();
campaignLoyaltyList.clear();
ArrayList<Campaign> campaignCarouselList = new ArrayList<>();
campaignCarouselList.clear();
......@@ -2027,11 +2025,10 @@ public class WarplyManager {
// }
// WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
CampaignList tempAllCamps = new CampaignList();
Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList);
tempAllCamps.clear();
tempAllCamps.addAll(set);
receiver.onSuccess(tempAllCamps); //result, //campaignLoyaltyList
campaignLoyaltyList.clear();
campaignLoyaltyList.addAll(set);
receiver.onSuccess(campaignLoyaltyList); //result
}
@Override
......@@ -2594,9 +2591,9 @@ public class WarplyManager {
new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
......@@ -2610,9 +2607,9 @@ public class WarplyManager {
@Override
public void onFailure(int errorCode) {
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(CampaignList result) {
public void onSuccess(ArrayList<Campaign> result) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
......