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-09-08 18:44:13 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
85b2b4f79aa8ab63faf688dec951e5520393a34c
85b2b4f7
1 parent
8b713b90
fixes
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
12 deletions
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/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.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/java/ly/warp/sdk/views/WarpView.java
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
85b2b4f
...
...
@@ -36,7 +36,7 @@ public class SplashActivity extends BaseActivity {
public
void
onWarplyReady
()
{
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
WarplyManager
.
getCosmoteUser
(
new
WarplyCosmoteUserRequest
()
.
setGuid
(
"70000010
25
"
),
//6012049321, 6012049322, 6012049323
.
setGuid
(
"70000010
18
"
),
//6012049321, 6012049322, 6012049323
mLoginReceiver
);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/build.gradle
View file @
85b2b4f
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4-cosbeta5
8
'
PUBLISH_VERSION
=
'4.5.4-cosbeta5
9i
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
85b2b4f
...
...
@@ -53,17 +53,23 @@ import org.greenrobot.eventbus.Subscribe;
import
org.json.JSONObject
;
import
java.security.SecureRandom
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
import
java.util.Locale
;
import
java.util.concurrent.ThreadLocalRandom
;
import
java.util.concurrent.TimeUnit
;
import
ly.warp.sdk.Warply
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.request.PacingCalculateRequest
;
import
ly.warp.sdk.io.request.WarplyUserCouponsRequest
;
import
ly.warp.sdk.services.EventQuestionnaireService
;
import
ly.warp.sdk.services.PushEventsClickedWorkerService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.WarplyPreferences
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
...
...
@@ -120,6 +126,7 @@ public class WarpViewActivity extends WarpBaseActivity {
super
.
onDestroy
();
if
(
metersHandler
!=
null
)
metersHandler
.
removeCallbacksAndMessages
(
null
);
sendSteps
();
WarpUtils
.
setWebviewParams
(
this
,
new
JSONObject
());
}
...
...
@@ -144,9 +151,9 @@ public class WarpViewActivity extends WarpBaseActivity {
setResult
(
RESULT_OK
,
new
Intent
());
finish
();
}
if
(
event
.
getCoupon
()
!=
null
)
{
WarplyManager
.
getUserCouponsWithCouponsets
(
new
WarplyUserCouponsRequest
(),
mUserCouponsReceiver
);
}
//
if (event.getCoupon() != null) {
//
WarplyManager.getUserCouponsWithCouponsets(new WarplyUserCouponsRequest(), mUserCouponsReceiver);
//
}
// if (event.getPacingCard() != null)
// finish();
// if (event.getPacingService() != null)
...
...
@@ -286,4 +293,29 @@ public class WarpViewActivity extends WarpBaseActivity {
public
static
Handler
getMetersHandler
()
{
return
metersHandler
;
}
private
void
sendSteps
()
{
String
date
=
new
SimpleDateFormat
(
"yyyy-MM-dd hh:mm:ss"
,
Locale
.
getDefault
()).
format
(
new
Date
());
if
(
WarpUtils
.
getStepsCounter
(
this
)
>
0
)
{
WarplyManager
.
setPacingDetails
(
new
PacingCalculateRequest
()
.
setCounter
(
WarpUtils
.
getStepsCounter
(
this
))
.
setDate
(
date
),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
WarplyManagerHelper
.
mSteps
=
0
;
WarpUtils
.
setStepsCounter
(
WarpViewActivity
.
this
,
0
);
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
WarpUtils
.
log
(
"Warply Health Service error: "
+
String
.
valueOf
(
errorCode
));
}
});
}
}
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
85b2b4f
...
...
@@ -34,6 +34,7 @@ import ly.warp.sdk.io.models.CouponsEventModel;
import
ly.warp.sdk.io.models.HealthEventModel
;
import
ly.warp.sdk.io.request.PacingCalculateRequest
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -54,7 +55,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
private
SensorManager
mSensorManager
;
private
Sensor
mSensor
;
private
int
mSteps
=
0
;
//
private int mSteps = 0;
private
double
mStepsAll
=
0.0d
;
private
final
int
ACCEL_RING_SIZE
=
50
;
private
final
int
VEL_RING_SIZE
=
10
;
...
...
@@ -139,6 +140,8 @@ public class WarplyHealthService extends Service implements SensorEventListener
unregisterStepSensor
();
mStepsAll
=
0.0d
;
WarpUtils
.
setStepsMetersCounter
(
this
,
0.0d
);
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
sendSteps
();
}
...
...
@@ -208,13 +211,15 @@ public class WarplyHealthService extends Service implements SensorEventListener
if
(
velocityEstimate
>
STEP_THRESHOLD
&&
oldVelocityEstimate
<=
STEP_THRESHOLD
&&
(
timeNs
-
lastStepTimeNs
>
STEP_DELAY_NS
))
{
mSteps
++;
WarplyManagerHelper
.
mSteps
++;
mStepsAll
++;
WarplyManagerHelper
.
mStepsWebview
++;
WarplyManagerHelper
.
mMetersWebview
=
(
WarplyManagerHelper
.
mStepsWebview
*
0.762
);
HealthEventModel
healthSteps
=
new
HealthEventModel
();
healthSteps
.
setMeters
((
mStepsAll
*
0.762
));
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthSteps
));
WarpUtils
.
setStepsMetersCounter
(
this
,
(
mStepsAll
*
0.762
));
WarpUtils
.
setStepsCounter
(
this
,
mSteps
);
WarpUtils
.
setStepsCounter
(
this
,
WarplyManagerHelper
.
mSteps
);
lastStepTimeNs
=
timeNs
;
}
...
...
@@ -270,7 +275,7 @@ public class WarplyHealthService extends Service implements SensorEventListener
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
mSteps
=
0
;
WarplyManagerHelper
.
mSteps
=
0
;
WarpUtils
.
setStepsCounter
(
WarplyHealthService
.
this
,
0
);
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
85b2b4f
...
...
@@ -103,6 +103,9 @@ public class WarplyManagerHelper {
private
static
LoyaltyBadgeModel
mLoyaltyBadge
=
new
LoyaltyBadgeModel
();
private
static
float
mDealsSum
=
0.0f
;
private
static
MerchantList
mMerchantList
=
new
MerchantList
();
public
static
double
mMetersWebview
=
0.0d
;
public
static
int
mStepsWebview
=
0
;
public
static
int
mSteps
=
0
;
// ===========================================================
// Methods for/from SuperClass/Interfaces
...
...
@@ -727,7 +730,8 @@ public class WarplyManagerHelper {
*/
public
static
void
setCCMSLoyaltyCampaigns
(
ArrayList
<
LoyaltyContextualOfferModel
>
list
)
{
mCCMSList
.
clear
();
mCCMSList
.
addAll
(
list
);
// mCCMSList.addAll(list);
mCCMSList
=
list
;
OneTimeWorkRequest
mywork
=
new
OneTimeWorkRequest
.
Builder
(
EventService
.
class
).
build
();
WorkManager
.
getInstance
(
Warply
.
getWarplyContext
()).
enqueue
(
mywork
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
85b2b4f
...
...
@@ -1523,6 +1523,45 @@ public class WarplyManager {
// " \"zone\": \"COSMOTE_APP_LOYALTY_PROMO\"\n" +
// " },\n" +
// " {\n" +
// " \"UACIOfferTrackingCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" +
// " \"businessAdditionalId\": \"\",\n" +
// " \"dataCategory\": \"Data\",\n" +
// " \"dataValue\": \"1\",\n" +
// " \"description\": \"5days1000 3744\",\n" +
// " \"discount\": \"None\",\n" +
// " \"duration\": \"5\",\n" +
// " \"eligibleAssets\": [],\n" +
// " \"giftType\": \"GB\",\n" +
// " \"giftValue\": \"1\",\n" +
// " \"id\": \"000003744\",\n" +
// " \"imageOfferUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_detailed_default.png\",\n" +
// " \"imageUrl\": \"https://uatatg.cosmote.gr/images/ContexualOffers//testOffer/x3_store_default.png\",\n" +
// " \"loyaltyCampaignId\": \"NA\",\n" +
// " \"minsValue\": \"None\",\n" +
// " \"noOfRecurrance\": \"5\",\n" +
// " \"notificationMessage\": \"5days1000 3744\",\n" +
// " \"offerAudienceLevel\": \"guid\",\n" +
// " \"offerCode1\": \"000003744\",\n" +
// " \"offerName\": \"White_Label_5days1000 3744\",\n" +
// " \"price\": \"0\",\n" +
// " \"productType\": \"White Label\",\n" +
// " \"provDuration\": \"1.0\",\n" +
// " \"score\": \"50\",\n" +
// " \"sessionId\": \"COSMOTE_APP_BALANCES.6945251078.20220908115231\",\n" +
// " \"treatmentCode\": \"546d.ea1.ffffffffcc4c34b3.c64ed53\",\n" +
// " \"validity\": \"0\",\n" +
// " \"wave\": \"1\",\n" +
// " \"voiceCategory\": \"None\",\n" +
// " \"validity\": \"5\",\n" +
// " \"imageUrl\": \"https://www.cosmotetvott.gr/assets/images/ogImage.jpg\",\n" +
// " \"title\": \"White_Label_5days1000 3744\",\n" +
// " \"titleOffer\": \"5days1000 3744\",\n" +
// " \"termsAndConditions\": \"5days1000 3744\",\n" +
// " \"subtitle\": \"5days1000 3744\",\n" +
// " \"description\": \"Test6\",\n" +
// " \"zone\": \"COSMOTE_APP_GIFTS4U\"\n" +
// " },\n" +
// " {\n" +
// " \"UACIOfferTrackingCode\": \"51ed.e10.2c006f18.71e96d08\",\n" +
// " \"businessAdditionalId\": \"\",\n" +
// " \"dataCategory\": \"Data\",\n" +
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
85b2b4f
...
...
@@ -70,6 +70,7 @@ import ly.warp.sdk.io.models.QuestionnaireEventModel;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.WarplyProperty
;
import
ly.warp.sdk.utils.WarplyUrlHandler
;
import
ly.warp.sdk.utils.constants.WarpConstants
;
...
...
@@ -405,7 +406,7 @@ public class WarpView extends WebView {
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
questionnaireEvent
));
}
}
else
if
(
parts
[
1
].
equals
(
"couponRetrieved"
))
{
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
new
CouponEventModel
()));
//
EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
}
else
if
(
parts
[
1
].
equals
(
"couponShared"
))
{
// EventBus.getDefault().post(new WarplyEventBusManager(new CouponEventModel()));
}
/*else if (parts[2].equals("serviceDisabled")) {
...
...
@@ -514,11 +515,13 @@ public class WarpView extends WebView {
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
String
tempMeters
=
String
.
valueOf
(
Warp
Utils
.
getStepsMetersCounter
(
getContext
())
);
String
tempMeters
=
String
.
valueOf
(
Warp
lyManagerHelper
.
mMetersWebview
);
String
scriptSourceMeters
=
"passMeters("
+
tempMeters
+
");"
;
WarpView
.
this
.
evaluateJavascript
(
scriptSourceMeters
,
s
->
{
});
WarplyManagerHelper
.
mStepsWebview
=
0
;
WarplyManagerHelper
.
mMetersWebview
=
0.0d
;
WarpViewActivity
.
getMetersHandler
().
postDelayed
(
this
,
1000
);
}
},
1000
);
...
...
Please
register
or
login
to post a comment