diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt index 9c07846f..c3caa97a 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeActivity.kt @@ -124,6 +124,7 @@ import kotlinx.android.synthetic.main.compose_activity.scheduleLabel import kotlinx.android.synthetic.main.compose_activity.scheduledCancel import kotlinx.android.synthetic.main.compose_activity.scheduledGroup import kotlinx.android.synthetic.main.compose_activity.scheduledTime +import kotlinx.android.synthetic.main.compose_activity.scheduledSend import kotlinx.android.synthetic.main.compose_activity.send import kotlinx.android.synthetic.main.compose_activity.sendAsGroup import kotlinx.android.synthetic.main.compose_activity.sendAsGroupBackground @@ -182,7 +183,7 @@ class ComposeActivity : QkThemedActivity(), ComposeView { override val scheduleSelectedIntent: Subject = PublishSubject.create() override val changeSimIntent by lazy { sim.clicks() } override val scheduleCancelIntent by lazy { scheduledCancel.clicks() } - override val sendIntent by lazy { send.clicks() } + override val sendIntent by lazy { Observable.merge(send.clicks(), scheduledSend.clicks()) } override val viewQksmsPlusIntent: Subject = PublishSubject.create() override val backPressedIntent: Subject = PublishSubject.create() override val confirmDeleteIntent: Subject> = PublishSubject.create() @@ -532,9 +533,10 @@ class ComposeActivity : QkThemedActivity(), ComposeView { sim.contentDescription = getString(R.string.compose_sim_cd, state.subscription?.displayName) simIndex.text = state.subscription?.simSlotIndex?.plus(1)?.toString() - // show either send or audio msg record button - send.visibility = if (state.canSend && !state.loading) View.VISIBLE else View.INVISIBLE + // show either send, audio msg record, or sendScheduled button + send.visibility = if (state.canSend && !state.loading && state.scheduled == 0L) View.VISIBLE else View.INVISIBLE recordAudioMsg.visibility = if (state.canSend && !state.loading) View.INVISIBLE else View.VISIBLE + scheduledSend.visibility = if (state.canSend && (state.scheduled != 0L) && !state.loading) View.VISIBLE else View.INVISIBLE // if not in editing mode, and there are no non-me participants that can be sent to, // hide controls that allow constructing a reply and inform user no valid recipients diff --git a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt index 572bd434..64077b07 100644 --- a/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt +++ b/presentation/src/main/java/com/moez/QKSMS/feature/compose/ComposeViewModel.kt @@ -834,7 +834,8 @@ class ComposeViewModel @Inject constructor( .subscribe { newState { copy( - canSend = (it.first.isNotBlank() || (it.second > 0)) || (it.third > 0) + canSend = (it.first.isNotBlank() || (it.second > 0)), + scheduled = it.third ) } } diff --git a/presentation/src/main/res/layout/compose_activity.xml b/presentation/src/main/res/layout/compose_activity.xml index 0fb27f70..0c1a5b1c 100644 --- a/presentation/src/main/res/layout/compose_activity.xml +++ b/presentation/src/main/res/layout/compose_activity.xml @@ -347,6 +347,21 @@ app:tint="?android:textColorSecondary" tools:visibility="visible" /> + + Sending on December 23rd  Schedule a message + Schedule this message Scheduled message Missing