Panagiotis Triantafyllou

minor fixes

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta78'
PUBLISH_VERSION = '4.5.4-cosbeta79'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -26,6 +26,8 @@ import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import java.util.ArrayList;
import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import ly.warp.sdk.R;
import ly.warp.sdk.io.callbacks.CallbackReceiver;
......@@ -61,7 +63,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private String mSender = "";
private EditText mEdtReceiver;
private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing,
mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing,mAlertDialogNoAssets;
mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets;
private boolean mIsFromWallet = false;
// ===========================================================
......@@ -107,12 +109,24 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
return;
}
if (view.getId() == R.id.ll_share_view) {
if (mConsumer == null)
return;
try {
JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
if (profMeta != null) {
JSONArray msisdnList = new JSONArray();
msisdnList = profMeta.optJSONArray(MSISDN_LIST);
if (msisdnList == null || msisdnList.length() == 0) {
ArrayList<String> listdata = new ArrayList<String>();
if (msisdnList != null) {
for (int i = 0; i < msisdnList.length(); i++) {
if (!TextUtils.isEmpty(msisdnList.optString(i).trim()))
listdata.add(msisdnList.optString(i).trim());
}
}
if (listdata == null || listdata.size() == 0) {
showNoAssetsDialog();
return;
}
......@@ -125,7 +139,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
return;
}
if (view.getId() == R.id.ll_share_button) {
if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender)) {
if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender) && !TextUtils.isEmpty(mEdtReceiver.getText().toString())) {
askSharingDialog();
} else {
errorSharingDialog2();
......@@ -240,7 +254,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private void errorSharingDialog2() {
mAlertDialogErrorSharing = new AlertDialog.Builder(this)
.setTitle(R.string.cos_dlg_error_title)
.setTitle(R.string.cos_dlg_error_title2)
.setMessage(R.string.cos_dlg_error_subtitle2)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
......@@ -254,6 +268,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
.setMessage(R.string.cos_share_no_assets)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
onBackPressed();
})
.show();
}
......
......@@ -195,10 +195,12 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
sBuilderShared.setSpan(typefaceRegularSharedSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE);
String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
.append(getString(R.string.cos_wallet_text3))
.append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue())))
.append(String.format(getString(R.string.cos_value), badgeValue))
.append(getString(R.string.cos_wallet_text4))
.append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
.append(getString(R.string.cos_wallet_text5));
......
......@@ -361,12 +361,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
if (WarplyManagerHelper.getLoyaltyBadge() != null) {
if (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0) {
mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue())));
String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
SpannableStringBuilder sBuilder = new SpannableStringBuilder();
sBuilder
.append(getString(R.string.cos_wallet_text3))
.append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue())))
.append(String.format(getString(R.string.cos_value), badgeValue))
.append(getString(R.string.cos_wallet_text4))
.append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
.append(getString(R.string.cos_wallet_text5));
......
......@@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private final int ACCEL_RING_SIZE = 50;
private final int VEL_RING_SIZE = 10;
// change this threshold according to your sensitivity preferences
private final float STEP_THRESHOLD = 50f; // default 40, cosmote default 20
private final float STEP_THRESHOLD = 60f; // default 40, cosmote default 20
private final int STEP_DELAY_NS = 250000000;
private int accelRingCounter = 0;
private float[] accelRingX = new float[ACCEL_RING_SIZE];
......
......@@ -1421,45 +1421,45 @@ public class WarplyManager {
}
if (camp.getOfferCategory().equals("questionnaire")) {
if (WarplyManagerHelper.getConsumerInternal() != null) {
JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
if (profMetadata != null) {
if (!profMetadata.has("answered")) {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
} else {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
} else {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
if (extraFields != null) {
if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
campaignLoyaltyList.add(camp);
}
}
} catch (Exception exception) {
campaignLoyaltyList.add(camp);
}
}
// if (WarplyManagerHelper.getConsumerInternal() != null) {
// JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
// if (profMetadata != null) {
// if (!profMetadata.has("answered")) {
// try {
// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
// if (extraFields != null) {
// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
// campaignLoyaltyList.add(camp);
// }
// }
// } catch (Exception exception) {
// campaignLoyaltyList.add(camp);
// }
// }
// } else {
// try {
// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
// if (extraFields != null) {
// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
// campaignLoyaltyList.add(camp);
// }
// }
// } catch (Exception exception) {
// campaignLoyaltyList.add(camp);
// }
// }
// } else {
// try {
// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
// if (extraFields != null) {
// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
// campaignLoyaltyList.add(camp);
// }
// }
// } catch (Exception exception) {
// campaignLoyaltyList.add(camp);
// }
// }
} else {
try {
JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
......
......@@ -39,6 +39,7 @@
<string name="cos_redeem_coupon">Απόκτησέ το</string>
<string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string>
<string name="cos_dlg_error_title">Αποτυχία</string>
<string name="cos_dlg_error_title2">Αποτυχία αποστολής</string>
<string name="cos_dlg_return_title">Επιστροφή δώρου</string>
<string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string>
<string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string>
......@@ -102,7 +103,7 @@
<string name="cos_dlg_positive_coupon_title">Κάνε δώρο</string>
<string name="cos_dlg_positive_coupon_subtitle">Είσαι σίγουρος /-ή ότι θέλεις να κάνεις δώρο το κουπόνι σου;</string>
<string name="cos_dlg_negative_button3">Αποστολή</string>
<string name="cos_dlg_error_subtitle2">Τα πεδία δεν είναι σωστά</string>
<string name="cos_dlg_error_subtitle2">Παρακαλούμε συμπλήρωσε σωστά τα πεδία.</string>
<string name="cos_dlg_success_couponset_title">Επιτυχής ενεργοποίηση</string>
<string name="cos_dlg_success_couponset_subtitle">Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.</string>
<string name="cos_dlg_activate_telco_title">Ενεργοποίηση υπηρεσίας</string>
......