mirror of
https://github.com/quik-sms/quik.git
synced 2026-11-17 11:38:51 +01:00
Add ability to forward message
This commit is contained in:
@@ -22,8 +22,9 @@ class Navigator @Inject constructor(val context: Context) {
|
||||
context.startActivity(intent)
|
||||
}
|
||||
|
||||
fun showCompose() {
|
||||
fun showCompose(body: String? = null) {
|
||||
val intent = Intent(context, ComposeActivity::class.java)
|
||||
intent.putExtra("body", body)
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
@@ -55,7 +56,8 @@ class Navigator @Inject constructor(val context: Context) {
|
||||
|
||||
ComposeViewModel::class.java -> {
|
||||
val threadId = intent.getLongExtra("threadId", 0)
|
||||
ComposeViewModel(threadId)
|
||||
val body = intent.getStringExtra("body") ?: ""
|
||||
ComposeViewModel(threadId, body)
|
||||
}
|
||||
|
||||
SettingsViewModel::class.java -> {
|
||||
|
||||
@@ -24,7 +24,8 @@ import io.reactivex.subjects.PublishSubject
|
||||
import io.reactivex.subjects.Subject
|
||||
import javax.inject.Inject
|
||||
|
||||
class ComposeViewModel(threadId: Long) : QkViewModel<ComposeView, ComposeState>(ComposeState(editingMode = threadId == 0L)) {
|
||||
class ComposeViewModel(threadId: Long, body: String)
|
||||
: QkViewModel<ComposeView, ComposeState>(ComposeState(editingMode = threadId == 0L, draft = body)) {
|
||||
|
||||
@Inject lateinit var context: Context
|
||||
@Inject lateinit var contactFilter: ContactFilter
|
||||
@@ -182,6 +183,11 @@ class ComposeViewModel(threadId: Long) : QkViewModel<ComposeView, ComposeState>(
|
||||
context.makeToast(R.string.toast_copied)
|
||||
}
|
||||
|
||||
// Forward the message
|
||||
intents += view.forwardMessageIntent.subscribe { message ->
|
||||
navigator.showCompose(message.body)
|
||||
}
|
||||
|
||||
// Delete the selected message
|
||||
intents += view.deleteMessageIntent.subscribe { message ->
|
||||
deleteMessage.execute(message.id)
|
||||
|
||||
Reference in New Issue
Block a user