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-06 18:05:09 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
1c9f321a15f6c85548d8c67a6aaf92d22858f3a7
1c9f321a
1 parent
45e4a41f
added eurobank home activity, new colors, new files
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
498 additions
and
58 deletions
app/src/main/AndroidManifest.xml
app/src/main/assets/warply.properties
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/EurobankHomeActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHookDefault.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
warply_android_sdk/src/main/res/drawable-xhdpi/logo.png
warply_android_sdk/src/main/res/drawable/background_gradient.xml
warply_android_sdk/src/main/res/layout/activity_eurobank_home.xml
warply_android_sdk/src/main/res/values/colors.xml
app/src/main/AndroidManifest.xml
View file @
1c9f321
...
...
@@ -12,7 +12,7 @@
<!-- android:xlargeScreens="false" />-->
<application
android:name=
"
warp.ly.android_sdk
.WarplyAndroidSDKApplication"
android:name=
".WarplyAndroidSDKApplication"
android:allowBackup=
"false"
android:exported=
"true"
android:extractNativeLibs=
"true"
...
...
@@ -25,7 +25,7 @@
android:theme=
"@style/AppTheme"
>
<activity
android:name=
"
warp.ly.android_sdk
.activities.SplashActivity"
android:name=
".activities.SplashActivity"
android:exported=
"true"
android:label=
"@string/app_name"
android:screenOrientation=
"portrait"
>
...
...
@@ -41,8 +41,6 @@
android:exported=
"false"
android:label=
"@string/title_activity_main"
android:screenOrientation=
"portrait"
/>
</application>
<!-- For Huawei Push, only if we targetSdkVersion 30, comment if we are in Google build -->
...
...
app/src/main/assets/warply.properties
View file @
1c9f321
# {@link ly.warp.sdk.utils.WarplyProperty}
# The app uuid the warply sdk need to connect to the engage server
Uuid
=
b13ade8ef743468b89a7aaa8efbfc468
# Epistrofi dev app uuid 4e067691826111e2998e8d972467e239
Uuid
=
4e067691826111e2998e8d972467e239
# If we need to see logs in Logcat
Debug
=
false
...
...
@@ -37,7 +38,7 @@ SendPackages=false
#Language=el
# The merchant id for some requests
MerchantId
=
20113
MerchantId
=
59949
# The login type must be one of the below:
# email, msisdn, username
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
1c9f321
...
...
@@ -2,14 +2,21 @@ package warp.ly.android_sdk.activities;
import
android.content.Intent
;
import
android.os.Bundle
;
import
android.widget.Toast
;
import
java.util.ArrayList
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.activities.EurobankHomeActivity
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.callbacks.SimpleCallbackReceiver
;
import
ly.warp.sdk.io.callbacks.WarplyReadyCallback
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.request.WarplyGetCampaignsRequest
;
import
ly.warp.sdk.utils.WarplyInitializer
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
import
warp.ly.android_sdk.R
;
import
static
warp
.
ly
.
android_sdk
.
utils
.
Constants
.
SENDER_ID
;
...
...
@@ -26,19 +33,20 @@ public class SplashActivity extends BaseActivity {
mWarplyInitializer
=
Warply
.
getInitializer
(
this
,
new
WarplyReadyCallback
()
{
@Override
public
void
onWarplyReady
()
{
checkForAppUpdate
();
showToast
(
"Warply initialization success!"
);
WarplyManager
.
getCampaigns
(
new
WarplyGetCampaignsRequest
(),
mCampaignsCallback
);
}
@Override
public
void
onWarplyInitTimeOut
()
{
showToast
(
"Warply initialization timeout!"
);
checkForAppUpdate
();
startNextActivity
();
}
@Override
public
void
onWarplyPermissionsDenied
()
{
showToast
(
"Warply permissions denied!"
);
checkForAppUpdate
();
startNextActivity
();
}
});
}
...
...
@@ -55,20 +63,7 @@ public class SplashActivity extends BaseActivity {
// super.onRequestPermissionsResult(requestCode, permissions, grantResults);
// }
private
void
checkForAppUpdate
()
{
Warply
.
checkForAppUpdate
(
SplashActivity
.
this
,
new
SimpleCallbackReceiver
<
Boolean
>()
{
@Override
public
void
onResult
(
Boolean
updateAccepted
,
int
errorCode
)
{
if
(!
updateAccepted
)
{
startNextActivity
();
}
}
});
}
private
void
startNextActivity
()
{
if
(!
isFinishing
())
{
long
MIN_SPLASH_TIME
=
2000
;
new
Timer
().
schedule
(
new
TimerTask
()
{
...
...
@@ -80,7 +75,7 @@ public class SplashActivity extends BaseActivity {
public
void
run
()
{
if
(!
isFinishing
())
{
startActivity
(
new
Intent
(
SplashActivity
.
this
,
Main
Activity
.
class
));
EurobankHome
Activity
.
class
));
finish
();
}
}
...
...
@@ -89,4 +84,16 @@ public class SplashActivity extends BaseActivity {
},
MIN_SPLASH_TIME
);
}
}
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
mCampaignsCallback
=
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
startNextActivity
();
}
@Override
public
void
onFailure
(
int
errorCode
)
{
Toast
.
makeText
(
SplashActivity
.
this
,
"Campaigns Error"
,
Toast
.
LENGTH_SHORT
).
show
();
}
};
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
1c9f321
...
...
@@ -4,14 +4,16 @@
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
tools:node=
"remove"
/>
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<uses-permission
android:name=
"android.permission.BLUETOOTH"
/>
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
tools:node=
"remove"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<application>
<!-- For Huawei Push -->
...
...
@@ -24,6 +26,11 @@
android:value=
"false"
/>
<activity
android:name=
"ly.warp.sdk.activities.EurobankHomeActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
/>
<activity
android:name=
"ly.warp.sdk.activities.WarpViewActivity"
android:exported=
"false"
android:screenOrientation=
"portrait"
/>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/EurobankHomeActivity.java
0 → 100644
View file @
1c9f321
package
ly
.
warp
.
sdk
.
activities
;
import
android.os.Bundle
;
import
ly.warp.sdk.R
;
public
class
EurobankHomeActivity
extends
WarpBaseActivity
{
// ===========================================================
// Constants
// ===========================================================
// ===========================================================
// Fields
// ===========================================================
// ===========================================================
// Methods for/from SuperClass/Interfaces
// ===========================================================
@Override
public
void
onCreate
(
Bundle
savedInstanceState
)
{
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_eurobank_home
);
initViews
();
}
@Override
protected
void
onResume
()
{
super
.
onResume
();
}
private
void
initViews
()
{
}
// ===========================================================
// Methods
// ===========================================================
// ===========================================================
// Inner and Anonymous Classes
// ===========================================================
}
warply_android_sdk/src/main/java/ly/warp/sdk/io/callbacks/NewCampaignsHookDefault.java
0 → 100644
View file @
1c9f321
/*
* 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
.
callbacks
;
import
android.text.TextUtils
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.NewCampaign
;
import
ly.warp.sdk.io.models.NewCampaignList
;
import
ly.warp.sdk.utils.WarpJSONParser
;
/**
* Created by Panagiotis Triantafyllou on 12-May-22.
*/
public
class
NewCampaignsHookDefault
implements
CallbackReceiver
<
JSONObject
>
{
private
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
mListener
;
private
final
String
mRequestSignature
;
public
NewCampaignsHookDefault
(
CallbackReceiver
<
ArrayList
<
Campaign
>>
listener
,
String
requestSignature
)
{
this
.
mListener
=
listener
;
this
.
mRequestSignature
=
requestSignature
;
}
@Override
public
void
onSuccess
(
JSONObject
result
)
{
if
(
mListener
!=
null
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
NewCampaignList
cmpList
=
new
NewCampaignList
(
result
,
mRequestSignature
);
ArrayList
<
Campaign
>
tempCampaigns
=
new
ArrayList
<>();
for
(
NewCampaign
newCamp
:
cmpList
)
{
Campaign
camp
=
new
Campaign
();
camp
.
setIndexUrl
(
newCamp
.
getIndexUrl
());
camp
.
setLogoUrl
(
newCamp
.
getLogoUrl
());
camp
.
setMessage
(
newCamp
.
getMessage
());
camp
.
setOfferCategory
(
newCamp
.
getCommunicationCategory
());
camp
.
setSessionUUID
(
newCamp
.
getCommunicationUUID
());
camp
.
setTitle
(
newCamp
.
getTitle
());
camp
.
setSubtitle
(
newCamp
.
getSubtitle
());
camp
.
setSorting
(
newCamp
.
getSorting
());
camp
.
setNew
(
newCamp
.
getIsNew
());
camp
.
setType
(
newCamp
.
getCampaignType
());
try
{
camp
.
setExtraFields
(
newCamp
.
getExtraFields
().
toString
());
if
(!
TextUtils
.
isEmpty
(
newCamp
.
getExtraFields
().
toString
()))
{
JSONObject
extraFieldsResp
=
WarpJSONParser
.
getJSONFromString
(
newCamp
.
getExtraFields
().
toString
());
if
(
extraFieldsResp
!=
null
)
{
if
(
extraFieldsResp
.
has
(
"Banner_title"
))
{
camp
.
setBannerTitle
(
extraFieldsResp
.
optString
(
"Banner_title"
,
""
));
}
if
(
extraFieldsResp
.
has
(
"Banner_img"
))
{
camp
.
setBannerImage
(
extraFieldsResp
.
optString
(
"Banner_img"
,
""
));
}
}
}
else
{
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
}
}
catch
(
NullPointerException
e
)
{
camp
.
setExtraFields
(
""
);
camp
.
setBannerImage
(
""
);
camp
.
setBannerTitle
(
""
);
e
.
printStackTrace
();
}
try
{
camp
.
setCampaignTypeSettings
(
newCamp
.
getSettings
().
toString
());
}
catch
(
NullPointerException
e
)
{
camp
.
setCampaignTypeSettings
(
""
);
e
.
printStackTrace
();
}
tempCampaigns
.
add
(
camp
);
}
mListener
.
onSuccess
(
tempCampaigns
);
}
else
mListener
.
onFailure
(
status
);
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
if
(
mListener
!=
null
)
mListener
.
onFailure
(
errorCode
);
}
}
\ No newline at end of file
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/Campaign.java
View file @
1c9f321
...
...
@@ -22,11 +22,11 @@
* 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
;
import
android.os.Parcel
;
import
android.os.Parcelable
;
import
android.text.TextUtils
;
import
org.json.JSONArray
;
import
org.json.JSONException
;
...
...
@@ -36,16 +36,15 @@ import java.io.Serializable;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
public
class
Campaign
implements
Parcelable
,
Serializable
{
private
static
final
long
serialVersionUID
=
-
4754964462459705285L
;
/* Constants used to export the campaign in JSON formal and vice versa */
private
static
final
String
INDEX_URL
=
"index_url"
;
private
static
final
String
LOGO_URL
=
"logo_url"
;
private
static
final
String
ACTION
=
"action"
;
private
static
final
String
DELIVERED
=
"delivered"
;
...
...
@@ -67,30 +66,37 @@ public class Campaign implements Parcelable, Serializable {
private
static
final
String
DELIVERY_METHOD
=
"delivery_method"
;
private
static
final
String
DISPLAY_TYPE
=
"display_type"
;
private
static
final
String
ACTIONS
=
"actions"
;
private
static
final
String
BUS_ID
=
"busId"
;
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"
;
/* Member variables of the Campaign object */
private
final
int
action
;
private
final
double
delivered
;
private
int
action
;
private
double
delivered
;
private
double
expires
;
private
final
String
message
;
private
String
message
;
private
String
offerCategory
;
private
final
String
offerMessage
;
private
final
String
sessionUUID
;
private
final
double
starts
;
private
final
String
subtitle
;
private
final
String
title
;
private
final
int
sorting
;
private
final
int
opened
;
private
final
boolean
isNew
;
private
final
String
logoUrl
;
private
final
String
extraFields
;
private
final
String
type
;
private
final
boolean
expired
;
private
String
offerMessage
;
private
String
sessionUUID
;
private
double
starts
;
private
String
subtitle
;
private
String
title
;
private
int
sorting
;
private
int
opened
;
private
boolean
isNew
;
private
String
logoUrl
;
private
String
extraFields
;
private
String
type
;
private
boolean
expired
;
private
boolean
show
;
private
String
deliveryMethod
;
private
String
displayType
;
private
String
indexUrl
;
private
String
busId
;
private
ArrayList
<
CampaignAction
>
actions
=
new
ArrayList
<>();
private
String
campaignTypeSettings
;
private
String
bannerImage
;
private
String
bannerTitle
;
/**
* Basic constructor used to create an object from a String, representing a
...
...
@@ -103,12 +109,42 @@ public class Campaign implements Parcelable, Serializable {
this
(
new
JSONObject
(
json
));
}
public
Campaign
()
{
this
.
action
=
0
;
this
.
delivered
=
0.0d
;
this
.
expires
=
0.0d
;
this
.
message
=
""
;
this
.
offerCategory
=
""
;
this
.
offerMessage
=
""
;
this
.
sessionUUID
=
""
;
this
.
starts
=
0.0d
;
this
.
subtitle
=
""
;
this
.
title
=
""
;
this
.
sorting
=
0
;
this
.
opened
=
0
;
this
.
isNew
=
true
;
this
.
logoUrl
=
""
;
this
.
extraFields
=
""
;
this
.
type
=
""
;
this
.
expired
=
false
;
this
.
show
=
true
;
this
.
deliveryMethod
=
""
;
this
.
displayType
=
""
;
this
.
indexUrl
=
""
;
this
.
busId
=
""
;
this
.
actions
=
new
ArrayList
<>();
this
.
campaignTypeSettings
=
""
;
this
.
bannerImage
=
""
;
this
.
bannerTitle
=
""
;
}
/**
* Constructor used to create an Object from a given JSON Object
*
* @param json JSON Object used to create the Campaign
*/
public
Campaign
(
JSONObject
json
)
{
this
.
indexUrl
=
json
.
optString
(
INDEX_URL
);
this
.
logoUrl
=
json
.
optString
(
LOGO_URL
);
this
.
delivered
=
json
.
optDouble
(
DELIVERED
);
this
.
sessionUUID
=
json
.
optString
(
SESSION_UUID
);
...
...
@@ -118,24 +154,37 @@ public class Campaign implements Parcelable, Serializable {
this
.
opened
=
json
.
optInt
(
OPENED
);
this
.
expires
=
json
.
optDouble
(
EXPIRES
);
this
.
offerCategory
=
json
.
optString
(
OFFER_CATEGORY
);
if
(
belongsInCategory
(
WarpConstants
.
MICROAPP_CAMPAIGNS_STANDARD_OFFER_NO_DATE
))
{
this
.
expires
=
0
;
this
.
offerCategory
=
WarpConstants
.
MICROAPP_CAMPAIGNS_STANDARD_OFFER
;
}
this
.
title
=
json
.
optString
(
TITLE
);
this
.
action
=
json
.
optInt
(
ACTION
);
this
.
offerMessage
=
json
.
optString
(
OFFER_MESSAGE
);
this
.
isNew
=
json
.
optBoolean
(
IS_NEW
);
this
.
sorting
=
json
.
optInt
(
SORTING
);
this
.
extraFields
=
json
.
optString
(
EXTRA_FIELDS
);
if
(!
TextUtils
.
isEmpty
(
this
.
extraFields
))
{
JSONObject
extraFieldsResp
=
WarpJSONParser
.
getJSONFromString
(
this
.
extraFields
);
if
(
extraFieldsResp
!=
null
)
{
if
(
extraFieldsResp
.
has
(
"Banner_title"
))
{
this
.
bannerTitle
=
extraFieldsResp
.
optString
(
BANNER_TITLE
,
""
);
}
if
(
extraFieldsResp
.
has
(
"Banner_img"
))
{
this
.
bannerImage
=
extraFieldsResp
.
optString
(
BANNER_IMAGE
,
""
);
}
}
}
else
{
this
.
bannerImage
=
""
;
this
.
bannerTitle
=
""
;
}
this
.
type
=
json
.
optString
(
TYPE
);
this
.
expired
=
json
.
optBoolean
(
EXPIRED
);
this
.
show
=
json
.
optBoolean
(
SHOW
);
this
.
deliveryMethod
=
json
.
optString
(
DELIVERY_METHOD
);
this
.
displayType
=
json
.
optString
(
DISPLAY_TYPE
);
this
.
busId
=
json
.
optString
(
BUS_ID
);
this
.
campaignTypeSettings
=
json
.
optString
(
CAMPAIGN_TYPE_SETTINGS
);
JSONArray
actions
=
json
.
optJSONArray
(
ACTIONS
);
if
(
actions
!=
null
)
{
for
(
int
i
=
0
;
i
<
actions
.
length
();
i
++)
{
...
...
@@ -147,7 +196,7 @@ public class Campaign implements Parcelable, Serializable {
}
public
Campaign
(
Parcel
source
)
{
this
.
indexUrl
=
source
.
readString
();
this
.
action
=
source
.
readInt
();
this
.
delivered
=
source
.
readDouble
();
this
.
expires
=
source
.
readDouble
();
...
...
@@ -169,11 +218,13 @@ public class Campaign implements Parcelable, Serializable {
this
.
deliveryMethod
=
source
.
readString
();
this
.
displayType
=
source
.
readString
();
this
.
actions
=
source
.
readArrayList
(
CampaignAction
.
class
.
getClassLoader
());
this
.
busId
=
source
.
readString
();
this
.
campaignTypeSettings
=
source
.
readString
();
}
@Override
public
void
writeToParcel
(
Parcel
dest
,
int
flags
)
{
dest
.
writeString
(
this
.
indexUrl
);
dest
.
writeInt
(
this
.
action
);
dest
.
writeDouble
(
this
.
delivered
);
dest
.
writeDouble
(
this
.
expires
);
...
...
@@ -188,13 +239,15 @@ public class Campaign implements Parcelable, Serializable {
dest
.
writeInt
(
this
.
opened
);
dest
.
writeInt
(
this
.
isNew
?
1
:
0
);
dest
.
writeString
(
this
.
logoUrl
);
dest
.
writeString
(
extraFields
);
dest
.
writeString
(
type
);
dest
.
writeString
(
this
.
extraFields
);
dest
.
writeString
(
t
his
.
t
ype
);
dest
.
writeInt
(
this
.
expired
?
1
:
0
);
dest
.
writeInt
(
this
.
show
?
1
:
0
);
dest
.
writeString
(
deliveryMethod
);
dest
.
writeString
(
displayType
);
dest
.
writeList
(
actions
);
dest
.
writeString
(
this
.
deliveryMethod
);
dest
.
writeString
(
this
.
displayType
);
dest
.
writeList
(
this
.
actions
);
dest
.
writeString
(
this
.
busId
);
dest
.
writeString
(
this
.
campaignTypeSettings
);
}
/**
...
...
@@ -205,6 +258,7 @@ public class Campaign implements Parcelable, Serializable {
public
JSONObject
toJSONObject
()
{
JSONObject
jObj
=
new
JSONObject
();
try
{
jObj
.
putOpt
(
INDEX_URL
,
this
.
indexUrl
);
jObj
.
putOpt
(
LOGO_URL
,
this
.
logoUrl
);
jObj
.
putOpt
(
ACTION
,
this
.
action
);
jObj
.
putOpt
(
DELIVERED
,
this
.
delivered
);
...
...
@@ -226,6 +280,8 @@ public class Campaign implements Parcelable, Serializable {
jObj
.
putOpt
(
SHOW
,
this
.
show
);
jObj
.
putOpt
(
DELIVERY_METHOD
,
this
.
deliveryMethod
);
jObj
.
putOpt
(
DISPLAY_TYPE
,
this
.
displayType
);
jObj
.
put
(
BUS_ID
,
this
.
busId
);
jObj
.
put
(
CAMPAIGN_TYPE_SETTINGS
,
this
.
campaignTypeSettings
);
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
{
e
.
printStackTrace
();
...
...
@@ -294,7 +350,6 @@ public class Campaign implements Parcelable, Serializable {
}
return
humanReadableString
;
}
// ================================================================================
// Getters
// ================================================================================
...
...
@@ -411,6 +466,10 @@ public class Campaign implements Parcelable, Serializable {
return
logoUrl
;
}
public
String
getIndexUrl
()
{
return
indexUrl
;
}
public
String
getExtraFields
()
{
return
extraFields
;
}
...
...
@@ -439,6 +498,126 @@ public class Campaign implements Parcelable, Serializable {
return
actions
;
}
public
String
getBusId
()
{
return
busId
;
}
public
void
setBusId
(
String
busId
)
{
this
.
busId
=
busId
;
}
public
void
setNew
(
boolean
aNew
)
{
isNew
=
aNew
;
}
public
String
getCampaignTypeSettings
()
{
return
campaignTypeSettings
;
}
public
void
setExpires
(
double
expires
)
{
this
.
expires
=
expires
;
}
public
void
setOfferCategory
(
String
offerCategory
)
{
this
.
offerCategory
=
offerCategory
;
}
public
void
setShow
(
boolean
show
)
{
this
.
show
=
show
;
}
public
void
setDeliveryMethod
(
String
deliveryMethod
)
{
this
.
deliveryMethod
=
deliveryMethod
;
}
public
void
setDisplayType
(
String
displayType
)
{
this
.
displayType
=
displayType
;
}
public
void
setIndexUrl
(
String
indexUrl
)
{
this
.
indexUrl
=
indexUrl
;
}
public
void
setActions
(
ArrayList
<
CampaignAction
>
actions
)
{
this
.
actions
=
actions
;
}
public
void
setAction
(
int
action
)
{
this
.
action
=
action
;
}
public
void
setDelivered
(
double
delivered
)
{
this
.
delivered
=
delivered
;
}
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
void
setOfferMessage
(
String
offerMessage
)
{
this
.
offerMessage
=
offerMessage
;
}
public
void
setSessionUUID
(
String
sessionUUID
)
{
this
.
sessionUUID
=
sessionUUID
;
}
public
void
setStarts
(
double
starts
)
{
this
.
starts
=
starts
;
}
public
void
setSubtitle
(
String
subtitle
)
{
this
.
subtitle
=
subtitle
;
}
public
void
setTitle
(
String
title
)
{
this
.
title
=
title
;
}
public
void
setSorting
(
int
sorting
)
{
this
.
sorting
=
sorting
;
}
public
void
setOpened
(
int
opened
)
{
this
.
opened
=
opened
;
}
public
void
setLogoUrl
(
String
logoUrl
)
{
this
.
logoUrl
=
logoUrl
;
}
public
void
setExtraFields
(
String
extraFields
)
{
this
.
extraFields
=
extraFields
;
}
public
void
setType
(
String
type
)
{
this
.
type
=
type
;
}
public
void
setExpired
(
boolean
expired
)
{
this
.
expired
=
expired
;
}
public
void
setCampaignTypeSettings
(
String
campaignTypeSettings
)
{
this
.
campaignTypeSettings
=
campaignTypeSettings
;
}
public
String
getBannerImage
()
{
return
this
.
bannerImage
;
}
public
String
getBannerTitle
()
{
return
this
.
bannerTitle
;
}
public
void
setBannerImage
(
String
bannerImage
)
{
this
.
bannerImage
=
bannerImage
;
}
public
void
setBannerTitle
(
String
bannerTitle
)
{
this
.
bannerTitle
=
bannerTitle
;
}
@Override
public
int
describeContents
()
{
return
0
;
...
...
@@ -453,4 +632,4 @@ public class Campaign implements Parcelable, Serializable {
return
new
Campaign
[
size
];
}
};
}
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
0 → 100644
View file @
1c9f321
/*
* Copyright 2010-2022 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
.
utils
;
import
java.util.ArrayList
;
import
ly.warp.sdk.io.models.Campaign
;
public
class
WarplyManagerHelper
{
private
static
ArrayList
<
Campaign
>
mCampaignList
=
new
ArrayList
<
Campaign
>();
public
static
ArrayList
<
Campaign
>
getCampaignList
()
{
return
mCampaignList
;
}
public
static
void
setCampaignList
(
ArrayList
<
Campaign
>
campaignList
)
{
mCampaignList
.
clear
();
mCampaignList
=
campaignList
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
1c9f321
...
...
@@ -28,6 +28,8 @@ package ly.warp.sdk.utils.managers;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.util.ArrayList
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.AddressHook
;
...
...
@@ -40,12 +42,14 @@ import ly.warp.sdk.io.callbacks.CouponsetsHook;
import
ly.warp.sdk.io.callbacks.MerchantCategoriesHook
;
import
ly.warp.sdk.io.callbacks.MerchantsHook
;
import
ly.warp.sdk.io.callbacks.NewCampaignsHook
;
import
ly.warp.sdk.io.callbacks.NewCampaignsHookDefault
;
import
ly.warp.sdk.io.callbacks.PointsHook
;
import
ly.warp.sdk.io.callbacks.ProductsHook
;
import
ly.warp.sdk.io.callbacks.TagsCategoriesHook
;
import
ly.warp.sdk.io.callbacks.TagsHook
;
import
ly.warp.sdk.io.callbacks.TransactionsHook
;
import
ly.warp.sdk.io.models.AddressList
;
import
ly.warp.sdk.io.models.Campaign
;
import
ly.warp.sdk.io.models.Card
;
import
ly.warp.sdk.io.models.CardList
;
import
ly.warp.sdk.io.models.Consumer
;
...
...
@@ -97,6 +101,7 @@ import ly.warp.sdk.io.request.WarplyValidateCouponRequest;
import
ly.warp.sdk.io.request.WarplyVerifyOTPRequest
;
import
ly.warp.sdk.io.request.WarplyVerifyTicketRequest
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
...
...
@@ -1272,6 +1277,25 @@ public class WarplyManager {
});
}
public
static
void
getCampaigns
(
WarplyGetCampaignsRequest
request
,
final
CallbackReceiver
<
ArrayList
<
Campaign
>>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Get Campaigns Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Get Campaigns Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
WarpConstants
.
MICROAPP_NEW_CAMPAIGNS
,
false
,
"campaigns"
,
request
.
toJson
(),
new
NewCampaignsHookDefault
(
new
CallbackReceiver
<
ArrayList
<
Campaign
>>()
{
@Override
public
void
onSuccess
(
ArrayList
<
Campaign
>
result
)
{
WarplyManagerHelper
.
setCampaignList
(
result
);
receiver
.
onSuccess
(
result
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
},
request
.
getSignature
()));
}
public
static
void
getCampaigns
(
WarplyGetCampaignsRequest
request
,
boolean
auth
,
final
CallbackReceiver
<
NewCampaignList
>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Get Campaigns Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Get Campaigns Request is active"
);
...
...
warply_android_sdk/src/main/res/drawable-xhdpi/logo.png
0 → 100644
View file @
1c9f321
19.4 KB
warply_android_sdk/src/main/res/drawable/background_gradient.xml
0 → 100644
View file @
1c9f321
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<gradient
android:angle=
"0"
android:endColor=
"@color/blue"
android:startColor=
"@color/blue_dark"
android:type=
"linear"
/>
</shape>
\ No newline at end of file
warply_android_sdk/src/main/res/layout/activity_eurobank_home.xml
0 → 100644
View file @
1c9f321
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"@color/grey"
>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"120dp"
android:background=
"@drawable/background_gradient"
android:scaleType=
"centerCrop"
>
<ImageView
android:layout_width=
"180dp"
android:layout_height=
"60dp"
android:src=
"@drawable/logo"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
warply_android_sdk/src/main/res/values/colors.xml
View file @
1c9f321
...
...
@@ -3,4 +3,7 @@
<color
name=
"colorPrimary"
>
#0a1a50
</color>
<color
name=
"colorAccent"
>
#044C86
</color>
<color
name=
"colorPrimaryDark"
>
#0a1a50
</color>
<color
name=
"grey"
>
#E7EAEB
</color>
<color
name=
"blue_dark"
>
#081748
</color>
<color
name=
"blue"
>
#204EAC
</color>
</resources>
\ No newline at end of file
...
...
Please
register
or
login
to post a comment