Commit a051ca4c authored by Filipe de Lima Brito's avatar Filipe de Lima Brito

Show discussion name.

parent 521f0a8b
......@@ -2,7 +2,7 @@
"formatVersion": 1,
"database": {
"version": 11,
"identityHash": "fb9f1c815809b0217d326452aeb34e92",
"identityHash": "f0e15bc95a0bb09b052c484704dd3abd",
"entities": [
{
"tableName": "users",
......@@ -59,7 +59,7 @@
},
{
"tableName": "chatrooms",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `subscriptionId` TEXT NOT NULL, `type` TEXT NOT NULL, `name` TEXT NOT NULL, `fullname` TEXT, `userId` TEXT, `ownerId` TEXT, `readonly` INTEGER, `isDefault` INTEGER, `favorite` INTEGER, `topic` TEXT, `announcement` TEXT, `description` TEXT, `open` INTEGER NOT NULL, `alert` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `userMentions` INTEGER, `groupMentions` INTEGER, `updatedAt` INTEGER, `timestamp` INTEGER, `lastSeen` INTEGER, `lastMessageText` TEXT, `lastMessageUserId` TEXT, `lastMessageTimestamp` INTEGER, `broadcast` INTEGER, `muted` TEXT, PRIMARY KEY(`id`), FOREIGN KEY(`ownerId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`userId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`lastMessageUserId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` TEXT NOT NULL, `subscriptionId` TEXT NOT NULL, `parentId` TEXT, `type` TEXT NOT NULL, `name` TEXT NOT NULL, `fullname` TEXT, `userId` TEXT, `ownerId` TEXT, `readonly` INTEGER, `isDefault` INTEGER, `favorite` INTEGER, `topic` TEXT, `announcement` TEXT, `description` TEXT, `open` INTEGER NOT NULL, `alert` INTEGER NOT NULL, `unread` INTEGER NOT NULL, `userMentions` INTEGER, `groupMentions` INTEGER, `updatedAt` INTEGER, `timestamp` INTEGER, `lastSeen` INTEGER, `lastMessageText` TEXT, `lastMessageUserId` TEXT, `lastMessageTimestamp` INTEGER, `broadcast` INTEGER, `muted` TEXT, PRIMARY KEY(`id`), FOREIGN KEY(`ownerId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`userId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION , FOREIGN KEY(`lastMessageUserId`) REFERENCES `users`(`id`) ON UPDATE NO ACTION ON DELETE NO ACTION )",
"fields": [
{
"fieldPath": "id",
......@@ -73,6 +73,12 @@
"affinity": "TEXT",
"notNull": true
},
{
"fieldPath": "parentId",
"columnName": "parentId",
"affinity": "TEXT",
"notNull": false
},
{
"fieldPath": "type",
"columnName": "type",
......@@ -1099,7 +1105,7 @@
],
"setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"fb9f1c815809b0217d326452aeb34e92\")"
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, \"f0e15bc95a0bb09b052c484704dd3abd\")"
]
}
}
\ No newline at end of file
This diff is collapsed.
......@@ -931,6 +931,7 @@ class ChatRoomPresenter @Inject constructor(
ChatRoom(
id = id,
subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type),
unread = unread,
broadcast = broadcast ?: false,
......@@ -974,6 +975,7 @@ class ChatRoomPresenter @Inject constructor(
ChatRoom(
id = id,
subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type),
unread = unread,
broadcast = broadcast ?: false,
......
......@@ -173,6 +173,7 @@ class UiModelMapper @Inject constructor(
ChatRoom(
id = id,
subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type),
unread = unread,
broadcast = broadcast ?: false,
......
......@@ -93,6 +93,7 @@ class ChatRoomsPresenter @Inject constructor(
val entity = ChatRoomEntity(
id = id,
subscriptionId = "",
parentId = null,
type = type.toString(),
name = username ?: name.toString(),
fullname = name.toString(),
......
......@@ -475,6 +475,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) {
return ChatRoomEntity(
id = room.id,
subscriptionId = subscription.id,
parentId = subscription.parentId,
type = room.type.toString(),
name = room.name ?: subscription.name
?: throw NullPointerException(), // this should be filtered on the SDK
......@@ -516,6 +517,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) {
return ChatRoomEntity(
id = id,
subscriptionId = subscriptionId,
parentId = parentId,
type = type.toString(),
name = name,
fullname = fullName,
......
......@@ -25,7 +25,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter
AttachmentFieldEntity::class, AttachmentActionEntity::class, UrlEntity::class,
ReactionEntity::class, MessagesSync::class
],
version = 11,
version = 12,
exportSchema = true
)
@TypeConverters(StringListConverter::class)
......
......@@ -26,6 +26,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter
data class ChatRoomEntity(
@PrimaryKey var id: String,
var subscriptionId: String,
var parentId: String?,
var type: String,
var name: String,
var fullname: String? = null,
......
......@@ -146,6 +146,7 @@ class DirectoryPresenter @Inject constructor(
val chatRoomEntity = ChatRoomEntity(
id = directMessage.id,
parentId = null,
name = username,
description = null,
type = RoomType.DIRECT_MESSAGE,
......
......@@ -89,6 +89,7 @@ class UserDetailsPresenter @Inject constructor(
val chatRoomEntity = ChatRoomEntity(
id = directMessage.id,
name = userEntity.username ?: userEntity.name.orEmpty(),
parentId = null,
description = null,
type = RoomType.DIRECT_MESSAGE,
fullname = userEntity.name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment