Panagiotis Triantafyllou

new keys

...@@ -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-cosbeta60' 5 + PUBLISH_VERSION = '4.5.4-cosbeta61'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -47,11 +47,15 @@ public class PacingDetails { ...@@ -47,11 +47,15 @@ public class PacingDetails {
47 private static final String METERS = "meters"; 47 private static final String METERS = "meters";
48 private static final String RESULT = "result"; 48 private static final String RESULT = "result";
49 private static final String ENABLED = "enabled"; 49 private static final String ENABLED = "enabled";
50 + private static final String GOAL_REACHED = "goal_reached";
51 + private static final String MESSAGE = "msg";
50 52
51 /* Member variables of the Campaign object */ 53 /* Member variables of the Campaign object */
52 private PacingInner steps = new PacingInner(); 54 private PacingInner steps = new PacingInner();
53 private PacingInner meters = new PacingInner(); 55 private PacingInner meters = new PacingInner();
54 private boolean enabled = false; 56 private boolean enabled = false;
57 + private boolean goal_reached = false;
58 + private String msg = "";
55 59
56 /** 60 /**
57 * Basic constructor used to create an object from a String, representing a 61 * Basic constructor used to create an object from a String, representing a
...@@ -81,6 +85,8 @@ public class PacingDetails { ...@@ -81,6 +85,8 @@ public class PacingDetails {
81 this.meters = new PacingInner(result.optJSONObject(METERS)); 85 this.meters = new PacingInner(result.optJSONObject(METERS));
82 } 86 }
83 this.enabled = result.optBoolean(ENABLED); 87 this.enabled = result.optBoolean(ENABLED);
88 + this.goal_reached = result.optBoolean(GOAL_REACHED);
89 + this.msg = result.optString(MESSAGE);
84 } 90 }
85 } 91 }
86 } 92 }
...@@ -96,6 +102,8 @@ public class PacingDetails { ...@@ -96,6 +102,8 @@ public class PacingDetails {
96 jObj.putOpt(STEPS, this.steps); 102 jObj.putOpt(STEPS, this.steps);
97 jObj.putOpt(METERS, this.meters); 103 jObj.putOpt(METERS, this.meters);
98 jObj.putOpt(ENABLED, this.enabled); 104 jObj.putOpt(ENABLED, this.enabled);
105 + jObj.putOpt(ENABLED, this.goal_reached);
106 + jObj.putOpt(ENABLED, this.msg);
99 } catch (JSONException e) { 107 } catch (JSONException e) {
100 if (WarpConstants.DEBUG) { 108 if (WarpConstants.DEBUG) {
101 e.printStackTrace(); 109 e.printStackTrace();
...@@ -324,4 +332,12 @@ public class PacingDetails { ...@@ -324,4 +332,12 @@ public class PacingDetails {
324 public void setMeters(PacingInner meters) { 332 public void setMeters(PacingInner meters) {
325 this.meters = meters; 333 this.meters = meters;
326 } 334 }
335 +
336 + public boolean isGoal_reached() {
337 + return goal_reached;
338 + }
339 +
340 + public String getMsg() {
341 + return msg;
342 + }
327 } 343 }
......
...@@ -177,9 +177,11 @@ public class WarplyManagerHelper { ...@@ -177,9 +177,11 @@ public class WarplyManagerHelper {
177 } 177 }
178 } 178 }
179 } else if (status == 4) { 179 } else if (status == 4) {
180 - errorExpiredDialog(context); 180 + String modalText4 = result.optString("msg", "");
181 + errorExpiredDialog(context, modalText4);
181 } else if (status == 5) { 182 } else if (status == 5) {
182 - errorUsedDialog(context); 183 + String modalText5 = result.optString("msg", "");
184 + errorUsedDialog(context, modalText5);
183 } else 185 } else
184 errorSharingDialog(context); 186 errorSharingDialog(context);
185 } 187 }
...@@ -325,10 +327,10 @@ public class WarplyManagerHelper { ...@@ -325,10 +327,10 @@ public class WarplyManagerHelper {
325 /** 327 /**
326 * Expired dialog 328 * Expired dialog
327 */ 329 */
328 - private static void errorExpiredDialog(Context context) { 330 + private static void errorExpiredDialog(Context context, String message) {
329 mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context) 331 mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context)
330 .setTitle(R.string.cos_dlg_error_title) 332 .setTitle(R.string.cos_dlg_error_title)
331 - .setMessage(R.string.cos_dlg_error_expired) 333 + .setMessage(message)
332 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 334 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
333 dialogPositive.dismiss(); 335 dialogPositive.dismiss();
334 }) 336 })
...@@ -338,10 +340,10 @@ public class WarplyManagerHelper { ...@@ -338,10 +340,10 @@ public class WarplyManagerHelper {
338 /** 340 /**
339 * Used dialog 341 * Used dialog
340 */ 342 */
341 - private static void errorUsedDialog(Context context) { 343 + private static void errorUsedDialog(Context context, String message) {
342 mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context) 344 mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context)
343 .setTitle(R.string.cos_dlg_error_title) 345 .setTitle(R.string.cos_dlg_error_title)
344 - .setMessage(R.string.cos_dlg_error_used) 346 + .setMessage(message)
345 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 347 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
346 dialogPositive.dismiss(); 348 dialogPositive.dismiss();
347 }) 349 })
......
...@@ -523,6 +523,7 @@ public class WarplyManager { ...@@ -523,6 +523,7 @@ public class WarplyManager {
523 WarpUtils.log("**************************************************"); 523 WarpUtils.log("**************************************************");
524 524
525 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false); 525 WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
526 + WarpUtils.setUserTag(Warply.getWarplyContext(), "");
526 527
527 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth(); 528 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
528 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient(); 529 WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
...@@ -2168,10 +2169,10 @@ public class WarplyManager { ...@@ -2168,10 +2169,10 @@ public class WarplyManager {
2168 Warply.postReceiveMicroappData(true, "context", request.toJson(), new PacingDetailsHook(new CallbackReceiver<PacingDetails>() { 2169 Warply.postReceiveMicroappData(true, "context", request.toJson(), new PacingDetailsHook(new CallbackReceiver<PacingDetails>() {
2169 @Override 2170 @Override
2170 public void onSuccess(PacingDetails result) { 2171 public void onSuccess(PacingDetails result) {
2171 - if (result.getMeters().getMonth().getValue() >= result.getMeters().getMonth().getGoal()) { 2172 + if (result.isGoal_reached()) {
2172 new AlertDialog.Builder(context) 2173 new AlertDialog.Builder(context)
2173 .setTitle(R.string.cos_dlg_success_title) 2174 .setTitle(R.string.cos_dlg_success_title)
2174 - .setMessage(R.string.cos_dlg_pacing_goal) 2175 + .setMessage(result.getMsg())
2175 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 2176 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
2176 dialogPositive.dismiss(); 2177 dialogPositive.dismiss();
2177 }) 2178 })
......
...@@ -68,12 +68,12 @@ ...@@ -68,12 +68,12 @@
68 android:id="@+id/ll_user_badge" 68 android:id="@+id/ll_user_badge"
69 android:layout_width="wrap_content" 69 android:layout_width="wrap_content"
70 android:layout_height="wrap_content" 70 android:layout_height="wrap_content"
71 - android:background="@drawable/shape_cos_gradient6" 71 + android:background="@drawable/shape_cos_gradient6_shahow"
72 android:gravity="center" 72 android:gravity="center"
73 android:paddingHorizontal="10dp" 73 android:paddingHorizontal="10dp"
74 android:paddingVertical="3dp" 74 android:paddingVertical="3dp"
75 android:visibility="gone" 75 android:visibility="gone"
76 - tools:visibility="gone"> 76 + tools:visibility="visible">
77 77
78 <TextView 78 <TextView
79 android:id="@+id/tv_type" 79 android:id="@+id/tv_type"
...@@ -93,7 +93,7 @@ ...@@ -93,7 +93,7 @@
93 android:paddingHorizontal="8dp" 93 android:paddingHorizontal="8dp"
94 android:paddingVertical="4dp" 94 android:paddingVertical="4dp"
95 android:visibility="gone" 95 android:visibility="gone"
96 - tools:visibility="visible"> 96 + tools:visibility="gone">
97 97
98 <TextView 98 <TextView
99 android:id="@+id/tv_questionnaire" 99 android:id="@+id/tv_questionnaire"
......