Panagiotis Triantafyllou

neo tag implementation

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta74'
PUBLISH_VERSION = '4.5.4-cosbeta75'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -1309,7 +1309,7 @@ public enum Warply {
isInitializedOrThrow();
WarpUtils.log("************* WARPLY Microapp ********************");
if (!WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.APPLICATION_DATA)) {
if (!WarplyServerPreferencesManager.isMicroAppActive(WarpConstants.MicroApp.DEVICE_INFO)) {
WarpUtils.log("[WARP Trace] Application Info Microapp is not active");
return;
} else {
......
......@@ -13,6 +13,8 @@ import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -32,10 +34,12 @@ import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent;
import ly.warp.sdk.io.models.LoyaltyGiftsForYouPackage;
import ly.warp.sdk.io.models.MergedGifts;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.managers.WarplyEventBusManager;
import ly.warp.sdk.utils.managers.WarplyManager;
import ly.warp.sdk.views.adapters.MergedGiftsAdapter;
......@@ -149,6 +153,14 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
@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);
}
}
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) {
......@@ -204,16 +216,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
intent.putExtra("ccms", ccmsItem);
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
......@@ -231,15 +244,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
......@@ -255,10 +269,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
intent.putExtra("ccms", ccms);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
......@@ -268,16 +283,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
WarpUtils.log("CCMS_CLICK " + ccms.toString());
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
} else if (dataItem.getDataType() == 2) {
LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
......@@ -340,16 +355,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
intent.putExtra("ccms", ccmsItem);
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
......@@ -367,15 +383,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
......@@ -391,10 +408,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID());
Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class);
intent.putExtra("ccms", ccms);
intent.putExtra("loyalty", (Serializable) dataItem.getCampaign());
startActivity(intent);
startActivityForResult(intent, 1004);
break;
}
}
......@@ -403,16 +421,16 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) {
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004);
}
} else if (dataItem.getDataType() == 2) {
LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent();
......
......@@ -13,6 +13,8 @@ import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.work.OneTimeWorkRequest;
import androidx.work.WorkManager;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
......@@ -31,6 +33,7 @@ import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel;
import ly.warp.sdk.io.models.MergedMore;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -174,6 +177,14 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
super.attachBaseContext(ViewPumpContextWrapper.wrap(newBase));
}
@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);
}
}
@Subscribe()
public void onMessageEvent(WarplyEventBusManager event) {
if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) {
......@@ -520,16 +531,16 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) {
if (ccms.getLoyaltyCampaignId().equals(moreItem.getSessionUUID())) {
WarpUtils.log("CCMS_CLICK " + ccms.toString());
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(moreItem, ccms)));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(moreItem, ccms)), 1003);
break;
}
}
} else {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)), 1003);
}
}
} catch (Exception exception) {
startActivity(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)));
startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(moreItem)), 1003);
}
}
......
......@@ -739,6 +739,7 @@ public class WarplyManagerHelper {
}
} else if (extraFields.has("type") && extraFields.optString("type").equals("telco")) {
if (item.getLoyaltyCampaignId().equals(camp.getSessionUUID())) {
WarplyManager.getSingleCampaign(camp.getSessionUUID());
Intent intent = new Intent(context, TelcoActivity.class);
intent.putExtra("ccms", item);
intent.putExtra("loyalty", (Serializable) camp);
......@@ -775,6 +776,7 @@ public class WarplyManagerHelper {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(item.getSessionUUID());
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) item);
......@@ -802,6 +804,7 @@ public class WarplyManagerHelper {
String cpnUuid = campaignSettings.optString("couponset");
for (Couponset cpns : WarplyManagerHelper.getCouponsets()) {
if (cpns.getUuid().equals(cpnUuid)) {
WarplyManager.getSingleCampaign(item.getSessionUUID());
Intent intent = new Intent(context, CouponsetInfoActivity.class);
intent.putExtra("couponset", (Serializable) cpns);
intent.putExtra("loyalty", (Serializable) item);
......
......@@ -31,6 +31,8 @@ import android.os.Looper;
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.JSONArray;
......@@ -133,6 +135,7 @@ import ly.warp.sdk.io.request.WarplyUserCouponsRequest;
import ly.warp.sdk.io.request.WarplyValidateCouponRequest;
import ly.warp.sdk.io.request.WarplyVerifyOTPRequest;
import ly.warp.sdk.io.request.WarplyVerifyTicketRequest;
import ly.warp.sdk.services.EventCampaignService;
import ly.warp.sdk.utils.WarpJSONParser;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
......@@ -2577,19 +2580,41 @@ public class WarplyManager {
WarpUtils.log("[WARP Trace] WARPLY Get Event Request is active");
WarpUtils.log("**************************************************");
// String url = WarplyProperty.getBaseUrl(Warply.getWarplyContext()) + WarpConstants.BASE_REMOTE_PAGE_URL + sessionUuid;
//
// Warply.getSingleCampaign(null, url,
// new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// WarpUtils.log("GET_SINGLE_CAMPAIGN_SUCCESS");
// }
//
// @Override
// public void onFailure(int errorCode) {
// WarpUtils.log("GET_SINGLE_CAMPAIGN_FAILED");
// }
// }, null);
String url = WarplyProperty.getBaseUrl(Warply.getWarplyContext()) + WarpConstants.BASE_REMOTE_PAGE_URL + sessionUuid;
Warply.getSingleCampaign(null, url,
new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
@Override
public void onSuccess(CampaignList result) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
@Override
public void onFailure(int errorCode) {
}
});
}
@Override
public void onFailure(int errorCode) {
WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), new CallbackReceiver<CampaignList>() {
@Override
public void onSuccess(CampaignList result) {
OneTimeWorkRequest mywork = new OneTimeWorkRequest.Builder(EventCampaignService.class).build();
WorkManager.getInstance(Warply.getWarplyContext()).enqueue(mywork);
}
@Override
public void onFailure(int errorCode) {
}
});
}
}, null);
}
}
......