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
2023-10-19 12:14:34 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0a6cda84610659de06b48f5b761d9d6dd23eb420
0a6cda84
1 parent
b5dd8adc
vouchers part1
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
186 additions
and
1 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/VouchersActivityEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/VouchersFetchedEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/VouchersFetchedService.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/build.gradle
View file @
0a6cda8
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc
79
'
PUBLISH_VERSION
=
'4.5.4.6rc
80
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
0a6cda8
...
...
@@ -184,6 +184,11 @@
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.VouchersFetchedService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventCouponsService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/LoyaltyWallet.java
View file @
0a6cda8
...
...
@@ -186,6 +186,7 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
@Override
public
void
onDestroy
()
{
super
.
onDestroy
();
WarplyManagerHelper
.
clearShowVouchersBanner
();
EventBus
.
getDefault
().
unregister
(
this
);
}
...
...
@@ -354,6 +355,18 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
@Subscribe
()
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getVouchersFetched
()
!=
null
)
{
WarpUtils
.
log
(
String
.
valueOf
(
event
.
getVouchersFetched
().
isFetched
()));
WarpUtils
.
log
(
WarplyManagerHelper
.
getShowVouchersBanner
());
if
(
WarplyManagerHelper
.
getShowVouchersBanner
().
equals
(
"true"
))
{
//TODO: hide spinner and enable button
}
else
{
//.equals("false)
//TODO: hide it completely or leave it disabled??
}
return
;
}
if
(
event
.
getUnifiedCouponsAdded
()
!=
null
)
{
mUnifiedPressed
=
false
;
if
(
WarplyManagerHelper
.
getMarketCouponsList
()
!=
null
&&
WarplyManagerHelper
.
getMarketCouponsList
().
size
()
>
0
)
{
...
...
@@ -510,6 +523,15 @@ public class LoyaltyWallet extends Activity implements View.OnClickListener, Vie
// ===========================================================
private
void
initViews
()
{
if
(
TextUtils
.
isEmpty
(
WarplyManagerHelper
.
getShowVouchersBanner
()))
{
//TODO: show spinner
}
else
if
(
WarplyManagerHelper
.
getShowVouchersBanner
().
equals
(
"true"
))
{
//TODO: hide spinner and enable button
}
else
{
//.equals("false)
//TODO: hide it completely or leave it disabled??
}
if
(
WarpUtils
.
getUserNonTelco
(
this
))
{
nonTelcoDialog
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/VouchersActivityEventModel.java
0 → 100644
View file @
0a6cda8
/*
* 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 19-Oct-23.
*/
public
class
VouchersActivityEventModel
{
private
boolean
openActivity
;
public
VouchersActivityEventModel
()
{
this
.
openActivity
=
true
;
}
public
boolean
isOpened
()
{
return
openActivity
;
}
public
void
setOpened
(
boolean
openActivity
)
{
this
.
openActivity
=
openActivity
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/VouchersFetchedEventModel.java
0 → 100644
View file @
0a6cda8
/*
* 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 19-Oct-23.
*/
public
class
VouchersFetchedEventModel
{
private
boolean
fetched
;
public
VouchersFetchedEventModel
()
{
this
.
fetched
=
true
;
}
public
boolean
isFetched
()
{
return
fetched
;
}
public
void
setFetched
(
boolean
fetched
)
{
this
.
fetched
=
fetched
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/services/VouchersFetchedService.java
0 → 100644
View file @
0a6cda8
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.CouponsEventModel
;
import
ly.warp.sdk.io.models.VouchersFetchedEventModel
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
/**
* Created by Panagiotis Triantafyllou on 19/Oct/2023.
*/
public
class
VouchersFetchedService
extends
Worker
{
public
VouchersFetchedService
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
VouchersFetchedEventModel
vouchersFetched
=
new
VouchersFetchedEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
vouchersFetched
));
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
0a6cda8
...
...
@@ -88,7 +88,9 @@ import ly.warp.sdk.io.request.WarplyEditConsumerRequest;
import
ly.warp.sdk.io.request.WarplyIntegrationRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.services.EventUnifiedCouponsService
;
import
ly.warp.sdk.services.FCMBaseMessagingService
;
import
ly.warp.sdk.services.VouchersFetchedService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
...
...
@@ -134,6 +136,7 @@ public class WarplyManagerHelper {
public
static
int
mSteps
=
0
;
private
static
ArrayList
<
UnifiedCoupon
>
mMarketCoupons
=
new
ArrayList
<>(),
mMarketCouponsList
=
new
ArrayList
<>();
private
static
String
showVouchersBanner
=
""
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -1406,6 +1409,25 @@ public class WarplyManagerHelper {
return
false
;
}
public
static
void
clearShowVouchersBanner
()
{
showVouchersBanner
=
""
;
}
public
static
void
setShowVouchersBanner
(
boolean
show
)
{
showVouchersBanner
=
String
.
valueOf
(
show
);
}
public
static
String
getShowVouchersBanner
()
{
return
showVouchersBanner
;
}
public
static
void
setVouchersFetched
(
boolean
success
)
{
setShowVouchersBanner
(
success
);
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
VouchersFetchedService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
}
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
0a6cda8
...
...
@@ -16,6 +16,7 @@ import ly.warp.sdk.io.models.LoyaltySDKSessionExpiredEventModel;
import
ly.warp.sdk.io.models.QuestionnaireEventModel
;
import
ly.warp.sdk.io.models.RefreshUnifiedCouponsEventModel
;
import
ly.warp.sdk.io.models.UnifiedCouponsEventModel
;
import
ly.warp.sdk.io.models.VouchersFetchedEventModel
;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel
;
...
...
@@ -41,6 +42,7 @@ public class WarplyEventBusManager {
private
WarplyCCMSEnabledModel
ccmsActivated
;
private
LoyaltyGiftsForYouOfferClickEvent
giftsYou
;
private
QuestionnaireEventModel
questionnaire
;
private
VouchersFetchedEventModel
vouchersFetched
;
private
CouponEventModel
coupon
;
private
ActiveDFYCouponEventModel
activeCoupon
;
private
ContexualEventModel
ccmsAdded
;
...
...
@@ -74,6 +76,10 @@ public class WarplyEventBusManager {
this
.
questionnaire
=
questionnaire
;
}
public
WarplyEventBusManager
(
VouchersFetchedEventModel
vouchersFetched
)
{
this
.
vouchersFetched
=
vouchersFetched
;
}
public
WarplyEventBusManager
(
WarplyWebviewCallbackEventModel
webviewCallback
)
{
this
.
webviewCallback
=
webviewCallback
;
}
...
...
@@ -220,6 +226,10 @@ public class WarplyEventBusManager {
return
questionnaire
;
}
public
VouchersFetchedEventModel
getVouchersFetched
()
{
return
vouchersFetched
;
}
public
CouponEventModel
getCoupon
()
{
return
coupon
;
}
...
...
Please
register
or
login
to post a comment