Panagiotis Triantafyllou

new keys

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta60'
PUBLISH_VERSION = '4.5.4-cosbeta61'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -47,11 +47,15 @@ public class PacingDetails {
private static final String METERS = "meters";
private static final String RESULT = "result";
private static final String ENABLED = "enabled";
private static final String GOAL_REACHED = "goal_reached";
private static final String MESSAGE = "msg";
/* Member variables of the Campaign object */
private PacingInner steps = new PacingInner();
private PacingInner meters = new PacingInner();
private boolean enabled = false;
private boolean goal_reached = false;
private String msg = "";
/**
* Basic constructor used to create an object from a String, representing a
......@@ -81,6 +85,8 @@ public class PacingDetails {
this.meters = new PacingInner(result.optJSONObject(METERS));
}
this.enabled = result.optBoolean(ENABLED);
this.goal_reached = result.optBoolean(GOAL_REACHED);
this.msg = result.optString(MESSAGE);
}
}
}
......@@ -96,6 +102,8 @@ public class PacingDetails {
jObj.putOpt(STEPS, this.steps);
jObj.putOpt(METERS, this.meters);
jObj.putOpt(ENABLED, this.enabled);
jObj.putOpt(ENABLED, this.goal_reached);
jObj.putOpt(ENABLED, this.msg);
} catch (JSONException e) {
if (WarpConstants.DEBUG) {
e.printStackTrace();
......@@ -324,4 +332,12 @@ public class PacingDetails {
public void setMeters(PacingInner meters) {
this.meters = meters;
}
public boolean isGoal_reached() {
return goal_reached;
}
public String getMsg() {
return msg;
}
}
......
......@@ -177,9 +177,11 @@ public class WarplyManagerHelper {
}
}
} else if (status == 4) {
errorExpiredDialog(context);
String modalText4 = result.optString("msg", "");
errorExpiredDialog(context, modalText4);
} else if (status == 5) {
errorUsedDialog(context);
String modalText5 = result.optString("msg", "");
errorUsedDialog(context, modalText5);
} else
errorSharingDialog(context);
}
......@@ -325,10 +327,10 @@ public class WarplyManagerHelper {
/**
* Expired dialog
*/
private static void errorExpiredDialog(Context context) {
private static void errorExpiredDialog(Context context, String message) {
mAlertDialogErrorExpiredSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(R.string.cos_dlg_error_expired)
.setMessage(message)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
......@@ -338,10 +340,10 @@ public class WarplyManagerHelper {
/**
* Used dialog
*/
private static void errorUsedDialog(Context context) {
private static void errorUsedDialog(Context context, String message) {
mAlertDialogErrorUsedSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_error_title)
.setMessage(R.string.cos_dlg_error_used)
.setMessage(message)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
......
......@@ -523,6 +523,7 @@ public class WarplyManager {
WarpUtils.log("**************************************************");
WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
WarpUtils.setUserTag(Warply.getWarplyContext(), "");
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteAuth();
WarplyDBHelper.getInstance(Warply.getWarplyContext()).deleteClient();
......@@ -2168,10 +2169,10 @@ public class WarplyManager {
Warply.postReceiveMicroappData(true, "context", request.toJson(), new PacingDetailsHook(new CallbackReceiver<PacingDetails>() {
@Override
public void onSuccess(PacingDetails result) {
if (result.getMeters().getMonth().getValue() >= result.getMeters().getMonth().getGoal()) {
if (result.isGoal_reached()) {
new AlertDialog.Builder(context)
.setTitle(R.string.cos_dlg_success_title)
.setMessage(R.string.cos_dlg_pacing_goal)
.setMessage(result.getMsg())
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
......
......@@ -68,12 +68,12 @@
android:id="@+id/ll_user_badge"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/shape_cos_gradient6"
android:background="@drawable/shape_cos_gradient6_shahow"
android:gravity="center"
android:paddingHorizontal="10dp"
android:paddingVertical="3dp"
android:visibility="gone"
tools:visibility="gone">
tools:visibility="visible">
<TextView
android:id="@+id/tv_type"
......@@ -93,7 +93,7 @@
android:paddingHorizontal="8dp"
android:paddingVertical="4dp"
android:visibility="gone"
tools:visibility="visible">
tools:visibility="gone">
<TextView
android:id="@+id/tv_questionnaire"
......