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
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
286 additions
and
25 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
This diff is collapsed. Click to expand it.
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