Panagiotis Triantafyllou

campaigns 2

...@@ -21,8 +21,6 @@ import ly.warp.sdk.R; ...@@ -21,8 +21,6 @@ import ly.warp.sdk.R;
21 import ly.warp.sdk.activities.BillPaymentActivity; 21 import ly.warp.sdk.activities.BillPaymentActivity;
22 import ly.warp.sdk.activities.CouponInfoActivity; 22 import ly.warp.sdk.activities.CouponInfoActivity;
23 import ly.warp.sdk.activities.WarpViewActivity; 23 import ly.warp.sdk.activities.WarpViewActivity;
24 -import ly.warp.sdk.io.models.Campaign;
25 -import ly.warp.sdk.io.models.CampaignList;
26 import ly.warp.sdk.io.models.Coupon; 24 import ly.warp.sdk.io.models.Coupon;
27 import ly.warp.sdk.io.models.CouponList; 25 import ly.warp.sdk.io.models.CouponList;
28 import ly.warp.sdk.views.adapters.HomeCampaignAdapter; 26 import ly.warp.sdk.views.adapters.HomeCampaignAdapter;
...@@ -74,19 +72,9 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener { ...@@ -74,19 +72,9 @@ public class HomeFragment extends BaseFragment implements View.OnClickListener {
74 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user), 72 mTvUsername.setText(String.format(getResources().getString(R.string.welcome_user),
75 BaseFragment.getConsumer().getFirstName() + " " + BaseFragment.getConsumer().getLastName())); 73 BaseFragment.getConsumer().getFirstName() + " " + BaseFragment.getConsumer().getLastName()));
76 74
77 - /********* TEST CAMPAIGNS DATA **********/
78 - CampaignList clistCampaigns = new CampaignList();
79 - try {
80 - clistCampaigns.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
81 - clistCampaigns.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
82 - } catch (JSONException e) {
83 - e.printStackTrace();
84 - }
85 - /********* TEST CAMPAIGNS DATA **********/
86 -
87 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns); 75 mRecyclerCampaigns = view.findViewById(R.id.rv_home_campaigns);
88 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 76 mRecyclerCampaigns.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
89 - mAdapterCampaigns = new HomeCampaignAdapter(getContext(), clistCampaigns); 77 + mAdapterCampaigns = new HomeCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("homescreen"));
90 mRecyclerCampaigns.setAdapter(mAdapterCampaigns); 78 mRecyclerCampaigns.setAdapter(mAdapterCampaigns);
91 mAdapterCampaigns.getPositionClicks() 79 mAdapterCampaigns.getPositionClicks()
92 .doOnNext(campaign -> { 80 .doOnNext(campaign -> {
......
...@@ -14,13 +14,9 @@ import androidx.fragment.app.Fragment; ...@@ -14,13 +14,9 @@ import androidx.fragment.app.Fragment;
14 import androidx.recyclerview.widget.LinearLayoutManager; 14 import androidx.recyclerview.widget.LinearLayoutManager;
15 import androidx.recyclerview.widget.RecyclerView; 15 import androidx.recyclerview.widget.RecyclerView;
16 16
17 -import org.json.JSONException;
18 -
19 import ly.warp.sdk.R; 17 import ly.warp.sdk.R;
20 import ly.warp.sdk.activities.LoyaltyActivity; 18 import ly.warp.sdk.activities.LoyaltyActivity;
21 import ly.warp.sdk.activities.WarpViewActivity; 19 import ly.warp.sdk.activities.WarpViewActivity;
22 -import ly.warp.sdk.io.models.Campaign;
23 -import ly.warp.sdk.io.models.CampaignList;
24 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter; 20 import ly.warp.sdk.views.adapters.ProfileCampaignAdapter;
25 21
26 public class LoyaltyFragment extends BaseFragment implements View.OnClickListener { 22 public class LoyaltyFragment extends BaseFragment implements View.OnClickListener {
...@@ -52,16 +48,6 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -52,16 +48,6 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
52 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 48 public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
53 super.onViewCreated(view, savedInstanceState); 49 super.onViewCreated(view, savedInstanceState);
54 50
55 - /********* TEST DATA **********/
56 - CampaignList clist = new CampaignList();
57 - try {
58 - clist.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
59 - clist.add(new Campaign("{\"session_uuid\": \"a724e911a71a42408b6ba50ae6c08dbb\", \"title\": \"\\u039a\\u03ac\\u03bd\\u03b5 strike\", \"subtitle\": \"\\u03ba\\u03b1\\u03b9 \\u03ba\\u03ad\\u03c1\\u03b4\\u03b9\\u03c3\\u03b5!\", \"offer_message\": null, \"message\": null, \"index_url\": \"https://warply.s3.amazonaws.com/artworks/034fba10ceac4e0f9338bd8e60086292/index.html\", \"logo_url\": \"https://warply.s3.amazonaws.com/temp/96322898cc824981aece923d8b5afc88/drggtdr.jpg\", \"starts\": 1644494400, \"expires\": 1881522000, \"delivered\": 1644607293, \"action\": 0, \"opened\": 1, \"offer_category\": \"standard-offer\", \"sorting\": 0, \"is_new\": true, \"session_metadata\": \"\\\"\\\"\", \"display_type\": null, \"delivery_method\": 2, \"extra_fields\": \"{}\", \"campaign_type\": null, \"campaign_type_settings\": null, \"actions\": null, \"show\": true, \"expired\": false, \"audience\": \"all\"}"));
60 - } catch (JSONException e) {
61 - e.printStackTrace();
62 - }
63 - /********* TEST DATA **********/
64 -
65 mClRewardsWallet = view.findViewById(R.id.cl_rewards_wallet); 51 mClRewardsWallet = view.findViewById(R.id.cl_rewards_wallet);
66 mClRewardsWallet.setOnClickListener(this); 52 mClRewardsWallet.setOnClickListener(this);
67 53
...@@ -79,7 +65,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -79,7 +65,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
79 65
80 mRecyclerDeals = view.findViewById(R.id.rv_deals); 66 mRecyclerDeals = view.findViewById(R.id.rv_deals);
81 mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 67 mRecyclerDeals.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
82 - mAdapterDeals = new ProfileCampaignAdapter(getContext(), clist); 68 + mAdapterDeals = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("deals"));
83 mRecyclerDeals.setAdapter(mAdapterDeals); 69 mRecyclerDeals.setAdapter(mAdapterDeals);
84 mAdapterDeals.getPositionClicks() 70 mAdapterDeals.getPositionClicks()
85 .doOnNext(deal -> { 71 .doOnNext(deal -> {
...@@ -93,7 +79,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -93,7 +79,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
93 79
94 mRecyclerGifts = view.findViewById(R.id.rv_gifts); 80 mRecyclerGifts = view.findViewById(R.id.rv_gifts);
95 mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 81 mRecyclerGifts.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
96 - mAdapterGifts = new ProfileCampaignAdapter(getContext(), clist); 82 + mAdapterGifts = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("gifts"));
97 mRecyclerGifts.setAdapter(mAdapterGifts); 83 mRecyclerGifts.setAdapter(mAdapterGifts);
98 mAdapterGifts.getPositionClicks() 84 mAdapterGifts.getPositionClicks()
99 .doOnNext(gift -> { 85 .doOnNext(gift -> {
...@@ -107,7 +93,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene ...@@ -107,7 +93,7 @@ public class LoyaltyFragment extends BaseFragment implements View.OnClickListene
107 93
108 mRecyclerMore = view.findViewById(R.id.rv_more); 94 mRecyclerMore = view.findViewById(R.id.rv_more);
109 mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false)); 95 mRecyclerMore.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
110 - mAdapterMore = new ProfileCampaignAdapter(getContext(), clist); 96 + mAdapterMore = new ProfileCampaignAdapter(getContext(), BaseFragment.getUniqueCampaignList().get("more"));
111 mRecyclerMore.setAdapter(mAdapterMore); 97 mRecyclerMore.setAdapter(mAdapterMore);
112 mAdapterMore.getPositionClicks() 98 mAdapterMore.getPositionClicks()
113 .doOnNext(more -> { 99 .doOnNext(more -> {
......