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:47:52 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
ee6ee87ae66b23d38e42f2bd4e34bce97c13cacb
ee6ee87a
1 parent
6cfe1dbb
REMOVE STEPS
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
60 additions
and
149 deletions
warply_android_sdk/build.gradle
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
warply_android_sdk/build.gradle
View file @
ee6ee87
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.4r3
2
'
PUBLISH_VERSION
=
'4.5.5.4r3
3
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/AndroidManifest.xml
View file @
ee6ee87
...
...
@@ -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" />--
>
<uses-permission
android:name=
"android.permission.POST_NOTIFICATIONS"
/>
<!-- <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />-->
<!-- <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />-->
...
...
@@ -230,11 +230,11 @@
<!-- android:stopWithTask="false"-->
<!-- android:process=":warplyHealthService"-->
<service
android:name=
".services.WarplyHealthService"
android:exported=
"false"
android:foregroundServiceType=
"health"
android:permission=
"android.permission.FOREGROUND_SERVICE"
/
>
<!-- <service-->
<!-- android:name=".services.WarplyHealthService"-->
<!-- android:exported="false"-->
<!-- android:foregroundServiceType="health"-->
<!-- android:permission="android.permission.FOREGROUND_SERVICE" />--
>
<service
android:name=
".services.WarplyBeaconsRangingService"
...
...
@@ -288,14 +288,14 @@
android:name=
".receivers.WarplyInAppNotificationReceiver"
android:exported=
"false"
/>
<receiver
android:name=
".receivers.RestartHealthServiceReceiver"
android:exported=
"false"
>
<intent-filter
>
<!--
<action android:name="android.intent.action.BOOT_COMPLETED" />
-->
<action
android:name=
"android.intent.action.RESTART"
/
>
</intent-filter
>
</receiver
>
<!-- <receiver-->
<!-- android:name=".receivers.RestartHealthServiceReceiver"-->
<!-- android:exported="false">--
>
<!-- <intent-filter>--
>
<!--
<!– <action android:name="android.intent.action.BOOT_COMPLETED" />–>
-->
<!-- <action android:name="android.intent.action.RESTART" />--
>
<!-- </intent-filter>--
>
<!-- </receiver>--
>
<!-- <provider-->
<!-- android:name=".utils.WarplyProvider"-->
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/WarplyManagerHelper.java
View file @
ee6ee87
...
...
@@ -1478,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 @
ee6ee87
...
...
@@ -977,20 +977,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));
//
}
//
}
}
}
}
...
...
@@ -1111,20 +1111,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));
//
}
//
}
}
}
}
...
...
@@ -4783,95 +4783,6 @@ public class WarplyManager {
return
future
;
}
public
static
void
getCosmoteUser
(
WarplyCosmoteUserRequest
request
,
final
CallbackReceiver
<
JSONObject
>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Cosmote User Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Cosmote User Request is active"
);
WarpUtils
.
log
(
"**************************************************"
);
Warply
.
postReceiveMicroappData
(
false
,
"cosuser"
,
request
.
toJson
(),
new
CallbackReceiver
<
JSONObject
>()
{
@Override
public
void
onSuccess
(
JSONObject
result
)
{
int
status
=
result
.
optInt
(
"status"
,
2
);
if
(
status
==
1
)
{
JSONObject
tokens
=
result
.
optJSONObject
(
"result"
);
if
(
tokens
!=
null
)
{
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()).
saveClientAccess
(
tokens
.
optString
(
"client_id"
,
""
),
tokens
.
optString
(
"client_secret"
,
""
)
);
WarplyDBHelper
.
getInstance
(
Warply
.
getWarplyContext
()).
saveAuthAccess
(
tokens
.
optString
(
"access_token"
,
""
),
tokens
.
optString
(
"refresh_token"
,
""
)
);
JSONObject
newResult
=
new
JSONObject
();
try
{
newResult
.
putOpt
(
"status"
,
1
);
newResult
.
putOpt
(
"message"
,
"Success"
);
receiver
.
onSuccess
(
newResult
);
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
receiver
.
onFailure
(
2
);
}
getConsumer
(
new
WarplyConsumerRequest
(),
new
CallbackReceiver
<
Consumer
>()
{
@Override
public
void
onSuccess
(
Consumer
result
)
{
WarplyManagerHelper
.
setConsumerInternal
(
result
);
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
&&
profMetadata
.
has
(
"nonTelco"
))
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
profMetadata
.
optBoolean
(
"nonTelco"
));
}
else
{
WarpUtils
.
setUserNonTelco
(
Warply
.
getWarplyContext
(),
false
);
}
}
if
(
result
!=
null
)
{
JSONObject
profMetadata
=
WarpJSONParser
.
getJSONFromString
(
result
.
getProfileMetadata
());
if
(
profMetadata
!=
null
)
{
if
(
profMetadata
.
has
(
"badge"
))
{
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
));
}
}
}
}
}
@Override
public
void
onFailure
(
int
errorCode
)
{
}
});
}
else
receiver
.
onFailure
(
2
);
}
else
receiver
.
onFailure
(
status
);
}
@Override
public
void
onFailure
(
int
errorCode
)
{
receiver
.
onFailure
(
errorCode
);
}
});
}
public
static
void
submitOrder
(
CosmoteSubmitOrderRequest
request
,
final
CallbackReceiver
<
JSONObject
>
receiver
)
{
WarpUtils
.
log
(
"************* WARPLY Submit Order Request ********************"
);
WarpUtils
.
log
(
"[WARP Trace] WARPLY Submit Order Request is active"
);
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/views/WarpView.java
View file @
ee6ee87
...
...
@@ -425,12 +425,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
...
...
@@ -561,9 +561,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
// }
WarplyHealthEventModel
healthActive
=
new
WarplyHealthEventModel
();
healthActive
.
setActivated
(
true
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthActive
));
//
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);
...
...
@@ -572,9 +572,9 @@ public class WarpView extends WebView implements DefaultLifecycleObserver {
// pacingVisible.setVisible(false);
// EventBus.getDefault().post(new WarplyEventBusManager(pacingVisible));
WarplyHealthEventModel
healthActive
=
new
WarplyHealthEventModel
();
healthActive
.
setActivated
(
false
);
EventBus
.
getDefault
().
post
(
new
WarplyEventBusManager
(
healthActive
));
//
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