Showing
11 changed files
with
120 additions
and
326 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 | ... | ... |
... | @@ -23,7 +23,6 @@ import org.json.JSONObject; | ... | @@ -23,7 +23,6 @@ import org.json.JSONObject; |
23 | 23 | ||
24 | import java.io.Serializable; | 24 | import java.io.Serializable; |
25 | import java.util.ArrayList; | 25 | import java.util.ArrayList; |
26 | -import java.util.HashMap; | ||
27 | import java.util.HashSet; | 26 | import java.util.HashSet; |
28 | import java.util.LinkedHashSet; | 27 | import java.util.LinkedHashSet; |
29 | import java.util.Set; | 28 | import java.util.Set; |
... | @@ -31,7 +30,6 @@ import java.util.Set; | ... | @@ -31,7 +30,6 @@ import java.util.Set; |
31 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; | 30 | import io.github.inflationx.viewpump.ViewPumpContextWrapper; |
32 | import ly.warp.sdk.R; | 31 | import ly.warp.sdk.R; |
33 | import ly.warp.sdk.io.models.Campaign; | 32 | import ly.warp.sdk.io.models.Campaign; |
34 | -import ly.warp.sdk.io.models.CampaignList; | ||
35 | import ly.warp.sdk.io.models.Couponset; | 33 | import ly.warp.sdk.io.models.Couponset; |
36 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; | 34 | import ly.warp.sdk.io.models.LoyaltyContextualOfferModel; |
37 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; | 35 | import ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent; |
... | @@ -60,13 +58,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -60,13 +58,11 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
60 | 58 | ||
61 | private ImageView mIvBack, mIvPopupClose; | 59 | private ImageView mIvBack, mIvPopupClose; |
62 | private TextView mTvTitle; | 60 | private TextView mTvTitle; |
63 | - private HashMap<String, CampaignList> mUniqueGiftsList = new HashMap<String, CampaignList>(); | ||
64 | private LinearLayout mLlGiftsPopup; | 61 | private LinearLayout mLlGiftsPopup; |
65 | - private ArrayList<MergedGifts> mData = new ArrayList(); | 62 | + private ArrayList<MergedGifts> mData = new ArrayList<>(); |
66 | private RecyclerView mRecyclerMergedGifts; | 63 | private RecyclerView mRecyclerMergedGifts; |
67 | private MergedGiftsAdapter mAdapterMergedGifts; | 64 | private MergedGiftsAdapter mAdapterMergedGifts; |
68 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); | 65 | private ArrayList<Campaign> mValuesList = new ArrayList<>(); |
69 | - // private HashSet<Campaign> mHashSetList = new HashSet<>(); | ||
70 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); | 66 | private ArrayList<LoyaltyGiftsForYouPackage> mSeasonalList = new ArrayList<>(); |
71 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); | 67 | private HashSet<LoyaltyGiftsForYouPackage> mHashSetSeasonalList = new HashSet<>(); |
72 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); | 68 | private ArrayList<LoyaltyContextualOfferModel> mContextualList = new ArrayList<>(); |
... | @@ -82,37 +78,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -82,37 +78,17 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
82 | super.onCreate(savedInstanceState); | 78 | super.onCreate(savedInstanceState); |
83 | setContentView(R.layout.activity_gifts_for_you); | 79 | setContentView(R.layout.activity_gifts_for_you); |
84 | mSecondsHandler = new Handler(); | 80 | mSecondsHandler = new Handler(); |
85 | - filterItems(); | ||
86 | - | ||
87 | - if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | ||
88 | - mHashSetSeasonalList.clear(); | ||
89 | - mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | ||
90 | - mSeasonalList.clear(); | ||
91 | - mSeasonalList.addAll(mHashSetSeasonalList); | ||
92 | - } | ||
93 | - | ||
94 | - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
95 | - mContextualList.clear(); | ||
96 | - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
97 | - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
98 | - && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
99 | - mContextualList.add(ccmsItem); | ||
100 | - } | ||
101 | - } | ||
102 | - | ||
103 | - mergeDatasets( | ||
104 | - mSeasonalList, | ||
105 | - mContextualList, | ||
106 | - mValuesList | ||
107 | - ); | ||
108 | 81 | ||
109 | mIvBack = findViewById(R.id.iv_list_close); | 82 | mIvBack = findViewById(R.id.iv_list_close); |
110 | mTvTitle = findViewById(R.id.textView3); | 83 | mTvTitle = findViewById(R.id.textView3); |
111 | mIvPopupClose = findViewById(R.id.iv_popup_gifts_close); | 84 | mIvPopupClose = findViewById(R.id.iv_popup_gifts_close); |
112 | mLlGiftsPopup = findViewById(R.id.ll_gifts_popup); | 85 | mLlGiftsPopup = findViewById(R.id.ll_gifts_popup); |
113 | - | ||
114 | mRecyclerMergedGifts = findViewById(R.id.rv_merged_gifts); | 86 | mRecyclerMergedGifts = findViewById(R.id.rv_merged_gifts); |
115 | 87 | ||
88 | + filterItems(); | ||
89 | + | ||
90 | + mergeDatasets(); | ||
91 | + | ||
116 | initViews(); | 92 | initViews(); |
117 | } | 93 | } |
118 | 94 | ||
... | @@ -191,29 +167,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -191,29 +167,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
191 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { | 167 | if (event.getCcmsAdded() != null || event.getCampaignsAdded() != null) { |
192 | filterItems(); | 168 | filterItems(); |
193 | 169 | ||
194 | - if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | 170 | + mergeDatasets(); |
195 | - mHashSetSeasonalList.clear(); | ||
196 | - mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | ||
197 | - mSeasonalList.clear(); | ||
198 | - mSeasonalList.addAll(mHashSetSeasonalList); | ||
199 | - } | ||
200 | - | ||
201 | - if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
202 | - mContextualList.clear(); | ||
203 | - for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
204 | - if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
205 | - && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
206 | - mContextualList.add(ccmsItem); | ||
207 | - } | ||
208 | - } | ||
209 | - | ||
210 | - mergeDatasets( | ||
211 | - mSeasonalList, | ||
212 | - mContextualList, | ||
213 | - mValuesList | ||
214 | - ); | ||
215 | 171 | ||
216 | - runOnUiThread(this::initViews); | 172 | + runOnUiThread(this::initViews2); |
217 | } | 173 | } |
218 | } | 174 | } |
219 | 175 | ||
... | @@ -229,13 +185,41 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -229,13 +185,41 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
229 | // mLlGiftsPopup.setVisibility(View.VISIBLE); | 185 | // mLlGiftsPopup.setVisibility(View.VISIBLE); |
230 | 186 | ||
231 | if (mData != null && mData.size() > 0) { | 187 | if (mData != null && mData.size() > 0) { |
188 | + mRecyclerMergedGifts.setNestedScrollingEnabled(false); | ||
232 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | 189 | mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); |
233 | mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); | 190 | mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); |
234 | -// mAdapterMergedGifts.setHasStableIds(true); | ||
235 | -// mRecyclerMergedGifts.setItemAnimator(null); | ||
236 | mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); | 191 | mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); |
237 | mAdapterMergedGifts.getPositionClicks() | 192 | mAdapterMergedGifts.getPositionClicks() |
238 | - .doOnNext(dataItem -> { | 193 | + .doOnNext(this::handleGiftItemClick) |
194 | + .doOnError(error -> { | ||
195 | + }) | ||
196 | + .subscribe(); | ||
197 | + } | ||
198 | + } | ||
199 | + | ||
200 | + private void initViews2() { | ||
201 | + mIvBack.setOnClickListener(this); | ||
202 | + mIvPopupClose.setOnClickListener(this); | ||
203 | + | ||
204 | +// if (WarpUtils.getGiftsPopup(this)) | ||
205 | +// mLlGiftsPopup.setVisibility(View.VISIBLE); | ||
206 | + | ||
207 | + if (mData != null && mData.size() > 0) { | ||
208 | +// mRecyclerMergedGifts.setNestedScrollingEnabled(false); | ||
209 | +// mRecyclerMergedGifts.setLayoutManager(new LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)); | ||
210 | +// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); | ||
211 | +// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); | ||
212 | +// mAdapterMergedGifts.getPositionClicks() | ||
213 | +// .doOnNext(this::handleGiftItemClick) | ||
214 | +// .doOnError(error -> { | ||
215 | +// }) | ||
216 | +// .subscribe(); | ||
217 | + | ||
218 | + mAdapterMergedGifts.updateData(mData); | ||
219 | + } | ||
220 | + } | ||
221 | + | ||
222 | + private void handleGiftItemClick(MergedGifts dataItem) { | ||
239 | if (dataItem.getDataType() == 1) { | 223 | if (dataItem.getDataType() == 1) { |
240 | WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString()); | 224 | WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString()); |
241 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); | 225 | EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); |
... | @@ -386,153 +370,13 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -386,153 +370,13 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
386 | intent.putExtra("ccms", dataItem.getCCMS()); | 370 | intent.putExtra("ccms", dataItem.getCCMS()); |
387 | startActivity(intent); | 371 | startActivity(intent); |
388 | } | 372 | } |
389 | - }) | ||
390 | - .doOnError(error -> { | ||
391 | - }) | ||
392 | - .subscribe(); | ||
393 | - } | ||
394 | - } | ||
395 | - | ||
396 | - private void initViews2() { | ||
397 | - mIvBack.setOnClickListener(this); | ||
398 | - mIvPopupClose.setOnClickListener(this); | ||
399 | - | ||
400 | - if (mData != null && mData.size() > 0) { | ||
401 | -// mAdapterMergedGifts = new MergedGiftsAdapter(this, mData); | ||
402 | -// mAdapterMergedGifts.setHasStableIds(true); | ||
403 | -// mRecyclerMergedGifts.setItemAnimator(null); | ||
404 | -// mRecyclerMergedGifts.setAdapter(mAdapterMergedGifts); | ||
405 | -// mAdapterMergedGifts.getPositionClicks() | ||
406 | -// .doOnNext(dataItem -> { | ||
407 | -// if (dataItem.getDataType() == 1) { | ||
408 | -// WarpUtils.log("GFY_CLICK " + dataItem.getCampaign().toString()); | ||
409 | -// EventBus.getDefault().post(new WarplyEventBusManager(new LoyaltyGiftsForYouOfferClickEvent())); | ||
410 | -// | ||
411 | -// if (dataItem.getCampaign().getType().equals("coupon")) { | ||
412 | -// if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
413 | -// LoyaltyContextualOfferModel ccmsItem = null; | ||
414 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
415 | -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ||
416 | -// ccmsItem = ccms; | ||
417 | -// break; | ||
418 | -// } | ||
419 | -// } | ||
420 | -// | ||
421 | -// if (ccmsItem != null) { | ||
422 | -// try { | ||
423 | -// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | ||
424 | -// if (campaignSettings != null) { | ||
425 | -// if (campaignSettings.has("couponset")) { | ||
426 | -// String cpnUuid = campaignSettings.optString("couponset"); | ||
427 | -// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | ||
428 | -// if (cpns.getUuid().equals(cpnUuid)) { | ||
429 | -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
430 | -// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | ||
431 | -// intent.putExtra("couponset", (Serializable) cpns); | ||
432 | -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | ||
433 | -// intent.putExtra("ccms", ccmsItem); | ||
434 | -// startActivityForResult(intent, 1004); | ||
435 | -// break; | ||
436 | -// } | ||
437 | -// } | ||
438 | -// } else { | ||
439 | -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | ||
440 | -// } | ||
441 | -// } | ||
442 | -// } catch (Exception exception) { | ||
443 | -// exception.printStackTrace(); | ||
444 | -// } | ||
445 | -// | ||
446 | -// return; | ||
447 | -// } | ||
448 | -// } | ||
449 | -// | ||
450 | -// try { | ||
451 | -// JSONObject campaignSettings = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getCampaignTypeSettings()); | ||
452 | -// if (campaignSettings != null) { | ||
453 | -// if (campaignSettings.has("couponset")) { | ||
454 | -// String cpnUuid = campaignSettings.optString("couponset"); | ||
455 | -// for (Couponset cpns : WarplyManagerHelper.getCouponsets()) { | ||
456 | -// if (cpns.getUuid().equals(cpnUuid)) { | ||
457 | -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
458 | -// Intent intent = new Intent(GiftsForYouActivity.this, CouponsetInfoActivity.class); | ||
459 | -// intent.putExtra("couponset", (Serializable) cpns); | ||
460 | -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | ||
461 | -// startActivityForResult(intent, 1004); | ||
462 | -// break; | ||
463 | -// } | ||
464 | -// } | ||
465 | -// } else { | ||
466 | -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | ||
467 | -// } | ||
468 | -// } | ||
469 | -// } catch (Exception exception) { | ||
470 | -// exception.printStackTrace(); | ||
471 | -// } | ||
472 | -// | ||
473 | -// return; | ||
474 | -// } | ||
475 | -// | ||
476 | -// try { | ||
477 | -// JSONObject extraFields = WarpJSONParser.getJSONFromString(dataItem.getCampaign().getExtraFields()); | ||
478 | -// if (extraFields != null) { | ||
479 | -// if (extraFields.has("type") && extraFields.optString("type").equals("telco")) { | ||
480 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
481 | -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ||
482 | -// WarplyManager.getSingleCampaign(dataItem.getCampaign().getSessionUUID()); | ||
483 | -// Intent intent = new Intent(GiftsForYouActivity.this, TelcoActivity.class); | ||
484 | -// intent.putExtra("ccms", ccms); | ||
485 | -// intent.putExtra("loyalty", (Serializable) dataItem.getCampaign()); | ||
486 | -// startActivityForResult(intent, 1004); | ||
487 | -// break; | ||
488 | -// } | ||
489 | -// } | ||
490 | -// return; | ||
491 | -// } | ||
492 | -// if (extraFields.has("ccms_offer") && extraFields.optString("ccms_offer").equals("true")) { | ||
493 | -// for (LoyaltyContextualOfferModel ccms : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
494 | -// if (ccms.getLoyaltyCampaignId().equals(dataItem.getCampaign().getSessionUUID())) { | ||
495 | -// WarpUtils.log("CCMS_CLICK " + ccms.toString()); | ||
496 | -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCcmsUrl(dataItem.getCampaign(), ccms)), 1004); | ||
497 | -// break; | ||
498 | -// } | ||
499 | -// } | ||
500 | -// } else { | ||
501 | -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | ||
502 | -// } | ||
503 | -// } | ||
504 | -// } catch (Exception exception) { | ||
505 | -// startActivityForResult(WarpViewActivity.createIntentFromURL(this, WarplyManagerHelper.constructCampaignUrl(dataItem.getCampaign())), 1004); | ||
506 | -// } | ||
507 | -// } else if (dataItem.getDataType() == 2) { | ||
508 | -// LoyaltyGiftsForYouOfferClickEvent seasonalCLick = new LoyaltyGiftsForYouOfferClickEvent(); | ||
509 | -// seasonalCLick.setTitle(dataItem.getSeasonalList().getTitle()); | ||
510 | -// seasonalCLick.setLoyaltyPackageId(dataItem.getSeasonalList().getLoyaltyPackageId()); | ||
511 | -// seasonalCLick.setImageUrl(dataItem.getSeasonalList().getImageUrl()); | ||
512 | -// seasonalCLick.setContext(GiftsForYouActivity.this); | ||
513 | -// EventBus.getDefault().post(new WarplyEventBusManager(seasonalCLick)); | ||
514 | -// } else if (dataItem.getDataType() == 3) { | ||
515 | -// Intent intent = new Intent(GiftsForYouActivity.this, ContextualActivity.class); | ||
516 | -// intent.putExtra("ccms", dataItem.getCCMS()); | ||
517 | -// startActivity(intent); | ||
518 | -// } | ||
519 | -// }) | ||
520 | -// .doOnError(error -> { | ||
521 | -// }) | ||
522 | -// .subscribe(); | ||
523 | -// mAdapterMergedGifts.notifyDataSetChanged(); | ||
524 | - | ||
525 | - mAdapterMergedGifts.updateData(mData); | ||
526 | - } | ||
527 | } | 373 | } |
528 | 374 | ||
529 | - private void mergeDatasets(ArrayList<LoyaltyGiftsForYouPackage> seasonalList, | 375 | + private void mergeDatasets() { |
530 | - ArrayList<LoyaltyContextualOfferModel> ccmsList, | ||
531 | - ArrayList<Campaign> campaignList) { | ||
532 | mData.clear(); | 376 | mData.clear(); |
533 | - if (seasonalList != null && seasonalList.size() > 0) { | 377 | + if (mSeasonalList != null && mSeasonalList.size() > 0) { |
534 | - Log.v("SEASONAL", String.valueOf(seasonalList.size())); | 378 | + Log.v("SEASONAL", String.valueOf(mSeasonalList.size())); |
535 | - for (LoyaltyGiftsForYouPackage seasonal : seasonalList) { | 379 | + for (LoyaltyGiftsForYouPackage seasonal : mSeasonalList) { |
536 | MergedGifts data = new MergedGifts(); | 380 | MergedGifts data = new MergedGifts(); |
537 | data.setCampaign(null); | 381 | data.setCampaign(null); |
538 | data.setSeasonalList(seasonal); | 382 | data.setSeasonalList(seasonal); |
... | @@ -542,9 +386,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -542,9 +386,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
542 | } | 386 | } |
543 | } | 387 | } |
544 | 388 | ||
545 | - if (ccmsList != null && ccmsList.size() > 0) { | 389 | + if (mContextualList != null && mContextualList.size() > 0) { |
546 | - Log.v("CCMS", String.valueOf(ccmsList.size())); | 390 | + Log.v("CCMS", String.valueOf(mContextualList.size())); |
547 | - for (LoyaltyContextualOfferModel ccmsItem : ccmsList) { | 391 | + for (LoyaltyContextualOfferModel ccmsItem : mContextualList) { |
548 | MergedGifts data = new MergedGifts(); | 392 | MergedGifts data = new MergedGifts(); |
549 | data.setCampaign(null); | 393 | data.setCampaign(null); |
550 | data.setSeasonalList(null); | 394 | data.setSeasonalList(null); |
... | @@ -554,16 +398,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -554,16 +398,9 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
554 | } | 398 | } |
555 | } | 399 | } |
556 | 400 | ||
557 | - if (campaignList != null && campaignList.size() > 0) { | 401 | + if (mValuesList != null && mValuesList.size() > 0) { |
558 | - final ArrayList<Campaign> customs3 = new ArrayList<Campaign>(); | 402 | + Log.v("GIFTS_FOR_YOU", String.valueOf(mValuesList.size())); |
559 | - for (Campaign campaignItem : campaignList) { | 403 | + for (Campaign campaign : mValuesList) { |
560 | - if (!customs3.contains(campaignItem)) { | ||
561 | - customs3.add(campaignItem); | ||
562 | - } | ||
563 | - } | ||
564 | - | ||
565 | - Log.v("GIFTS_FOR_YOU", String.valueOf(campaignList.size())); | ||
566 | - for (Campaign campaign : customs3) { | ||
567 | MergedGifts data = new MergedGifts(); | 404 | MergedGifts data = new MergedGifts(); |
568 | data.setCampaign(campaign); | 405 | data.setCampaign(campaign); |
569 | data.setSeasonalList(null); | 406 | data.setSeasonalList(null); |
... | @@ -579,6 +416,22 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -579,6 +416,22 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
579 | } | 416 | } |
580 | 417 | ||
581 | private void filterItems() { | 418 | private void filterItems() { |
419 | + if (WarplyManagerHelper.getSeasonalList() != null && WarplyManagerHelper.getSeasonalList().size() > 0) { | ||
420 | + mHashSetSeasonalList.clear(); | ||
421 | + mHashSetSeasonalList.addAll(WarplyManagerHelper.getSeasonalList()); | ||
422 | + mSeasonalList.clear(); | ||
423 | + mSeasonalList.addAll(mHashSetSeasonalList); | ||
424 | + } | ||
425 | + | ||
426 | + if (WarplyManagerHelper.getCCMSLoyaltyCampaigns() != null && WarplyManagerHelper.getCCMSLoyaltyCampaigns().size() > 0) { | ||
427 | + mContextualList.clear(); | ||
428 | + for (LoyaltyContextualOfferModel ccmsItem : WarplyManagerHelper.getCCMSLoyaltyCampaigns()) { | ||
429 | + if ((TextUtils.isEmpty(ccmsItem.getLoyaltyCampaignId()) || ccmsItem.getLoyaltyCampaignId().equals("NA")) | ||
430 | + && ccmsItem.getZone().equals("COSMOTE_APP_GIFTS4U")) | ||
431 | + mContextualList.add(ccmsItem); | ||
432 | + } | ||
433 | + } | ||
434 | + | ||
582 | mValuesList.clear(); | 435 | mValuesList.clear(); |
583 | ArrayList<Campaign> gfyList = new ArrayList<>(); | 436 | ArrayList<Campaign> gfyList = new ArrayList<>(); |
584 | if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) { | 437 | if (WarplyManagerHelper.getCampaignListAll() != null && WarplyManagerHelper.getCampaignListAll().size() > 0) { |
... | @@ -623,15 +476,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene | ... | @@ -623,15 +476,8 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene |
623 | 476 | ||
624 | WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size())); | 477 | WarpUtils.log("GFY_FILTER_LIST_COUNT: " + String.valueOf(gfyList.size())); |
625 | WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString())); | 478 | WarpUtils.log("GFY_FILTER_LIST_JSON: " + String.valueOf(gfyList.toString())); |
626 | - mValuesList.addAll(gfyList); | ||
627 | - final ArrayList<Campaign> customs = new ArrayList<Campaign>(); | ||
628 | - for (Campaign campaignItem : mValuesList) { | ||
629 | - if (!customs.contains(campaignItem)) { | ||
630 | - customs.add(campaignItem); | ||
631 | - } | ||
632 | - } | ||
633 | mValuesList.clear(); | 479 | mValuesList.clear(); |
634 | - mValuesList.addAll(customs); | 480 | + mValuesList.addAll(gfyList); |
635 | WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size())); | 481 | WarpUtils.log("GFY_VAR_LIST_COUNT: " + String.valueOf(mValuesList.size())); |
636 | WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString())); | 482 | WarpUtils.log("GFY_VAR_LIST_JSON: " + String.valueOf(mValuesList.toString())); |
637 | } | 483 | } | ... | ... |
... | @@ -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,45 +1379,20 @@ public class WarplyManager { | ... | @@ -1392,45 +1379,20 @@ 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 | - } | ||
1408 | - }); | ||
1409 | - } | ||
1410 | - | ||
1411 | - @Override | ||
1412 | - public void onFailure(int errorCode) { | ||
1413 | - receiver.onFailure(errorCode); | ||
1414 | - } | ||
1415 | - }, | ||
1416 | - request.getSignature())); | ||
1417 | - } | ||
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<>(); | 1391 | ArrayList<Campaign> campaignLoyaltyList = new ArrayList<>(); |
1430 | campaignLoyaltyList.clear(); | 1392 | campaignLoyaltyList.clear(); |
1431 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); | 1393 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); |
1432 | campaignCarouselList.clear(); | 1394 | campaignCarouselList.clear(); |
1433 | - for (Campaign camp : mNewCampaignList) { | 1395 | + for (Campaign camp : newCampaignList) { |
1434 | JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); | 1396 | JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); |
1435 | if (campMetadata != null) { | 1397 | if (campMetadata != null) { |
1436 | if (campMetadata.has("carousel")) { | 1398 | if (campMetadata.has("carousel")) { |
... | @@ -1491,10 +1453,9 @@ public class WarplyManager { | ... | @@ -1491,10 +1453,9 @@ public class WarplyManager { |
1491 | } | 1453 | } |
1492 | } | 1454 | } |
1493 | } | 1455 | } |
1494 | - WarplyManagerHelper.setCampaignList(mNewCampaignList); | ||
1495 | WarplyManagerHelper.setCarouselList(campaignCarouselList); | 1456 | 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" + |
... | @@ -2048,7 +2009,33 @@ public class WarplyManager { | ... | @@ -2048,7 +2009,33 @@ public class WarplyManager { |
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