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-09-13 15:10:26 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
c18986c31fbe0b02cea61e663cc8e25f3c05a3d7
c18986c3
1 parent
c79fa621
new keys
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
119 additions
and
31 deletions
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveCouponsActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelcoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Coupon.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
c18986c
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"601204932
2
"
),
//6012049321, 6012049322, 6012049323
.
setGuid
(
"601204932
1
"
),
//6012049321, 6012049322, 6012049323
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
c18986c
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta6
1
'
PUBLISH_VERSION
=
'4.5.4-cosbeta6
2
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/ActiveCouponsActivity.java
View file @
c18986c
...
...
@@ -12,6 +12,11 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import
androidx.recyclerview.widget.RecyclerView
;
import
java.io.Serializable
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
io.github.inflationx.viewpump.ViewPumpContextWrapper
;
import
ly.warp.sdk.R
;
...
...
@@ -49,9 +54,21 @@ public class ActiveCouponsActivity extends Activity implements View.OnClickListe
mCouponList
=
new
CouponList
(
getIntent
().
getSerializableExtra
(
"couponlist"
).
toString
(),
true
);
CouponList
cpnlist
=
new
CouponList
();
for
(
Coupon
cpn
:
mCouponList
)
{
if
(
cpn
.
getStatus
()
==
1
)
if
(
cpn
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
newDate
=
simpleDateFormat
.
parse
(
cpn
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
cpn
.
setExpirationDate
(
newDate
);
cpnlist
.
add
(
cpn
);
}
}
Collections
.
sort
(
cpnlist
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
mCouponList
.
clear
();
mCouponList
.
addAll
(
cpnlist
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
View file @
c18986c
...
...
@@ -37,6 +37,7 @@ import io.github.inflationx.viewpump.ViewPumpContextWrapper;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.io.models.ActiveDFYCouponEventModel
;
import
ly.warp.sdk.io.models.ActiveDFYCouponModel
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel
;
import
ly.warp.sdk.utils.WarpUtils
;
...
...
@@ -185,11 +186,29 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getCouponsAdded
()
!=
null
)
{
CouponList
tempCouponList
=
new
CouponList
();
CouponList
cpnlist
=
new
CouponList
();
tempCouponList
.
clear
();
tempCouponList
.
addAll
(
WarplyManagerHelper
.
getCouponList
());
for
(
Coupon
cpn
:
tempCouponList
)
{
if
(
cpn
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
newDate
=
simpleDateFormat
.
parse
(
cpn
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
cpn
.
setExpirationDate
(
newDate
);
cpnlist
.
add
(
cpn
);
}
}
Collections
.
sort
(
cpnlist
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
runOnUiThread
(()
->
{
if
(
tempCouponList
!=
null
&&
tempCouponL
ist
.
size
()
>
0
)
{
mAdapterCoupons
=
new
ActiveCouponAdapter
(
this
,
tempCouponL
ist
);
if
(
cpnlist
!=
null
&&
cpnl
ist
.
size
()
>
0
)
{
mAdapterCoupons
=
new
ActiveCouponAdapter
(
this
,
cpnl
ist
);
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
...
...
@@ -225,7 +244,24 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
}
if
(
WarplyManagerHelper
.
getCouponList
()
!=
null
&&
WarplyManagerHelper
.
getCouponList
().
size
()
>
0
)
{
mAdapterCoupons
=
new
ActiveCouponAdapter
(
this
,
WarplyManagerHelper
.
getCouponList
());
CouponList
cpnlist
=
new
CouponList
();
for
(
Coupon
cpn
:
WarplyManagerHelper
.
getCouponList
())
{
if
(
cpn
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
newDate
=
simpleDateFormat
.
parse
(
cpn
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
cpn
.
setExpirationDate
(
newDate
);
cpnlist
.
add
(
cpn
);
}
}
Collections
.
sort
(
cpnlist
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
mAdapterCoupons
=
new
ActiveCouponAdapter
(
this
,
cpnlist
);
mRecyclerCoupons
.
setAdapter
(
mAdapterCoupons
);
mAdapterCoupons
.
getPositionClicks
()
.
doOnNext
(
coupon
->
{
...
...
@@ -305,7 +341,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener {
try
{
Date
toDate
=
dateFormat
.
parse
(
date2
);
Date
fromDate
=
dateFormat
.
parse
(
date1
);
long
diff
=
TimeUnit
.
MILLISECONDS
.
toDays
(
fromDate
.
getTime
()
-
toDate
.
getTime
());
long
diff
=
TimeUnit
.
MILLISECONDS
.
toDays
(
fromDate
.
getTime
()
-
toDate
.
getTime
())
+
1
;
mTvActiveDate
.
setText
(
String
.
format
(
getString
(
R
.
string
.
cos_active_coupon_date
),
String
.
valueOf
(
diff
)));
mTvActiveDate
.
setVisibility
(
View
.
VISIBLE
);
}
catch
(
ParseException
e
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/TelcoActivity.java
View file @
c18986c
...
...
@@ -168,18 +168,41 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
ImageView
dialogClose
=
(
ImageView
)
bottomSheetDialog
.
findViewById
(
R
.
id
.
iv_sender_list_close
);
dialogClose
.
setOnClickListener
(
view
->
bottomSheetDialog
.
dismiss
());
if
(
mConsumer
!=
null
)
{
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
)
{
for
(
int
i
=
0
;
i
<
msisdnList
.
length
();
i
++)
{
// if (mConsumer != null) {
// 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) {
// for (int i = 0; i < msisdnList.length(); i++) {
// LayoutInflater vi = (LayoutInflater) getApplicationContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
// LinearLayout v = (LinearLayout) vi.inflate(R.layout.item_share, null);
// TextView textView = (TextView) v.findViewById(R.id.tv_phone_share);
// textView.setText(msisdnList.optString(i));
// textView.setOnClickListener(view -> {
// TextView tv = (TextView) view;
// mSender = tv.getText().toString();
// bottomSheetDialog.dismiss();
// askActivateDialog();
// });
// parent.addView(v, 0, new ViewGroup.LayoutParams(
// ViewGroup.LayoutParams.MATCH_PARENT,
// ViewGroup.LayoutParams.WRAP_CONTENT));
// }
// }
// }
// } catch (JSONException e) {
// e.printStackTrace();
// }
// }
if
(
mCCMS
.
getEligibleAssets
()
!=
null
&&
mCCMS
.
getEligibleAssets
().
size
()
>
0
)
{
for
(
int
i
=
0
;
i
<
mCCMS
.
getEligibleAssets
().
size
();
i
++)
{
LayoutInflater
vi
=
(
LayoutInflater
)
getApplicationContext
().
getSystemService
(
Context
.
LAYOUT_INFLATER_SERVICE
);
LinearLayout
v
=
(
LinearLayout
)
vi
.
inflate
(
R
.
layout
.
item_share
,
null
);
TextView
textView
=
(
TextView
)
v
.
findViewById
(
R
.
id
.
tv_phone_share
);
textView
.
setText
(
msisdnList
.
optString
(
i
));
textView
.
setText
(
mCCMS
.
getEligibleAssets
().
get
(
i
));
textView
.
setOnClickListener
(
view
->
{
TextView
tv
=
(
TextView
)
view
;
mSender
=
tv
.
getText
().
toString
();
...
...
@@ -191,11 +214,6 @@ public class TelcoActivity extends Activity implements View.OnClickListener {
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
));
}
}
}
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
}
bottomSheetDialog
.
show
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Coupon.java
View file @
c18986c
...
...
@@ -32,6 +32,7 @@ import org.json.JSONException;
import
org.json.JSONObject
;
import
java.io.Serializable
;
import
java.util.Date
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
...
...
@@ -81,6 +82,7 @@ public class Coupon implements Parcelable, Serializable {
private
String
couponsetUuid
=
""
;
private
String
merchantUuid
=
""
;
private
String
innerText
=
""
;
private
Date
expirationDate
=
new
Date
();
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -347,6 +349,14 @@ public class Coupon implements Parcelable, Serializable {
this
.
innerText
=
innerText
;
}
public
Date
getExpirationDate
()
{
return
expirationDate
;
}
public
void
setExpirationDate
(
Date
expirationDate
)
{
this
.
expirationDate
=
expirationDate
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
c18986c
...
...
@@ -879,6 +879,7 @@ public class WarplyManagerHelper {
* Set the List with active D4Y coupons
*/
public
static
void
setActiveDFYCoupons
(
ArrayList
<
ActiveDFYCouponModel
>
dfyCoupons
)
{
mDfyCoupons
.
clear
();
mDfyCoupons
=
dfyCoupons
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
c18986c
...
...
@@ -28,7 +28,6 @@ public class WarplyEventBusManager {
private
LoyaltyContextualOfferModel
ccms
;
protected
HashMap
<
String
,
Object
>
mWarplyEventBusManager
=
new
HashMap
();
private
WarplyPacingEventModel
pacing
;
private
WarplyPacingCardEventModel
pacingCard
;
private
WarplyPacingCardServiceEnabledModel
pacingService
;
private
WarplyDealsAnalysisEventModel
dealsAnalysis
;
private
WarplyCCMSEnabledModel
ccmsActivated
;
...
...
@@ -94,10 +93,6 @@ public class WarplyEventBusManager {
public
WarplyEventBusManager
(
WarplyPacingEventModel
pacing
)
{
this
.
pacing
=
pacing
;
}
// public WarplyEventBusManager(WarplyPacingCardEventModel pacingCard) {
// this.pacingCard = pacingCard;
// }
//
// public WarplyEventBusManager(WarplyPacingCardServiceEnabledModel pacingService) {
// this.pacingService = pacingService;
...
...
@@ -157,10 +152,6 @@ public class WarplyEventBusManager {
return
mWarplyEventBusManager
;
}
public
WarplyPacingCardEventModel
getPacingCard
()
{
return
pacingCard
;
}
public
WarplyPacingCardServiceEnabledModel
getPacingService
()
{
return
pacingService
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
c18986c
...
...
@@ -37,9 +37,12 @@ import org.json.JSONArray;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Comparator
;
import
java.util.Date
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
...
...
@@ -780,6 +783,7 @@ public class WarplyManager {
WarpUtils
.
log
(
"[WARP Trace] WARPLY Verify Ticket Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
""
);
Warply
.
postReceiveMicroappData
(
false
,
"verify"
,
request
.
toJson
(),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
...
...
@@ -2282,9 +2286,20 @@ public class WarplyManager {
CouponList
mActiveCouponList
=
new
CouponList
();
for
(
Coupon
coupon
:
mCouponList
)
{
if
(
coupon
.
getStatus
()
==
1
)
if
(
coupon
.
getStatus
()
==
1
)
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm"
);
Date
newDate
=
new
Date
();
try
{
newDate
=
simpleDateFormat
.
parse
(
coupon
.
getExpiration
());
}
catch
(
ParseException
e
)
{
e
.
printStackTrace
();
}
coupon
.
setExpirationDate
(
newDate
);
mActiveCouponList
.
add
(
coupon
);
}
}
Collections
.
sort
(
mActiveCouponList
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
receiver
.
onSuccess
(
mActiveCouponList
);
}
...
...
Please
register
or
login
to post a comment