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-09 11:27:19 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b989d001980f6f412f2c159c5c9c4f7313f6ddba
b989d001
1 parent
6bdd9dd8
ADD STEPS
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
90 additions
and
96 deletions
.idea/deploymentTargetDropDown.xml
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/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
.idea/deploymentTargetDropDown.xml
View file @
b989d00
...
...
@@ -3,20 +3,7 @@
<component
name=
"deploymentTargetDropDown"
>
<value>
<entry
key=
"app"
>
<State>
<targetSelectedWithDropDown>
<Target>
<type
value=
"QUICK_BOOT_TARGET"
/>
<deviceKey>
<Key>
<type
value=
"VIRTUAL_DEVICE_PATH"
/>
<value
value=
"$USER_HOME$/.android/avd/Pixel_7_v14.avd"
/>
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown
value=
"2024-04-10T09:29:35.626328Z"
/>
</State>
<State
/>
</entry>
</value>
</component>
...
...
app/src/main/java/warp/ly/android_sdk/activities/SplashActivity.java
View file @
b989d00
...
...
@@ -38,7 +38,7 @@ public class SplashActivity extends BaseActivity {
if
(!
WarplyDBHelper
.
getInstance
(
SplashActivity
.
this
).
isTableNotEmpty
(
"auth"
))
{
//6012049321, 6012049322, 6012049323, 7000000831 history, 7000000826, 7000000831 shared coupons
//prod 6006552990, prod 6005892749, live 3000184910,prod 7000070282, live 3000136179
WarplyManager
.
getCosmoteUser
(
"70000
23687
"
,
mLoginReceiver
);
WarplyManager
.
getCosmoteUser
(
"70000
00831
"
,
mLoginReceiver
);
// WarplyManager.verifyTicket("", "7000023699", mLoginReceiver);
}
else
{
startNextActivity
();
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
b989d00
...
...
@@ -14,8 +14,8 @@
tools:node=
"remove"
/>
<uses-permission
android:name=
"com.huawei.appmarket.service.commondata.permission.GET_COMMON_DATA"
/>
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<!-- <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.FOREGROUND_SERVICE_HEALTH"
/
>
<uses-permission
android:name=
"android.permission.HIGH_SAMPLING_RATE_SENSORS"
/
>
<application
android:largeHeap=
"true"
>
<!-- <meta-data-->
...
...
@@ -233,11 +233,11 @@
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<!-- <service-->
<!-- android:name="ly.warp.sdk.services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.BIND_JOB_SERVICE" />--
>
<service
android:name=
"ly.warp.sdk.services.WarplyHealthService"
android:exported=
"false"
android:foregroundServiceType=
"health"
android:permission=
"android.permission.BIND_JOB_SERVICE"
/
>
<service
android:name=
"ly.warp.sdk.services.WarplyBeaconsRangingService"
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
b989d00
...
...
@@ -81,6 +81,7 @@ import ly.warp.sdk.io.request.WarplyIntegrationRequest;
import
ly.warp.sdk.services.EventService
;
import
ly.warp.sdk.services.FCMBaseMessagingService
;
import
ly.warp.sdk.services.VouchersFetchedService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.managers.WarplyAnalyticsManager
;
import
ly.warp.sdk.utils.managers.WarplyEventBusManager
;
import
ly.warp.sdk.utils.managers.WarplyManager
;
...
...
@@ -1477,10 +1478,10 @@ public class WarplyManagerHelper {
}
public
static
void
logoutUser
()
{
//
if (isMyServiceRunning(WarplyHealthService.class)) {
//
Intent stepsServiceIntent = new Intent(Warply.getWarplyContext(), WarplyHealthService.class);
//
Warply.getWarplyContext().stopService(stepsServiceIntent);
//
}
if
(
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
Intent
stepsServiceIntent
=
new
Intent
(
Warply
.
getWarplyContext
(),
WarplyHealthService
.
class
);
Warply
.
getWarplyContext
().
stopService
(
stepsServiceIntent
);
}
}
private
static
boolean
isMyServiceRunning
(
Class
<?>
serviceClass
)
{
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyManager.java
View file @
b989d00
...
...
@@ -27,6 +27,8 @@ package ly.warp.sdk.utils.managers;
import
android.app.ActivityManager
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.os.Build
;
import
android.os.Handler
;
import
android.os.Looper
;
import
android.text.TextUtils
;
...
...
@@ -106,6 +108,7 @@ import ly.warp.sdk.io.models.TransactionsList;
import
ly.warp.sdk.io.models.TripMetrics
;
import
ly.warp.sdk.io.models.UnifiedCampaignModel
;
import
ly.warp.sdk.io.models.UnifiedCoupon
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.io.request.CosmoteCouponSharingRequest
;
import
ly.warp.sdk.io.request.CosmotePostEventRequest
;
import
ly.warp.sdk.io.request.CosmoteRetrieveSharingRequest
;
...
...
@@ -158,6 +161,7 @@ import ly.warp.sdk.services.EventCampaignService;
import
ly.warp.sdk.services.EventCouponsService
;
import
ly.warp.sdk.services.EventRewardsCouponsService
;
import
ly.warp.sdk.services.EventUnifiedCouponsService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpJSONParser
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyDeviceInfoCollector
;
...
...
@@ -972,20 +976,20 @@ public class WarplyManager {
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
profMetadata
.
optString
(
"badge"
));
}
//
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
//
if (!isMyServiceRunning(WarplyHealthService.class)) {
//
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
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
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
));
}
}
}
}
}
...
...
@@ -1106,20 +1110,20 @@ public class WarplyManager {
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
profMetadata
.
optString
(
"badge"
));
}
//
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
//
if (!isMyServiceRunning(WarplyHealthService.class)) {
//
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
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
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
));
}
}
}
}
}
...
...
@@ -4831,20 +4835,20 @@ public class WarplyManager {
WarpUtils
.
setUserTag
(
Warply
.
getWarplyContext
(),
profMetadata
.
optString
(
"badge"
));
}
//
if (profMetadata.has("steps_enabled") && profMetadata.optBoolean("steps_enabled")) {
//
if (!isMyServiceRunning(WarplyHealthService.class)) {
//
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
(
profMetadata
.
has
(
"steps_enabled"
)
&&
profMetadata
.
optBoolean
(
"steps_enabled"
))
{
if
(!
isMyServiceRunning
(
WarplyHealthService
.
class
))
{
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
));
}
}
}
}
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
b989d00
...
...
@@ -104,8 +104,10 @@ 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.WarplyPacingCardEventModel
;
import
ly.warp.sdk.io.models.WarplyPacingEventModel
;
import
ly.warp.sdk.io.models.WarplyUnifiedActivatedEventModel
;
import
ly.warp.sdk.services.EventCampaignService
;
import
ly.warp.sdk.services.WarplyHealthService
;
import
ly.warp.sdk.utils.WarpUtils
;
import
ly.warp.sdk.utils.WarplyManagerHelper
;
import
ly.warp.sdk.utils.WarplyProperty
;
...
...
@@ -422,12 +424,12 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
if
(!
EventBus
.
getDefault
().
isRegistered
(
this
))
EventBus
.
getDefault
().
register
(
this
);
//
if (mWebviewLoaded) {
//
String scriptSourceInit = "webviewDidFocus(" + String.valueOf(mWebviewLoaded) + "," + String.valueOf(isMyServiceRunning(WarplyHealthService.class)) + ");";
//
WarpView.this.evaluateJavascript(scriptSourceInit, s -> {
//
//
});
//
}
if
(
mWebviewLoaded
)
{
String
scriptSourceInit
=
"webviewDidFocus("
+
String
.
valueOf
(
mWebviewLoaded
)
+
","
+
String
.
valueOf
(
isMyServiceRunning
(
WarplyHealthService
.
class
))
+
");"
;
WarpView
.
this
.
evaluateJavascript
(
scriptSourceInit
,
s
->
{
});
}
}
@Override
...
...
@@ -541,29 +543,29 @@ 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
));
}
}
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
));
}
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