mirror of
https://github.com/oxen-io/session-android.git
synced 2025-04-05 17:35:40 +00:00
Fixed a few cases where we were using the write access for read operations
This commit is contained in:
parent
f9ff3feb29
commit
693c3a9656
@ -349,7 +349,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getLastMessageServerID(room: String, server: String): Long? {
|
override fun getLastMessageServerID(room: String, server: String): Long? {
|
||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
val index = "$server.$room"
|
val index = "$server.$room"
|
||||||
return database.get(lastMessageServerIDTable, "$lastMessageServerIDTableIndex = ?", wrap(index)) { cursor ->
|
return database.get(lastMessageServerIDTable, "$lastMessageServerIDTableIndex = ?", wrap(index)) { cursor ->
|
||||||
cursor.getInt(lastMessageServerID)
|
cursor.getInt(lastMessageServerID)
|
||||||
@ -520,7 +520,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getServerCapabilities(serverName: String): List<String> {
|
fun getServerCapabilities(serverName: String): List<String> {
|
||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
return database.get(serverCapabilitiesTable, "$server = ?", wrap(serverName)) { cursor ->
|
return database.get(serverCapabilitiesTable, "$server = ?", wrap(serverName)) { cursor ->
|
||||||
cursor.getString(capabilities)
|
cursor.getString(capabilities)
|
||||||
}?.split(",") ?: emptyList()
|
}?.split(",") ?: emptyList()
|
||||||
@ -533,7 +533,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getLastInboxMessageId(serverName: String): Long? {
|
fun getLastInboxMessageId(serverName: String): Long? {
|
||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
return database.get(lastInboxMessageServerIdTable, "$server = ?", wrap(serverName)) { cursor ->
|
return database.get(lastInboxMessageServerIdTable, "$server = ?", wrap(serverName)) { cursor ->
|
||||||
cursor.getInt(lastInboxMessageServerId)
|
cursor.getInt(lastInboxMessageServerId)
|
||||||
}?.toLong()
|
}?.toLong()
|
||||||
@ -550,7 +550,7 @@ class LokiAPIDatabase(context: Context, helper: SQLCipherOpenHelper) : Database(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun getLastOutboxMessageId(serverName: String): Long? {
|
fun getLastOutboxMessageId(serverName: String): Long? {
|
||||||
val database = databaseHelper.writableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
return database.get(lastOutboxMessageServerIdTable, "$server = ?", wrap(serverName)) { cursor ->
|
return database.get(lastOutboxMessageServerIdTable, "$server = ?", wrap(serverName)) { cursor ->
|
||||||
cursor.getInt(lastOutboxMessageServerId)
|
cursor.getInt(lastOutboxMessageServerId)
|
||||||
}?.toLong()
|
}?.toLong()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user