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-11-04 17:19:06 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
956a7f2b149a77d55d08d754a4c0c5901b6a903e
956a7f2b
1 parent
b41ff4b0
new keys
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
3 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyAnalyticsManager.java
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyServerPreferencesManager.java
warply_android_sdk/build.gradle
View file @
956a7f2
...
...
@@ -2,7 +2,7 @@ apply plugin: 'com.android.library'
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.4.6rc
5
'
PUBLISH_VERSION
=
'4.5.4.6rc
6
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyAnalyticsManager.java
View file @
956a7f2
...
...
@@ -59,8 +59,8 @@ public class WarplyAnalyticsManager {
public
static
void
logTrackersEvent
(
Context
context
,
String
eventType
,
String
eventName
)
{
if
(
WarpUtils
.
getTrackersEnabled
(
context
))
{
Warply
.
getInitializer
(
context
).
init
();
sendEvent
(
null
,
eventType
.
concat
(
":"
).
concat
(
eventName
),
null
,
false
);
//
Warply.getInitializer(context).init();
sendEvent
(
context
,
null
,
eventType
.
concat
(
":"
).
concat
(
eventName
),
null
,
false
);
}
}
...
...
@@ -174,6 +174,29 @@ public class WarplyAnalyticsManager {
WarpUtils
.
log
(
"analytics micro-app is not active"
);
}
private
static
void
sendEvent
(
Context
context
,
@Nullable
String
eventPage
,
String
eventId
,
@Nullable
JSONObject
metadata
,
boolean
force
)
{
boolean
isInAppAnalyticsMicroAppActive
=
WarplyServerPreferencesManager
.
isMicroAppActive
(
context
,
WarpConstants
.
MicroApp
.
CUSTOM_ANALYTICS
);
if
(
isInAppAnalyticsMicroAppActive
)
try
{
JSONObject
jObj
=
new
JSONObject
();
if
(
eventPage
!=
null
)
{
jObj
.
putOpt
(
"page_id"
,
eventPage
);
}
jObj
.
putOpt
(
"event_id"
,
eventId
);
jObj
.
putOpt
(
"time_submitted"
,
System
.
currentTimeMillis
()
/
1000
);
if
(
metadata
!=
null
)
{
jObj
.
putOpt
(
"action_metadata"
,
metadata
);
}
Warply
.
postMicroappData
(
WarpConstants
.
MICROAPP_INAPP_ANALYTICS
,
jObj
,
force
);
}
catch
(
JSONException
e
)
{
if
(
WarpConstants
.
DEBUG
)
{
e
.
printStackTrace
();
}
}
else
WarpUtils
.
log
(
"analytics micro-app is not active"
);
}
/**
* Send an in app event to the Warply server and show a campaign per screen
*
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/utils/managers/WarplyServerPreferencesManager.java
View file @
956a7f2
package
ly
.
warp
.
sdk
.
utils
.
managers
;
import
android.content.Context
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
...
...
@@ -36,6 +38,22 @@ public class WarplyServerPreferencesManager {
MICRO_APP_STATUSES_MAP
=
map
;
}
public
static
void
initiateMicroAppStatusesMap
(
Context
context
)
{
Map
<
MicroApp
,
Boolean
>
map
=
new
HashMap
<>();
WarplyPreferences
wPref
=
new
WarplyPreferences
(
context
);
map
.
put
(
MicroApp
.
CONSUMER
,
wPref
.
getConsumerAppStatus
());
map
.
put
(
MicroApp
.
APPLICATION_DATA
,
wPref
.
getAppDataStatus
());
map
.
put
(
MicroApp
.
OFFERS
,
wPref
.
getOffersStatus
());
map
.
put
(
MicroApp
.
LIFECYCLE_ANALYTICS
,
wPref
.
getLifeCycleAnalyticsStatus
());
map
.
put
(
MicroApp
.
CUSTOM_ANALYTICS
,
wPref
.
getCustomAnalyticsStatus
());
map
.
put
(
MicroApp
.
USER_TAGGING
,
wPref
.
getUserTaggingStatus
());
map
.
put
(
MicroApp
.
DEVICE_INFO
,
wPref
.
getDeviceInfoStatus
());
map
.
put
(
MicroApp
.
USER_SESSION
,
wPref
.
getUserSessionStatus
());
map
.
put
(
MicroApp
.
BEACONS
,
wPref
.
getBeaconsStatus
());
map
.
put
(
MicroApp
.
RADIO_SILENT
,
wPref
.
getRadioSilentStatus
());
MICRO_APP_STATUSES_MAP
=
map
;
}
public
static
boolean
isMicroAppActive
(
MicroApp
app
)
{
if
(
MICRO_APP_STATUSES_MAP
==
null
)
{
...
...
@@ -44,6 +62,14 @@ public class WarplyServerPreferencesManager {
return
MICRO_APP_STATUSES_MAP
.
get
(
app
);
}
public
static
boolean
isMicroAppActive
(
Context
context
,
MicroApp
app
)
{
if
(
MICRO_APP_STATUSES_MAP
==
null
)
{
initiateMicroAppStatusesMap
(
context
);
}
return
MICRO_APP_STATUSES_MAP
.
get
(
app
);
}
public
static
void
checkServerPreferences
(
final
ServerPreferencesReceivedListener
receiveListener
)
{
...
...
Please
register
or
login
to post a comment