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

Fix bug with lateinit property being not initialized.

parent 49eb678e
...@@ -123,7 +123,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -123,7 +123,7 @@ class ChatRoomPresenter @Inject constructor(
private var lastState = manager.state private var lastState = manager.state
private var typingStatusList = arrayListOf<String>() private var typingStatusList = arrayListOf<String>()
private val roomChangesChannel = Channel<Room>(Channel.CONFLATED) private val roomChangesChannel = Channel<Room>(Channel.CONFLATED)
private lateinit var unfinishedMessageKey: String private lateinit var draftKey: String
fun setupChatRoom( fun setupChatRoom(
roomId: String, roomId: String,
...@@ -131,17 +131,17 @@ class ChatRoomPresenter @Inject constructor( ...@@ -131,17 +131,17 @@ class ChatRoomPresenter @Inject constructor(
roomType: String, roomType: String,
chatRoomMessage: String? = null chatRoomMessage: String? = null
) { ) {
draftKey = "${currentServer}_${LocalRepository.DRAFT_KEY}$roomId"
chatRoomId = roomId
chatRoomType = roomType
launch(CommonPool + strategy.jobs) { launch(CommonPool + strategy.jobs) {
try { try {
unfinishedMessageKey = "${currentServer}_${LocalRepository.UNFINISHED_MSG_KEY}$roomId"
chatRoomId = roomId
chatRoomType = roomType
chatRoles = if (roomTypeOf(roomType) !is RoomType.DirectMessage) { chatRoles = if (roomTypeOf(roomType) !is RoomType.DirectMessage) {
client.chatRoomRoles(roomType = roomTypeOf(roomType), roomName = roomName) client.chatRoomRoles(roomType = roomTypeOf(roomType), roomName = roomName)
} else { } else {
emptyList() emptyList()
} }
} catch (ex: RocketChatException) { } catch (ex: Exception) {
Timber.e(ex) Timber.e(ex)
chatRoles = emptyList() chatRoles = emptyList()
} finally { } finally {
...@@ -187,7 +187,6 @@ class ChatRoomPresenter @Inject constructor( ...@@ -187,7 +187,6 @@ class ChatRoomPresenter @Inject constructor(
} }
} }
} }
} }
} }
...@@ -919,7 +918,7 @@ class ChatRoomPresenter @Inject constructor( ...@@ -919,7 +918,7 @@ class ChatRoomPresenter @Inject constructor(
navigator.toChatDetails(chatRoomId, chatRoomType, isSubscribed, isMenuDisabled) navigator.toChatDetails(chatRoomId, chatRoomType, isSubscribed, isMenuDisabled)
} }
fun loadChatRooms() { fun loadChatRoomsSuggestions() {
launchUI(strategy) { launchUI(strategy) {
try { try {
val chatRooms = getChatRoomsAsync() val chatRooms = getChatRoomsAsync()
...@@ -1297,12 +1296,12 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1297,12 +1296,12 @@ class ChatRoomPresenter @Inject constructor(
*/ */
fun saveUnfinishedMessage(unfinishedMessage: String) { fun saveUnfinishedMessage(unfinishedMessage: String) {
if (unfinishedMessage.isNotBlank()) { if (unfinishedMessage.isNotBlank()) {
localRepository.save(unfinishedMessageKey, unfinishedMessage) localRepository.save(draftKey, unfinishedMessage)
} }
} }
fun clearUnfinishedMessage() { fun clearUnfinishedMessage() {
localRepository.clear(unfinishedMessageKey) localRepository.clear(draftKey)
} }
/** /**
* Get unfinished message from local repository, when user left chat room without * Get unfinished message from local repository, when user left chat room without
...@@ -1311,6 +1310,6 @@ class ChatRoomPresenter @Inject constructor( ...@@ -1311,6 +1310,6 @@ class ChatRoomPresenter @Inject constructor(
* @return Returns the unfinished message, null otherwise. * @return Returns the unfinished message, null otherwise.
*/ */
fun getUnfinishedMessage(): String? { fun getUnfinishedMessage(): String? {
return localRepository.get(unfinishedMessageKey) return localRepository.get(draftKey)
} }
} }
...@@ -27,7 +27,7 @@ interface LocalRepository { ...@@ -27,7 +27,7 @@ interface LocalRepository {
const val SETTINGS_KEY = "settings_" const val SETTINGS_KEY = "settings_"
const val PERMISSIONS_KEY = "permissions_" const val PERMISSIONS_KEY = "permissions_"
const val USER_KEY = "user_" const val USER_KEY = "user_"
const val UNFINISHED_MSG_KEY = "unfinished_msg_" const val DRAFT_KEY = "draft"
const val CURRENT_USERNAME_KEY = "username_" const val CURRENT_USERNAME_KEY = "username_"
const val LAST_CHATROOMS_REFRESH = "_chatrooms_refresh" const val LAST_CHATROOMS_REFRESH = "_chatrooms_refresh"
} }
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
<string name="msg_send">Sende</string> <string name="msg_send">Sende</string>
<string name="msg_sent_attachment">Sende Anhang</string> <string name="msg_sent_attachment">Sende Anhang</string>
<string name="msg_welcome_to_rocket_chat">Willkommen bei Rocket.Chat</string> <string name="msg_welcome_to_rocket_chat">Willkommen bei Rocket.Chat</string>
<string name="msg_team_communication">Open Source-Kommunikation</string> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Einloggen mit <b>e-mail</b></string> <string name="msg_login_with_email">Einloggen mit <b>e-mail</b></string>
<string name="msg_create_account">Ein Konto erstellen</string> <string name="msg_create_account">Ein Konto erstellen</string>
<string name="msg_continue_with_facebook">Weitermachen mit <b>Facebook</b></string> <string name="msg_continue_with_facebook">Weitermachen mit <b>Facebook</b></string>
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
<string name="msg_delete_description">Seguro que quieres borrar este mensaje</string> <string name="msg_delete_description">Seguro que quieres borrar este mensaje</string>
<string name="msg_no_search_found">No se han encontrado resultados</string> <string name="msg_no_search_found">No se han encontrado resultados</string>
<string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation --> <string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation -->
<string name="msg_team_communication">Open Source Communication</string> <!-- TODO Add translation --> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation --> <string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation -->
<string name="msg_create_account">Create an account</string> <!-- TODO Add translation --> <string name="msg_create_account">Create an account</string> <!-- TODO Add translation -->
<string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation --> <string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation -->
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<string name="msg_delete_message">Supprimer Message</string> <string name="msg_delete_message">Supprimer Message</string>
<string name="msg_delete_description">Êtes-vous sûr de vouloir supprimer ce message</string> <string name="msg_delete_description">Êtes-vous sûr de vouloir supprimer ce message</string>
<string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation --> <string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation -->
<string name="msg_team_communication">Open Source Communication</string> <!-- TODO Add translation --> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation --> <string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation -->
<string name="msg_create_account">Create an account</string> <!-- TODO Add translation --> <string name="msg_create_account">Create an account</string> <!-- TODO Add translation -->
<string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation --> <string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation -->
......
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
<string name="msg_delete_message">संदेश को हटाएं</string> <string name="msg_delete_message">संदेश को हटाएं</string>
<string name="msg_delete_description">क्या आप निश्चित रूप से यह संदेश हटाना चाहते हैं</string> <string name="msg_delete_description">क्या आप निश्चित रूप से यह संदेश हटाना चाहते हैं</string>
<string name="msg_welcome_to_rocket_chat">Rocket.Chat में आपका स्वागत है</string> <string name="msg_welcome_to_rocket_chat">Rocket.Chat में आपका स्वागत है</string>
<string name="msg_team_communication">ओपन सोर्स कम्युनिकेशन</string> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">ई-मेल के साथ लॉगिन करें</string> <string name="msg_login_with_email">ई-मेल के साथ लॉगिन करें</string>
<string name="msg_create_account">खाता बनाएं</string> <string name="msg_create_account">खाता बनाएं</string>
<string name="msg_continue_with_facebook"><b>Facebook</b> के साथ जारी रखें</string> <string name="msg_continue_with_facebook"><b>Facebook</b> के साथ जारी रखें</string>
......
...@@ -146,7 +146,7 @@ ...@@ -146,7 +146,7 @@
<string name="msg_send">Inviare</string> <string name="msg_send">Inviare</string>
<string name="msg_sent_attachment">Inviato allegato</string> <string name="msg_sent_attachment">Inviato allegato</string>
<string name="msg_welcome_to_rocket_chat">Benvenuto in Rocket.Chat </string> <string name="msg_welcome_to_rocket_chat">Benvenuto in Rocket.Chat </string>
<string name="msg_team_communication">Team Communication</string> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Accedi con <b>e-mail</b></string> <string name="msg_login_with_email">Accedi con <b>e-mail</b></string>
<string name="msg_create_account">Crea un utente</string> <string name="msg_create_account">Crea un utente</string>
<string name="msg_continue_with_facebook">Continua con <b>Facebook</b></string> <string name="msg_continue_with_facebook">Continua con <b>Facebook</b></string>
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<string name="msg_send">送信</string> <string name="msg_send">送信</string>
<string name="msg_sent_attachment">添付ファイルを送信しました</string> <string name="msg_sent_attachment">添付ファイルを送信しました</string>
<string name="msg_welcome_to_rocket_chat">Rocket.Chatへようこそ</string> <string name="msg_welcome_to_rocket_chat">Rocket.Chatへようこそ</string>
<string name="msg_team_communication">チームコミュニケーション</string> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email"><b>e-mail</b>でログイン</string> <string name="msg_login_with_email"><b>e-mail</b>でログイン</string>
<string name="msg_create_account">アカウントを作成</string> <string name="msg_create_account">アカウントを作成</string>
<string name="msg_continue_with_facebook"><b>Facebook</b>でログイン</string> <string name="msg_continue_with_facebook"><b>Facebook</b>でログイン</string>
......
...@@ -151,7 +151,7 @@ ...@@ -151,7 +151,7 @@
<string name="msg_delete_message">Remove mensagem</string> <string name="msg_delete_message">Remove mensagem</string>
<string name="msg_delete_description">Tem certeza que quer apagar esta mensagem?</string> <string name="msg_delete_description">Tem certeza que quer apagar esta mensagem?</string>
<string name="msg_welcome_to_rocket_chat">Bem-vindo ao Rocket.Chat</string> <string name="msg_welcome_to_rocket_chat">Bem-vindo ao Rocket.Chat</string>
<string name="msg_team_communication">Comunicação Open Source</string> <string name="msg_team_communication">Comunicação para equipes</string>
<string name="msg_login_with_email">Fazer login com <b>e-mail</b></string> <string name="msg_login_with_email">Fazer login com <b>e-mail</b></string>
<string name="msg_create_account">Criar conta</string> <string name="msg_create_account">Criar conta</string>
<string name="msg_continue_with_facebook">Continuar com <b>Facebook</b></string> <string name="msg_continue_with_facebook">Continuar com <b>Facebook</b></string>
......
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
<string name="msg_channel_name">Название канала</string> <string name="msg_channel_name">Название канала</string>
<string name="msg_search">Поиск</string> <string name="msg_search">Поиск</string>
<string name="msg_welcome_to_rocket_chat">Rocket.Chat</string> <string name="msg_welcome_to_rocket_chat">Rocket.Chat</string>
<string name="msg_team_communication">Чат с открытым исходным кодом</string> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Войти с помощью <b>e-mail</b></string> <string name="msg_login_with_email">Войти с помощью <b>e-mail</b></string>
<string name="msg_create_account">Создать аккаунт</string> <string name="msg_create_account">Создать аккаунт</string>
<string name="msg_continue_with_facebook">Войти с помощью <b>Facebook</b></string> <string name="msg_continue_with_facebook">Войти с помощью <b>Facebook</b></string>
......
...@@ -150,7 +150,7 @@ ...@@ -150,7 +150,7 @@
<string name="msg_send">Gönder</string> <string name="msg_send">Gönder</string>
<string name="msg_sent_attachment">Bir dosya eki gönderildi</string> <string name="msg_sent_attachment">Bir dosya eki gönderildi</string>
<string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation --> <string name="msg_welcome_to_rocket_chat">Welcome to Rocket.Chat</string> <!-- TODO Add translation -->
<string name="msg_team_communication">Team Communication</string> <!-- TODO Add translation --> <string name="msg_team_communication">Team Communication</string> <!-- TODO Translate -->
<string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation --> <string name="msg_login_with_email">Login with <b>e-mail</b></string> <!-- TODO Add translation -->
<string name="msg_create_account">Create an account</string> <!-- TODO Add translation --> <string name="msg_create_account">Create an account</string> <!-- TODO Add translation -->
<string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation --> <string name="msg_continue_with_facebook">Continue with <b>Facebook</b></string> <!-- TODO Add translation -->
......
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