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