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-24 11:24:50 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bf8219dd97ab3ba368d46e54c2551d93ed5ab3de
bf8219dd
1 parent
c5f83d27
minor db revert
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
41 deletions
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
warply_android_sdk/src/main/java/ly/warp/sdk/db/WarplyDBHelper.java
View file @
bf8219d
...
...
@@ -35,7 +35,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
private
static
final
String
DB_NAME
=
"warply.db"
;
private
static
final
int
DB_VERSION
=
6
;
private
static
final
int
DB_VERSION
=
7
;
private
static
final
String
KEY_CIPHER
=
"tn#mpOl3v3Dy1pr@W"
;
//------------------------------ Fields -----------------------------//
...
...
@@ -222,15 +222,10 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
values
.
put
(
KEY_CLIENT_ID
,
clientId
);
if
(!
TextUtils
.
isEmpty
(
clientSecret
))
values
.
put
(
KEY_CLIENT_SECRET
,
clientSecret
);
if
(
isTableNotEmpty
(
TABLE_CLIENT
))
{
new
Thread
(()
->
{
if
(
isTableNotEmpty
(
TABLE_CLIENT
))
update
(
TABLE_CLIENT
,
values
);
}).
start
();
}
else
{
new
Thread
(()
->
{
else
insert
(
TABLE_CLIENT
,
values
);
}).
start
();
}
}
public
synchronized
void
saveAuthAccess
(
String
accessToken
,
String
refreshToken
)
{
...
...
@@ -239,15 +234,10 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
values
.
put
(
KEY_ACCESS_TOKEN
,
accessToken
);
if
(!
TextUtils
.
isEmpty
(
refreshToken
))
values
.
put
(
KEY_REFRESH_TOKEN
,
refreshToken
);
if
(
isTableNotEmpty
(
TABLE_AUTH
))
{
new
Thread
(()
->
{
if
(
isTableNotEmpty
(
TABLE_AUTH
))
update
(
TABLE_AUTH
,
values
);
}).
start
();
}
else
{
new
Thread
(()
->
{
else
insert
(
TABLE_AUTH
,
values
);
}).
start
();
}
}
@Nullable
...
...
@@ -275,15 +265,11 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
public
synchronized
void
deleteClient
()
{
new
Thread
(()
->
{
clearTable
(
TABLE_CLIENT
);
}).
start
();
}
public
synchronized
void
deleteAuth
()
{
new
Thread
(()
->
{
clearTable
(
TABLE_AUTH
);
}).
start
();
}
//------------------------------ Api requests -----------------------------//
...
...
@@ -312,56 +298,44 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
}
public
synchronized
void
deleteAllRequests
()
{
new
Thread
(()
->
{
clearTable
(
TABLE_REQUESTS
);
}).
start
();
}
public
synchronized
void
deleteAllPushRequests
()
{
new
Thread
(()
->
{
clearTable
(
TABLE_PUSH_REQUESTS
);
}).
start
();
}
public
synchronized
void
deleteAllPushAckRequests
()
{
new
Thread
(()
->
{
clearTable
(
TABLE_PUSH_ACK_REQUESTS
);
}).
start
();
}
public
synchronized
long
addRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_REQUESTS
,
values
);
}).
start
();
return
getRequestsInQueueCount
();
}
public
synchronized
long
addPushRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_REQUESTS
,
values
);
}).
start
();
return
getPushRequestsInQueueCount
();
}
public
synchronized
long
addPushAckRequest
(
String
microapp
,
String
entity
,
boolean
force
)
{
new
Thread
(()
->
{
ContentValues
values
=
new
ContentValues
();
values
.
put
(
KEY_REQUESTS_MICROAPP
,
microapp
);
values
.
put
(
KEY_REQUESTS_ENTITY
,
entity
);
values
.
put
(
KEY_REQUESTS_FORCE
,
force
?
1
:
0
);
values
.
put
(
KEY_REQUESTS_DATE_ADDED
,
System
.
currentTimeMillis
());
insert
(
TABLE_PUSH_ACK_REQUESTS
,
values
);
}).
start
();
return
getPushAckRequestsInQueueCount
();
}
...
...
@@ -388,9 +362,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
deletePushRequests
(
Long
...
ids
)
{
...
...
@@ -404,9 +376,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_PUSH_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
deletePushAckRequests
(
Long
...
ids
)
{
...
...
@@ -420,9 +390,7 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"="
);
strFilter
.
append
(
ids
[
i
]);
}
new
Thread
(()
->
{
getDb
().
delete
(
TABLE_PUSH_ACK_REQUESTS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
boolean
isForceRequestsExist
()
{
...
...
@@ -460,7 +428,6 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
//------------------------------ Tags -----------------------------//
public
synchronized
void
saveTags
(
String
[]
tags
)
{
new
Thread
(()
->
{
if
(
tags
!=
null
&&
tags
.
length
>
0
)
{
try
{
...
...
@@ -481,11 +448,9 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
getDb
().
endTransaction
();
}
}
}).
start
();
}
public
synchronized
void
removeTags
(
String
[]
tags
)
{
new
Thread
(()
->
{
StringBuilder
strFilter
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
tags
.
length
;
i
++)
{
if
(
i
>
0
)
{
...
...
@@ -498,7 +463,6 @@ public class WarplyDBHelper extends SQLiteOpenHelper {
strFilter
.
append
(
"'"
);
}
getDb
().
delete
(
TABLE_TAGS
,
strFilter
.
toString
(),
null
);
}).
start
();
}
public
synchronized
void
removeAllTags
()
{
...
...
Please
register
or
login
to post a comment