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" />
......
......@@ -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,7 +103,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerGifts.setAdapter(mAdapterGifts);
mAdapterGifts.getPositionClicks()
.doOnNext(gift -> {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
if (gift.getType().equals("coupon")) {
WarplyManagerHelper.openCouponset(getContext(), gift);
} else
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(gift)));
})
.doOnError(error -> {
})
......@@ -127,7 +130,10 @@ public class LoyaltyFragment extends Fragment implements View.OnClickListener {
mRecyclerMore.setAdapter(mAdapterMore);
mAdapterMore.getPositionClicks()
.doOnNext(more -> {
startActivity(WarpViewActivity.createIntentFromURL(getContext(), WarplyManagerHelper.constructCampaignUrl(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")) {
......