Panagiotis Triantafyllou

optimize campaigns, new campaign keys

...@@ -3,15 +3,15 @@ ...@@ -3,15 +3,15 @@
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=0086a2088301440792091b9f814c2267 6 +Uuid=f83dfde1145e4c2da69793abb2f579af
7 7
8 # If we need to see logs in Logcat 8 # If we need to see logs in Logcat
9 -Debug=false 9 +Debug=true
10 10
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.warp.ly 14 +BaseURL=https://engage-stage.warp.ly
15 15
16 # For Verify Ticket request 16 # For Verify Ticket request
17 VerifyURL=/partners/cosmote/verify 17 VerifyURL=/partners/cosmote/verify
...@@ -39,7 +39,7 @@ PushIcon=ic_notify ...@@ -39,7 +39,7 @@ PushIcon=ic_notify
39 SendPackages=false 39 SendPackages=false
40 40
41 # The app language 41 # The app language
42 -Language=el 42 +Language=en
43 43
44 # The merchant id for some requests 44 # The merchant id for some requests
45 MerchantId=20113 45 MerchantId=20113
......
...@@ -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("6010490808"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282 39 + .setGuid("7000000831"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282
40 mLoginReceiver); 40 mLoginReceiver);
41 } else { 41 } else {
42 startNextActivity(); 42 startNextActivity();
......
...@@ -65,6 +65,7 @@ dependencies { ...@@ -65,6 +65,7 @@ dependencies {
65 api 'com.github.siyamed:android-shape-imageview:0.9.3' 65 api 'com.github.siyamed:android-shape-imageview:0.9.3'
66 implementation 'org.greenrobot:eventbus:3.3.1' 66 implementation 'org.greenrobot:eventbus:3.3.1'
67 api 'org.apmem.tools:layouts:1.10' 67 api 'org.apmem.tools:layouts:1.10'
68 + api 'com.google.guava:guava:30.1-android'
68 69
69 //------------------------------ Firebase -----------------------------// 70 //------------------------------ Firebase -----------------------------//
70 api platform('com.google.firebase:firebase-bom:29.0.3') 71 api platform('com.google.firebase:firebase-bom:29.0.3')
......
...@@ -50,9 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -50,9 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
50 50
51 mBottomNavigationView = findViewById(R.id.bt_tabs); 51 mBottomNavigationView = findViewById(R.id.bt_tabs);
52 52
53 -// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
54 WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver); 53 WarplyManager.getUserCouponsWithCouponsets(mUserCouponsReceiver);
55 - WarplyManager.getCampaigns(new WarplyGetCampaignsRequest().setLanguage("en"), mCampaignsCallback); 54 + WarplyManager.getCampaigns(mCampaignsCallback);
56 WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback); 55 WarplyManager.getUnifiedCouponsDeals(mUnifiedCallback);
57 } 56 }
58 57
...@@ -123,7 +122,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation ...@@ -123,7 +122,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
123 private final CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() { 122 private final CallbackReceiver<ArrayList<Campaign>> mCampaignsCallback = new CallbackReceiver<ArrayList<Campaign>>() {
124 @Override 123 @Override
125 public void onSuccess(ArrayList<Campaign> result) { 124 public void onSuccess(ArrayList<Campaign> result) {
126 - Toast.makeText(BaseFragmentActivity.this, "Campaigns Success", Toast.LENGTH_SHORT).show(); 125 + Toast.makeText(BaseFragmentActivity.this, "Campaigns Success " + String.valueOf(result.size()), Toast.LENGTH_SHORT).show();
127 } 126 }
128 127
129 @Override 128 @Override
......
...@@ -74,6 +74,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -74,6 +74,8 @@ public class Campaign implements Parcelable, Serializable {
74 private static final String CAMPAIGN_TYPE_SETTINGS = "campaign_type_settings"; 74 private static final String CAMPAIGN_TYPE_SETTINGS = "campaign_type_settings";
75 private static final String BANNER_IMAGE = "Banner_img"; 75 private static final String BANNER_IMAGE = "Banner_img";
76 private static final String BANNER_TITLE = "Banner_title"; 76 private static final String BANNER_TITLE = "Banner_title";
77 + private static final String CATEGORY_ID = "category_id";
78 + private static final String COUPON_AVAILABILITY = "coupon_availability";
77 79
78 /* Member variables of the Campaign object */ 80 /* Member variables of the Campaign object */
79 81
...@@ -103,7 +105,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -103,7 +105,8 @@ public class Campaign implements Parcelable, Serializable {
103 private String campaignTypeSettings; 105 private String campaignTypeSettings;
104 private String bannerImage; 106 private String bannerImage;
105 private String bannerTitle; 107 private String bannerTitle;
106 - private UnifiedCampaignModel unifiedCampaign; 108 + private String categoryId;
109 + private Integer couponAvailability;
107 110
108 /** 111 /**
109 * Basic constructor used to create an object from a String, representing a 112 * Basic constructor used to create an object from a String, representing a
...@@ -143,7 +146,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -143,7 +146,8 @@ public class Campaign implements Parcelable, Serializable {
143 this.campaignTypeSettings = ""; 146 this.campaignTypeSettings = "";
144 this.bannerImage = ""; 147 this.bannerImage = "";
145 this.bannerTitle = ""; 148 this.bannerTitle = "";
146 - this.unifiedCampaign = new UnifiedCampaignModel(); 149 + this.couponAvailability = null;
150 + this.categoryId = "";
147 } 151 }
148 152
149 /** 153 /**
...@@ -204,6 +208,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -204,6 +208,8 @@ public class Campaign implements Parcelable, Serializable {
204 } else { 208 } else {
205 this.actions = null; 209 this.actions = null;
206 } 210 }
211 + this.categoryId = json.optString(CATEGORY_ID);
212 + this.couponAvailability = json.optInt(COUPON_AVAILABILITY);
207 } 213 }
208 214
209 public Campaign(Parcel source) { 215 public Campaign(Parcel source) {
...@@ -231,6 +237,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -231,6 +237,8 @@ public class Campaign implements Parcelable, Serializable {
231 this.actions = source.readArrayList(CampaignAction.class.getClassLoader()); 237 this.actions = source.readArrayList(CampaignAction.class.getClassLoader());
232 this.busId = source.readString(); 238 this.busId = source.readString();
233 this.campaignTypeSettings = source.readString(); 239 this.campaignTypeSettings = source.readString();
240 + this.categoryId = source.readString();
241 + this.couponAvailability = source.readInt();
234 } 242 }
235 243
236 @Override 244 @Override
...@@ -259,6 +267,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -259,6 +267,8 @@ public class Campaign implements Parcelable, Serializable {
259 dest.writeList(this.actions); 267 dest.writeList(this.actions);
260 dest.writeString(this.busId); 268 dest.writeString(this.busId);
261 dest.writeString(this.campaignTypeSettings); 269 dest.writeString(this.campaignTypeSettings);
270 + dest.writeInt(this.couponAvailability);
271 + dest.writeString(this.categoryId);
262 } 272 }
263 273
264 /** 274 /**
...@@ -293,6 +303,8 @@ public class Campaign implements Parcelable, Serializable { ...@@ -293,6 +303,8 @@ public class Campaign implements Parcelable, Serializable {
293 jObj.putOpt(DISPLAY_TYPE, this.displayType); 303 jObj.putOpt(DISPLAY_TYPE, this.displayType);
294 jObj.put(BUS_ID, this.busId); 304 jObj.put(BUS_ID, this.busId);
295 jObj.put(CAMPAIGN_TYPE_SETTINGS, this.campaignTypeSettings); 305 jObj.put(CAMPAIGN_TYPE_SETTINGS, this.campaignTypeSettings);
306 + jObj.putOpt(COUPON_AVAILABILITY, this.couponAvailability);
307 + jObj.putOpt(CATEGORY_ID, this.categoryId);
296 } catch (JSONException e) { 308 } catch (JSONException e) {
297 if (WarpConstants.DEBUG) { 309 if (WarpConstants.DEBUG) {
298 e.printStackTrace(); 310 e.printStackTrace();
...@@ -366,6 +378,23 @@ public class Campaign implements Parcelable, Serializable { ...@@ -366,6 +378,23 @@ public class Campaign implements Parcelable, Serializable {
366 // Getters 378 // Getters
367 // ================================================================================ 379 // ================================================================================
368 380
381 +
382 + public String getCategoryId() {
383 + return categoryId;
384 + }
385 +
386 + public void setCategoryId(String categoryId) {
387 + this.categoryId = categoryId;
388 + }
389 +
390 + public Integer getCouponAvailability() {
391 + return couponAvailability;
392 + }
393 +
394 + public void setCouponAvailability(Integer couponAvailability) {
395 + this.couponAvailability = couponAvailability;
396 + }
397 +
369 /** 398 /**
370 * @return The loyalty action of the Campaign, used if custom actions are 399 * @return The loyalty action of the Campaign, used if custom actions are
371 * implemented 400 * implemented
...@@ -630,14 +659,6 @@ public class Campaign implements Parcelable, Serializable { ...@@ -630,14 +659,6 @@ public class Campaign implements Parcelable, Serializable {
630 this.bannerTitle = bannerTitle; 659 this.bannerTitle = bannerTitle;
631 } 660 }
632 661
633 - public UnifiedCampaignModel getUnifiedCampaign() {
634 - return unifiedCampaign;
635 - }
636 -
637 - public void setUnifiedCampaign(UnifiedCampaignModel unifiedCampaign) {
638 - this.unifiedCampaign = unifiedCampaign;
639 - }
640 -
641 @Override 662 @Override
642 public int describeContents() { 663 public int describeContents() {
643 return 0; 664 return 0;
......
...@@ -79,6 +79,21 @@ public class NewCampaignList extends ArrayList<NewCampaign> { ...@@ -79,6 +79,21 @@ public class NewCampaignList extends ArrayList<NewCampaign> {
79 } 79 }
80 } 80 }
81 81
82 + public NewCampaignList(JSONObject campaignListJSONObject) {
83 + campaignListJSONObject = campaignListJSONObject.optJSONObject(JSON_KEY_CONTEXT);
84 + if (campaignListJSONObject == null)
85 + return;
86 + JSONObject jsonObject = campaignListJSONObject.optJSONObject(JSON_KEY_MAPP);
87 + if(jsonObject == null)
88 + return;;
89 + JSONArray jArray = jsonObject.optJSONArray(JSON_KEY_MAPP_VALUE);
90 + if (jArray != null) {
91 + for (int i = 0, lim = jArray.length(); i < lim; ++i) {
92 + add(new NewCampaign(jArray.optJSONObject(i)));
93 + }
94 + }
95 + }
96 +
82 @NonNull 97 @NonNull
83 public String getRequestSignature() { 98 public String getRequestSignature() {
84 return mRequestSignature; 99 return mRequestSignature;
......
...@@ -89,20 +89,31 @@ public interface ApiService { ...@@ -89,20 +89,31 @@ public interface ApiService {
89 @Header(WarpConstants.HEADER_SIGNATURE) String signature); 89 @Header(WarpConstants.HEADER_SIGNATURE) String signature);
90 90
91 @Headers("Content-Type: application/json") 91 @Headers("Content-Type: application/json")
92 + @POST("/api/mobile/v2/{appUuid}/context/")
93 + Call<ResponseBody> getCampaigns(@Path("appUuid") String appUuid,
94 + @Body RequestBody request,
95 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
96 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
97 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
98 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
99 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
100 + @Header(WarpConstants.HEADER_SIGNATURE) String signature);
101 +
102 + @Headers("Content-Type: application/json")
92 @POST("/oauth/{appUuid}/context") 103 @POST("/oauth/{appUuid}/context")
93 - Call<ResponseBody> sendTelematicsData(@Path("appUuid") String appUuid, 104 + Call<ResponseBody> getCampaignsPersonalized(@Path("appUuid") String appUuid,
94 - @Body RequestBody request, 105 + @Body RequestBody request,
95 - @Header(WarpConstants.HEADER_DATE) String timeStamp, 106 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
96 - @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 107 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
97 - @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 108 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
98 - @Header(WarpConstants.HEADER_CHANNEL) String channel, 109 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
99 - @Header(WarpConstants.HEADER_WEB_ID) String webId, 110 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
100 - @Header(WarpConstants.HEADER_SIGNATURE) String signature, 111 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
101 - @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); 112 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
102 113
103 @Headers("Content-Type: application/json") 114 @Headers("Content-Type: application/json")
104 @POST("/oauth/{appUuid}/context") 115 @POST("/oauth/{appUuid}/context")
105 - Call<ResponseBody> cancelUnifiedCoupon(@Path("appUuid") String appUuid, 116 + Call<ResponseBody> sendTelematicsData(@Path("appUuid") String appUuid,
106 @Body RequestBody request, 117 @Body RequestBody request,
107 @Header(WarpConstants.HEADER_DATE) String timeStamp, 118 @Header(WarpConstants.HEADER_DATE) String timeStamp,
108 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 119 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
...@@ -114,19 +125,19 @@ public interface ApiService { ...@@ -114,19 +125,19 @@ public interface ApiService {
114 125
115 @Headers("Content-Type: application/json") 126 @Headers("Content-Type: application/json")
116 @POST("/oauth/{appUuid}/context") 127 @POST("/oauth/{appUuid}/context")
117 - Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid, 128 + Call<ResponseBody> cancelUnifiedCoupon(@Path("appUuid") String appUuid,
118 - @Body RequestBody request, 129 + @Body RequestBody request,
119 - @Header(WarpConstants.HEADER_DATE) String timeStamp, 130 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
120 - @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 131 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
121 - @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId, 132 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
122 - @Header(WarpConstants.HEADER_CHANNEL) String channel, 133 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
123 - @Header(WarpConstants.HEADER_WEB_ID) String webId, 134 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
124 - @Header(WarpConstants.HEADER_SIGNATURE) String signature, 135 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
125 - @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); 136 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
126 137
127 @Headers("Content-Type: application/json") 138 @Headers("Content-Type: application/json")
128 @POST("/oauth/{appUuid}/context") 139 @POST("/oauth/{appUuid}/context")
129 - Call<ResponseBody> getTripMetrics(@Path("appUuid") String appUuid, 140 + Call<ResponseBody> getTelematicsHistoy(@Path("appUuid") String appUuid,
130 @Body RequestBody request, 141 @Body RequestBody request,
131 @Header(WarpConstants.HEADER_DATE) String timeStamp, 142 @Header(WarpConstants.HEADER_DATE) String timeStamp,
132 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 143 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
...@@ -138,7 +149,7 @@ public interface ApiService { ...@@ -138,7 +149,7 @@ public interface ApiService {
138 149
139 @Headers("Content-Type: application/json") 150 @Headers("Content-Type: application/json")
140 @POST("/oauth/{appUuid}/context") 151 @POST("/oauth/{appUuid}/context")
141 - Call<ResponseBody> rateTrip(@Path("appUuid") String appUuid, 152 + Call<ResponseBody> getTripMetrics(@Path("appUuid") String appUuid,
142 @Body RequestBody request, 153 @Body RequestBody request,
143 @Header(WarpConstants.HEADER_DATE) String timeStamp, 154 @Header(WarpConstants.HEADER_DATE) String timeStamp,
144 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId, 155 @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
...@@ -148,6 +159,18 @@ public interface ApiService { ...@@ -148,6 +159,18 @@ public interface ApiService {
148 @Header(WarpConstants.HEADER_SIGNATURE) String signature, 159 @Header(WarpConstants.HEADER_SIGNATURE) String signature,
149 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer); 160 @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
150 161
162 + @Headers("Content-Type: application/json")
163 + @POST("/oauth/{appUuid}/context")
164 + Call<ResponseBody> rateTrip(@Path("appUuid") String appUuid,
165 + @Body RequestBody request,
166 + @Header(WarpConstants.HEADER_DATE) String timeStamp,
167 + @Header(WarpConstants.HEADER_LOYALTY_BUNDLE_ID) String bundleId,
168 + @Header(WarpConstants.HEADER_UNIQUE_DEVICE_ID) String deviceId,
169 + @Header(WarpConstants.HEADER_CHANNEL) String channel,
170 + @Header(WarpConstants.HEADER_WEB_ID) String webId,
171 + @Header(WarpConstants.HEADER_SIGNATURE) String signature,
172 + @Header(WarpConstants.HEADER_AUTHORIZATION) String bearer);
173 +
151 // =========================================================== 174 // ===========================================================
152 // Getter & Setter 175 // Getter & Setter
153 // =========================================================== 176 // ===========================================================
......