Panagiotis Triantafyllou

fixes

......@@ -42,7 +42,7 @@ public class SplashActivity extends BaseActivity {
// );
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("6012049322"),
.setGuid("6012049321"), //6012049321, 6012049322
mLoginReceiver);
// WarplyManager.verifyTicket(new WarplyVerifyTicketRequest()
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta30i'
PUBLISH_VERSION = '4.5.4-cosbeta31i'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -137,6 +137,11 @@
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="ly.warp.sdk.services.EventService"
android:exported="false"
android:permission="android.permission.BIND_JOB_SERVICE" />
<service
android:name="ly.warp.sdk.services.WarplyBeaconsRangingService"
android:exported="false" />
......
......@@ -490,7 +490,32 @@ public enum Warply {
" \"dataValue\": \"None\",\n" +
" \"discount\": \"None\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003590\",\n" +
" \"loyaltyCampaignId\": \"NA\",\n" +
......@@ -518,7 +543,32 @@ public enum Warply {
" \"dataValue\": \"None\",\n" +
" \"discount\": \"None\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003599\",\n" +
" \"loyaltyCampaignId\": \"c5cc5f4f65624f47a580b720233fa60d\",\n" +
......@@ -544,7 +594,32 @@ public enum Warply {
" \"businessAdditionalId\": \"\",\n" +
" \"businessService\": \"0.0\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003588\",\n" +
" \"loyaltyCampaignId\": \"NA\",\n" +
......@@ -570,7 +645,32 @@ public enum Warply {
" \"dataValue\": \"None\",\n" +
" \"discount\": \"None\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003608\",\n" +
" \"loyaltyCampaignId\": \"c134cdeb8a924f8eac38e261acb9caf5\",\n" +
......@@ -596,7 +696,32 @@ public enum Warply {
" \"businessAdditionalId\": \"\",\n" +
" \"businessService\": \"0.0\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003612\",\n" +
" \"loyaltyCampaignId\": \"8eb71c4ceaff409c896e2d1f6f1c20f3\",\n" +
......@@ -622,7 +747,32 @@ public enum Warply {
" \"dataValue\": \"None\",\n" +
" \"discount\": \"None\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003610\",\n" +
" \"loyaltyCampaignId\": \"8e2c88ec94c948d8b51577324ed9a4d5\",\n" +
......@@ -648,7 +798,32 @@ public enum Warply {
" \"businessAdditionalId\": \"\",\n" +
" \"businessService\": \"0.0\",\n" +
" \"eligibleAssets\": [\n" +
" \"306945218770\"\n" +
" \"306945218770\",\n" +
" \"306944333488\",\n" +
" \"306932222490\",\n" +
" \"306996824010\",\n" +
" \"306972713201\",\n" +
" \"306942496252\",\n" +
" \"306977316716\",\n" +
" \"306945433100\",\n" +
" \"306977403986\",\n" +
" \"306936581495\",\n" +
" \"306980689662\",\n" +
" \"306970101490\",\n" +
" \"306973396329\",\n" +
" \"306972577064\",\n" +
" \"306974923219\",\n" +
" \"306977513761\",\n" +
" \"306984220987\",\n" +
" \"306979949205\",\n" +
" \"306943134127\",\n" +
" \"306970437794\",\n" +
" \"306932535319\",\n" +
" \"306974063133\",\n" +
" \"306932520323\",\n" +
" \"306978733823\",\n" +
" \"306985995420\",\n" +
" \"306983879555\",\n" +
" ],\n" +
" \"id\": \"000003614\",\n" +
" \"loyaltyCampaignId\": \"aaf4022194584f02bb84c7b283c7c51e\",\n" +
......
......@@ -148,6 +148,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mAdapterMergedGifts.getPositionClicks()
.doOnNext(dataItem -> {
if (dataItem.getDataType() == 1) {
WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
if (dataItem.getCampaign().getType().equals("coupon")) {
......@@ -227,6 +228,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
mAdapterMergedGifts.getPositionClicks()
.doOnNext(dataItem -> {
if (dataItem.getDataType() == 1) {
WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString());
EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent()));
if (dataItem.getCampaign().getType().equals("coupon")) {
......
......@@ -116,6 +116,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(gift -> {
WarpUtils.log("MFY_CLICK " + gift.toString());
EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel()));
try {
......@@ -124,6 +125,7 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(gift.getSessionUUID())) {
WarpUtils.log("CCMS_CLICK " + ccms.toString());
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(gift, ccms)));
break;
}
......
......@@ -33,6 +33,8 @@ import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.View;
......@@ -56,6 +58,9 @@ import java.util.concurrent.TimeUnit;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.services.PushEventsClickedWorkerService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
......@@ -63,6 +68,7 @@ import ly.warp.sdk.utils.WarplyPreferences;
import ly.warp.sdk.utils.WarplyProperty;
import ly.warp.sdk.utils.managers.WarplyAnalyticsManager;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.utils.managers.WarplySessionManager;
import ly.warp.sdk.views.WarpView;
......@@ -127,8 +133,9 @@ public class WarpViewActivity extends WarpBaseActivity {
setResult(RESULT_OK, new Intent());
finish();
}
// if (event.getCoupon() != null)
// finish();
if (event.getCoupon() != null) {
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
}
// if (event.getPacingCard() != null)
// finish();
// if (event.getPacingService() != null)
......@@ -252,4 +259,16 @@ public class WarpViewActivity extends WarpBaseActivity {
public static Intent createIntentFromURL(Context context, String url) {
return new Intent(context, WarpViewActivity.class).putExtra("sessionUrl", url);
}
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
}
@Override
public void onFailure(int errorCode) {
}
};
}
\ No newline at end of file
......
......@@ -103,6 +103,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
if (gift.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), gift);
} else
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
})
.doOnError(error -> {
......@@ -127,6 +130,9 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
if (more.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), more);
} else
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(more)));
})
.doOnError(error -> {
......
package ly.warp.sdk.services;
import android.content.Context;
import androidx.annotation.NonNull;
import androidx.work.Worker;
import androidx.work.WorkerParameters;
import org.greenrobot.eventbus.EventBus;
import ly.warp.sdk.io.models.ContexualEventModel;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
/**
* Created by Panagiotis Triantafyllou on 13/Ιουλ/2022.
*/
public class EventService extends Worker {
public EventService(@NonNull Context context, @NonNull WorkerParameters workerParams) {
super(context, workerParams);
}
@NonNull
@Override
public Result doWork() {
ContexualEventModel ccmsAdded = new ContexualEventModel();
EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
return Result.success();
}
}
......@@ -26,19 +26,25 @@
package ly.warp.sdk.utils;
import android.content.Context;
import android.content.Intent;
import android.text.TextUtils;
import android.util.Log;
import androidx.appcompat.app.AlertDialog;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import org.greenrobot.eventbus.EventBus;
import org.json.JSONObject;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.activities.CouponsetInfoActivity;
import ly.warp.sdk.activities.GiftsForYouActivity;
import ly.warp.sdk.activities.WarpViewActivity;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
......@@ -49,6 +55,7 @@ import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.ContexualEventModel;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.models.CustomerStateModel;
import ly.warp.sdk.io.models.LoyaltyBadgeModel;
......@@ -57,6 +64,7 @@ import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
import ly.warp.sdk.io.request.CosmoteSharingRequest;
import ly.warp.sdk.io.request.WarplyIntegrationRequest;
import ly.warp.sdk.services.EventService;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
......@@ -413,8 +421,11 @@ public class WarplyManagerHelper {
mCCMSList.clear();
mCCMSList.addAll(list);
ContexualEventModel ccmsAdded = new ContexualEventModel();
EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
// ContexualEventModel ccmsAdded = new ContexualEventModel();
// EventBus.getDefault().post(new WarplyEventBusManager(ccmsAdded));
// if (list == null || list.size() == 0) {
// CampaignList tempGifts = new CampaignList();
......@@ -537,6 +548,30 @@ public class WarplyManagerHelper {
}
/**
* Open Couponset
*/
public static void openCouponset(Context context, Campaign item) {
try {
JSONObject campaignSettings = WarpJSONParser.getJSONFromString(item.getCampaignTypeSettings());
if (campaignSettings != null) {
if (campaignSettings.has("couponset")) {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : mCouponsetsList) {
if (cpns.getUuid().equals(cpnUuid)) {
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
context.startActivity(intent);
break;
}
}
}
}
} catch (Exception exception) {
exception.printStackTrace();
}
}
/**
* Save if customer is nonTelco and if he/she has accepted the consents,
* And his msisdn list
*/
......
......@@ -382,7 +382,7 @@ public class WarpView extends WebView {
QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
questionnaireEvent.setName(parts[1]);
EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
} else if (parts[1].equals("addUserTag")) {
} else if (parts[1].equals("userAnswered")) {
QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
try {
questionnaireEvent.setName(parts[1]);
......@@ -395,6 +395,19 @@ public class WarpView extends WebView {
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
}
} else if (parts[1].equals("addUserTag")) {
// QuestionnaireEventModel questionnaireEvent = new QuestionnaireEventModel();
try {
// questionnaireEvent.setName(parts[1]);
// questionnaireEvent.setParameter(parts[2]);
WarpUtils.setUserTag(Warply.getWarplyContext(), parts[2]);
// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
} catch (IndexOutOfBoundsException e) {
// questionnaireEvent.setName(parts[1]);
// questionnaireEvent.setParameter("");
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
// EventBus.getDefault().post(new WarplyEventBusManager(questionnaireEvent));
}
} else if (parts[1].equals("couponRetrieved")) {
EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
} else if (parts[1].equals("couponShared")) {
......