Showing
11 changed files
with
79 additions
and
131 deletions
... | @@ -3,7 +3,7 @@ | ... | @@ -3,7 +3,7 @@ |
3 | # The app uuid the warply sdk need to connect to the engage server | 3 | # The app uuid the warply sdk need to connect to the engage server |
4 | # dev f83dfde1145e4c2da69793abb2f579af | 4 | # dev f83dfde1145e4c2da69793abb2f579af |
5 | # prod 0086a2088301440792091b9f814c2267 | 5 | # prod 0086a2088301440792091b9f814c2267 |
6 | -Uuid=f83dfde1145e4c2da69793abb2f579af | 6 | +Uuid=0086a2088301440792091b9f814c2267 |
7 | 7 | ||
8 | # If we need to see logs in Logcat | 8 | # If we need to see logs in Logcat |
9 | Debug=true | 9 | Debug=true |
... | @@ -11,7 +11,7 @@ Debug=true | ... | @@ -11,7 +11,7 @@ Debug=true |
11 | # Production or Development environment of the engage server | 11 | # Production or Development environment of the engage server |
12 | # Production: https://engage.warp.ly | 12 | # Production: https://engage.warp.ly |
13 | # Development: https://engage-stage.warp.ly | 13 | # Development: https://engage-stage.warp.ly |
14 | -BaseURL=https://engage-stage.warp.ly | 14 | +BaseURL=https://engage.warp.ly |
15 | 15 | ||
16 | # For Verify Ticket request | 16 | # For Verify Ticket request |
17 | VerifyURL=/partners/cosmote/verify | 17 | VerifyURL=/partners/cosmote/verify | ... | ... |
... | @@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity { | ... | @@ -27,19 +27,16 @@ public abstract class BaseActivity extends FragmentActivity { |
27 | @Override | 27 | @Override |
28 | protected void onCreate(Bundle savedInstanceState) { | 28 | protected void onCreate(Bundle savedInstanceState) { |
29 | super.onCreate(savedInstanceState); | 29 | super.onCreate(savedInstanceState); |
30 | - WarplySessionManager.onCreateActivity(this); | ||
31 | } | 30 | } |
32 | 31 | ||
33 | @Override | 32 | @Override |
34 | protected void onStart() { | 33 | protected void onStart() { |
35 | super.onStart(); | 34 | super.onStart(); |
36 | - WarplySessionManager.onStartActivity(this); | ||
37 | } | 35 | } |
38 | 36 | ||
39 | @Override | 37 | @Override |
40 | protected void onStop() { | 38 | protected void onStop() { |
41 | super.onStop(); | 39 | super.onStop(); |
42 | - WarplySessionManager.onStopActivity(this); | ||
43 | } | 40 | } |
44 | 41 | ||
45 | // =========================================================== | 42 | // =========================================================== | ... | ... |
... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { | ... | @@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity { |
36 | public void onWarplyReady() { | 36 | public void onWarplyReady() { |
37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { | 37 | if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) { |
38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() | 38 | WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest() |
39 | - .setGuid("7000000826"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990 | 39 | + .setGuid("6006552990"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990 |
40 | mLoginReceiver); | 40 | mLoginReceiver); |
41 | } else { | 41 | } else { |
42 | startNextActivity(); | 42 | startNextActivity(); | ... | ... |
... | @@ -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-cosbeta87' | 5 | + PUBLISH_VERSION = '4.5.4-cosbeta88' |
6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' | 6 | PUBLISH_ARTIFACT_ID = 'warply-android-sdk' |
7 | } | 7 | } |
8 | 8 | ... | ... |
... | @@ -156,20 +156,20 @@ public enum Warply { | ... | @@ -156,20 +156,20 @@ public enum Warply { |
156 | private void isInitializedOrThrow() { | 156 | private void isInitializedOrThrow() { |
157 | if (mContext == null) { | 157 | if (mContext == null) { |
158 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); | 158 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); |
159 | - return; | 159 | +// return; |
160 | } | 160 | } |
161 | if (mContext.get() == null) { | 161 | if (mContext.get() == null) { |
162 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); | 162 | WarpUtils.log("Warply has not been initialized, call init(Context) first"); |
163 | - return; | 163 | +// return; |
164 | } | 164 | } |
165 | String apiKey = WarplyProperty.getAppUuid(mContext.get()); | 165 | String apiKey = WarplyProperty.getAppUuid(mContext.get()); |
166 | if (apiKey == null) { | 166 | if (apiKey == null) { |
167 | WarpUtils.log("Warply application UUID has not been set in the Manifest"); | 167 | WarpUtils.log("Warply application UUID has not been set in the Manifest"); |
168 | - return; | 168 | +// return; |
169 | } | 169 | } |
170 | if ((apiKey.length() != 32) && (apiKey.length() != 36)) { | 170 | if ((apiKey.length() != 32) && (apiKey.length() != 36)) { |
171 | WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey); | 171 | WarpUtils.log("Warply application UUID has not been set correclty in the Manifest, key got: " + apiKey); |
172 | - return; | 172 | +// return; |
173 | } | 173 | } |
174 | } | 174 | } |
175 | 175 | ||
... | @@ -985,6 +985,9 @@ public enum Warply { | ... | @@ -985,6 +985,9 @@ public enum Warply { |
985 | } | 985 | } |
986 | 986 | ||
987 | private void check() { | 987 | private void check() { |
988 | +// if (mContext == null) { | ||
989 | +// return; | ||
990 | +// } | ||
988 | if (!WarpUtils.isRegisteredWarply(mContext.get())) { | 991 | if (!WarpUtils.isRegisteredWarply(mContext.get())) { |
989 | registerWarply(); | 992 | registerWarply(); |
990 | return; | 993 | return; | ... | ... |
... | @@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -54,7 +54,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
54 | @Override | 54 | @Override |
55 | public void onCreate(Bundle savedInstanceState) { | 55 | public void onCreate(Bundle savedInstanceState) { |
56 | super.onCreate(savedInstanceState); | 56 | super.onCreate(savedInstanceState); |
57 | - WarplySessionManager.onCreateActivity(this); | ||
58 | setContentView(R.layout.activity_base_fragment); | 57 | setContentView(R.layout.activity_base_fragment); |
59 | 58 | ||
60 | mBottomNavigationView = findViewById(R.id.bt_tabs); | 59 | mBottomNavigationView = findViewById(R.id.bt_tabs); |
... | @@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation | ... | @@ -71,13 +70,11 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation |
71 | @Override | 70 | @Override |
72 | protected void onStart() { | 71 | protected void onStart() { |
73 | super.onStart(); | 72 | super.onStart(); |
74 | - WarplySessionManager.onStartActivity(this); | ||
75 | } | 73 | } |
76 | 74 | ||
77 | @Override | 75 | @Override |
78 | protected void onStop() { | 76 | protected void onStop() { |
79 | super.onStop(); | 77 | super.onStop(); |
80 | - WarplySessionManager.onStopActivity(this); | ||
81 | } | 78 | } |
82 | 79 | ||
83 | @Override | 80 | @Override | ... | ... |
This diff is collapsed. Click to expand it.
... | @@ -6,7 +6,6 @@ import android.content.Intent; | ... | @@ -6,7 +6,6 @@ import android.content.Intent; |
6 | import android.os.Bundle; | 6 | import android.os.Bundle; |
7 | import android.os.Handler; | 7 | import android.os.Handler; |
8 | import android.text.TextUtils; | 8 | import android.text.TextUtils; |
9 | -import android.util.Log; | ||
10 | import android.view.View; | 9 | import android.view.View; |
11 | import android.widget.ImageView; | 10 | import android.widget.ImageView; |
12 | import android.widget.LinearLayout; | 11 | import android.widget.LinearLayout; |
... | @@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper; | ... | @@ -41,7 +40,6 @@ import ly.warp.sdk.utils.WarplyManagerHelper; |
41 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; | 40 | import ly.warp.sdk.utils.managers.WarplyAnalyticsManager; |
42 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; | 41 | import ly.warp.sdk.utils.managers.WarplyEventBusManager; |
43 | import ly.warp.sdk.utils.managers.WarplyManager; | 42 | import ly.warp.sdk.utils.managers.WarplyManager; |
44 | -import ly.warp.sdk.views.adapters.MergedMoreAdapter; | ||
45 | import ly.warp.sdk.views.adapters.MoreCampaignAdapter; | 43 | import ly.warp.sdk.views.adapters.MoreCampaignAdapter; |
46 | import ly.warp.sdk.views.adapters.MoreContextualAdapter; | 44 | import ly.warp.sdk.views.adapters.MoreContextualAdapter; |
47 | 45 | ||
... | @@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -59,8 +57,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
59 | private ImageView mIvBack, mIvPopupClose; | 57 | private ImageView mIvBack, mIvPopupClose; |
60 | private RecyclerView mRecyclerMore; | 58 | private RecyclerView mRecyclerMore; |
61 | private TextView mTvTitle; | 59 | private TextView mTvTitle; |
62 | - private MoreCampaignAdapter mAdapterMore; | ||
63 | - private MergedMoreAdapter mAdapterMergedMore; | ||
64 | private LinearLayout mLlMorePopup; | 60 | private LinearLayout mLlMorePopup; |
65 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); | 61 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); |
66 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); | 62 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); |
... | @@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -86,7 +82,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
86 | private MoreContextualAdapter mAdapterContextual; | 82 | private MoreContextualAdapter mAdapterContextual; |
87 | private int mTimer = 0; | 83 | private int mTimer = 0; |
88 | private Handler mSecondsHandler; | 84 | private Handler mSecondsHandler; |
89 | - | ||
90 | /** | 85 | /** |
91 | * New Implementation | 86 | * New Implementation |
92 | */ | 87 | */ |
... | @@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -247,8 +242,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
247 | mResearchItems.setNestedScrollingEnabled(false); | 242 | mResearchItems.setNestedScrollingEnabled(false); |
248 | mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 243 | mResearchItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
249 | mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); | 244 | mAdapterResearch = new MoreCampaignAdapter(this, mUniqueSectionList.get(firstKey)); |
250 | -// mResearchItems.setItemAnimator(null); | ||
251 | -// mAdapterResearch.setHasStableIds(true); | ||
252 | mResearchItems.setAdapter(mAdapterResearch); | 245 | mResearchItems.setAdapter(mAdapterResearch); |
253 | mAdapterResearch.getPositionClicks() | 246 | mAdapterResearch.getPositionClicks() |
254 | .doOnNext(this::handleMoreItemClick) | 247 | .doOnNext(this::handleMoreItemClick) |
... | @@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -269,8 +262,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
269 | mExclusiveItems.setNestedScrollingEnabled(false); | 262 | mExclusiveItems.setNestedScrollingEnabled(false); |
270 | mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 263 | mExclusiveItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
271 | mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); | 264 | mAdapterExclusive = new MoreCampaignAdapter(this, mUniqueSectionList.get(secondKey)); |
272 | -// mExclusiveItems.setItemAnimator(null); | ||
273 | -// mAdapterExclusive.setHasStableIds(true); | ||
274 | mExclusiveItems.setAdapter(mAdapterExclusive); | 265 | mExclusiveItems.setAdapter(mAdapterExclusive); |
275 | mAdapterExclusive.getPositionClicks() | 266 | mAdapterExclusive.getPositionClicks() |
276 | .doOnNext(this::handleMoreItemClick) | 267 | .doOnNext(this::handleMoreItemClick) |
... | @@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -291,8 +282,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
291 | mContestItems.setNestedScrollingEnabled(false); | 282 | mContestItems.setNestedScrollingEnabled(false); |
292 | mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 283 | mContestItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
293 | mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); | 284 | mAdapterContest = new MoreCampaignAdapter(this, mUniqueSectionList.get(thirdKey)); |
294 | -// mContestItems.setItemAnimator(null); | ||
295 | -// mAdapterContest.setHasStableIds(true); | ||
296 | mContestItems.setAdapter(mAdapterContest); | 285 | mContestItems.setAdapter(mAdapterContest); |
297 | mAdapterContest.getPositionClicks() | 286 | mAdapterContest.getPositionClicks() |
298 | .doOnNext(this::handleMoreItemClick) | 287 | .doOnNext(this::handleMoreItemClick) |
... | @@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -311,8 +300,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
311 | mContextualItems.setNestedScrollingEnabled(false); | 300 | mContextualItems.setNestedScrollingEnabled(false); |
312 | mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 301 | mContextualItems.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
313 | mAdapterContextual = new MoreContextualAdapter(this, mContextualList); | 302 | mAdapterContextual = new MoreContextualAdapter(this, mContextualList); |
314 | -// mContextualItems.setItemAnimator(null); | ||
315 | -// mAdapterContextual.setHasStableIds(true); | ||
316 | mContextualItems.setAdapter(mAdapterContextual); | 303 | mContextualItems.setAdapter(mAdapterContextual); |
317 | mAdapterContextual.getPositionClicks() | 304 | mAdapterContextual.getPositionClicks() |
318 | .doOnNext(this::handleMoreContextualItemClick) | 305 | .doOnNext(this::handleMoreContextualItemClick) |
... | @@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -424,8 +411,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
424 | } | 411 | } |
425 | 412 | ||
426 | private void handleMoreItemClick(Campaign moreItem) { | 413 | private void handleMoreItemClick(Campaign moreItem) { |
427 | - EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltySDKFirebaseEventModel())); | ||
428 | - | ||
429 | try { | 414 | try { |
430 | JSONObject extraFields = WarpJSONParser.getJSONFromString(moreItem.getExtraFields()); | 415 | JSONObject extraFields = WarpJSONParser.getJSONFromString(moreItem.getExtraFields()); |
431 | if (extraFields != null) { | 416 | if (extraFields != null) { |
... | @@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener | ... | @@ -483,31 +468,6 @@ public class MoreForYouActivity extends Activity implements View.OnClickListener |
483 | startActivity(intent); | 468 | startActivity(intent); |
484 | } | 469 | } |
485 | 470 | ||
486 | - private void mergeDatasets(ArrayList<Campaign> campaignList, | ||
487 | - ArrayList<LoyaltyContextualOfferModel> ccmsList) { | ||
488 | - mData.clear(); | ||
489 | - if (campaignList != null && campaignList.size() > 0) { | ||
490 | - Log.v("MORE_FOR_YOU", String.valueOf(campaignList.size())); | ||
491 | - for (Campaign campaign : campaignList) { | ||
492 | - MergedMore data = new MergedMore(); | ||
493 | - data.setCampaign(campaign); | ||
494 | - data.setDataType(1); | ||
495 | - mData.add(data); | ||
496 | - } | ||
497 | - } | ||
498 | - | ||
499 | - if (ccmsList != null && ccmsList.size() > 0) { | ||
500 | - Log.v("CCMS", String.valueOf(ccmsList.size())); | ||
501 | - for (LoyaltyContextualOfferModel ccmsItem : ccmsList) { | ||
502 | - MergedMore data = new MergedMore(); | ||
503 | - data.setCampaign(null); | ||
504 | - data.setCCMS(ccmsItem); | ||
505 | - data.setDataType(2); | ||
506 | - mData.add(data); | ||
507 | - } | ||
508 | - } | ||
509 | - } | ||
510 | - | ||
511 | /** | 471 | /** |
512 | * New Implementation | 472 | * New Implementation |
513 | */ | 473 | */ | ... | ... |
... | @@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener | ... | @@ -89,7 +89,7 @@ public class WarplyHealthService extends Service implements SensorEventListener |
89 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); | 89 | mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE); |
90 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); | 90 | mSensor = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER); |
91 | // registerStepSensor(); | 91 | // registerStepSensor(); |
92 | -// Warply.getInitializer(this).init(); | 92 | + Warply.getInitializer(getApplicationContext()).init(); |
93 | WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); | 93 | WarplyManager.getPacingDetails(new PacingDetailsRequest(), mPacingCallback); |
94 | } | 94 | } |
95 | 95 | ... | ... |
... | @@ -992,8 +992,8 @@ public class WarplyManagerHelper { | ... | @@ -992,8 +992,8 @@ public class WarplyManagerHelper { |
992 | }); | 992 | }); |
993 | } | 993 | } |
994 | 994 | ||
995 | - public static void setTrackersEnabled(boolean isEnabled) { | 995 | + public static void setTrackersEnabled(Context context, boolean isEnabled) { |
996 | - WarpUtils.setTrackersEnabled(Warply.getWarplyContext(), isEnabled); | 996 | + WarpUtils.setTrackersEnabled(context, isEnabled); |
997 | 997 | ||
998 | // JSONObject obj = new JSONObject(); | 998 | // JSONObject obj = new JSONObject(); |
999 | // try { | 999 | // try { |
... | @@ -1137,9 +1137,13 @@ public class WarplyManagerHelper { | ... | @@ -1137,9 +1137,13 @@ public class WarplyManagerHelper { |
1137 | public static void setCampaignList(ArrayList<Campaign> campaignList) { | 1137 | public static void setCampaignList(ArrayList<Campaign> campaignList) { |
1138 | // mCampaignList.clear(); | 1138 | // mCampaignList.clear(); |
1139 | // mCampaignList.addAll(campaignList); | 1139 | // mCampaignList.addAll(campaignList); |
1140 | - Set<Campaign> set = new LinkedHashSet<>(campaignList); | 1140 | + |
1141 | +// Set<Campaign> set = new LinkedHashSet<>(campaignList); | ||
1142 | +// mCampaignListAll.clear(); | ||
1143 | +// mCampaignListAll.addAll(set); | ||
1144 | + | ||
1141 | mCampaignListAll.clear(); | 1145 | mCampaignListAll.clear(); |
1142 | - mCampaignListAll.addAll(set); | 1146 | + mCampaignListAll = campaignList; |
1143 | 1147 | ||
1144 | mCampaignList.clear(); | 1148 | mCampaignList.clear(); |
1145 | for (Campaign camp : campaignList) { | 1149 | for (Campaign camp : campaignList) { | ... | ... |
... | @@ -29,16 +29,11 @@ import android.app.ActivityManager; | ... | @@ -29,16 +29,11 @@ import android.app.ActivityManager; |
29 | import android.content.Context; | 29 | import android.content.Context; |
30 | import android.content.Intent; | 30 | import android.content.Intent; |
31 | import android.os.Build; | 31 | import android.os.Build; |
32 | -import android.os.Handler; | ||
33 | -import android.os.Looper; | ||
34 | -import android.util.Log; | ||
35 | 32 | ||
36 | -import androidx.appcompat.app.AlertDialog; | ||
37 | import androidx.work.OneTimeWorkRequest; | 33 | import androidx.work.OneTimeWorkRequest; |
38 | import androidx.work.WorkManager; | 34 | import androidx.work.WorkManager; |
39 | 35 | ||
40 | import org.greenrobot.eventbus.EventBus; | 36 | import org.greenrobot.eventbus.EventBus; |
41 | -import org.json.JSONArray; | ||
42 | import org.json.JSONException; | 37 | import org.json.JSONException; |
43 | import org.json.JSONObject; | 38 | import org.json.JSONObject; |
44 | 39 | ||
... | @@ -46,12 +41,10 @@ import java.text.ParseException; | ... | @@ -46,12 +41,10 @@ import java.text.ParseException; |
46 | import java.text.SimpleDateFormat; | 41 | import java.text.SimpleDateFormat; |
47 | import java.util.ArrayList; | 42 | import java.util.ArrayList; |
48 | import java.util.Collections; | 43 | import java.util.Collections; |
49 | -import java.util.Comparator; | ||
50 | import java.util.Date; | 44 | import java.util.Date; |
51 | import java.util.LinkedHashSet; | 45 | import java.util.LinkedHashSet; |
52 | import java.util.Set; | 46 | import java.util.Set; |
53 | 47 | ||
54 | -import ly.warp.sdk.R; | ||
55 | import ly.warp.sdk.Warply; | 48 | import ly.warp.sdk.Warply; |
56 | import ly.warp.sdk.db.WarplyDBHelper; | 49 | import ly.warp.sdk.db.WarplyDBHelper; |
57 | import ly.warp.sdk.io.callbacks.AddressHook; | 50 | import ly.warp.sdk.io.callbacks.AddressHook; |
... | @@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook; | ... | @@ -73,7 +66,6 @@ import ly.warp.sdk.io.callbacks.TagsHook; |
73 | import ly.warp.sdk.io.callbacks.TransactionsHook; | 66 | import ly.warp.sdk.io.callbacks.TransactionsHook; |
74 | import ly.warp.sdk.io.models.AddressList; | 67 | import ly.warp.sdk.io.models.AddressList; |
75 | import ly.warp.sdk.io.models.Campaign; | 68 | import ly.warp.sdk.io.models.Campaign; |
76 | -import ly.warp.sdk.io.models.CampaignList; | ||
77 | import ly.warp.sdk.io.models.Card; | 69 | import ly.warp.sdk.io.models.Card; |
78 | import ly.warp.sdk.io.models.CardList; | 70 | import ly.warp.sdk.io.models.CardList; |
79 | import ly.warp.sdk.io.models.Consumer; | 71 | import ly.warp.sdk.io.models.Consumer; |
... | @@ -82,11 +74,8 @@ import ly.warp.sdk.io.models.Coupon; | ... | @@ -82,11 +74,8 @@ import ly.warp.sdk.io.models.Coupon; |
82 | import ly.warp.sdk.io.models.CouponList; | 74 | import ly.warp.sdk.io.models.CouponList; |
83 | import ly.warp.sdk.io.models.Couponset; | 75 | import ly.warp.sdk.io.models.Couponset; |
84 | import ly.warp.sdk.io.models.CouponsetsList; | 76 | import ly.warp.sdk.io.models.CouponsetsList; |
85 | -import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | ||
86 | import ly.warp.sdk.io.models.MerchantCategoriesList; | 77 | import ly.warp.sdk.io.models.MerchantCategoriesList; |
87 | import ly.warp.sdk.io.models.MerchantList; | 78 | import ly.warp.sdk.io.models.MerchantList; |
88 | -import ly.warp.sdk.io.models.NewCampaign; | ||
89 | -import ly.warp.sdk.io.models.NewCampaignList; | ||
90 | import ly.warp.sdk.io.models.PacingDetails; | 79 | import ly.warp.sdk.io.models.PacingDetails; |
91 | import ly.warp.sdk.io.models.PointsList; | 80 | import ly.warp.sdk.io.models.PointsList; |
92 | import ly.warp.sdk.io.models.ProductList; | 81 | import ly.warp.sdk.io.models.ProductList; |
... | @@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants; | ... | @@ -154,8 +143,6 @@ import ly.warp.sdk.utils.constants.WarpConstants; |
154 | */ | 143 | */ |
155 | 144 | ||
156 | public class WarplyManager { | 145 | public class WarplyManager { |
157 | - private static ArrayList<Campaign> mNewCampaignList = new ArrayList<Campaign>(); | ||
158 | - | ||
159 | public static void getProducts(WarplyProductsRequest request, final CallbackReceiver<ProductList> receiver) { | 146 | public static void getProducts(WarplyProductsRequest request, final CallbackReceiver<ProductList> receiver) { |
160 | // String productCategory = ""; | 147 | // String productCategory = ""; |
161 | // int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName()); | 148 | // int resStringId = getWarplyContext().getResources().getIdentifier("products_category", "string", getWarplyContext().getPackageName()); |
... | @@ -1392,53 +1379,28 @@ public class WarplyManager { | ... | @@ -1392,53 +1379,28 @@ public class WarplyManager { |
1392 | Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { | 1379 | Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, false, "campaigns", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { |
1393 | @Override | 1380 | @Override |
1394 | public void onSuccess(ArrayList<Campaign> result) { | 1381 | public void onSuccess(ArrayList<Campaign> result) { |
1395 | -// receiver.onSuccess(result); | ||
1396 | - mNewCampaignList.clear(); | ||
1397 | - mNewCampaignList.addAll(result); | ||
1398 | getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() { | 1382 | getCampaignsPersonalized(request, new CallbackReceiver<ArrayList<Campaign>>() { |
1399 | @Override | 1383 | @Override |
1400 | public void onSuccess(ArrayList<Campaign> resultPersonalized) { | 1384 | public void onSuccess(ArrayList<Campaign> resultPersonalized) { |
1401 | - receiver.onSuccess(resultPersonalized); | 1385 | + ArrayList<Campaign> newCampaignList = new ArrayList<Campaign>(); |
1402 | - } | 1386 | + newCampaignList.clear(); |
1403 | - | 1387 | + newCampaignList.addAll(result); |
1404 | - @Override | 1388 | + newCampaignList.addAll(resultPersonalized); |
1405 | - public void onFailure(int errorCode) { | 1389 | + Collections.sort(newCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); |
1406 | - receiver.onFailure(errorCode); | 1390 | + WarplyManagerHelper.setCampaignList(newCampaignList); |
1407 | - } | 1391 | + ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>(); |
1408 | - }); | 1392 | + campaignLoyaltyList.clear(); |
1409 | - } | 1393 | + ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); |
1410 | - | 1394 | + campaignCarouselList.clear(); |
1411 | - @Override | 1395 | + for (Campaign camp : newCampaignList) { |
1412 | - public void onFailure(int errorCode) { | 1396 | + JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); |
1413 | - receiver.onFailure(errorCode); | 1397 | + if (campMetadata != null) { |
1414 | - } | 1398 | + if (campMetadata.has("carousel")) { |
1415 | - }, | 1399 | + campaignCarouselList.add(camp); |
1416 | - request.getSignature())); | 1400 | + } |
1417 | - } | 1401 | + } |
1418 | - | ||
1419 | - public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) { | ||
1420 | - WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | ||
1421 | - WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | ||
1422 | - WarpUtils.log("**************************************************"); | ||
1423 | - | ||
1424 | - Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { | ||
1425 | - @Override | ||
1426 | - public void onSuccess(ArrayList<Campaign> result) { | ||
1427 | - mNewCampaignList.addAll(result); | ||
1428 | - Collections.sort(mNewCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); | ||
1429 | - ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>(); | ||
1430 | - campaignLoyaltyList.clear(); | ||
1431 | - ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); | ||
1432 | - campaignCarouselList.clear(); | ||
1433 | - for (Campaign camp : mNewCampaignList) { | ||
1434 | - JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); | ||
1435 | - if (campMetadata != null) { | ||
1436 | - if (campMetadata.has("carousel")) { | ||
1437 | - campaignCarouselList.add(camp); | ||
1438 | - } | ||
1439 | - } | ||
1440 | 1402 | ||
1441 | - if (camp.getOfferCategory().equals("questionnaire")) { | 1403 | + if (camp.getOfferCategory().equals("questionnaire")) { |
1442 | // if (WarplyManagerHelper.getConsumerInternal() != null) { | 1404 | // if (WarplyManagerHelper.getConsumerInternal() != null) { |
1443 | // JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); | 1405 | // JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); |
1444 | // if (profMetadata != null) { | 1406 | // if (profMetadata != null) { |
... | @@ -1478,23 +1440,22 @@ public class WarplyManager { | ... | @@ -1478,23 +1440,22 @@ public class WarplyManager { |
1478 | // campaignLoyaltyList.add(camp); | 1440 | // campaignLoyaltyList.add(camp); |
1479 | // } | 1441 | // } |
1480 | // } | 1442 | // } |
1481 | - } else { | 1443 | + } else { |
1482 | - try { | 1444 | + try { |
1483 | - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); | 1445 | + JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); |
1484 | - if (extraFields != null) { | 1446 | + if (extraFields != null) { |
1485 | - if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) { | 1447 | + if (extraFields.length() == 0 || !(/*extraFields.has("ccms_offer") || */extraFields.has("type"))) { |
1448 | + campaignLoyaltyList.add(camp); | ||
1449 | + } | ||
1450 | + } | ||
1451 | + } catch (Exception exception) { | ||
1486 | campaignLoyaltyList.add(camp); | 1452 | campaignLoyaltyList.add(camp); |
1487 | } | 1453 | } |
1488 | } | 1454 | } |
1489 | - } catch (Exception exception) { | ||
1490 | - campaignLoyaltyList.add(camp); | ||
1491 | } | 1455 | } |
1492 | - } | 1456 | + WarplyManagerHelper.setCarouselList(campaignCarouselList); |
1493 | - } | ||
1494 | - WarplyManagerHelper.setCampaignList(mNewCampaignList); | ||
1495 | - WarplyManagerHelper.setCarouselList(campaignCarouselList); | ||
1496 | 1457 | ||
1497 | -// ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>(); | 1458 | + // ArrayList<LoyaltyContextualOfferModel> list = new ArrayList<>(); |
1498 | // JSONArray jArray = null; | 1459 | // JSONArray jArray = null; |
1499 | // try { | 1460 | // try { |
1500 | // jArray = new JSONArray("[\n" + | 1461 | // jArray = new JSONArray("[\n" + |
... | @@ -2045,10 +2006,36 @@ public class WarplyManager { | ... | @@ -2045,10 +2006,36 @@ public class WarplyManager { |
2045 | // } | 2006 | // } |
2046 | // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); | 2007 | // WarplyManagerHelper.setCCMSLoyaltyCampaigns(list); |
2047 | 2008 | ||
2048 | - Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); | 2009 | + Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); |
2049 | - campaignLoyaltyList.clear(); | 2010 | + campaignLoyaltyList.clear(); |
2050 | - campaignLoyaltyList.addAll(set); | 2011 | + campaignLoyaltyList.addAll(set); |
2051 | - receiver.onSuccess(campaignLoyaltyList); //result | 2012 | + receiver.onSuccess(campaignLoyaltyList); //resultPersonalized |
2013 | + } | ||
2014 | + | ||
2015 | + @Override | ||
2016 | + public void onFailure(int errorCode) { | ||
2017 | + receiver.onFailure(errorCode); | ||
2018 | + } | ||
2019 | + }); | ||
2020 | + } | ||
2021 | + | ||
2022 | + @Override | ||
2023 | + public void onFailure(int errorCode) { | ||
2024 | + receiver.onFailure(errorCode); | ||
2025 | + } | ||
2026 | + }, | ||
2027 | + request.getSignature())); | ||
2028 | + } | ||
2029 | + | ||
2030 | + public static void getCampaignsPersonalized(WarplyGetCampaignsRequest request, final CallbackReceiver<ArrayList<Campaign>> receiver) { | ||
2031 | + WarpUtils.log("************* WARPLY Get Campaigns Request ********************"); | ||
2032 | + WarpUtils.log("[WARP Trace] WARPLY Get Campaigns Request is active"); | ||
2033 | + WarpUtils.log("**************************************************"); | ||
2034 | + | ||
2035 | + Warply.postReceiveMicroappData(WarpConstants.MICROAPP_NEW_CAMPAIGNS, true, "campaignsPersonalized", request.toJson(), new NewCampaignsHook(new CallbackReceiver<ArrayList<Campaign>>() { | ||
2036 | + @Override | ||
2037 | + public void onSuccess(ArrayList<Campaign> result) { | ||
2038 | + receiver.onSuccess(result); | ||
2052 | } | 2039 | } |
2053 | 2040 | ||
2054 | @Override | 2041 | @Override | ... | ... |
-
Please register or login to post a comment