Panagiotis Triantafyllou

fixes

...@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity { ...@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity {
42 // ); 42 // );
43 43
44 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() 44 WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
45 - .setGuid("6012049322"), 45 + .setGuid("6012049321"), //6012049321, 6012049322
46 mLoginReceiver); 46 mLoginReceiver);
47 47
48 // WarplyManager.verifyTicket(new WarplyVerifyTicketRequest() 48 // WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
......
...@@ -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-cosbeta30i' 5 + PUBLISH_VERSION = '4.5.4-cosbeta31i'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -137,6 +137,11 @@ ...@@ -137,6 +137,11 @@
137 android:permission="android.permission.BIND_JOB_SERVICE" /> 137 android:permission="android.permission.BIND_JOB_SERVICE" />
138 138
139 <service 139 <service
140 + android:name="ly.warp.sdk.services.EventService"
141 + android:exported="false"
142 + android:permission="android.permission.BIND_JOB_SERVICE" />
143 +
144 + <service
140 android:name="ly.warp.sdk.services.WarplyBeaconsRangingService" 145 android:name="ly.warp.sdk.services.WarplyBeaconsRangingService"
141 android:exported="false" /> 146 android:exported="false" />
142 147
......
...@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
148 mAdapterMergedGifts.getPositionClicks() 148 mAdapterMergedGifts.getPositionClicks()
149 .doOnNext(dataItem -> { 149 .doOnNext(dataItem -> {
150 if (dataItem.getDataType() == 1) { 150 if (dataItem.getDataType() == 1) {
151 + WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
151 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); 152 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
152 153
153 if (dataItem.getCampaign().getType().equals("coupon")) { 154 if (dataItem.getCampaign().getType().equals("coupon")) {
...@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene ...@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
227 mAdapterMergedGifts.getPositionClicks() 228 mAdapterMergedGifts.getPositionClicks()
228 .doOnNext(dataItem -> { 229 .doOnNext(dataItem -> {
229 if (dataItem.getDataType() == 1) { 230 if (dataItem.getDataType() == 1) {
231 + WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
230 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); 232 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
231 233
232 if (dataItem.getCampaign().getType().equals("coupon")) { 234 if (dataItem.getCampaign().getType().equals("coupon")) {
......
...@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
116 mRecyclerMore.setAdapter(mAdapterMore); 116 mRecyclerMore.setAdapter(mAdapterMore);
117 mAdapterMore.getPositionClicks() 117 mAdapterMore.getPositionClicks()
118 .doOnNext(gift -> { 118 .doOnNext(gift -> {
119 + WarpUtils.log("MFY_CLICK " + gift.toString());
119 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); 120 EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel()));
120 121
121 try { 122 try {
...@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener ...@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
124 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { 125 if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
125 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { 126 for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
126 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) { 127 if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
128 + WarpUtils.log("CCMS_CLICK " + ccms.toString());
127 startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms))); 129 startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms)));
128 break; 130 break;
129 } 131 }
......
...@@ -33,6 +33,8 @@ import android.content.Intent; ...@@ -33,6 +33,8 @@ 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;
37 +import android.os.Looper;
36 import android.text.TextUtils; 38 import android.text.TextUtils;
37 import android.view.KeyEvent; 39 import android.view.KeyEvent;
38 import android.view.View; 40 import android.view.View;
...@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit; ...@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit;
56 58
57 import ly.warp.sdk.R; 59 import ly.warp.sdk.R;
58 import ly.warp.sdk.Warply; 60 import ly.warp.sdk.Warply;
61 +import ly.warp.sdk.io.callbacks.CallbackReceiver;
62 +import ly.warp.sdk.io.models.CouponList;
63 +import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
59 import ly.warp.sdk.services.PushEventsClickedWorkerService; 64 import ly.warp.sdk.services.PushEventsClickedWorkerService;
60 import ly.warp.sdk.utils.WarpJSONParser; 65 import ly.warp.sdk.utils.WarpJSONParser;
61 import ly.warp.sdk.utils.WarpUtils; 66 import ly.warp.sdk.utils.WarpUtils;
...@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences; ...@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences;
63 import ly.warp.sdk.utils.WarplyProperty; 68 import ly.warp.sdk.utils.WarplyProperty;
64 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; 69 import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
65 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 70 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
71 +import ly.warp.sdk.utils.managers.WarplyManager;
66 import ly.warp.sdk.utils.managers.WarplySessionManager; 72 import ly.warp.sdk.utils.managers.WarplySessionManager;
67 import ly.warp.sdk.views.WarpView; 73 import ly.warp.sdk.views.WarpView;
68 74
...@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity {
127 setResult(RESULT_OK, new Intent()); 133 setResult(RESULT_OK, new Intent());
128 finish(); 134 finish();
129 } 135 }
130 -// if (event.getCoupon() != null) 136 + if (event.getCoupon() != null) {
131 -// finish(); 137 + WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
138 + }
132 // if (event.getPacingCard() != null) 139 // if (event.getPacingCard() != null)
133 // finish(); 140 // finish();
134 // if (event.getPacingService() != null) 141 // if (event.getPacingService() != null)
...@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity { ...@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity {
252 public static Intent createIntentFromURL(Context context, String url) { 259 public static Intent createIntentFromURL(Context context, String url) {
253 return new Intent(context, WarpViewActivity.class).putExtra("sessionUrl", url); 260 return new Intent(context, WarpViewActivity.class).putExtra("sessionUrl", url);
254 } 261 }
262 +
263 + private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
264 + @Override
265 + public void onSuccess(CouponList result) {
266 +
267 + }
268 +
269 + @Override
270 + public void onFailure(int errorCode) {
271 +
272 + }
273 + };
255 } 274 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -103,6 +103,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -103,6 +103,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
103 mRecyclerGifts.setAdapter(mAdapterGifts); 103 mRecyclerGifts.setAdapter(mAdapterGifts);
104 mAdapterGifts.getPositionClicks() 104 mAdapterGifts.getPositionClicks()
105 .doOnNext(gift -> { 105 .doOnNext(gift -> {
106 + if (gift.getType().equals("coupon")) {
107 + WarplyManagerHelper.openCouponset(getContext(), gift);
108 + } else
106 startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift))); 109 startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
107 }) 110 })
108 .doOnError(error -> { 111 .doOnError(error -> {
...@@ -127,6 +130,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener { ...@@ -127,6 +130,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
127 mRecyclerMore.setAdapter(mAdapterMore); 130 mRecyclerMore.setAdapter(mAdapterMore);
128 mAdapterMore.getPositionClicks() 131 mAdapterMore.getPositionClicks()
129 .doOnNext(more -> { 132 .doOnNext(more -> {
133 + if (more.getType().equals("coupon")) {
134 + WarplyManagerHelper.openCouponset(getContext(), more);
135 + } else
130 startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more))); 136 startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
131 }) 137 })
132 .doOnError(error -> { 138 .doOnError(error -> {
......
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.ContexualEventModel;
12 +import ly.warp.sdk.utils.managers.WarplyEventBusManager;
13 +
14 +/**
15 + * Created by Panagiotis Triantafyllou on 13/Ιουλ/2022.
16 + */
17 +public class EventService extends Worker {
18 +
19 + public EventService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
20 + super(context, workerParams);
21 + }
22 +
23 + @NonNull
24 + @Override
25 + public Result doWork() {
26 + ContexualEventModel ccmsAdded = new ContexualEventModel();
27 + EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
28 +
29 + return Result.success();
30 + }
31 +}
...@@ -26,19 +26,25 @@ ...@@ -26,19 +26,25 @@
26 package ly.warp.sdk.utils; 26 package ly.warp.sdk.utils;
27 27
28 import android.content.Context; 28 import android.content.Context;
29 +import android.content.Intent;
29 import android.text.TextUtils; 30 import android.text.TextUtils;
30 import android.util.Log; 31 import android.util.Log;
31 32
32 import androidx.appcompat.app.AlertDialog; 33 import androidx.appcompat.app.AlertDialog;
34 +import androidx.work.OneTimeWorkRequest;
35 +import androidx.work.WorkManager;
33 36
34 import org.greenrobot.eventbus.EventBus; 37 import org.greenrobot.eventbus.EventBus;
35 import org.json.JSONObject; 38 import org.json.JSONObject;
36 39
40 +import java.io.Serializable;
37 import java.util.ArrayList; 41 import java.util.ArrayList;
38 import java.util.HashMap; 42 import java.util.HashMap;
39 43
40 import ly.warp.sdk.R; 44 import ly.warp.sdk.R;
41 import ly.warp.sdk.Warply; 45 import ly.warp.sdk.Warply;
46 +import ly.warp.sdk.activities.CouponsetInfoActivity;
47 +import ly.warp.sdk.activities.GiftsForYouActivity;
42 import ly.warp.sdk.activities.WarpViewActivity; 48 import ly.warp.sdk.activities.WarpViewActivity;
43 import ly.warp.sdk.db.WarplyDBHelper; 49 import ly.warp.sdk.db.WarplyDBHelper;
44 import ly.warp.sdk.io.callbacks.CallbackReceiver; 50 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer; ...@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer;
49 import ly.warp.sdk.io.models.ContexualEventModel; 55 import ly.warp.sdk.io.models.ContexualEventModel;
50 import ly.warp.sdk.io.models.Coupon; 56 import ly.warp.sdk.io.models.Coupon;
51 import ly.warp.sdk.io.models.CouponList; 57 import ly.warp.sdk.io.models.CouponList;
58 +import ly.warp.sdk.io.models.Couponset;
52 import ly.warp.sdk.io.models.CouponsetsList; 59 import ly.warp.sdk.io.models.CouponsetsList;
53 import ly.warp.sdk.io.models.CustomerStateModel; 60 import ly.warp.sdk.io.models.CustomerStateModel;
54 import ly.warp.sdk.io.models.LoyaltyBadgeModel; 61 import ly.warp.sdk.io.models.LoyaltyBadgeModel;
...@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage; ...@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
57 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest; 64 import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
58 import ly.warp.sdk.io.request.CosmoteSharingRequest; 65 import ly.warp.sdk.io.request.CosmoteSharingRequest;
59 import ly.warp.sdk.io.request.WarplyIntegrationRequest; 66 import ly.warp.sdk.io.request.WarplyIntegrationRequest;
67 +import ly.warp.sdk.services.EventService;
60 import ly.warp.sdk.utils.managers.WarplyEventBusManager; 68 import ly.warp.sdk.utils.managers.WarplyEventBusManager;
61 import ly.warp.sdk.utils.managers.WarplyManager; 69 import ly.warp.sdk.utils.managers.WarplyManager;
62 70
...@@ -413,8 +421,11 @@ public class WarplyManagerHelper { ...@@ -413,8 +421,11 @@ public class WarplyManagerHelper {
413 mCCMSList.clear(); 421 mCCMSList.clear();
414 mCCMSList.addAll(list); 422 mCCMSList.addAll(list);
415 423
416 - ContexualEventModel ccmsAdded = new ContexualEventModel(); 424 + OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
417 - EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded)); 425 + WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
426 +
427 +// ContexualEventModel ccmsAdded = new ContexualEventModel();
428 +// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
418 429
419 // if (list == null || list.size() == 0) { 430 // if (list == null || list.size() == 0) {
420 // CampaignList tempGifts = new CampaignList(); 431 // CampaignList tempGifts = new CampaignList();
...@@ -537,6 +548,30 @@ public class WarplyManagerHelper { ...@@ -537,6 +548,30 @@ public class WarplyManagerHelper {
537 } 548 }
538 549
539 /** 550 /**
551 + * Open Couponset
552 + */
553 + public static void openCouponset(Context context, Campaign item) {
554 + try {
555 + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
556 + if (campaignSettings != null) {
557 + if (campaignSettings.has("couponset")) {
558 + String cpnUuid = campaignSettings.optString("couponset");
559 + for (Couponset cpns : mCouponsetsList) {
560 + if (cpns.getUuid().equals(cpnUuid)) {
561 + Intent intent = new Intent(context, CouponsetInfoActivity.class);
562 + intent.putExtra("couponset", (Serializable) cpns);
563 + context.startActivity(intent);
564 + break;
565 + }
566 + }
567 + }
568 + }
569 + } catch (Exception exception) {
570 + exception.printStackTrace();
571 + }
572 + }
573 +
574 + /**
540 * Save if customer is nonTelco and if he/she has accepted the consents, 575 * Save if customer is nonTelco and if he/she has accepted the consents,
541 * And his msisdn list 576 * And his msisdn list
542 */ 577 */
......
...@@ -382,7 +382,7 @@ public class WarpView extends WebView { ...@@ -382,7 +382,7 @@ public class WarpView extends WebView {
382 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); 382 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
383 questionnaireEvent.setName(parts[1]); 383 questionnaireEvent.setName(parts[1]);
384 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 384 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
385 - } else if (parts[1].equals("addUserTag")) { 385 + } else if (parts[1].equals("userAnswered")) {
386 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel(); 386 QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
387 try { 387 try {
388 questionnaireEvent.setName(parts[1]); 388 questionnaireEvent.setName(parts[1]);
...@@ -395,6 +395,19 @@ public class WarpView extends WebView { ...@@ -395,6 +395,19 @@ public class WarpView extends WebView {
395 WarpUtils.setUserTag(Warply.getWarplyContext(), ""); 395 WarpUtils.setUserTag(Warply.getWarplyContext(), "");
396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent)); 396 EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
397 } 397 }
398 + } else if (parts[1].equals("addUserTag")) {
399 +// QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
400 + try {
401 +// questionnaireEvent.setName(parts[1]);
402 +// questionnaireEvent.setParameter(parts[2]);
403 + WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]);
404 +// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
405 + } catch (IndexOutOfBoundsException e) {
406 +// questionnaireEvent.setName(parts[1]);
407 +// questionnaireEvent.setParameter("");
408 + WarpUtils.setUserTag(Warply.getWarplyContext(), "");
409 +// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
410 + }
398 } else if (parts[1].equals("couponRetrieved")) { 411 } else if (parts[1].equals("couponRetrieved")) {
399 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel())); 412 EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
400 } else if (parts[1].equals("couponShared")) { 413 } else if (parts[1].equals("couponShared")) {
......