Panagiotis Triantafyllou

new keys

......@@ -3,7 +3,7 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid=f83dfde1145e4c2da69793abb2f579af
Uuid=0086a2088301440792091b9f814c2267
# If we need to see logs in Logcat
Debug=true
......@@ -11,7 +11,7 @@ Debug=true
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL=https://engage-stage.warp.ly
BaseURL=https://engage.warp.ly
# For Verify Ticket request
VerifyURL=/partners/cosmote/verify
......
......@@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WarplySessionManager.onCreateActivity(this);
}
@Override
protected void onStart() {
super.onStart();
WarplySessionManager.onStartActivity(this);
}
@Override
protected void onStop() {
super.onStop();
WarplySessionManager.onStopActivity(this);
}
// ===========================================================
......
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000826"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
.setGuid("6006552990"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta87'
PUBLISH_VERSION = '4.5.4-cosbeta88'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -156,20 +156,20 @@ public enum Warply {
private void isInitializedOrThrow() {
if (mContext == null) {
WarpUtils.log("Warply has not been initialized, call init(Context) first");
return;
// return;
}
if (mContext.get() == null) {
WarpUtils.log("Warply has not been initialized, call init(Context) first");
return;
// return;
}
String apiKey = WarplyProperty.getAppUuid(mContext.get());
if (apiKey == null) {
WarpUtils.log("Warply application UUID has not been set in the Manifest");
return;
// return;
}
if ((apiKey.length() != 32) && (apiKey.length() != 36)) {
WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey);
return;
// return;
}
}
......@@ -985,6 +985,9 @@ public enum Warply {
}
private void check() {
// if (mContext == null) {
// return;
// }
if (!WarpUtils.isRegisteredWarply(mContext.get())) {
registerWarply();
return;
......
......@@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WarplySessionManager.onCreateActivity(this);
setContentView(R.layout.activity_base_fragment);
mBottomNavigationView = findViewById(R.id.bt_tabs);
......@@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
@Override
protected void onStart() {
super.onStart();
WarplySessionManager.onStartActivity(this);
}
@Override
protected void onStop() {
super.onStop();
WarplySessionManager.onStopActivity(this);
}
@Override
......
......@@ -6,7 +6,6 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.text.TextUtils;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
......@@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper;
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.views.adapters.MergedMoreAdapter;
import ly.warp.sdk.views.adapters.MoreCampaignAdapter;
import ly.warp.sdk.views.adapters.MoreContextualAdapter;
......@@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private ImageView mIvBack, mIvPopupClose;
private RecyclerView mRecyclerMore;
private TextView mTvTitle;
private MoreCampaignAdapter mAdapterMore;
private MergedMoreAdapter mAdapterMergedMore;
private LinearLayout mLlMorePopup;
private ArrayList<Campaign> mValuesList = new ArrayList<>();
private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>();
......@@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
private MoreContextualAdapter mAdapterContextual;
private int mTimer = 0;
private Handler mSecondsHandler;
/**
* New Implementation
*/
......@@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mResearchItems.setNestedScrollingEnabled(false);
mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey));
// mResearchItems.setItemAnimator(null);
// mAdapterResearch.setHasStableIds(true);
mResearchItems.setAdapter(mAdapterResearch);
mAdapterResearch.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
......@@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mExclusiveItems.setNestedScrollingEnabled(false);
mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey));
// mExclusiveItems.setItemAnimator(null);
// mAdapterExclusive.setHasStableIds(true);
mExclusiveItems.setAdapter(mAdapterExclusive);
mAdapterExclusive.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
......@@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContestItems.setNestedScrollingEnabled(false);
mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey));
// mContestItems.setItemAnimator(null);
// mAdapterContest.setHasStableIds(true);
mContestItems.setAdapter(mAdapterContest);
mAdapterContest.getPositionClicks()
.doOnNext(this::handleMoreItemClick)
......@@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
mContextualItems.setNestedScrollingEnabled(false);
mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false));
mAdapterContextual = new MoreContextualAdapter(this, mContextualList);
// mContextualItems.setItemAnimator(null);
// mAdapterContextual.setHasStableIds(true);
mContextualItems.setAdapter(mAdapterContextual);
mAdapterContextual.getPositionClicks()
.doOnNext(this::handleMoreContextualItemClick)
......@@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
}
private void handleMoreItemClick(Campaign moreItem) {
EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel()));
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(moreItem.getExtraFields());
if (extraFields != null) {
......@@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener
startActivity(intent);
}
private void mergeDatasets(ArrayList<Campaign> campaignList,
ArrayList<LoyaltyContextualOfferModel> ccmsList) {
mData.clear();
if (campaignList != null && campaignList.size() > 0) {
Log.v("MORE_FOR_YOU", String.valueOf(campaignList.size()));
for (Campaign campaign : campaignList) {
MergedMore data = new MergedMore();
data.setCampaign(campaign);
data.setDataType(1);
mData.add(data);
}
}
if (ccmsList != null && ccmsList.size() > 0) {
Log.v("CCMS", String.valueOf(ccmsList.size()));
for (LoyaltyContextualOfferModel ccmsItem : ccmsList) {
MergedMore data = new MergedMore();
data.setCampaign(null);
data.setCCMS(ccmsItem);
data.setDataType(2);
mData.add(data);
}
}
}
/**
* New Implementation
*/
......
......@@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
// registerStepSensor();
// Warply.getInitializer(this).init();
Warply.getInitializer(getApplicationContext()).init();
WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback);
}
......
......@@ -992,8 +992,8 @@ public class WarplyManagerHelper {
});
}
public static void setTrackersEnabled(boolean isEnabled) {
WarpUtils.setTrackersEnabled(Warply.getWarplyContext(), isEnabled);
public static void setTrackersEnabled(Context context, boolean isEnabled) {
WarpUtils.setTrackersEnabled(context, isEnabled);
// JSONObject obj = new JSONObject();
// try {
......@@ -1137,9 +1137,13 @@ public class WarplyManagerHelper {
public static void setCampaignList(ArrayList<Campaign> campaignList) {
// mCampaignList.clear();
// mCampaignList.addAll(campaignList);
Set<Campaign> set = new LinkedHashSet<>(campaignList);
// Set<Campaign> set = new LinkedHashSet<>(campaignList);
// mCampaignListAll.clear();
// mCampaignListAll.addAll(set);
mCampaignListAll.clear();
mCampaignListAll.addAll(set);
mCampaignListAll = campaignList;
mCampaignList.clear();
for (Campaign camp : campaignList) {
......
......@@ -29,16 +29,11 @@ import android.app.ActivityManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Handler;
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;
import org.json.JSONException;
import org.json.JSONObject;
......@@ -46,12 +41,10 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.Set;
import ly.warp.sdk.R;
import ly.warp.sdk.Warply;
import ly.warp.sdk.db.WarplyDBHelper;
import ly.warp.sdk.io.callbacks.AddressHook;
......@@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook;
import ly.warp.sdk.io.callbacks.TransactionsHook;
import ly.warp.sdk.io.models.AddressList;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Card;
import ly.warp.sdk.io.models.CardList;
import ly.warp.sdk.io.models.Consumer;
......@@ -82,11 +74,8 @@ 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.LoyaltyContextualOfferModel;
import ly.warp.sdk.io.models.MerchantCategoriesList;
import ly.warp.sdk.io.models.MerchantList;
import ly.warp.sdk.io.models.NewCampaign;
import ly.warp.sdk.io.models.NewCampaignList;
import ly.warp.sdk.io.models.PacingDetails;
import ly.warp.sdk.io.models.PointsList;
import ly.warp.sdk.io.models.ProductList;
......@@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants;
*/
public class WarplyManager {
private static ArrayList<Campaign> mNewCampaignList = new ArrayList<Campaign>();
public static void getProducts(WarplyProductsRequest request, final CallbackReceiver<ProductList> receiver) {
// String productCategory = "";
// int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName());
......@@ -1392,53 +1379,28 @@ public class WarplyManager {
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> result) {
// receiver.onSuccess(result);
mNewCampaignList.clear();
mNewCampaignList.addAll(result);
getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> resultPersonalized) {
receiver.onSuccess(resultPersonalized);
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
},
request.getSignature()));
}
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<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> result) {
mNewCampaignList.addAll(result);
Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting()));
ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>();
campaignLoyaltyList.clear();
ArrayList<Campaign> campaignCarouselList = new ArrayList<>();
campaignCarouselList.clear();
for (Campaign camp : mNewCampaignList) {
JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (campMetadata != null) {
if (campMetadata.has("carousel")) {
campaignCarouselList.add(camp);
}
}
ArrayList<Campaign> newCampaignList = new ArrayList<Campaign>();
newCampaignList.clear();
newCampaignList.addAll(result);
newCampaignList.addAll(resultPersonalized);
Collections.sort(newCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting()));
WarplyManagerHelper.setCampaignList(newCampaignList);
ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>();
campaignLoyaltyList.clear();
ArrayList<Campaign> campaignCarouselList = new ArrayList<>();
campaignCarouselList.clear();
for (Campaign camp : newCampaignList) {
JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (campMetadata != null) {
if (campMetadata.has("carousel")) {
campaignCarouselList.add(camp);
}
}
if (camp.getOfferCategory().equals("questionnaire")) {
if (camp.getOfferCategory().equals("questionnaire")) {
// if (WarplyManagerHelper.getConsumerInternal() != null) {
// JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
// if (profMetadata != null) {
......@@ -1478,23 +1440,22 @@ public class WarplyManager {
// campaignLoyaltyList.add(camp);
// }
// }
} else {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) {
} else {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
}
WarplyManagerHelper.setCampaignList(mNewCampaignList);
WarplyManagerHelper.setCarouselList(campaignCarouselList);
WarplyManagerHelper.setCarouselList(campaignCarouselList);
// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>();
// JSONArray jArray = null;
// try {
// jArray = new JSONArray("[\n" +
......@@ -2045,10 +2006,36 @@ public class WarplyManager {
// }
// WarplyManagerHelper.setCCMSLoyaltyCampaigns(list);
Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList);
campaignLoyaltyList.clear();
campaignLoyaltyList.addAll(set);
receiver.onSuccess(campaignLoyaltyList); //result
Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList);
campaignLoyaltyList.clear();
campaignLoyaltyList.addAll(set);
receiver.onSuccess(campaignLoyaltyList); //resultPersonalized
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
});
}
@Override
public void onFailure(int errorCode) {
receiver.onFailure(errorCode);
}
},
request.getSignature()));
}
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<ArrayList<Campaign>>() {
@Override
public void onSuccess(ArrayList<Campaign> result) {
receiver.onSuccess(result);
}
@Override
......