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

Show discussion name.

parent 521f0a8b
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"formatVersion": 1, "formatVersion": 1,
"database": { "database": {
"version": 11, "version": 11,
"identityHash": "fb9f1c815809b0217d326452aeb34e92", "identityHash": "f0e15bc95a0bb09b052c484704dd3abd",
"entities": [ "entities": [
{ {
"tableName": "users", "tableName": "users",
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
}, },
{ {
"tableName": "chatrooms", "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": [ "fields": [
{ {
"fieldPath": "id", "fieldPath": "id",
...@@ -73,6 +73,12 @@ ...@@ -73,6 +73,12 @@
"affinity": "TEXT", "affinity": "TEXT",
"notNull": true "notNull": true
}, },
{
"fieldPath": "parentId",
"columnName": "parentId",
"affinity": "TEXT",
"notNull": false
},
{ {
"fieldPath": "type", "fieldPath": "type",
"columnName": "type", "columnName": "type",
...@@ -1099,7 +1105,7 @@ ...@@ -1099,7 +1105,7 @@
], ],
"setupQueries": [ "setupQueries": [
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)", "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( ...@@ -931,6 +931,7 @@ class ChatRoomPresenter @Inject constructor(
ChatRoom( ChatRoom(
id = id, id = id,
subscriptionId = subscriptionId, subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type), type = roomTypeOf(type),
unread = unread, unread = unread,
broadcast = broadcast ?: false, broadcast = broadcast ?: false,
...@@ -974,6 +975,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -974,6 +975,7 @@ class ChatRoomPresenter @Inject constructor(
ChatRoom( ChatRoom(
id = id, id = id,
subscriptionId = subscriptionId, subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type), type = roomTypeOf(type),
unread = unread, unread = unread,
broadcast = broadcast ?: false, broadcast = broadcast ?: false,
......
...@@ -173,6 +173,7 @@ class UiModelMapper @Inject constructor( ...@@ -173,6 +173,7 @@ class UiModelMapper @Inject constructor(
ChatRoom( ChatRoom(
id = id, id = id,
subscriptionId = subscriptionId, subscriptionId = subscriptionId,
parentId = parentId,
type = roomTypeOf(type), type = roomTypeOf(type),
unread = unread, unread = unread,
broadcast = broadcast ?: false, broadcast = broadcast ?: false,
......
...@@ -93,6 +93,7 @@ class ChatRoomsPresenter @Inject constructor( ...@@ -93,6 +93,7 @@ class ChatRoomsPresenter @Inject constructor(
val entity = ChatRoomEntity( val entity = ChatRoomEntity(
id = id, id = id,
subscriptionId = "", subscriptionId = "",
parentId = null,
type = type.toString(), type = type.toString(),
name = username ?: name.toString(), name = username ?: name.toString(),
fullname = name.toString(), fullname = name.toString(),
......
...@@ -475,6 +475,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) { ...@@ -475,6 +475,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) {
return ChatRoomEntity( return ChatRoomEntity(
id = room.id, id = room.id,
subscriptionId = subscription.id, subscriptionId = subscription.id,
parentId = subscription.parentId,
type = room.type.toString(), type = room.type.toString(),
name = room.name ?: subscription.name name = room.name ?: subscription.name
?: throw NullPointerException(), // this should be filtered on the SDK ?: throw NullPointerException(), // this should be filtered on the SDK
...@@ -516,6 +517,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) { ...@@ -516,6 +517,7 @@ class DatabaseManager(val context: Application, val serverUrl: String) {
return ChatRoomEntity( return ChatRoomEntity(
id = id, id = id,
subscriptionId = subscriptionId, subscriptionId = subscriptionId,
parentId = parentId,
type = type.toString(), type = type.toString(),
name = name, name = name,
fullname = fullName, fullname = fullName,
......
...@@ -25,7 +25,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter ...@@ -25,7 +25,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter
AttachmentFieldEntity::class, AttachmentActionEntity::class, UrlEntity::class, AttachmentFieldEntity::class, AttachmentActionEntity::class, UrlEntity::class,
ReactionEntity::class, MessagesSync::class ReactionEntity::class, MessagesSync::class
], ],
version = 11, version = 12,
exportSchema = true exportSchema = true
) )
@TypeConverters(StringListConverter::class) @TypeConverters(StringListConverter::class)
......
...@@ -26,6 +26,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter ...@@ -26,6 +26,7 @@ import chat.rocket.android.emoji.internal.db.StringListConverter
data class ChatRoomEntity( data class ChatRoomEntity(
@PrimaryKey var id: String, @PrimaryKey var id: String,
var subscriptionId: String, var subscriptionId: String,
var parentId: String?,
var type: String, var type: String,
var name: String, var name: String,
var fullname: String? = null, var fullname: String? = null,
......
...@@ -146,6 +146,7 @@ class DirectoryPresenter @Inject constructor( ...@@ -146,6 +146,7 @@ class DirectoryPresenter @Inject constructor(
val chatRoomEntity = ChatRoomEntity( val chatRoomEntity = ChatRoomEntity(
id = directMessage.id, id = directMessage.id,
parentId = null,
name = username, name = username,
description = null, description = null,
type = RoomType.DIRECT_MESSAGE, type = RoomType.DIRECT_MESSAGE,
......
...@@ -89,6 +89,7 @@ class UserDetailsPresenter @Inject constructor( ...@@ -89,6 +89,7 @@ class UserDetailsPresenter @Inject constructor(
val chatRoomEntity = ChatRoomEntity( val chatRoomEntity = ChatRoomEntity(
id = directMessage.id, id = directMessage.id,
name = userEntity.username ?: userEntity.name.orEmpty(), name = userEntity.username ?: userEntity.name.orEmpty(),
parentId = null,
description = null, description = null,
type = RoomType.DIRECT_MESSAGE, type = RoomType.DIRECT_MESSAGE,
fullname = userEntity.name, 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