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
2024-04-02 12:13:14 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4166bbf936c3465e18f2f04a9ebd1c722e9c6f56
4166bbf9
1 parent
6b636b45
feedback fixes and changes
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
23 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
warply_android_sdk/build.gradle
View file @
4166bbf
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.4r1
6
'
PUBLISH_VERSION
=
'4.5.5.4r1
7
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
4166bbf
...
...
@@ -34,10 +34,8 @@ import ly.warp.sdk.io.models.CouponList;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.OpenMyRewardsEventModel
;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.io.request.WarplyRedeemCouponRequest
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.utils.WarpUtils
;
...
...
@@ -237,12 +235,8 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
mCoupon
.
setImage
(
mCouponset
.
getImgPreview
());
mCoupon
.
setName
(
mCouponset
.
getName
());
showDialog
(
true
,
1
);
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
}
}).
start
();
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
}
else
{
showDialog
(
false
,
status
);
}
...
...
@@ -364,7 +358,6 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
// Thread.currentThread().interrupt();
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
...
...
@@ -372,7 +365,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
...
...
@@ -381,12 +374,11 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
// Thread.currentThread().interrupt();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
View file @
4166bbf
...
...
@@ -110,6 +110,7 @@ public class Campaign implements Parcelable, Serializable {
private
String
endDate
,
startDate
;
private
boolean
showExpiration
;
private
String
couponImg
;
private
String
filter
=
""
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -698,6 +699,14 @@ public class Campaign implements Parcelable, Serializable {
this
.
couponImg
=
couponImg
;
}
public
String
getFilter
()
{
return
filter
;
}
public
void
setFilter
(
String
filter
)
{
this
.
filter
=
filter
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaign.java
View file @
4166bbf
...
...
@@ -95,6 +95,7 @@ public class NewCampaign implements Parcelable, Serializable {
private
String
bannerTitle
=
""
;
private
boolean
showExpiration
=
false
;
private
String
couponImg
=
""
;
private
String
filter
=
""
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -146,6 +147,11 @@ public class NewCampaign implements Parcelable, Serializable {
}
else
{
this
.
showExpiration
=
false
;
}
if
(
this
.
extraFields
.
has
(
"filter"
))
{
this
.
filter
=
this
.
extraFields
.
optString
(
"filter"
);
}
else
{
this
.
filter
=
""
;
}
}
this
.
couponImg
=
json
.
optString
(
"coupon_img"
);
}
...
...
@@ -402,6 +408,14 @@ public class NewCampaign implements Parcelable, Serializable {
this
.
couponImg
=
couponImg
;
}
public
String
getFilter
()
{
return
filter
;
}
public
void
setFilter
(
String
filter
)
{
this
.
filter
=
filter
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
4166bbf
...
...
@@ -1533,7 +1533,8 @@ public class WarplyManager {
JSONObject
campMetadata
=
WarpJSONParser
.
getJSONFromString
(
camp
.
getExtraFields
());
if
(
campMetadata
!=
null
)
{
if
(
campMetadata
.
has
(
"carousel"
))
{
campaignCarouselList
.
add
(
camp
);
if
(
camp
.
getCouponAvailability
()
==
null
||
camp
.
getCouponAvailability
()
!=
0
)
campaignCarouselList
.
add
(
camp
);
}
}
...
...
@@ -1541,11 +1542,13 @@ public class WarplyManager {
JSONObject
extraFields
=
WarpJSONParser
.
getJSONFromString
(
camp
.
getExtraFields
());
if
(
extraFields
!=
null
)
{
if
(
extraFields
.
length
()
==
0
||
!(
extraFields
.
has
(
"ccms_offer"
)
||
extraFields
.
has
(
"type"
)))
{
campaignLoyaltyList
.
add
(
camp
);
if
(
camp
.
getCouponAvailability
()
==
null
||
camp
.
getCouponAvailability
()
!=
0
)
campaignLoyaltyList
.
add
(
camp
);
}
}
}
catch
(
Exception
exception
)
{
campaignLoyaltyList
.
add
(
camp
);
if
(
camp
.
getCouponAvailability
()
==
null
||
camp
.
getCouponAvailability
()
!=
0
)
campaignLoyaltyList
.
add
(
camp
);
}
}
WarplyManagerHelper
.
setCampaignList
(
newCampaignList
);
...
...
@@ -1770,6 +1773,7 @@ public class WarplyManager {
camp
.
setStartDate
(
newCamp
.
getStartDate
());
camp
.
setShowExpiration
(
newCamp
.
isShowExpiration
());
camp
.
setCouponImg
(
newCamp
.
getCouponImg
());
camp
.
setFilter
(
newCamp
.
getFilter
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
...
...
@@ -1918,6 +1922,7 @@ public class WarplyManager {
camp
.
setStartDate
(
newCamp
.
getStartDate
());
camp
.
setShowExpiration
(
newCamp
.
isShowExpiration
());
camp
.
setCouponImg
(
newCamp
.
getCouponImg
());
camp
.
setFilter
(
newCamp
.
getFilter
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
4166bbf
...
...
@@ -89,8 +89,6 @@ import ly.warp.sdk.R;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.ActiveCouponsActivity
;
import
ly.warp.sdk.activities.ActiveUnifiedCouponsActivity
;
import
ly.warp.sdk.activities.BaseFragmentActivity
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
...
...
@@ -99,7 +97,6 @@ import ly.warp.sdk.io.models.CouponEventModel;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.LoyaltySDKDynatraceEventModel
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.OpenMyRewardsEventModel
;
import
ly.warp.sdk.io.models.QuestionnaireEventModel
;
import
ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel
;
import
ly.warp.sdk.io.models.RefreshVouchersEventModel
;
...
...
@@ -508,18 +505,34 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
}
else
if
(
parts
[
1
].
equals
(
"couponRetrieved"
))
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
CouponEventModel
()));
}
else
if
(
parts
[
1
].
equals
(
"loyaltyWallet"
))
{
// Open the old LoyaltyWallet activity
// Intent intent = new Intent((WarpActivity != null && !WarpActivity.isFinishing()) ? WarpActivity : getContext(), LoyaltyWallet.class);
// getContext().startActivity(intent);
OpenMyRewardsEventModel
openMyRewards
=
new
OpenMyRewardsEventModel
();
openMyRewards
.
setOpen
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
openMyRewards
));
// Client now opens the new LoyaltyWallet via event which is fragment (LoyaltyFragment)
// OpenMyRewardsEventModel openMyRewards = new OpenMyRewardsEventModel();
// openMyRewards.setOpen(true);
// EventBus.getDefault().post(new WarplyEventBusManager(openMyRewards));
//Now the client does nothing, the sdk opens the active unified screen
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
RefreshVouchersEventModel
vouchersRefreshed
=
new
RefreshVouchersEventModel
();
vouchersRefreshed
.
setRefreshed
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
vouchersRefreshed
));
}
else
if
(
parts
[
1
].
equals
(
"activeCoupons"
))
{
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
Handler
handlerIntent
=
new
Handler
();
Runnable
runnableIntent
=
new
Runnable
()
{
@Override
public
void
run
()
{
Intent
intent
=
new
Intent
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
(),
ActiveCouponsActivity
.
class
);
getContext
().
startActivity
(
intent
);
}
};
handlerIntent
.
postDelayed
(
runnableIntent
,
1500
);
}
else
if
(
parts
[
1
].
equals
(
"ccmsRetrieved"
))
{
WarplyCCMSEnabledModel
ccmsEnabled
=
new
WarplyCCMSEnabledModel
();
ccmsEnabled
.
setActivated
(
true
);
...
...
@@ -900,4 +913,31 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
getContext
().
startActivity
(
intent
);
}
};
private
final
CallbackReceiver
<
CouponList
>
mUserCouponsReceiver
=
new
CallbackReceiver
<
CouponList
>()
{
@Override
public
void
onSuccess
(
CouponList
result
)
{
WarplyCouponsChangedEventModel
couponsChanged
=
new
WarplyCouponsChangedEventModel
();
couponsChanged
.
setChanged
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsChanged
));
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
private
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
((
WarpActivity
!=
null
&&
!
WarpActivity
.
isFinishing
())
?
WarpActivity
:
getContext
()).
enqueue
(
mywork
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
};
}
\ No newline at end of file
...
...
Please
register
or
login
to post a comment