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-02-28 19:05:23 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
9593c4f7e7eed3582d77ea53f8213e4129b1261a
9593c4f7
1 parent
e28224d8
optimize campaigns, new campaign keys
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
98 additions
and
39 deletions
app/src/main/assets/warply.properties
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/BaseFragmentActivity.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/NewCampaignList.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/ApiService.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
app/src/main/assets/warply.properties
View file @
9593c4f
...
...
@@ -3,15 +3,15 @@
# The app uuid the warply sdk need to connect to the engage server
# dev f83dfde1145e4c2da69793abb2f579af
# prod 0086a2088301440792091b9f814c2267
Uuid
=
0086a2088301440792091b9f814c2267
Uuid
=
f83dfde1145e4c2da69793abb2f579af
# If we need to see logs in Logcat
Debug
=
fals
e
Debug
=
tru
e
# Production or Development environment of the engage server
# Production: https://engage.warp.ly
# Development: https://engage-stage.warp.ly
BaseURL
=
https://engage.warp.ly
BaseURL
=
https://engage
-stage
.warp.ly
# For Verify Ticket request
VerifyURL
=
/partners/cosmote/verify
...
...
@@ -39,7 +39,7 @@ PushIcon=ic_notify
SendPackages
=
false
# The app language
Language
=
e
l
Language
=
e
n
# The merchant id for some requests
MerchantId
=
20113
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
9593c4f
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"
6010490808
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282
.
setGuid
(
"
7000000831
"
),
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons, prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
9593c4f
...
...
@@ -65,6 +65,7 @@ dependencies {
api
'com.github.siyamed:android-shape-imageview:0.9.3'
implementation
'org.greenrobot:eventbus:3.3.1'
api
'org.apmem.tools:layouts:1.10'
api
'com.google.guava:guava:30.1-android'
//------------------------------ Firebase -----------------------------//
api
platform
(
'com.google.firebase:firebase-bom:29.0.3'
)
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/BaseFragmentActivity.java
View file @
9593c4f
...
...
@@ -50,9 +50,8 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
mBottomNavigationView
=
findViewById
(
R
.
id
.
bt_tabs
);
// WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
WarplyManager
.
getUserCouponsWithCouponsets
(
mUserCouponsReceiver
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
().
setLanguage
(
"en"
),
mCampaignsCallback
);
WarplyManager
.
getCampaigns
(
mCampaignsCallback
);
WarplyManager
.
getUnifiedCouponsDeals
(
mUnifiedCallback
);
}
...
...
@@ -123,7 +122,7 @@ public class BaseFragmentActivity extends FragmentActivity implements Navigation
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Campaigns Success
"
,
Toast
.
LENGTH_SHORT
).
show
();
Toast
.
makeText
(
BaseFragmentActivity
.
this
,
"Campaigns Success
"
+
String
.
valueOf
(
result
.
size
())
,
Toast
.
LENGTH_SHORT
).
show
();
}
@Override
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
View file @
9593c4f
...
...
@@ -74,6 +74,8 @@ public class Campaign implements Parcelable, Serializable {
private
static
final
String
CAMPAIGN_TYPE_SETTINGS
=
"campaign_type_settings"
;
private
static
final
String
BANNER_IMAGE
=
"Banner_img"
;
private
static
final
String
BANNER_TITLE
=
"Banner_title"
;
private
static
final
String
CATEGORY_ID
=
"category_id"
;
private
static
final
String
COUPON_AVAILABILITY
=
"coupon_availability"
;
/* Member variables of the Campaign object */
...
...
@@ -103,7 +105,8 @@ public class Campaign implements Parcelable, Serializable {
private
String
campaignTypeSettings
;
private
String
bannerImage
;
private
String
bannerTitle
;
private
UnifiedCampaignModel
unifiedCampaign
;
private
String
categoryId
;
private
Integer
couponAvailability
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -143,7 +146,8 @@ public class Campaign implements Parcelable, Serializable {
this
.
campaignTypeSettings
=
""
;
this
.
bannerImage
=
""
;
this
.
bannerTitle
=
""
;
this
.
unifiedCampaign
=
new
UnifiedCampaignModel
();
this
.
couponAvailability
=
null
;
this
.
categoryId
=
""
;
}
/**
...
...
@@ -204,6 +208,8 @@ public class Campaign implements Parcelable, Serializable {
}
else
{
this
.
actions
=
null
;
}
this
.
categoryId
=
json
.
optString
(
CATEGORY_ID
);
this
.
couponAvailability
=
json
.
optInt
(
COUPON_AVAILABILITY
);
}
public
Campaign
(
Parcel
source
)
{
...
...
@@ -231,6 +237,8 @@ public class Campaign implements Parcelable, Serializable {
this
.
actions
=
source
.
readArrayList
(
CampaignAction
.
class
.
getClassLoader
());
this
.
busId
=
source
.
readString
();
this
.
campaignTypeSettings
=
source
.
readString
();
this
.
categoryId
=
source
.
readString
();
this
.
couponAvailability
=
source
.
readInt
();
}
@Override
...
...
@@ -259,6 +267,8 @@ public class Campaign implements Parcelable, Serializable {
dest
.
writeList
(
this
.
actions
);
dest
.
writeString
(
this
.
busId
);
dest
.
writeString
(
this
.
campaignTypeSettings
);
dest
.
writeInt
(
this
.
couponAvailability
);
dest
.
writeString
(
this
.
categoryId
);
}
/**
...
...
@@ -293,6 +303,8 @@ public class Campaign implements Parcelable, Serializable {
jObj
.
putOpt
(
DISPLAY_TYPE
,
this
.
displayType
);
jObj
.
put
(
BUS_ID
,
this
.
busId
);
jObj
.
put
(
CAMPAIGN_TYPE_SETTINGS
,
this
.
campaignTypeSettings
);
jObj
.
putOpt
(
COUPON_AVAILABILITY
,
this
.
couponAvailability
);
jObj
.
putOpt
(
CATEGORY_ID
,
this
.
categoryId
);
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
{
e
.
printStackTrace
();
...
...
@@ -366,6 +378,23 @@ public class Campaign implements Parcelable, Serializable {
// Getters
// ================================================================================
public
String
getCategoryId
()
{
return
categoryId
;
}
public
void
setCategoryId
(
String
categoryId
)
{
this
.
categoryId
=
categoryId
;
}
public
Integer
getCouponAvailability
()
{
return
couponAvailability
;
}
public
void
setCouponAvailability
(
Integer
couponAvailability
)
{
this
.
couponAvailability
=
couponAvailability
;
}
/**
* @return The loyalty action of the Campaign, used if custom actions are
* implemented
...
...
@@ -630,14 +659,6 @@ public class Campaign implements Parcelable, Serializable {
this
.
bannerTitle
=
bannerTitle
;
}
public
UnifiedCampaignModel
getUnifiedCampaign
()
{
return
unifiedCampaign
;
}
public
void
setUnifiedCampaign
(
UnifiedCampaignModel
unifiedCampaign
)
{
this
.
unifiedCampaign
=
unifiedCampaign
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/NewCampaignList.java
View file @
9593c4f
...
...
@@ -79,6 +79,21 @@ public class NewCampaignList extends ArrayList<NewCampaign> {
}
}
public
NewCampaignList
(
JSONObject
campaignListJSONObject
)
{
campaignListJSONObject
=
campaignListJSONObject
.
optJSONObject
(
JSON_KEY_CONTEXT
);
if
(
campaignListJSONObject
==
null
)
return
;
JSONObject
jsonObject
=
campaignListJSONObject
.
optJSONObject
(
JSON_KEY_MAPP
);
if
(
jsonObject
==
null
)
return
;;
JSONArray
jArray
=
jsonObject
.
optJSONArray
(
JSON_KEY_MAPP_VALUE
);
if
(
jArray
!=
null
)
{
for
(
int
i
=
0
,
lim
=
jArray
.
length
();
i
<
lim
;
++
i
)
{
add
(
new
NewCampaign
(
jArray
.
optJSONObject
(
i
)));
}
}
}
@NonNull
public
String
getRequestSignature
()
{
return
mRequestSignature
;
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/volley/ApiService.java
View file @
9593c4f
...
...
@@ -89,20 +89,31 @@ public interface ApiService {
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
);
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/api/mobile/v2/{appUuid}/context/"
)
Call
<
ResponseBody
>
getCampaigns
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
);
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
sendTelematicsData
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
Call
<
ResponseBody
>
getCampaignsPersonalized
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
cancelUnifiedCoupon
(
@Path
(
"appUuid"
)
String
appUuid
,
Call
<
ResponseBody
>
sendTelematicsData
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
...
...
@@ -114,19 +125,19 @@ public interface ApiService {
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
getTelematicsHistoy
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
Call
<
ResponseBody
>
cancelUnifiedCoupon
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
getT
ripMetrics
(
@Path
(
"appUuid"
)
String
appUuid
,
Call
<
ResponseBody
>
getT
elematicsHistoy
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
...
...
@@ -138,7 +149,7 @@ public interface ApiService {
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
rateTrip
(
@Path
(
"appUuid"
)
String
appUuid
,
Call
<
ResponseBody
>
getTripMetrics
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
...
...
@@ -148,6 +159,18 @@ public interface ApiService {
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
@Headers
(
"Content-Type: application/json"
)
@POST
(
"/oauth/{appUuid}/context"
)
Call
<
ResponseBody
>
rateTrip
(
@Path
(
"appUuid"
)
String
appUuid
,
@Body
RequestBody
request
,
@Header
(
WarpConstants
.
HEADER_DATE
)
String
timeStamp
,
@Header
(
WarpConstants
.
HEADER_LOYALTY_BUNDLE_ID
)
String
bundleId
,
@Header
(
WarpConstants
.
HEADER_UNIQUE_DEVICE_ID
)
String
deviceId
,
@Header
(
WarpConstants
.
HEADER_CHANNEL
)
String
channel
,
@Header
(
WarpConstants
.
HEADER_WEB_ID
)
String
webId
,
@Header
(
WarpConstants
.
HEADER_SIGNATURE
)
String
signature
,
@Header
(
WarpConstants
.
HEADER_AUTHORIZATION
)
String
bearer
);
// ===========================================================
// Getter & Setter
// ===========================================================
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
9593c4f
This diff is collapsed. Click to expand it.
Please
register
or
login
to post a comment