mirror of
https://github.com/ChronosX88/Influence.git
synced 2024-12-27 08:41:45 +00:00
Added checking interlocutor's JID before saving chat
This commit is contained in:
parent
77c97cf012
commit
65bb540110
@ -17,6 +17,7 @@
|
||||
package io.github.chronosx88.influence.presenters
|
||||
|
||||
import android.content.Intent
|
||||
import io.github.chronosx88.influence.R
|
||||
import io.github.chronosx88.influence.contracts.CoreContracts
|
||||
import io.github.chronosx88.influence.helpers.AppHelper
|
||||
import io.github.chronosx88.influence.helpers.LocalDBWrapper
|
||||
@ -36,7 +37,11 @@ class MainPresenter(private val view: CoreContracts.IMainViewContract) : CoreCon
|
||||
}
|
||||
|
||||
override fun startChatWithPeer(username: String) {
|
||||
LocalDBWrapper.createChatEntry(username, username)
|
||||
if(!username.contains("@")) {
|
||||
view.showSnackbar(AppHelper.getContext().getString(R.string.invalid_jid_error))
|
||||
return
|
||||
}
|
||||
LocalDBWrapper.createChatEntry(username, username.split("@")[0])
|
||||
EventBus.getDefault().post(NewChatEvent(username))
|
||||
}
|
||||
|
||||
|
@ -23,4 +23,5 @@
|
||||
<string name="hint_enter_a_message">Введите сообщение...</string>
|
||||
<string name="logout">Выйти из аккаунта</string>
|
||||
<string name="sign_in_button">Войти</string>
|
||||
<string name="invalid_jid_error">Неверный JabberID!</string>
|
||||
</resources>
|
@ -22,4 +22,5 @@
|
||||
<string name="hint_enter_a_message">Enter message...</string>
|
||||
<string name="logout">Log out from account</string>
|
||||
<string name="sign_in_button">Sign In</string>
|
||||
<string name="invalid_jid_error">Invalid JabberID!</string>
|
||||
</resources>
|
||||
|
Loading…
Reference in New Issue
Block a user