Showing
1 changed file
with
26 additions
and
4 deletions
... | @@ -54,6 +54,7 @@ import org.json.JSONArray; | ... | @@ -54,6 +54,7 @@ import org.json.JSONArray; |
54 | import org.json.JSONException; | 54 | import org.json.JSONException; |
55 | import org.json.JSONObject; | 55 | import org.json.JSONObject; |
56 | 56 | ||
57 | +import java.io.Serializable; | ||
57 | import java.text.ParseException; | 58 | import java.text.ParseException; |
58 | import java.text.SimpleDateFormat; | 59 | import java.text.SimpleDateFormat; |
59 | import java.util.ArrayList; | 60 | import java.util.ArrayList; |
... | @@ -67,6 +68,9 @@ import java.util.concurrent.ExecutorService; | ... | @@ -67,6 +68,9 @@ import java.util.concurrent.ExecutorService; |
67 | import java.util.concurrent.Executors; | 68 | import java.util.concurrent.Executors; |
68 | 69 | ||
69 | import ly.warp.sdk.Warply; | 70 | import ly.warp.sdk.Warply; |
71 | +import ly.warp.sdk.activities.CouponsetInfoActivity; | ||
72 | +import ly.warp.sdk.activities.GiftsForYouActivity; | ||
73 | +import ly.warp.sdk.activities.WarpViewActivity; | ||
70 | import ly.warp.sdk.db.WarplyDBHelper; | 74 | import ly.warp.sdk.db.WarplyDBHelper; |
71 | import ly.warp.sdk.io.callbacks.AddressHook; | 75 | import ly.warp.sdk.io.callbacks.AddressHook; |
72 | import ly.warp.sdk.io.callbacks.CallbackReceiver; | 76 | import ly.warp.sdk.io.callbacks.CallbackReceiver; |
... | @@ -96,6 +100,7 @@ import ly.warp.sdk.io.models.CouponList; | ... | @@ -96,6 +100,7 @@ import ly.warp.sdk.io.models.CouponList; |
96 | import ly.warp.sdk.io.models.Couponset; | 100 | import ly.warp.sdk.io.models.Couponset; |
97 | import ly.warp.sdk.io.models.CouponsetsList; | 101 | import ly.warp.sdk.io.models.CouponsetsList; |
98 | import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; | 102 | import ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel; |
103 | +import ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel; | ||
99 | import ly.warp.sdk.io.models.Merchant; | 104 | import ly.warp.sdk.io.models.Merchant; |
100 | import ly.warp.sdk.io.models.MerchantCategoriesList; | 105 | import ly.warp.sdk.io.models.MerchantCategoriesList; |
101 | import ly.warp.sdk.io.models.MerchantList; | 106 | import ly.warp.sdk.io.models.MerchantList; |
... | @@ -1576,11 +1581,22 @@ public class WarplyManager { | ... | @@ -1576,11 +1581,22 @@ public class WarplyManager { |
1576 | 1581 | ||
1577 | if (newCampaignList != null && newCampaignList.size() > 0) { | 1582 | if (newCampaignList != null && newCampaignList.size() > 0) { |
1578 | Collections.sort(newCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); | 1583 | Collections.sort(newCampaignList, (obj1, obj2) -> Integer.compare(obj1.getSorting(), obj2.getSorting())); |
1579 | - WarplyManagerHelper.setCampaignList(newCampaignList); | ||
1580 | campaignLoyaltyList.clear(); | 1584 | campaignLoyaltyList.clear(); |
1581 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); | 1585 | ArrayList<Campaign> campaignCarouselList = new ArrayList<>(); |
1582 | campaignCarouselList.clear(); | 1586 | campaignCarouselList.clear(); |
1583 | for (Campaign camp : newCampaignList) { | 1587 | for (Campaign camp : newCampaignList) { |
1588 | + if (resultCampaignsAvailability != null && resultCampaignsAvailability.length() > 0) { | ||
1589 | + JSONObject campaignSettings = WarpJSONParser.getJSONFromString(camp.getCampaignTypeSettings()); | ||
1590 | + if (campaignSettings != null) { | ||
1591 | + if (campaignSettings.has("couponset")) { | ||
1592 | + String cpnUuid = campaignSettings.optString("couponset"); | ||
1593 | + if (resultCampaignsAvailability.has(cpnUuid)) { | ||
1594 | + camp.setCouponAvailability(resultCampaignsAvailability.optInt(cpnUuid)); | ||
1595 | + } | ||
1596 | + } | ||
1597 | + } | ||
1598 | + } | ||
1599 | + | ||
1584 | JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); | 1600 | JSONObject campMetadata = WarpJSONParser.getJSONFromString(camp.getExtraFields()); |
1585 | if (campMetadata != null) { | 1601 | if (campMetadata != null) { |
1586 | if (campMetadata.has("carousel")) { | 1602 | if (campMetadata.has("carousel")) { |
... | @@ -1599,6 +1615,7 @@ public class WarplyManager { | ... | @@ -1599,6 +1615,7 @@ public class WarplyManager { |
1599 | campaignLoyaltyList.add(camp); | 1615 | campaignLoyaltyList.add(camp); |
1600 | } | 1616 | } |
1601 | } | 1617 | } |
1618 | + WarplyManagerHelper.setCampaignList(newCampaignList); | ||
1602 | WarplyManagerHelper.setCarouselList(campaignCarouselList); | 1619 | WarplyManagerHelper.setCarouselList(campaignCarouselList); |
1603 | 1620 | ||
1604 | Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); | 1621 | Set<Campaign> set = new LinkedHashSet<>(campaignLoyaltyList); |
... | @@ -1790,6 +1807,9 @@ public class WarplyManager { | ... | @@ -1790,6 +1807,9 @@ public class WarplyManager { |
1790 | if (extraFieldsResp.has("Banner_img")) { | 1807 | if (extraFieldsResp.has("Banner_img")) { |
1791 | camp.setBannerImage(extraFieldsResp.optString("Banner_img", "")); | 1808 | camp.setBannerImage(extraFieldsResp.optString("Banner_img", "")); |
1792 | } | 1809 | } |
1810 | + if (extraFieldsResp.has("category_id")) { | ||
1811 | + camp.setCategoryId(extraFieldsResp.optString("category_id", "")); | ||
1812 | + } | ||
1793 | } | 1813 | } |
1794 | } else { | 1814 | } else { |
1795 | camp.setBannerImage(""); | 1815 | camp.setBannerImage(""); |
... | @@ -1929,6 +1949,9 @@ public class WarplyManager { | ... | @@ -1929,6 +1949,9 @@ public class WarplyManager { |
1929 | if (extraFieldsResp.has("Banner_img")) { | 1949 | if (extraFieldsResp.has("Banner_img")) { |
1930 | camp.setBannerImage(extraFieldsResp.optString("Banner_img", "")); | 1950 | camp.setBannerImage(extraFieldsResp.optString("Banner_img", "")); |
1931 | } | 1951 | } |
1952 | + if (extraFieldsResp.has("category_id")) { | ||
1953 | + camp.setCategoryId(extraFieldsResp.optString("category_id", "")); | ||
1954 | + } | ||
1932 | } | 1955 | } |
1933 | } else { | 1956 | } else { |
1934 | camp.setBannerImage(""); | 1957 | camp.setBannerImage(""); |
... | @@ -2014,10 +2037,9 @@ public class WarplyManager { | ... | @@ -2014,10 +2037,9 @@ public class WarplyManager { |
2014 | Map<String, Object> jsonParams = new ArrayMap<>(); | 2037 | Map<String, Object> jsonParams = new ArrayMap<>(); |
2015 | jsonParams.put("action", "availability"); | 2038 | jsonParams.put("action", "availability"); |
2016 | Map<String, Object> jsonParamsFilters = new ArrayMap<>(); | 2039 | Map<String, Object> jsonParamsFilters = new ArrayMap<>(); |
2017 | - jsonParams.put("uuids", null); | 2040 | + jsonParamsFilters.put("uuids", null); |
2018 | - jsonParams.put("availability_enabled", true); | 2041 | + jsonParamsFilters.put("availability_enabled", true); |
2019 | jsonParams.put("filters", jsonParamsFilters); | 2042 | jsonParams.put("filters", jsonParamsFilters); |
2020 | - jsonParams.put("language", WarplyProperty.getLanguage(Warply.getWarplyContext())); | ||
2021 | 2043 | ||
2022 | jsonParamsCampaignsAvailability.put("coupon", jsonParams); | 2044 | jsonParamsCampaignsAvailability.put("coupon", jsonParams); |
2023 | RequestBody campaignsAvailabilityRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCampaignsAvailability)).toString()); | 2045 | RequestBody campaignsAvailabilityRequest = RequestBody.create(MediaType.get("application/json; charset=utf-8"), (new JSONObject(jsonParamsCampaignsAvailability)).toString()); | ... | ... |
-
Please register or login to post a comment