Panagiotis Triantafyllou

minor fixes

...@@ -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-cosbeta78' 5 + PUBLISH_VERSION = '4.5.4-cosbeta79'
6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk' 6 PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
7 } 7 }
8 8
......
...@@ -26,6 +26,8 @@ import org.json.JSONArray; ...@@ -26,6 +26,8 @@ import org.json.JSONArray;
26 import org.json.JSONException; 26 import org.json.JSONException;
27 import org.json.JSONObject; 27 import org.json.JSONObject;
28 28
29 +import java.util.ArrayList;
30 +
29 import io.github.inflationx.viewpump.ViewPumpContextWrapper; 31 import io.github.inflationx.viewpump.ViewPumpContextWrapper;
30 import ly.warp.sdk.R; 32 import ly.warp.sdk.R;
31 import ly.warp.sdk.io.callbacks.CallbackReceiver; 33 import ly.warp.sdk.io.callbacks.CallbackReceiver;
...@@ -61,7 +63,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -61,7 +63,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
61 private String mSender = ""; 63 private String mSender = "";
62 private EditText mEdtReceiver; 64 private EditText mEdtReceiver;
63 private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing, 65 private AlertDialog mAlertDialogSuccessSharing, mAlertDialogErrorSharing,
64 - mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing,mAlertDialogNoAssets; 66 + mAlertDialogCouponAskSharing, mAlertDialogWrongNumberSharing, mAlertDialogNoAssets;
65 private boolean mIsFromWallet = false; 67 private boolean mIsFromWallet = false;
66 68
67 // =========================================================== 69 // ===========================================================
...@@ -107,12 +109,24 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -107,12 +109,24 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
107 return; 109 return;
108 } 110 }
109 if (view.getId() == R.id.ll_share_view) { 111 if (view.getId() == R.id.ll_share_view) {
112 + if (mConsumer == null)
113 + return;
114 +
110 try { 115 try {
111 JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata()); 116 JSONObject profMeta = new JSONObject(mConsumer.getProfileMetadata());
112 if (profMeta != null) { 117 if (profMeta != null) {
113 JSONArray msisdnList = new JSONArray(); 118 JSONArray msisdnList = new JSONArray();
114 msisdnList = profMeta.optJSONArray(MSISDN_LIST); 119 msisdnList = profMeta.optJSONArray(MSISDN_LIST);
115 - if (msisdnList == null || msisdnList.length() == 0) { 120 +
121 + ArrayList<String> listdata = new ArrayList<String>();
122 + if (msisdnList != null) {
123 + for (int i = 0; i < msisdnList.length(); i++) {
124 + if (!TextUtils.isEmpty(msisdnList.optString(i).trim()))
125 + listdata.add(msisdnList.optString(i).trim());
126 + }
127 + }
128 +
129 + if (listdata == null || listdata.size() == 0) {
116 showNoAssetsDialog(); 130 showNoAssetsDialog();
117 return; 131 return;
118 } 132 }
...@@ -125,7 +139,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -125,7 +139,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
125 return; 139 return;
126 } 140 }
127 if (view.getId() == R.id.ll_share_button) { 141 if (view.getId() == R.id.ll_share_button) {
128 - if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender)) { 142 + if (!TextUtils.isEmpty(mSender) && !mTvPhoneHeader.getText().toString().equals(R.string.cos_coupon_share_sender) && !TextUtils.isEmpty(mEdtReceiver.getText().toString())) {
129 askSharingDialog(); 143 askSharingDialog();
130 } else { 144 } else {
131 errorSharingDialog2(); 145 errorSharingDialog2();
...@@ -240,7 +254,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -240,7 +254,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
240 254
241 private void errorSharingDialog2() { 255 private void errorSharingDialog2() {
242 mAlertDialogErrorSharing = new AlertDialog.Builder(this) 256 mAlertDialogErrorSharing = new AlertDialog.Builder(this)
243 - .setTitle(R.string.cos_dlg_error_title) 257 + .setTitle(R.string.cos_dlg_error_title2)
244 .setMessage(R.string.cos_dlg_error_subtitle2) 258 .setMessage(R.string.cos_dlg_error_subtitle2)
245 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 259 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
246 dialogPositive.dismiss(); 260 dialogPositive.dismiss();
...@@ -254,6 +268,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene ...@@ -254,6 +268,7 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
254 .setMessage(R.string.cos_share_no_assets) 268 .setMessage(R.string.cos_share_no_assets)
255 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> { 269 .setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
256 dialogPositive.dismiss(); 270 dialogPositive.dismiss();
271 + onBackPressed();
257 }) 272 })
258 .show(); 273 .show();
259 } 274 }
......
...@@ -195,10 +195,12 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis ...@@ -195,10 +195,12 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
195 sBuilderShared.setSpan(typefaceRegularSharedSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); 195 sBuilderShared.setSpan(typefaceRegularSharedSpan, 0, getString(R.string.cos_shared_gifts_tab).length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
196 sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE); 196 sharedTab.setText(sBuilderShared, TextView.BufferType.SPANNABLE);
197 197
198 + String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
199 +
198 SpannableStringBuilder sBuilder = new SpannableStringBuilder(); 200 SpannableStringBuilder sBuilder = new SpannableStringBuilder();
199 sBuilder 201 sBuilder
200 .append(getString(R.string.cos_wallet_text3)) 202 .append(getString(R.string.cos_wallet_text3))
201 - .append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()))) 203 + .append(String.format(getString(R.string.cos_value), badgeValue))
202 .append(getString(R.string.cos_wallet_text4)) 204 .append(getString(R.string.cos_wallet_text4))
203 .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))) 205 .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
204 .append(getString(R.string.cos_wallet_text5)); 206 .append(getString(R.string.cos_wallet_text5));
......
...@@ -361,12 +361,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie ...@@ -361,12 +361,14 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
361 361
362 if (WarplyManagerHelper.getLoyaltyBadge() != null) { 362 if (WarplyManagerHelper.getLoyaltyBadge() != null) {
363 if (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0) { 363 if (WarplyManagerHelper.getLoyaltyBadge().getCouponCount() > 0) {
364 - mTvGiftsValue.setText(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()))); 364 + String badgeValue = String.format("%.02f", WarplyManagerHelper.getLoyaltyBadge().getValue());
365 +
366 + mTvGiftsValue.setText(String.format(getString(R.string.cos_value), badgeValue));
365 367
366 SpannableStringBuilder sBuilder = new SpannableStringBuilder(); 368 SpannableStringBuilder sBuilder = new SpannableStringBuilder();
367 sBuilder 369 sBuilder
368 .append(getString(R.string.cos_wallet_text3)) 370 .append(getString(R.string.cos_wallet_text3))
369 - .append(String.format(getString(R.string.cos_value), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getValue()))) 371 + .append(String.format(getString(R.string.cos_value), badgeValue))
370 .append(getString(R.string.cos_wallet_text4)) 372 .append(getString(R.string.cos_wallet_text4))
371 .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount()))) 373 .append(String.format(getString(R.string.cos_value2), String.valueOf(WarplyManagerHelper.getLoyaltyBadge().getCouponCount())))
372 .append(getString(R.string.cos_wallet_text5)); 374 .append(getString(R.string.cos_wallet_text5));
......
...@@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener ...@@ -57,7 +57,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
57 private final int ACCEL_RING_SIZE = 50; 57 private final int ACCEL_RING_SIZE = 50;
58 private final int VEL_RING_SIZE = 10; 58 private final int VEL_RING_SIZE = 10;
59 // change this threshold according to your sensitivity preferences 59 // change this threshold according to your sensitivity preferences
60 - private final float STEP_THRESHOLD = 50f; // default 40, cosmote default 20 60 + private final float STEP_THRESHOLD = 60f; // default 40, cosmote default 20
61 private final int STEP_DELAY_NS = 250000000; 61 private final int STEP_DELAY_NS = 250000000;
62 private int accelRingCounter = 0; 62 private int accelRingCounter = 0;
63 private float[] accelRingX = new float[ACCEL_RING_SIZE]; 63 private float[] accelRingX = new float[ACCEL_RING_SIZE];
......
...@@ -1421,45 +1421,45 @@ public class WarplyManager { ...@@ -1421,45 +1421,45 @@ public class WarplyManager {
1421 } 1421 }
1422 1422
1423 if (camp.getOfferCategory().equals("questionnaire")) { 1423 if (camp.getOfferCategory().equals("questionnaire")) {
1424 - if (WarplyManagerHelper.getConsumerInternal() != null) { 1424 +// if (WarplyManagerHelper.getConsumerInternal() != null) {
1425 - JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata()); 1425 +// JSONObject profMetadata = WarpJSONParser.getJSONFromString(WarplyManagerHelper.getConsumerInternal().getProfileMetadata());
1426 - if (profMetadata != null) { 1426 +// if (profMetadata != null) {
1427 - if (!profMetadata.has("answered")) { 1427 +// if (!profMetadata.has("answered")) {
1428 - try { 1428 +// try {
1429 - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1429 +// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1430 - if (extraFields != null) { 1430 +// if (extraFields != null) {
1431 - if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) { 1431 +// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
1432 - campaignLoyaltyList.add(camp); 1432 +// campaignLoyaltyList.add(camp);
1433 - } 1433 +// }
1434 - } 1434 +// }
1435 - } catch (Exception exception) { 1435 +// } catch (Exception exception) {
1436 - campaignLoyaltyList.add(camp); 1436 +// campaignLoyaltyList.add(camp);
1437 - } 1437 +// }
1438 - } 1438 +// }
1439 - } else { 1439 +// } else {
1440 - try { 1440 +// try {
1441 - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1441 +// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1442 - if (extraFields != null) { 1442 +// if (extraFields != null) {
1443 - if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) { 1443 +// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
1444 - campaignLoyaltyList.add(camp); 1444 +// campaignLoyaltyList.add(camp);
1445 - } 1445 +// }
1446 - } 1446 +// }
1447 - } catch (Exception exception) { 1447 +// } catch (Exception exception) {
1448 - campaignLoyaltyList.add(camp); 1448 +// campaignLoyaltyList.add(camp);
1449 - } 1449 +// }
1450 - } 1450 +// }
1451 - } else { 1451 +// } else {
1452 - try { 1452 +// try {
1453 - JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1453 +// JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
1454 - if (extraFields != null) { 1454 +// if (extraFields != null) {
1455 - if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) { 1455 +// if (extraFields.length() == 0 || !(extraFields.has("ccms_offer") || extraFields.has("type"))) {
1456 - campaignLoyaltyList.add(camp); 1456 +// campaignLoyaltyList.add(camp);
1457 - } 1457 +// }
1458 - } 1458 +// }
1459 - } catch (Exception exception) { 1459 +// } catch (Exception exception) {
1460 - campaignLoyaltyList.add(camp); 1460 +// campaignLoyaltyList.add(camp);
1461 - } 1461 +// }
1462 - } 1462 +// }
1463 } else { 1463 } else {
1464 try { 1464 try {
1465 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields()); 1465 JSONObject extraFields = WarpJSONParser.getJSONFromString(camp.getExtraFields());
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
39 <string name="cos_redeem_coupon">Απόκτησέ το</string> 39 <string name="cos_redeem_coupon">Απόκτησέ το</string>
40 <string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string> 40 <string name="cos_dlg_success_subtitle">Το κουπόνι εξαργυρώθηκε με επιτυχία</string>
41 <string name="cos_dlg_error_title">Αποτυχία</string> 41 <string name="cos_dlg_error_title">Αποτυχία</string>
42 + <string name="cos_dlg_error_title2">Αποτυχία αποστολής</string>
42 <string name="cos_dlg_return_title">Επιστροφή δώρου</string> 43 <string name="cos_dlg_return_title">Επιστροφή δώρου</string>
43 <string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string> 44 <string name="cos_dlg_error_subtitle">Κάτι πήγε στραβά</string>
44 <string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string> 45 <string name="cos_dlg_error_subtitle_non_buyable">Το κουπόνι δεν είναι διαθέσιμο για αγορά</string>
...@@ -102,7 +103,7 @@ ...@@ -102,7 +103,7 @@
102 <string name="cos_dlg_positive_coupon_title">Κάνε δώρο</string> 103 <string name="cos_dlg_positive_coupon_title">Κάνε δώρο</string>
103 <string name="cos_dlg_positive_coupon_subtitle">Είσαι σίγουρος /-ή ότι θέλεις να κάνεις δώρο το κουπόνι σου;</string> 104 <string name="cos_dlg_positive_coupon_subtitle">Είσαι σίγουρος /-ή ότι θέλεις να κάνεις δώρο το κουπόνι σου;</string>
104 <string name="cos_dlg_negative_button3">Αποστολή</string> 105 <string name="cos_dlg_negative_button3">Αποστολή</string>
105 - <string name="cos_dlg_error_subtitle2">Τα πεδία δεν είναι σωστά</string> 106 + <string name="cos_dlg_error_subtitle2">Παρακαλούμε συμπλήρωσε σωστά τα πεδία.</string>
106 <string name="cos_dlg_success_couponset_title">Επιτυχής ενεργοποίηση</string> 107 <string name="cos_dlg_success_couponset_title">Επιτυχής ενεργοποίηση</string>
107 <string name="cos_dlg_success_couponset_subtitle">Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.</string> 108 <string name="cos_dlg_success_couponset_subtitle">Το κουπόνι σου έχει ενεργοποιηθεί στην ενότητα My Rewards.</string>
108 <string name="cos_dlg_activate_telco_title">Ενεργοποίηση υπηρεσίας</string> 109 <string name="cos_dlg_activate_telco_title">Ενεργοποίηση υπηρεσίας</string>
......