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-30 14:04:22 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
a6a2062d6f51b77be7506d246d669d40bd7576a3
a6a2062d
1 parent
8cbd78a1
added event when coupons request completed
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
98 additions
and
1 deletions
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/RewardsCouponsEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventRewardsCouponsService.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
warply_android_sdk/src/main/AndroidManifest.xml
View file @
a6a2062
...
...
@@ -202,6 +202,11 @@
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventRewardsCouponsService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventUnifiedCouponsService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/fragments/MyRewardsFragment.java
View file @
a6a2062
...
...
@@ -418,7 +418,7 @@ public class MyRewardsFragment extends Fragment implements View.OnClickListener
});
return
;
}
if
(
event
.
getCouponsAdded
()
!=
null
)
{
if
(
event
.
getCouponsAdded
()
!=
null
||
event
.
getRewardsCouponsEventModel
()
!=
null
)
{
Handler
mUIHandler
=
new
Handler
(
Looper
.
getMainLooper
());
mUIHandler
.
post
(()
->
{
if
(
WarplyManagerHelper
.
getCouponList
()
!=
null
&&
WarplyManagerHelper
.
getCouponList
().
size
()
>
0
)
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/RewardsCouponsEventModel.java
0 → 100644
View file @
a6a2062
/*
* Copyright 2010-2013 Warply Ltd. All rights reserved.
*
* Redistribution and use in source and binary forms, without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE WARPLY LTD ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
* EVENT SHALL WARPLY LTD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package
ly
.
warp
.
sdk
.
io
.
models
;
/**
* Created by Panagiotis Triantafyllou on 30-April-24.
*/
public
class
RewardsCouponsEventModel
{
private
boolean
success
;
public
RewardsCouponsEventModel
()
{
this
.
success
=
true
;
}
public
boolean
isSuccess
()
{
return
success
;
}
public
void
setSuccess
(
boolean
success
)
{
this
.
success
=
success
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventRewardsCouponsService.java
0 → 100644
View file @
a6a2062
package
ly
.
warp
.
sdk
.
services
;
import
android.content.Context
;
import
androidx.annotation.NonNull
;
import
androidx.work.Worker
;
import
androidx.work.WorkerParameters
;
import
org.greenrobot.eventbus.EventBus
;
import
ly.warp.sdk.io.models.RewardsCouponsEventModel
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
/**
* Created by Panagiotis Triantafyllou on 05/Sept/2022.
*/
public
class
EventRewardsCouponsService
extends
Worker
{
public
EventRewardsCouponsService
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
RewardsCouponsEventModel
couponsAdded
=
new
RewardsCouponsEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
couponsAdded
));
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
a6a2062
...
...
@@ -17,6 +17,7 @@ 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
;
import
ly.warp.sdk.io.models.RewardsCouponsEventModel
;
import
ly.warp.sdk.io.models.UnifiedCouponsEventModel
;
import
ly.warp.sdk.io.models.VouchersActivityEventModel
;
import
ly.warp.sdk.io.models.VouchersFetchedEventModel
;
...
...
@@ -48,6 +49,7 @@ public class WarplyEventBusManager {
private
LoyaltyGiftsForYouOfferClickEvent
giftsYou
;
private
QuestionnaireEventModel
questionnaire
;
private
OpenMyRewardsEventModel
openRewards
;
private
RewardsCouponsEventModel
rewardsCoupons
;
private
VouchersActivityEventModel
vouchersActivity
;
private
VouchersFetchedEventModel
vouchersFetched
;
private
CouponEventModel
coupon
;
...
...
@@ -89,6 +91,10 @@ public class WarplyEventBusManager {
this
.
openRewards
=
openRewards
;
}
public
WarplyEventBusManager
(
RewardsCouponsEventModel
rewardsCoupons
)
{
this
.
rewardsCoupons
=
rewardsCoupons
;
}
public
WarplyEventBusManager
(
RefreshVouchersEventModel
vouchersRefreshed
)
{
this
.
vouchersRefreshed
=
vouchersRefreshed
;
}
...
...
@@ -338,4 +344,8 @@ public class WarplyEventBusManager {
public
OpenMyRewardsEventModel
getOpenMyRewardsEventModel
()
{
return
openRewards
;
}
public
RewardsCouponsEventModel
getRewardsCouponsEventModel
()
{
return
rewardsCoupons
;
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
a6a2062
...
...
@@ -155,6 +155,8 @@ import ly.warp.sdk.io.request.WarplyVerifyTicketRequest;
import
ly.warp.sdk.io.volley.ApiClient
;
import
ly.warp.sdk.io.volley.ApiService
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.services.EventCouponsService
;
import
ly.warp.sdk.services.EventRewardsCouponsService
;
import
ly.warp.sdk.services.EventUnifiedCouponsService
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
...
...
@@ -4709,6 +4711,8 @@ public class WarplyManager {
WarplyManagerHelper
.
setCouponList
(
mCouponsList
);
WarplyManagerHelper
.
setCouponRedeemedList
(
mCouponRedeemedList
);
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventRewardsCouponsService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
Collections
.
sort
(
mActiveCouponList
,
(
coupon1
,
coupon2
)
->
coupon1
.
getExpirationDate
().
compareTo
(
coupon2
.
getExpirationDate
()));
...
...
Please
register
or
login
to post a comment