Toggle navigation
Toggle navigation
This project
Loading...
Sign in
open-source
/
warply_android_sdk_maven_plugin
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
Panagiotis Triantafyllou
2022-07-04 14:37:36 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
92e0d0cf108640cad90305fd7006e4236a88528a
92e0d0cf
1 parent
b797d2fc
new version
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
146 additions
and
38 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/res/layout/activity_coupon_info.xml
warply_android_sdk/src/main/res/layout/activity_coupon_share.xml
warply_android_sdk/src/main/res/values/colors.xml
warply_android_sdk/src/main/res/values/strings.xml
warply_android_sdk/build.gradle
View file @
92e0d0c
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
2
'
PUBLISH_VERSION
=
'4.5.4-cosbeta2
3
'
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'
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
92e0d0c
...
...
@@ -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
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponShareActivity.java
View file @
92e0d0c
...
...
@@ -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
()
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
92e0d0c
...
...
@@ -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
);
}
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
92e0d0c
...
...
@@ -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
);
}
...
...
warply_android_sdk/src/main/res/layout/activity_coupon_info.xml
View file @
92e0d0c
...
...
@@ -159,14 +159,15 @@
<LinearLayout
android:id=
"@+id/ll_gift_it"
android:layout_width=
"2
4
0dp"
android:layout_height=
"
50dp
"
android:layout_width=
"2
2
0dp"
android:layout_height=
"
wrap_content
"
android:layout_marginHorizontal=
"32dp"
android:layout_marginTop=
"64dp"
android:background=
"@drawable/selector_button_green"
android:gravity=
"center"
android:visibility=
"
gon
e"
android:visibility=
"
invisibl
e"
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:text
Size=
"17dp
"
android:text
FontWeight=
"600
"
/>
android:text
FontWeight=
"600
"
android:text
Size=
"17dp
"
/>
</LinearLayout>
<LinearLayout
android:id=
"@+id/ll_shops"
android:layout_width=
"2
4
0dp"
android:layout_height=
"
50dp
"
android:layout_width=
"2
2
0dp"
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:text
Size=
"17dp
"
android:text
FontWeight=
"600
"
/>
android:text
FontWeight=
"600
"
android:text
Size=
"17dp
"
/>
</LinearLayout>
<RelativeLayout
...
...
warply_android_sdk/src/main/res/layout/activity_coupon_share.xml
View file @
92e0d0c
...
...
@@ -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>
...
...
warply_android_sdk/src/main/res/values/colors.xml
View file @
92e0d0c
...
...
@@ -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
...
...
warply_android_sdk/src/main/res/values/strings.xml
View file @
92e0d0c
...
...
@@ -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>
...
...
Please
register
or
login
to post a comment