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-07-26 16:29:04 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
6cfe1dbbdea0dc4ce6a30d0757e51c214fd0b06d
6cfe1dbb
1 parent
ca998455
steps fixes
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
270 additions
and
50 deletions
.idea/deploymentTargetDropDown.xml
warply_android_sdk/src/main/AndroidManifest.xml
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyHealthEventModel.java
warply_android_sdk/src/main/java/ly/warp/sdk/receivers/RestartHealthServiceReceiver.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthWorker.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
.idea/deploymentTargetDropDown.xml
View file @
6cfe1db
...
...
@@ -4,18 +4,18 @@
<value>
<entry
key=
"app"
>
<State>
<
t
argetSelectedWithDropDown>
<
runningDeviceT
argetSelectedWithDropDown>
<Target>
<type
value=
"
QUICK_BOOT
_TARGET"
/>
<type
value=
"
RUNNING_DEVICE
_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"
VIRTUAL_DEVICE_PATH
"
/>
<value
value=
"
$USER_HOME$/.android/avd/Pixel_7_v13.avd
"
/>
<type
value=
"
SERIAL_NUMBER
"
/>
<value
value=
"
R58M42EM7YT
"
/>
</Key>
</deviceKey>
</Target>
</
t
argetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2024-07-
09T11:41:15.263632
Z"
/>
</
runningDeviceT
argetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2024-07-
26T13:26:33.140020
Z"
/>
</State>
</entry>
</value>
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
6cfe1db
...
...
@@ -17,7 +17,8 @@
<uses-permission
android:name=
"android.permission.FOREGROUND_SERVICE_HEALTH"
/>
<uses-permission
android:name=
"android.permission.HIGH_SAMPLING_RATE_SENSORS"
/>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<uses-permission
android:name=
"android.permission.RECEIVE_BOOT_COMPLETED"
/>
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
<application
android:largeHeap=
"true"
>
<!-- <meta-data-->
...
...
@@ -291,8 +292,8 @@
android:name=
".receivers.RestartHealthServiceReceiver"
android:exported=
"false"
>
<intent-filter>
<action
android:name=
"android.intent.action.BOOT_COMPLETED"
/
>
<action
android:name=
"android.intent.action.
MY_PACKAGE_REPLACED
"
/>
<!-- <action android:name="android.intent.action.BOOT_COMPLETED" />--
>
<action
android:name=
"android.intent.action.
RESTART
"
/>
</intent-filter>
</receiver>
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/activities/WarpViewActivity.java
View file @
6cfe1db
...
...
@@ -28,6 +28,8 @@ package ly.warp.sdk.activities;
import
static
ly
.
warp
.
sdk
.
utils
.
constants
.
WarpConstants
.
RANDOM_MAX
;
import
static
ly
.
warp
.
sdk
.
utils
.
constants
.
WarpConstants
.
RANDOM_MIN
;
import
android.Manifest
;
import
android.app.ActivityManager
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.pm.PackageManager
;
...
...
@@ -35,6 +37,8 @@ import android.graphics.Color;
import
android.os.Build
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.PowerManager
;
import
android.provider.Settings
;
import
android.text.TextUtils
;
import
android.view.KeyEvent
;
import
android.view.View
;
...
...
@@ -44,6 +48,8 @@ import android.widget.ProgressBar;
import
android.widget.RelativeLayout
;
import
androidx.annotation.NonNull
;
import
androidx.core.app.ActivityCompat
;
import
androidx.core.content.ContextCompat
;
import
androidx.work.Constraints
;
import
androidx.work.NetworkType
;
import
androidx.work.OneTimeWorkRequest
;
...
...
@@ -62,11 +68,14 @@ import ly.warp.sdk.Warply;
import
ly.warp.sdk.db.WarplyDBHelper
;
import
ly.warp.sdk.io.callbacks.CallbackReceiver
;
import
ly.warp.sdk.io.models.CouponList
;
import
ly.warp.sdk.io.models.LoyaltySDKFirebaseEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.io.models.WarplyWebviewActivityCallbackEventModel
;
import
ly.warp.sdk.io.models.WarplyWebviewCallbackEventModel
;
import
ly.warp.sdk.services.EventCampaignCouponService
;
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.WarplyPreferences
;
...
...
@@ -164,6 +173,24 @@ public class WarpViewActivity extends WarpBaseActivity {
webviewCallbackEventModel
.
setResponseCode
(
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
?
"allow"
:
"deny"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
webviewCallbackEventModel
));
}
if
(
requestCode
==
5001
&&
grantResults
.
length
>
0
&&
grantResults
[
0
]
==
PackageManager
.
PERMISSION_GRANTED
)
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
LoyaltySDKFirebaseEventModel
analyticsEvent
=
new
LoyaltySDKFirebaseEventModel
();
analyticsEvent
.
setEventName
(
"loyalty_steps_activation"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
analyticsEvent
));
Intent
stepsServiceIntent
=
new
Intent
(
this
,
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
stepsServiceIntent
);
}
else
{
startService
(
stepsServiceIntent
);
}
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
}
}
@Override
...
...
@@ -195,6 +222,60 @@ public class WarpViewActivity extends WarpBaseActivity {
// if (event.getPacingService() != null)
// finish();
if
(
event
.
getPacing
()
!=
null
&&
!
event
.
getPacing
().
isVisible
())
finish
();
if
(
event
.
getHealth
()
!=
null
)
{
if
(
event
.
getHealth
().
isActivated
())
{
WarpUtils
.
setIsStepsManuallyStopped
(
this
,
false
);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
// if (ContextCompat.checkSelfPermission(this, Manifest.permission.ACTIVITY_RECOGNITION) != PackageManager.PERMISSION_GRANTED) {
// ActivityCompat.requestPermissions(this, new String[]{
// Manifest.permission.ACTIVITY_RECOGNITION
// }, 5001);
// } else {
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("loyalty_steps_activation");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//
// Intent stepsServiceIntent = new Intent(this, WarplyHealthService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// startForegroundService(stepsServiceIntent);
// } else {
// startService(stepsServiceIntent);
// }
//
// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
// pacingVisible.setVisible(true);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// }
// }
// } else {
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
LoyaltySDKFirebaseEventModel
analyticsEvent
=
new
LoyaltySDKFirebaseEventModel
();
analyticsEvent
.
setEventName
(
"loyalty_steps_activation"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
analyticsEvent
));
Intent
stepsServiceIntent
=
new
Intent
(
this
,
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
startForegroundService
(
stepsServiceIntent
);
}
else
{
startService
(
stepsServiceIntent
);
}
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
// }
}
else
{
WarpUtils
.
setIsStepsManuallyStopped
(
this
,
true
);
Intent
stepsServiceIntent
=
new
Intent
(
this
,
WarplyHealthService
.
class
);
stopService
(
stepsServiceIntent
);
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
false
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
}
}
// ===========================================================
...
...
@@ -251,19 +332,19 @@ public class WarpViewActivity extends WarpBaseActivity {
if
(
intent
.
hasExtra
(
"source"
)
&&
intent
.
getStringExtra
(
"source"
).
equalsIgnoreCase
(
"from_notification_status"
))
{
JSONObject
params
=
new
JSONObject
();
try
{
params
.
putOpt
(
"web_id"
,
WarpUtils
.
getWebId
(
Warply
.
getWarplyContext
()
));
params
.
putOpt
(
"app_uuid"
,
WarplyProperty
.
getAppUuid
(
Warply
.
getWarplyContext
()
));
params
.
putOpt
(
"api_key"
,
WarpUtils
.
getApiKey
(
Warply
.
getWarplyContext
()
));
params
.
putOpt
(
"web_id"
,
WarpUtils
.
getWebId
(
this
));
params
.
putOpt
(
"app_uuid"
,
WarplyProperty
.
getAppUuid
(
this
));
params
.
putOpt
(
"api_key"
,
WarpUtils
.
getApiKey
(
this
));
params
.
putOpt
(
"session_uuid"
,
sessionUUID
);
params
.
putOpt
(
"access_token"
,
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()
).
getAuthValue
(
"access_token"
));
params
.
putOpt
(
"refresh_token"
,
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()
).
getAuthValue
(
"refresh_token"
));
params
.
putOpt
(
"client_id"
,
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()
).
getClientValue
(
"client_id"
));
params
.
putOpt
(
"client_secret"
,
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()
).
getClientValue
(
"client_secret"
));
params
.
putOpt
(
"access_token"
,
WarplyDBHelper
.
getInstance
(
this
).
getAuthValue
(
"access_token"
));
params
.
putOpt
(
"refresh_token"
,
WarplyDBHelper
.
getInstance
(
this
).
getAuthValue
(
"refresh_token"
));
params
.
putOpt
(
"client_id"
,
WarplyDBHelper
.
getInstance
(
this
).
getClientValue
(
"client_id"
));
params
.
putOpt
(
"client_secret"
,
WarplyDBHelper
.
getInstance
(
this
).
getClientValue
(
"client_secret"
));
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
WarpUtils
.
setWebviewParams
(
Warply
.
getWarplyContext
()
,
params
);
WarpUtils
.
setWebviewParams
(
this
,
params
);
setUpPushEvents
(
sessionUUID
);
}
...
...
@@ -341,4 +422,24 @@ public class WarpViewActivity extends WarpBaseActivity {
public
static
void
setWebviewSupermarket
(
boolean
isLoaded
)
{
mWebviewSupermarket
=
isLoaded
;
}
private
boolean
isMyServiceRunning
(
Class
<?>
serviceClass
)
{
ActivityManager
manager
=
(
ActivityManager
)
getSystemService
(
Context
.
ACTIVITY_SERVICE
);
for
(
ActivityManager
.
RunningServiceInfo
service
:
manager
.
getRunningServices
(
Integer
.
MAX_VALUE
))
{
if
(
serviceClass
.
getName
().
equals
(
service
.
service
.
getClassName
()))
{
return
true
;
}
}
return
false
;
}
private
void
checkBatteryOptimizationForWarplyHealth
()
{
PowerManager
pm
=
(
PowerManager
)
getSystemService
(
Context
.
POWER_SERVICE
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
M
)
{
if
(!
pm
.
isIgnoringBatteryOptimizations
(
getPackageName
()))
{
Intent
intent
=
new
Intent
(
Settings
.
ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS
);
startActivityForResult
(
intent
,
6001
);
}
}
}
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/io/models/WarplyHealthEventModel.java
0 → 100644
View file @
6cfe1db
/*
* 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 25-July-24.
*/
public
class
WarplyHealthEventModel
{
private
boolean
activated
;
public
WarplyHealthEventModel
()
{
this
.
activated
=
true
;
}
public
boolean
isActivated
()
{
return
activated
;
}
public
void
setActivated
(
boolean
activated
)
{
this
.
activated
=
activated
;
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/receivers/RestartHealthServiceReceiver.java
View file @
6cfe1db
package
ly
.
warp
.
sdk
.
receivers
;
import
static
ly
.
warp
.
sdk
.
services
.
WarplyHealthService
.
ACTION_RESTART_SERVICE
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
androidx.work.OneTimeWorkRequest
;
import
androidx.work.WorkManager
;
import
java.util.concurrent.TimeUnit
;
import
ly.warp.sdk.services.WarplyHealthWorker
;
public
class
RestartHealthServiceReceiver
extends
BroadcastReceiver
{
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
if
(
Intent
.
ACTION_BOOT_COMPLETED
.
equals
(
intent
.
getAction
())
||
Intent
.
ACTION_MY_PACKAGE_REPLACED
.
equals
(
intent
.
getAction
()))
{
Intent
stepsRestartServiceIntent
=
new
Intent
(
context
,
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
context
.
startForegroundService
(
stepsRestartServiceIntent
);
}
else
{
context
.
startService
(
stepsRestartServiceIntent
);
if
(
intent
!=
null
&&
intent
.
getAction
()
!=
null
&&
ACTION_RESTART_SERVICE
.
equals
(
intent
.
getAction
()))
{
scheduleWork
(
context
);
}
}
private
void
scheduleWork
(
Context
context
)
{
OneTimeWorkRequest
workRequest
=
new
OneTimeWorkRequest
.
Builder
(
WarplyHealthWorker
.
class
)
.
setInitialDelay
(
2
,
TimeUnit
.
SECONDS
)
.
build
();
WorkManager
.
getInstance
(
context
).
enqueue
(
workRequest
);
}
}
\ No newline at end of file
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthService.java
View file @
6cfe1db
This diff is collapsed. Click to expand it.
warply_android_sdk/src/main/java/ly/warp/sdk/services/WarplyHealthWorker.java
0 → 100644
View file @
6cfe1db
package
ly
.
warp
.
sdk
.
services
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
androidx.annotation.NonNull
;
import
androidx.work.Worker
;
import
androidx.work.WorkerParameters
;
/**
* Created by Panagiotis Triantafyllou on 26/Ιουλ/2024.
*/
public
class
WarplyHealthWorker
extends
Worker
{
public
WarplyHealthWorker
(
@NonNull
Context
context
,
@NonNull
WorkerParameters
workerParams
)
{
super
(
context
,
workerParams
);
}
@NonNull
@Override
public
Result
doWork
()
{
Context
context
=
getApplicationContext
();
Intent
stepsRestartServiceIntent
=
new
Intent
(
context
,
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
context
.
startForegroundService
(
stepsRestartServiceIntent
);
}
else
{
context
.
startService
(
stepsRestartServiceIntent
);
}
return
Result
.
success
();
}
}
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarpUtils.java
View file @
6cfe1db
...
...
@@ -157,6 +157,8 @@ public class WarpUtils {
+
"language"
;
private
static
final
String
PREFERENCES_KEY_STEPS
=
PREFERENCES_PREFIX
+
"steps"
;
private
static
final
String
PREFERENCES_KEY_STEPS_MANUALLY_STOPPED
=
PREFERENCES_PREFIX
+
"steps_manually_stopped"
;
private
static
SharedPreferences
_prefs
;
...
...
@@ -166,9 +168,19 @@ public class WarpUtils {
return
getPreferences
(
context
).
getBoolean
(
PREFERENCES_KEY_STEPS
,
false
);
}
public
static
void
setIsSteps
(
Context
context
,
boolean
isS
upermarket
)
{
public
static
void
setIsSteps
(
Context
context
,
boolean
isS
teps
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_STEPS
,
isSupermarket
);
editor
.
putBoolean
(
PREFERENCES_KEY_STEPS
,
isSteps
);
editor
.
apply
();
}
public
static
boolean
getIsStepsManuallyStopped
(
Context
context
)
{
return
getPreferences
(
context
).
getBoolean
(
PREFERENCES_KEY_STEPS_MANUALLY_STOPPED
,
false
);
}
public
static
void
setIsStepsManuallyStopped
(
Context
context
,
boolean
isManuallyStopped
)
{
SharedPreferences
.
Editor
editor
=
getPreferences
(
context
).
edit
();
editor
.
putBoolean
(
PREFERENCES_KEY_STEPS_MANUALLY_STOPPED
,
isManuallyStopped
);
editor
.
apply
();
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyEventBusManager.java
View file @
6cfe1db
...
...
@@ -27,6 +27,7 @@ import ly.warp.sdk.io.models.WarplyBoxAnalysisEventModel;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.models.WarplyDealsAnalysisEventModel
;
import
ly.warp.sdk.io.models.WarplyHealthEventModel
;
import
ly.warp.sdk.io.models.WarplyNavigateBackEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardServiceEnabledModel
;
...
...
@@ -51,6 +52,7 @@ public class WarplyEventBusManager {
private
WarplyCCMSEnabledModel
ccmsActivated
;
private
LoyaltyGiftsForYouOfferClickEvent
giftsYou
;
private
QuestionnaireEventModel
questionnaire
;
private
WarplyHealthEventModel
health
;
private
OpenMyRewardsEventModel
openRewards
;
private
RewardsCouponsEventModel
rewardsCoupons
;
private
VouchersActivityEventModel
vouchersActivity
;
...
...
@@ -91,6 +93,10 @@ public class WarplyEventBusManager {
this
.
questionnaire
=
questionnaire
;
}
public
WarplyEventBusManager
(
WarplyHealthEventModel
health
)
{
this
.
health
=
health
;
}
public
WarplyEventBusManager
(
OpenMyRewardsEventModel
openRewards
)
{
this
.
openRewards
=
openRewards
;
}
...
...
@@ -276,6 +282,10 @@ public class WarplyEventBusManager {
return
questionnaire
;
}
public
WarplyHealthEventModel
getHealth
()
{
return
health
;
}
public
VouchersActivityEventModel
getVouchersActivity
()
{
return
vouchersActivity
;
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
6cfe1db
...
...
@@ -103,6 +103,7 @@ import ly.warp.sdk.io.models.RefreshVouchersEventModel;
import
ly.warp.sdk.io.models.UnifiedCoupon
;
import
ly.warp.sdk.io.models.WarplyCCMSEnabledModel
;
import
ly.warp.sdk.io.models.WarplyCouponsChangedEventModel
;
import
ly.warp.sdk.io.models.WarplyHealthEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel
;
...
...
@@ -543,29 +544,37 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
pacingWidgetVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingWidgetVisible
));
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutEnabled"
))
{
// This is for the pacing service
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
LoyaltySDKFirebaseEventModel
analyticsEvent
=
new
LoyaltySDKFirebaseEventModel
();
analyticsEvent
.
setEventName
(
"loyalty_steps_activation"
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
analyticsEvent
));
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
Warply
.
getWarplyContext
().
startForegroundService
(
stepsServiceIntent
);
}
else
{
Warply
.
getWarplyContext
().
startService
(
stepsServiceIntent
);
}
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
}
// if (!isMyServiceRunning(WarplyHealthService.class)) {
// LoyaltySDKFirebaseEventModel analyticsEvent = new LoyaltySDKFirebaseEventModel();
// analyticsEvent.setEventName("loyalty_steps_activation");
// EventBus.getDefault().post(new WarplyEventBusManager(analyticsEvent));
//
// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
// Warply.getWarplyContext().startForegroundService(stepsServiceIntent);
// } else {
// Warply.getWarplyContext().startService(stepsServiceIntent);
// }
//
// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
// pacingVisible.setVisible(true);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// }
WarplyHealthEventModel
healthActive
=
new
WarplyHealthEventModel
();
healthActive
.
setActivated
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthActive
));
}
else
if
(
parts
[
1
].
equals
(
"steps"
)
&&
parts
[
2
].
equals
(
"shortcutDisabled"
))
{
// This is for the pacing service
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
Warply
.
getWarplyContext
().
stopService
(
stepsServiceIntent
);
WarplyPacingEventModel
pacingVisible
=
new
WarplyPacingEventModel
();
pacingVisible
.
setVisible
(
false
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
pacingVisible
));
// Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
// Warply.getWarplyContext().stopService(stepsServiceIntent);
//
// WarplyPacingEventModel pacingVisible = new WarplyPacingEventModel();
// pacingVisible.setVisible(false);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
WarplyHealthEventModel
healthActive
=
new
WarplyHealthEventModel
();
healthActive
.
setActivated
(
false
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthActive
));
}
else
if
(
parts
[
1
].
equals
(
"request"
)
||
parts
[
1
].
equals
(
"response"
))
{
WarpUtils
.
log
(
"**************** WARPLY Webview Log START *****************"
);
WarpUtils
.
log
(
message
);
...
...
Please
register
or
login
to post a comment