Panagiotis Triantafyllou

ui changes and fixes

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_6a_API_29.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-11-28T10:41:57.588318Z" />
<value>
<entry key="app">
<State />
</entry>
</value>
</component>
</project>
\ No newline at end of file
......
......@@ -4,11 +4,9 @@
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleHome" value="$PROJECT_DIR$/../../../../../../gradle-6.6.1" />
<option name="gradleJvm" value="jbr-17" />
<option name="gradleJvm" value="#GRADLE_LOCAL_JAVA_HOME" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
......@@ -16,6 +14,7 @@
<option value="$PROJECT_DIR$/warply_android_sdk" />
</set>
</option>
<option name="resolveExternalAnnotations" value="false" />
</GradleProjectSettings>
</option>
</component>
......
......@@ -3,7 +3,7 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid=f83dfde1145e4c2da69793abb2f579af
Uuid=0086a2088301440792091b9f814c2267
# If we need to see logs in Logcat
Debug=false
......@@ -11,7 +11,7 @@ Debug=false
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL=https://engage-stage.warp.ly
BaseURL=https://engage.warp.ly
# For Verify Ticket request
VerifyURL=/partners/cosmote/verify
......
......@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public void onWarplyReady() {
if (!WarplyDBHelper.getInstance(SplashActivity.this).isTableNotEmpty("auth")) {
WarplyManager.getCosmoteUser(new WarplyCosmoteUserRequest()
.setGuid("7000000833"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282
.setGuid("6010490808"), //6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282
mLoginReceiver);
} else {
startNextActivity();
......
......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.5.4r4'
PUBLISH_VERSION = '4.5.5.4r5'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......
......@@ -60,7 +60,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
private SharedCouponAdapter mAdapterSharedCoupons;
private LinearLayout mLlExpiredTab, mLlSharedTab, mLlShowMoreExpired, mLlShowMoreShared;
private RelativeLayout mRlExpiredView;
private CardView mRlSharedView;
private CardView mRlSharedView, mCvExpiredInnerTitle;
private SharingList mSharedCoupons = new SharingList();
private int mTimer = 0;
private Handler mSecondsHandler;
......@@ -87,6 +87,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
mTvExpiredEmpty = findViewById(R.id.tv_expired_empty);
mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired);
mLlShowMoreShared = findViewById(R.id.ll_show_more_shared);
mCvExpiredInnerTitle = findViewById(R.id.cv_expired_coupons_inner_title);
initViews();
}
......@@ -282,6 +283,7 @@ public class LoyaltyAnalysisActivity extends Activity implements View.OnClickLis
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, WarplyManagerHelper.getCouponExpiredList());
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
} else {
mCvExpiredInnerTitle.setVisibility(View.GONE);
mTvExpiredEmpty.setVisibility(View.VISIBLE);
}
}
......
......@@ -60,7 +60,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
private SharedCouponAdapter mAdapterSharedCoupons;
private LinearLayout mLlExpiredTab, mLlSharedTab, mLlShowMoreExpired, mLlShowMoreShared;
private RelativeLayout mRlExpiredView;
private CardView mRlSharedView;
private CardView mRlSharedView, mCvExpiredInfoView;
private SharingList mSharedCoupons = new SharingList();
private int mTimer = 0;
private Handler mSecondsHandler;
......@@ -87,6 +87,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
mTvExpiredEmpty = findViewById(R.id.tv_expired_empty);
mLlShowMoreExpired = findViewById(R.id.ll_show_more_expired);
mLlShowMoreShared = findViewById(R.id.ll_show_more_shared);
mCvExpiredInfoView = findViewById(R.id.cv_expired_coupons_inner_title);
if (WarplyManagerHelper.getMarketCoupons() != null && WarplyManagerHelper.getMarketCoupons().size() > 0) {
final ExecutorService executor = Executors.newFixedThreadPool(1);
executor.submit(() -> {
......@@ -283,6 +284,7 @@ public class LoyaltyMarketAnalysisActivity extends Activity implements View.OnCl
mAdapterExpiredCoupons = new ExpiredCouponAdapter(this, mExpiredMarketCoupons, true);
mRvExpiredCoupons.setAdapter(mAdapterExpiredCoupons);
} else {
mCvExpiredInfoView.setVisibility(View.GONE);
mTvExpiredEmpty.setVisibility(View.VISIBLE);
}
}
......
......@@ -61,7 +61,8 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
private TextView mTvUsername, mTvDealsValue, mTvDealsValueAll,
mTvUserBadge, mTvGiftsValue, mTvGiftsValueAll, mTvActiveCode, mTvActiveDate,
mTvActiveTitle, mTvActiveCouponsHeader, mTvMarketValue, mTvMarketAll, mTvFavValue,
mTvFavValueAll, mTvDealsCountBadge, mTvUnifiedCountBadge, mTvGiftsCountBadge;
mTvFavValueAll, mTvDealsCountBadge, mTvUnifiedCountBadge, mTvGiftsCountBadge,
mTvVouchersDisabledTitle, mTvVouchersDisabledSubtitle, mTvVouchersTitle, mTvVouchersSubtitle;
private ConstraintLayout mClDealsBanner, mClDealsView,
mClGiftsBanner, mClToolbar, mClMarket;
private LinearLayout mLlQuestionnaire, mLlUserBadge, mLlEmptyWallet, mLlDeals, mLlGifts,
......@@ -152,6 +153,10 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mLlVouchersSpinner = findViewById(R.id.ll_vouchers_spinner);
mSeparator = findViewById(R.id.v_separator_vouchers);
mSeparatorDisabled = findViewById(R.id.v_separator_vouchers_disabled);
mTvVouchersDisabledTitle = findViewById(R.id.tv_vouchers_title_disabled);
mTvVouchersDisabledSubtitle = findViewById(R.id.tv_vouchers_info_title_disabled);
mTvVouchersTitle = findViewById(R.id.tv_vouchers_title);
mTvVouchersSubtitle = findViewById(R.id.tv_vouchers_info_title);
/** Deals Badge */
// if (WarplyManagerHelper.getActiveDFYCoupons() != null) {
......@@ -1007,6 +1012,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
/** Hide spinner and hide empty view and show vouchers and hide disabled vouchers */
mLlVouchersSpinner.setVisibility(View.GONE);
mLlEmptyWallet.setVisibility(View.GONE);
if (TextUtils.isEmpty(WarpUtils.getLanguage(this)) || WarpUtils.getLanguage(this).equals("el")) {
mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title));
mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title));
} else {
mTvVouchersTitle.setText(getString(R.string.cos_vouchers_title_en));
mTvVouchersSubtitle.setText(getString(R.string.cos_vouchers_info_title_en));
}
mLlVouchers.setVisibility(View.VISIBLE);
mLlVouchersDisabled.setVisibility(View.GONE);
mSeparatorDisabled.setVisibility(View.VISIBLE);
......@@ -1027,6 +1039,13 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
mLlEmptyWallet.setVisibility(View.GONE);
mLlVouchers.setVisibility(View.GONE);
mSeparator.setVisibility(View.VISIBLE);
if (TextUtils.isEmpty(WarpUtils.getLanguage(this)) || WarpUtils.getLanguage(this).equals("el")) {
mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title));
mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled));
} else {
mTvVouchersDisabledTitle.setText(getString(R.string.cos_vouchers_title_en));
mTvVouchersDisabledSubtitle.setText(getString(R.string.cos_vouchers_info_title_disabled_en));
}
mLlVouchersDisabled.setVisibility(View.VISIBLE);
mSeparatorDisabled.setVisibility(View.VISIBLE);
if ((WarplyManagerHelper.getActiveDFYCoupons() != null && WarplyManagerHelper.getActiveDFYCoupons().size() == 0)
......
......@@ -10,13 +10,14 @@ public class CustomerStateModel {
private boolean nonTelco = false;
private boolean acceptedConsent = false;
private ArrayList<String> msisdnList = new ArrayList<>();
private String guid = "";
private String guid = "", language = "";
public CustomerStateModel() {
this.nonTelco = false;
this.acceptedConsent = false;
this.msisdnList = new ArrayList<>();
this.guid = "";
this.language = "";
}
public boolean isNonTelco() {
......@@ -50,4 +51,12 @@ public class CustomerStateModel {
public void setGuid(String guid) {
this.guid = guid;
}
public String getLanguage() {
return language;
}
public void setLanguage(String language) {
this.language = language;
}
}
......
......@@ -40,7 +40,7 @@ public class WarplyIntegrationRequest {
private long mCacheUpdateInterval = 0;
private boolean mIsNonTelco = false;
private boolean mHasAcceptedConsent = false;
private String mGuid = "";
private String mGuid = "", mLanguage = "";
private ArrayList<String> mPhoneList = new ArrayList<>();
// ===========================================================
......@@ -56,6 +56,7 @@ public class WarplyIntegrationRequest {
this.mHasAcceptedConsent = false;
this.mGuid = "";
this.mPhoneList = new ArrayList<>();
this.mLanguage = "";
}
public WarplyIntegrationRequest(WarplyIntegrationRequest copy) {
......@@ -111,6 +112,15 @@ public class WarplyIntegrationRequest {
return this;
}
public WarplyIntegrationRequest setLanguage(String language) {
this.mLanguage = language;
return this;
}
public String getLanguage() {
return mLanguage;
}
/**
* Call this to get how often the cached data will be updated.
*
......@@ -179,6 +189,7 @@ public class WarplyIntegrationRequest {
data.putOpt("acceptedConsent", mHasAcceptedConsent);
data.putOpt("msisdnList", new JSONArray(mPhoneList));
data.putOpt("guid", mGuid);
data.putOpt("language", mLanguage);
extraJson.putOpt(KEY_DATA, data);
bodyJsonObject.putOpt(KEY_MAPP, extraJson);
......
......@@ -147,6 +147,8 @@ public class WarpUtils {
+ "steps_meters_counter";
private static final String PREFERENCES_TRACKERS_ENABLED = PREFERENCES_PREFIX
+ "trackers_enabled";
private static final String PREFERENCES_KEY_LANGUAGE = PREFERENCES_PREFIX
+ "language";
private static SharedPreferences _prefs;
......@@ -162,6 +164,16 @@ public class WarpUtils {
editor.apply();
}
public static String getLanguage(Context context) {
return getPreferences(context).getString(PREFERENCES_KEY_LANGUAGE, "el");
}
public static void setLanguage(Context context, String userTag) {
SharedPreferences.Editor editor = getPreferences(context).edit();
editor.putString(PREFERENCES_KEY_LANGUAGE, userTag);
editor.apply();
}
public static boolean getUserNonTelco(Context context) {
return getPreferences(context).getBoolean(PREFERENCES_KEY_USER_NON_TELCO, false);
}
......
......@@ -1112,12 +1112,14 @@ public class WarplyManagerHelper {
*/
public static void saveCustomerState(CustomerStateModel customerState) {
mCustomerStateModel = customerState;
WarpUtils.setLanguage(Warply.getWarplyContext(), customerState.getLanguage());
WarplyIntegrationRequest request = new WarplyIntegrationRequest();
request.setIsNoTelco(customerState.isNonTelco())
.setHasAcceptedConsent(customerState.isAcceptedConsent())
.setGuid(customerState.getGuid())
.setMsisdnList(customerState.getMsisdnList());
.setMsisdnList(customerState.getMsisdnList())
.setLanguage(customerState.getLanguage());
WarplyManager.consumerIntegration(request, new CallbackReceiver<JSONObject>() {
@Override
public void onSuccess(JSONObject result) {
......
......@@ -1651,6 +1651,77 @@ public class WarplyManager {
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1) {
// JSONObject profMetadata = new JSONObject();
// try {
// profMetadata.putOpt("language", request.getLanguage());
// } catch (JSONException e) {
// throw new RuntimeException(e);
// }
// WarplyEditConsumerRequest editConsumerRequest = new WarplyEditConsumerRequest()
// .setHasProfileMetadata(true)
// .setProfileMetadata(profMetadata);
// editConsumer(editConsumerRequest, new CallbackReceiver<JSONObject>() {
// @Override
// public void onSuccess(JSONObject result) {
// int status = result.optInt("status", 2);
// if (status == 1) {
// getConsumer(new WarplyConsumerRequest(), new CallbackReceiver<Consumer>() {
// @Override
// public void onSuccess(Consumer result) {
// WarplyManagerHelper.setConsumerInternal(result);
//
//// if (result != null) {
//// JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
//// if (profMetadata != null && profMetadata.has("nonTelco")) {
//// WarpUtils.setUserNonTelco(Warply.getWarplyContext(), profMetadata.optBoolean("nonTelco"));
//// } else {
//// WarpUtils.setUserNonTelco(Warply.getWarplyContext(), false);
//// }
//// }
////
//// if (result != null) {
//// JSONObject profMetadata = WarpJSONParser.getJSONFromString(result.getProfileMetadata());
//// if (profMetadata != null) {
//// if (profMetadata.has("badge")) {
//// WarpUtils.setUserTag(Warply.getWarplyContext(), profMetadata.optString("badge"));
//// }
////
//// if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
//// if (!isMyServiceRunning(WarplyHealthService.class)) {
//// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
//// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
//// AlarmManager mgr = (AlarmManager) Warply.getWarplyContext().getSystemService(Context.ALARM_SERVICE);
//// PendingIntent pi = PendingIntent.getService(Warply.getWarplyContext(), 2002, stepsServiceIntent, PendingIntent.FLAG_ONE_SHOT | PendingIntent.FLAG_MUTABLE);
//// mgr.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, SystemClock.elapsedRealtime() + 1000, pi);
//// } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
//// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
//// } else {
//// Warply.getWarplyContext().startService(stepsServiceIntent);
//// }
////
//// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
//// pacingVisible.setVisible(true);
//// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
//// }
//// }
//// }
//// }
// }
//
// @Override
// public void onFailure(int errorCode) {
//
// }
// });
// }
// }
//
// @Override
// public void onFailure(int errorCode) {
//
// }
// });
LoyaltySDKDynatraceEventModel dynatraceEvent = new LoyaltySDKDynatraceEventModel();
dynatraceEvent.setEventName("custom_success_customer_state_loyalty");
EventBus.getDefault().post(new WarplyEventBusManager(dynatraceEvent));
......
......@@ -115,6 +115,7 @@
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv_expired_coupons_inner_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cv_expired_coupons_title"
......@@ -184,21 +185,21 @@
android:src="@drawable/ic_down_dark_new" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv_expired_coupons_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
<androidx.cardview.widget.CardView
......
......@@ -115,6 +115,7 @@
</androidx.cardview.widget.CardView>
<androidx.cardview.widget.CardView
android:id="@+id/cv_expired_coupons_inner_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/cv_expired_coupons_title"
......@@ -185,21 +186,21 @@
android:src="@drawable/ic_down_dark_new" />
</LinearLayout>
</LinearLayout>
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/tv_expired_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
</androidx.cardview.widget.CardView>
<TextView
android:id="@+id/tv_expired_empty"
fontPath="fonts/PeridotPE-Regular.ttf"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/cv_expired_coupons_title"
android:layout_centerHorizontal="true"
android:layout_marginTop="56dp"
android:text="@string/cos_empty_expired_coupons"
android:textColor="@color/cos_light_black"
android:textSize="16sp"
android:visibility="gone" />
</RelativeLayout>
<androidx.cardview.widget.CardView
......
......@@ -510,6 +510,7 @@
<TextView
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:id="@+id/tv_vouchers_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
......@@ -583,7 +584,7 @@
android:layout_marginTop="32dp"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="visible">
tools:visibility="gone">
<View
android:id="@+id/v_separator_vouchers_disabled"
......@@ -593,6 +594,7 @@
<TextView
fontPath="fonts/PeridotPE-SemiBold.ttf"
android:id="@+id/tv_vouchers_title_disabled"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="24dp"
......
......@@ -201,7 +201,9 @@
<string name="cos_dlg_negative_button4">Όχι</string>
<string name="cos_dlg_positive_button3">Ναι</string>
<string name="cos_vouchers_title">Υπόλοιπο επιδότησης</string>
<string name="cos_vouchers_title_en">Subsidy balance</string>
<string name="cos_vouchers_info_title">Δες το διαθέσιμο υπόλοιπο</string>
<string name="cos_vouchers_info_title_en">Check the available balance</string>
<string name="cos_loyalty_history">Ιστορικό</string>
<string name="cos_redeemed_coupons_loyalty_title">Εξαργυρωμένα κουπόνια</string>
<string name="cos_history_info_text">Δες αναλυτικά το συνολικό όφελός σου έως τώρα από κουπόνια</string>
......@@ -209,6 +211,7 @@
<string name="cos_dlg_service_unavailable">Προσωρινά μη διαθέσιμη πληροφορία.\nΠαρακαλούμε δοκίμασε ξανά σε λίγο.</string>
<string name="cos_dlg_return">Επιστροφή</string>
<string name="cos_vouchers_info_title_disabled">Διαθέσιμο υπόλοιπο</string>
<string name="cos_vouchers_info_title_disabled_en">Available balance</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......