Panagiotis Triantafyllou

new version

......@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext {
PUBLISH_GROUP_ID = 'ly.warp'
PUBLISH_VERSION = '4.5.4-cosbeta22'
PUBLISH_VERSION = '4.5.4-cosbeta23'
PUBLISH_ARTIFACT_ID = 'warply-android-sdk'
}
......@@ -40,7 +40,6 @@ dependencies {
api "androidx.security:security-crypto:1.1.0-alpha03" // For minSDK 23 use 1.0.0, for minSDK 21 use 1.1.0 that is currently in alpha
api 'org.altbeacon:android-beacon-library:2.19.3'
api 'org.jbundle.util.osgi.wrapped:org.jbundle.util.osgi.wrapped.org.apache.http.client:4.1.2'
api "commons-logging:commons-logging:1.2"
api 'de.hdodenhof:circleimageview:3.1.0'
api group: 'io.reactivex.rxjava2', name: 'rxjava', version: '2.2.21'
api 'com.google.android.material:material:1.5.0'
......
......@@ -27,9 +27,7 @@ import ly.warp.sdk.io.callbacks.CallbackReceiver;
import ly.warp.sdk.io.models.Campaign;
import ly.warp.sdk.io.models.CampaignList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.request.WarplyConsumerRequest;
import ly.warp.sdk.io.request.WarplyGetCouponsetsRequest;
......@@ -54,7 +52,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private Fragment mFragmentToSet = null;
private static Consumer mConsumer;
private static HashMap<String, CampaignList> mUniqueCampaignList = new HashMap<String, CampaignList>();
private CouponsetsList mCouponsetsList;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -210,8 +207,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private CallbackReceiver<CouponsetsList> mCouponsetsReceiver = new CallbackReceiver<CouponsetsList>() {
@Override
public void onSuccess(CouponsetsList result) {
mCouponsetsList = result;
WarplyManagerHelper.setCouponsets(result);
WarplyManager.getUserCoupons(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
}
......@@ -225,20 +220,6 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private final CallbackReceiver<CouponList> mUserCouponsReceiver = new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
CouponList mCouponList = new CouponList();
for (Coupon coupon : result) {
for (Couponset couponset : mCouponsetsList) {
if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
coupon.setDescription(couponset.getShortDescription());
coupon.setImage(couponset.getImgPreview());
coupon.setName(couponset.getName());
mCouponList.add(coupon);
}
}
}
WarplyManagerHelper.setCouponList(mCouponList);
Thread.currentThread().interrupt();
new Handler(Looper.getMainLooper()).post(() -> {
initViews();
......
......@@ -8,6 +8,7 @@ import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.bumptech.glide.Glide;
......@@ -35,6 +36,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
private TextView mTvCouponTitle;
private Coupon mCoupon;
private Consumer mConsumer;
private RelativeLayout mRlSenderView;
private LinearLayout mLlShareButton;
// ===========================================================
// Methods for/from SuperClass/Interfaces
......@@ -50,6 +53,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
mIvBack = findViewById(R.id.iv_coupon_share_back);
mTvCouponTitle = findViewById(R.id.textView13);
mIvCouponPhoto = findViewById(R.id.imageView6);
mRlSenderView = findViewById(R.id.ll_share_view);
mLlShareButton = findViewById(R.id.ll_share_button);
initViews();
}
......@@ -73,10 +78,13 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
onBackPressed();
return;
}
// if (view.getId() == R.id.ll_gift_it) {
// showSharingDialog();
// return;
// }
if (view.getId() == R.id.ll_share_view) {
showSharingDialog();
return;
}
if (view.getId() == R.id.ll_share_button) {
}
}
// ===========================================================
......@@ -101,6 +109,8 @@ public class CouponShareActivity extends Activity implements View.OnClickListene
.into(mIvCouponPhoto);
}
mIvBack.setOnClickListener(this);
mRlSenderView.setOnClickListener(this);
mLlShareButton.setOnClickListener(this);
}
private void showSharingDialog() {
......
......@@ -209,6 +209,10 @@ public class WarplyManagerHelper {
@Override
public void onSuccess(JSONObject result) {
int status = result.optInt("status", 2);
if (status == 1)
returnSharingSuccessDialog(context);
else
errorSharingDialog(context);
}
@Override
......@@ -237,6 +241,19 @@ public class WarplyManagerHelper {
}
/**
* Dialog when the gift gets successfully returned
*/
private static void returnSharingSuccessDialog(Context context) {
mAlertDialogReturnSharing = new AlertDialog.Builder(context)
.setTitle(R.string.cod_dlg_reject_title)
.setMessage(R.string.cod_dlg_reject_subtitle)
.setPositiveButton(R.string.cos_dlg_positive_button2, (dialogPositive, whichPositive) -> {
dialogPositive.dismiss();
})
.show();
}
/**
* Error dialog
*/
private static void errorSharingDialog(Context context) {
......@@ -569,12 +586,18 @@ public class WarplyManagerHelper {
for (Coupon coupon : couponList) {
if (coupon.getStatus() == 1) {
try {
float tempCouponValue = Float.parseFloat(coupon.getDiscount());
cpnlist.add(coupon);
} catch (NumberFormatException e) {
cpnlist.remove(coupon);
}
} else if (coupon.getStatus() == 0) {
try {
couponCount += 1;
couponValue += Float.parseFloat(coupon.getDiscount());
} catch (NumberFormatException e) {
cpnlist.remove(coupon);
couponCount -= 1;
cpnlist.remove(coupon);
}
}
}
......
......@@ -51,7 +51,9 @@ import ly.warp.sdk.io.models.Card;
import ly.warp.sdk.io.models.CardList;
import ly.warp.sdk.io.models.Consumer;
import ly.warp.sdk.io.models.ContentList;
import ly.warp.sdk.io.models.Coupon;
import ly.warp.sdk.io.models.CouponList;
import ly.warp.sdk.io.models.Couponset;
import ly.warp.sdk.io.models.CouponsetsList;
import ly.warp.sdk.io.models.MerchantCategoriesList;
import ly.warp.sdk.io.models.MerchantList;
......@@ -103,6 +105,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest;
import ly.warp.sdk.io.request.WarplyVerifyOTPRequest;
import ly.warp.sdk.io.request.WarplyVerifyTicketRequest;
import ly.warp.sdk.utils.WarpUtils;
import ly.warp.sdk.utils.WarplyManagerHelper;
import ly.warp.sdk.utils.constants.WarpConstants;
/**
......@@ -792,7 +795,19 @@ public class WarplyManager {
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, true, "context", request.toJson(), new CouponsHook(new CallbackReceiver<CouponList>() {
@Override
public void onSuccess(CouponList result) {
receiver.onSuccess(result);
CouponList mCouponList = new CouponList();
for (Coupon coupon : result) {
for (Couponset couponset : WarplyManagerHelper.getCouponsets()) {
if (coupon.getCouponsetUuid().equals(couponset.getUuid())) {
coupon.setDescription(couponset.getShortDescription());
coupon.setImage(couponset.getImgPreview());
coupon.setName(couponset.getName());
mCouponList.add(coupon);
}
}
}
WarplyManagerHelper.setCouponList(mCouponList);
receiver.onSuccess(mCouponList);
}
@Override
......@@ -1196,6 +1211,7 @@ public class WarplyManager {
Warply.postReceiveMicroappData(WarpConstants.MICROAPP_COUPONS, request.toJson(), new CouponsetsHook(new CallbackReceiver<CouponsetsList>() {
@Override
public void onSuccess(CouponsetsList result) {
WarplyManagerHelper.setCouponsets(result);
receiver.onSuccess(result);
}
......
......@@ -159,14 +159,15 @@
<LinearLayout
android:id="@+id/ll_gift_it"
android:layout_width="240dp"
android:layout_height="50dp"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="64dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:visibility="gone"
android:visibility="invisible"
android:orientation="horizontal"
android:paddingVertical="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView17">
......@@ -177,19 +178,20 @@
android:gravity="center"
android:text="@string/cos_gift_it"
android:textColor="@color/white"
android:textSize="17dp"
android:textFontWeight="600" />
android:textFontWeight="600"
android:textSize="17dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/ll_shops"
android:layout_width="240dp"
android:layout_height="50dp"
android:layout_width="220dp"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="24dp"
android:background="@drawable/selector_button_grey"
android:gravity="center"
android:orientation="horizontal"
android:paddingVertical="8dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_gift_it">
......@@ -200,8 +202,8 @@
android:gravity="center"
android:text="@string/cos_shops"
android:textColor="@color/cos_green6"
android:textSize="17dp"
android:textFontWeight="600" />
android:textFontWeight="600"
android:textSize="17dp" />
</LinearLayout>
<RelativeLayout
......
......@@ -99,6 +99,8 @@
android:id="@+id/ll_share_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="64dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView14">
......@@ -119,10 +121,79 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:layout_centerVertical="true"
android:tint="@color/blue_dark"
android:rotation="90"
android:src="@drawable/ic_arrow_right_white"/>
android:src="@drawable/ic_arrow_right_white"
android:tint="@color/blue_dark" />
</RelativeLayout>
<View
android:id="@+id/v_separator"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="20dp"
android:background="@color/cos_grey7"
app:layout_constraintEnd_toEndOf="@+id/ll_share_view"
app:layout_constraintStart_toStartOf="@+id/ll_share_view"
app:layout_constraintTop_toBottomOf="@+id/ll_share_view" />
<RelativeLayout
android:id="@+id/ll_share_view2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="24dp"
android:layout_marginTop="48dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v_separator">
<EditText
android:id="@+id/et_phone"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:background="@android:color/transparent"
android:hint="@string/cos_coupon_share_hint"
android:textColor="@color/grey"
android:inputType="phone"
android:textColorHint="@color/cos_grey8"
android:textSize="16sp" />
</RelativeLayout>
<View
android:id="@+id/v_separator2"
android:layout_width="0dp"
android:layout_height="1dp"
android:layout_marginTop="20dp"
android:background="@color/cos_grey7"
app:layout_constraintEnd_toEndOf="@+id/ll_share_view2"
app:layout_constraintStart_toStartOf="@+id/ll_share_view2"
app:layout_constraintTop_toBottomOf="@+id/ll_share_view2" />
<LinearLayout
android:id="@+id/ll_share_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="32dp"
android:layout_marginTop="64dp"
android:paddingVertical="8dp"
android:paddingHorizontal="16dp"
android:background="@drawable/selector_button_green"
android:gravity="center"
android:orientation="horizontal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/v_separator2">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/cos_coupon_share_button"
android:textColor="@color/white"
android:textSize="17dp"
android:textFontWeight="600" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>
......
......@@ -48,4 +48,6 @@
<color name="cos_skyblue">#13ACD4</color>
<color name="cos_grey6">#536C79</color>
<color name="cos_grey_tr">#00000029</color>
<color name="cos_grey7">#C0C7CD</color>
<color name="cos_grey8">#AEAEAE</color>
</resources>
\ No newline at end of file
......
......@@ -93,6 +93,10 @@
<string name="cos_coupon_gift">Κάντο δώρο!</string>
<string name="cos_coupon_share_gift_title">Επίλεξε τον αριθμό από τον οποίο θα στείλεις το δώρο και καταχώρησε το COSMOTE τηλέφωνο του φίλου σου.</string>
<string name="cos_coupon_share_sender">Αποστολέας</string>
<string name="cos_coupon_share_hint">Καταχώρηση τηλεφώνου</string>
<string name="cos_coupon_share_button">Αποστολή με SMS</string>
<string name="cod_dlg_reject_title">Απόρριψη δώρου</string>
<string name="cod_dlg_reject_subtitle">To δώρο αππορίφθηκε</string>
<string-array name="coupons_array">
<item>Κουπόνια</item>
......