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
2025-06-19 13:12:55 +0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
718dd745b8a727cf1a7bb8585ebcdcb7fd11a965
718dd745
1 parent
0a6b1c9f
fixes
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
15 deletions
warply_android_sdk/build.gradle
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
warply_android_sdk/build.gradle
View file @
718dd74
...
...
@@ -5,7 +5,7 @@ android.buildFeatures.buildConfig = true
ext
{
PUBLISH_GROUP_ID
=
'ly.warp'
PUBLISH_VERSION
=
'4.5.5.4m
5
'
PUBLISH_VERSION
=
'4.5.5.4m
6
'
PUBLISH_ARTIFACT_ID
=
'warply-android-sdk'
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/Warply.java
View file @
718dd74
...
...
@@ -151,8 +151,8 @@ public enum Warply {
private
static
void
initInternal
(
Context
context
,
boolean
isNew
)
{
if
(
context
!=
null
)
{
INSTANCE
.
check
(
context
);
if
(
INSTANCE
.
mRequestQueue
==
null
)
INSTANCE
.
mRequestQueue
=
Volley
.
newRequestQueue
(
context
);
//
if (INSTANCE.mRequestQueue == null)
INSTANCE
.
mRequestQueue
=
Volley
.
newRequestQueue
(
context
);
INSTANCE
.
mContext
=
context
.
getApplicationContext
();
WarpConstants
.
DEBUG
=
WarplyProperty
.
isDebugMode
(
INSTANCE
.
mContext
);
INSTANCE
.
isInitializedOrThrow
();
...
...
@@ -1031,6 +1031,9 @@ public enum Warply {
WarpUtils
.
log
(
"**********************************************************"
);
WarplyJsonObjectRequest
request
=
new
WarplyJsonObjectRequest
(
method
,
url
,
data
,
vt
,
vt
);
request
.
setTag
(
tag
);
if
(
mRequestQueue
==
null
)
{
mRequestQueue
=
Volley
.
newRequestQueue
(
mContext
);
}
mRequestQueue
.
add
(
request
);
}
...
...
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
View file @
718dd74
...
...
@@ -212,6 +212,12 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
return
mDb
;
}
private
SQLiteDatabase
getReadableDbInner
()
{
if
(
mDb
==
null
)
mDb
=
getReadableDatabase
(
KEY_CIPHER
);
return
mDb
;
}
/**
* Close database connection - should only be called when app is being destroyed
* or when database won't be used for a long time
...
...
@@ -439,6 +445,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
//------------------------------ Api requests -----------------------------//
/**
* Gets all requests from the database.
* NOTE: The caller is responsible for closing the returned Cursor when done with it.
...
...
@@ -518,24 +525,86 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
public
synchronized
long
getRequestsInQueueCount
()
{
SQLiteDatabase
db
=
getReadableDb
();
long
count
=
DatabaseUtils
.
queryNumEntries
(
db
,
TABLE_REQUESTS
);
// Don't close the database here to improve performance
return
count
;
SQLiteDatabase
db
=
getReadableDbInner
();
if
(
db
==
null
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Database is null in getRequestsInQueueCount()"
);
return
0
;
}
// long count = DatabaseUtils.queryNumEntries(db, TABLE_REQUESTS);
// // Don't close the database here to improve performance
// return count;
Cursor
cursor
=
null
;
try
{
cursor
=
db
.
rawQuery
(
"SELECT COUNT(*) FROM "
+
TABLE_REQUESTS
,
null
);
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
return
cursor
.
getLong
(
0
);
}
return
0
;
}
catch
(
Exception
e
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Error counting getRequestsInQueueCount"
,
e
);
return
0
;
}
finally
{
if
(
cursor
!=
null
)
{
cursor
.
close
();
}
}
}
public
synchronized
long
getPushRequestsInQueueCount
()
{
SQLiteDatabase
db
=
getReadableDb
();
long
count
=
DatabaseUtils
.
queryNumEntries
(
db
,
TABLE_PUSH_REQUESTS
);
// Don't close the database here to improve performance
return
count
;
SQLiteDatabase
db
=
getReadableDbInner
();
if
(
db
==
null
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Database is null in getPushRequestsInQueueCount()"
);
return
0
;
}
// long count = DatabaseUtils.queryNumEntries(db, TABLE_PUSH_REQUESTS);
// // Don't close the database here to improve performance
// return count;
Cursor
cursor
=
null
;
try
{
cursor
=
db
.
rawQuery
(
"SELECT COUNT(*) FROM "
+
TABLE_PUSH_REQUESTS
,
null
);
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
return
cursor
.
getLong
(
0
);
}
return
0
;
}
catch
(
Exception
e
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Error counting getPushRequestsInQueueCount"
,
e
);
return
0
;
}
finally
{
if
(
cursor
!=
null
)
{
cursor
.
close
();
}
}
}
public
synchronized
long
getPushAckRequestsInQueueCount
()
{
SQLiteDatabase
db
=
getReadableDb
();
long
count
=
DatabaseUtils
.
queryNumEntries
(
db
,
TABLE_PUSH_ACK_REQUESTS
);
// Don't close the database here to improve performance
return
count
;
SQLiteDatabase
db
=
getReadableDbInner
();
if
(
db
==
null
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Database is null in getPushAckRequestsInQueueCount()"
);
return
0
;
}
// long count = DatabaseUtils.queryNumEntries(db, TABLE_PUSH_ACK_REQUESTS);
// // Don't close the database here to improve performance
// return count;
Cursor
cursor
=
null
;
try
{
cursor
=
db
.
rawQuery
(
"SELECT COUNT(*) FROM "
+
TABLE_PUSH_ACK_REQUESTS
,
null
);
if
(
cursor
!=
null
&&
cursor
.
moveToFirst
())
{
return
cursor
.
getLong
(
0
);
}
return
0
;
}
catch
(
Exception
e
)
{
Log
.
e
(
"WarplyDBHelper"
,
"Error counting getPushAckRequestsInQueueCount"
,
e
);
return
0
;
}
finally
{
if
(
cursor
!=
null
)
{
cursor
.
close
();
}
}
}
public
synchronized
void
deleteRequests
(
Long
...
ids
)
{
...
...
Please
register
or
login
to post a comment