mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-29 04:55:15 +00:00
refactor: merge changes, re-add the group check in unapproved messages
This commit is contained in:
parent
4843d42643
commit
82bffcbf2f
@ -199,25 +199,6 @@ class MmsDatabase(context: Context, databaseHelper: SQLCipherOpenHelper) : Messa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(RecipientFormattingException::class, MmsException::class)
|
|
||||||
private fun getThreadIdFor(retrieved: IncomingMediaMessage): Long {
|
|
||||||
return if (retrieved.groupId != null) {
|
|
||||||
val groupRecipients = Recipient.from(
|
|
||||||
context,
|
|
||||||
retrieved.groupId,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
get(context).threadDatabase().getOrCreateThreadIdFor(groupRecipients)
|
|
||||||
} else {
|
|
||||||
val sender = Recipient.from(
|
|
||||||
context,
|
|
||||||
retrieved.from,
|
|
||||||
true
|
|
||||||
)
|
|
||||||
get(context).threadDatabase().getOrCreateThreadIdFor(sender)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun rawQuery(where: String, arguments: Array<String>?): Cursor {
|
private fun rawQuery(where: String, arguments: Array<String>?): Cursor {
|
||||||
val database = databaseHelper.readableDatabase
|
val database = databaseHelper.readableDatabase
|
||||||
return database.rawQuery(
|
return database.rawQuery(
|
||||||
|
@ -439,9 +439,12 @@ public class ThreadDatabase extends Database {
|
|||||||
String query = "SELECT COUNT (*) FROM " + TABLE_NAME +
|
String query = "SELECT COUNT (*) FROM " + TABLE_NAME +
|
||||||
" LEFT OUTER JOIN " + RecipientDatabase.TABLE_NAME +
|
" LEFT OUTER JOIN " + RecipientDatabase.TABLE_NAME +
|
||||||
" ON " + TABLE_NAME + "." + ADDRESS + " = " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.ADDRESS +
|
" ON " + TABLE_NAME + "." + ADDRESS + " = " + RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.ADDRESS +
|
||||||
|
" LEFT OUTER JOIN " + GroupDatabase.TABLE_NAME +
|
||||||
|
" ON " + TABLE_NAME + "." + ADDRESS + " = " + GroupDatabase.TABLE_NAME + "." + GROUP_ID +
|
||||||
" WHERE " + MESSAGE_COUNT + " != 0 AND " + ARCHIVED + " = 0 AND " + HAS_SENT + " = 0 AND " + MESSAGE_COUNT + " = " + UNREAD_COUNT + " AND " +
|
" WHERE " + MESSAGE_COUNT + " != 0 AND " + ARCHIVED + " = 0 AND " + HAS_SENT + " = 0 AND " + MESSAGE_COUNT + " = " + UNREAD_COUNT + " AND " +
|
||||||
RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.BLOCK + " = 0 AND " +
|
RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.BLOCK + " = 0 AND " +
|
||||||
RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.APPROVED + " = 0";
|
RecipientDatabase.TABLE_NAME + "." + RecipientDatabase.APPROVED + " = 0 AND " +
|
||||||
|
GroupDatabase.TABLE_NAME + "." + GROUP_ID + " IS NULL";
|
||||||
cursor = db.rawQuery(query, null);
|
cursor = db.rawQuery(query, null);
|
||||||
|
|
||||||
if (cursor != null && cursor.moveToFirst())
|
if (cursor != null && cursor.moveToFirst())
|
||||||
|
Loading…
Reference in New Issue
Block a user