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-21 14:25:36 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2adacdd61d66b72ee204749ba8254c040c4607b6
2adacdd6
1 parent
86bf1b07
minor fixes
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
139 additions
and
12 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/LoyaltyEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/request/WarplyRedeemCouponRequest.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignService.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
warply_android_sdk/build.gradle
View file @
2adacdd
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta3
8
'
PUBLISH_VERSION
=
'4.5.4-cosbeta3
9
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
2adacdd
...
...
@@ -147,6 +147,11 @@
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.EventCampaignService"
android:exported=
"false"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/>
<service
android:name=
"ly.warp.sdk.services.WarplyBeaconsRangingService"
android:exported=
"false"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/CouponsetInfoActivity.java
View file @
2adacdd
...
...
@@ -11,6 +11,8 @@ import android.widget.ProgressBar;
import
android.widget.TextView
;
import
androidx.appcompat.app.AlertDialog
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
com.bumptech.glide.Glide
;
import
com.bumptech.glide.load.engine.DiskCacheStrategy
;
...
...
@@ -18,12 +20,18 @@ import com.bumptech.glide.load.engine.DiskCacheStrategy;
import
org.json.JSONObject
;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
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.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.Couponset
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.io.request.WarplyRedeemCouponRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -45,6 +53,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
private
Coupon
mCoupon
;
private
boolean
mIsTermsPressed
=
false
;
private
AlertDialog
mAlertDialogCouponset
;
private
Campaign
mLoyalty
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -56,6 +65,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
setContentView
(
R
.
layout
.
activity_couponset_info
);
mCouponset
=
(
Couponset
)
getIntent
().
getSerializableExtra
(
"couponset"
);
mLoyalty
=
(
Campaign
)
getIntent
().
getSerializableExtra
(
"loyalty"
);
mIvBack
=
findViewById
(
R
.
id
.
iv_couponset_info_back
);
mTvTerms
=
findViewById
(
R
.
id
.
tv_terms
);
...
...
@@ -84,7 +94,9 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
}
if
(
view
.
getId
()
==
R
.
id
.
ll_get_gift
)
{
mPbLoading
.
setVisibility
(
View
.
VISIBLE
);
WarplyManager
.
redeemCoupon
(
new
WarplyRedeemCouponRequest
().
setCouponsetUuid
(
mCouponset
.
getUuid
()),
mRedeemCouponCallback
);
WarplyManager
.
redeemCoupon
(
new
WarplyRedeemCouponRequest
()
.
setCouponsetUuid
(
mCouponset
.
getUuid
())
.
setCommunicationUuid
(
mLoyalty
.
getSessionUUID
()),
mRedeemCouponCallback
);
return
;
}
if
(
view
.
getId
()
==
R
.
id
.
ll_terms_inner
)
{
...
...
@@ -143,6 +155,7 @@ public class CouponsetInfoActivity extends Activity implements View.OnClickListe
new
Thread
(()
->
{
if
(!
Thread
.
currentThread
().
isInterrupted
())
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
mCampaignsCallback
);
}
}).
start
();
showDialog
(
true
,
1
);
...
...
@@ -206,8 +219,22 @@ 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();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Thread
.
currentThread
().
interrupt
();
}
};
private
CallbackReceiver
<
CampaignList
>
mCampaignsCallback
=
new
CallbackReceiver
<
CampaignList
>()
{
@Override
public
void
onSuccess
(
CampaignList
result
)
{
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventCampaignService
.
class
).
build
();
WorkManager
.
getInstance
(
CouponsetInfoActivity
.
this
).
enqueue
(
mywork
);
// Thread.currentThread().interrupt();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/GiftsForYouActivity.java
View file @
2adacdd
...
...
@@ -127,7 +127,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
@Subscribe
()
public
void
onMessageEvent
(
WarplyEventBusManager
event
)
{
if
(
event
.
getCcmsAdded
()
!=
null
)
{
if
(
event
.
getCcmsAdded
()
!=
null
||
event
.
getCampaignsAdded
()
!=
null
)
{
filterItems
();
if
(
WarplyManagerHelper
.
getSeasonalList
()
!=
null
&&
WarplyManagerHelper
.
getSeasonalList
().
size
()
>
0
)
{
...
...
@@ -161,6 +161,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivity
(
intent
);
break
;
}
...
...
@@ -254,6 +255,7 @@ public class GiftsForYouActivity extends Activity implements View.OnClickListene
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
GiftsForYouActivity
.
this
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
dataItem
.
getCampaign
());
startActivity
(
intent
);
break
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/LoyaltyEventModel.java
0 → 100644
View file @
2adacdd
/*
* 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 21-July-22.
*/
public
class
LoyaltyEventModel
{
private
boolean
success
;
public
LoyaltyEventModel
()
{
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/io/request/WarplyRedeemCouponRequest.java
View file @
2adacdd
...
...
@@ -25,6 +25,7 @@ public class WarplyRedeemCouponRequest {
private
final
String
KEY_ACTION
=
"action"
;
private
final
String
KEY_ACTION_VALUE
=
"retrieve_coupon"
;
private
final
String
KEY_COUPONSET
=
"coupon_set"
;
private
final
String
KEY_COMMUNICATION_UUID
=
"communication_uuid"
;
// ===========================================================
// Fields
...
...
@@ -33,6 +34,7 @@ public class WarplyRedeemCouponRequest {
private
HashMap
<
String
,
String
>
mFilters
;
private
long
mCacheUpdateInterval
=
0
;
private
String
mCouponsetUuid
=
""
;
private
String
mCommunicationUuid
=
""
;
// ===========================================================
// Constructor
...
...
@@ -83,6 +85,11 @@ public class WarplyRedeemCouponRequest {
return
this
;
}
public
WarplyRedeemCouponRequest
setCommunicationUuid
(
String
uuid
)
{
mCommunicationUuid
=
uuid
;
return
this
;
}
/**
* Call this to get how often the cached data will be updated.
*
...
...
@@ -145,6 +152,7 @@ public class WarplyRedeemCouponRequest {
try
{
bodyJsonObject
.
putOpt
(
KEY_ACTION
,
KEY_ACTION_VALUE
);
bodyJsonObject
.
putOpt
(
KEY_COUPONSET
,
mCouponsetUuid
);
bodyJsonObject
.
putOpt
(
KEY_COMMUNICATION_UUID
,
mCommunicationUuid
);
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
e
.
printStackTrace
();
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/EventCampaignService.java
0 → 100644
View file @
2adacdd
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.LoyaltyEventModel
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
/**
* Created by Panagiotis Triantafyllou on 21/Ιουλ/2022.
*/
public
class
EventCampaignService
extends
Worker
{
public
EventCampaignService
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
LoyaltyEventModel
campaignsAdded
=
new
LoyaltyEventModel
();
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
campaignsAdded
));
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
2adacdd
...
...
@@ -34,7 +34,6 @@ import androidx.appcompat.app.AlertDialog;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
org.greenrobot.eventbus.EventBus
;
import
org.json.JSONObject
;
import
java.io.Serializable
;
...
...
@@ -44,8 +43,6 @@ import java.util.HashMap;
import
ly.warp.sdk.R
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.CouponsetInfoActivity
;
import
ly.warp.sdk.activities.GiftsForYouActivity
;
import
ly.warp.sdk.activities.MoreForYouActivity
;
import
ly.warp.sdk.activities.TelcoActivity
;
import
ly.warp.sdk.activities.WarpViewActivity
;
import
ly.warp.sdk.db.WarplyDBHelper
;
...
...
@@ -54,7 +51,6 @@ import ly.warp.sdk.io.models.ActiveDFYCouponModel;
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.ContexualEventModel
;
import
ly.warp.sdk.io.models.Coupon
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.Couponset
;
...
...
@@ -67,7 +63,6 @@ import ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest;
import
ly.warp.sdk.io.request.CosmoteSharingRequest
;
import
ly.warp.sdk.io.request.WarplyIntegrationRequest
;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
/**
...
...
@@ -502,6 +497,7 @@ public class WarplyManagerHelper {
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
context
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
item
);
context
.
startActivity
(
intent
);
break
;
}
...
...
@@ -557,8 +553,8 @@ public class WarplyManagerHelper {
* Open Questionnaire
*/
public
static
String
openQuestionnaire
()
{
if
(
mCampaignList
!=
null
&&
mCampaignList
.
size
()
>
0
)
{
for
(
Campaign
camp
:
mCampaignList
)
{
if
(
mCampaignList
All
!=
null
&&
mCampaignListAll
.
size
()
>
0
)
{
for
(
Campaign
camp
:
mCampaignList
All
)
{
if
(
camp
.
getOfferCategory
().
equals
(
"questionnaire"
))
{
return
constructCampaignUrl
(
camp
);
}
...
...
@@ -572,8 +568,8 @@ public class WarplyManagerHelper {
* Open Pacing
*/
public
static
String
openPacing
()
{
if
(
mCampaignList
!=
null
&&
mCampaignList
.
size
()
>
0
)
{
for
(
Campaign
camp
:
mCampaignList
)
{
if
(
mCampaignList
All
!=
null
&&
mCampaignListAll
.
size
()
>
0
)
{
for
(
Campaign
camp
:
mCampaignList
All
)
{
if
(
camp
.
getOfferCategory
().
equals
(
"pacing"
))
{
String
pacingUrl
=
constructCampaignUrl
(
camp
);
WarpUtils
.
log
(
"PACING_LOG: "
+
pacingUrl
);
...
...
@@ -598,6 +594,7 @@ public class WarplyManagerHelper {
if
(
cpns
.
getUuid
().
equals
(
cpnUuid
))
{
Intent
intent
=
new
Intent
(
context
,
CouponsetInfoActivity
.
class
);
intent
.
putExtra
(
"couponset"
,
(
Serializable
)
cpns
);
intent
.
putExtra
(
"loyalty"
,
(
Serializable
)
item
);
context
.
startActivity
(
intent
);
break
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
2adacdd
...
...
@@ -6,6 +6,7 @@ import ly.warp.sdk.io.models.ActiveDFYCouponEventModel;
import
ly.warp.sdk.io.models.ContexualEventModel
;
import
ly.warp.sdk.io.models.CouponEventModel
;
import
ly.warp.sdk.io.models.LoyaltyContextualOfferModel
;
import
ly.warp.sdk.io.models.LoyaltyEventModel
;
import
ly.warp.sdk.io.models.LoyaltyGiftsForYouOfferClickEvent
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.QuestionnaireEventModel
;
...
...
@@ -33,6 +34,7 @@ public class WarplyEventBusManager {
private
CouponEventModel
coupon
;
private
ActiveDFYCouponEventModel
activeCoupon
;
private
ContexualEventModel
ccmsAdded
;
private
LoyaltyEventModel
campaignsAdded
;
public
WarplyEventBusManager
()
{
...
...
@@ -50,6 +52,10 @@ public class WarplyEventBusManager {
this
.
ccmsAdded
=
ccmsAdded
;
}
public
WarplyEventBusManager
(
LoyaltyEventModel
campaignsAdded
)
{
this
.
campaignsAdded
=
campaignsAdded
;
}
public
WarplyEventBusManager
(
CouponEventModel
coupon
)
{
this
.
coupon
=
coupon
;
}
...
...
@@ -167,4 +173,8 @@ public class WarplyEventBusManager {
public
ContexualEventModel
getCcmsAdded
()
{
return
ccmsAdded
;
}
public
LoyaltyEventModel
getCampaignsAdded
()
{
return
campaignsAdded
;
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
2adacdd
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment