Align messages to correct side in list

This commit is contained in:
Moez Bhatti
2017-07-08 20:51:50 -04:00
parent d8eb265321
commit 3de1229de6
4 changed files with 67 additions and 15 deletions
@@ -77,12 +77,23 @@ internal object MessageSyncManager {
Realm.getDefaultInstance().executeTransaction {
while (cursor.moveToNext()) {
val body = cursor.getString(columnsMap.mColumnSmsBody) ?: ""
val type = cursor.getString(columnsMap.mColumnMsgType)
if (type != "sms" && type != "mms") continue // If we can't read the type, don't use this message
it.insertOrUpdate(Message(
cursor.getLong(columnsMap.mColumnMsgId),
threadId,
body))
val isMms = type == "mms"
val body = cursor.getString(columnsMap.mColumnSmsBody) ?: ""
val errorType = cursor.getInt(columnsMap.mColumnMmsErrorType)
val boxId: Int
if (isMms) {
boxId = cursor.getInt(columnsMap.mColumnMmsMessageBox)
} else {
boxId = cursor.getInt(columnsMap.mColumnSmsType)
}
it.insertOrUpdate(
Message(cursor.getLong(columnsMap.mColumnMsgId), threadId, boxId, type, body, errorType))
}
}