Impl changes, unable to replicate 1.)

Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
rapterjet2004 2025-01-06 20:28:57 -06:00 committed by Marcel Hibbe
parent a8f1d37236
commit 490cd32c25
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
2 changed files with 28 additions and 11 deletions

View File

@ -150,6 +150,7 @@ class ChatViewModel @Inject constructor(
object GetReminderStartState : ViewState
open class GetReminderExistState(val reminder: Reminder) : ViewState
object GetReminderStateSet : ViewState
private val _getReminderExistState: MutableLiveData<ViewState> = MutableLiveData(GetReminderStartState)
@ -310,6 +311,10 @@ class ChatViewModel @Inject constructor(
?.subscribe(GetReminderObserver())
}
fun overrideReminderState() {
_getReminderExistState.value = GetReminderStateSet
}
fun deleteReminder(user: User, roomToken: String, messageId: String, chatApiVersion: Int) {
chatNetworkDataSource.deleteReminder(user, roomToken, messageId, chatApiVersion)
.subscribeOn(Schedulers.io())
@ -754,7 +759,7 @@ class ChatViewModel @Inject constructor(
val model = ConversationModel.mapToConversationModel(it, userProvider.currentUser.blockingGet())
ConversationUtils.isNoteToSelfConversation(model)
}
_getNoteToSelfAvailability.value = NoteToSelfAvailableState(noteToSelf.token!!)
_getNoteToSelfAvailability.value = NoteToSelfAvailableState(noteToSelf.token)
} catch (e: NoSuchElementException) {
_getNoteToSelfAvailability.value = NoteToSelfNotAvailableState
Log.e(TAG, "Note to self not found $e")

View File

@ -88,6 +88,9 @@ class DateTimeCompose(val bundle: Bundle) {
@Inject
lateinit var viewThemeUtils: ViewThemeUtils
// TODO, can't seem to replicate 1.) on Sow's comment
// TODO make an issue out of the problem I gave marcel
@Composable
fun GetDateTimeDialog(shouldDismiss: MutableState<Boolean>, context: Context) {
if (shouldDismiss.value) {
@ -144,7 +147,7 @@ class DateTimeCompose(val bundle: Bundle) {
.weight(CUBED_PADDING)
) {
Text(
"Delete",
stringResource(R.string.nc_delete),
color = Color.Red
)
}
@ -163,7 +166,7 @@ class DateTimeCompose(val bundle: Bundle) {
modifier = Modifier
.weight(CUBED_PADDING)
) {
Text("Set")
Text(stringResource(R.string.set))
}
TextButton(
@ -173,7 +176,7 @@ class DateTimeCompose(val bundle: Bundle) {
modifier = Modifier
.weight(CUBED_PADDING)
) {
Text("Close")
Text(stringResource(R.string.close))
}
}
}
@ -215,7 +218,7 @@ class DateTimeCompose(val bundle: Bundle) {
label = stringResource(R.string.later_today),
timeString = laterTodayStr
) {
timeState.value = laterToday
setTime(laterToday)
}
}
@ -224,7 +227,7 @@ class DateTimeCompose(val bundle: Bundle) {
label = stringResource(R.string.tomorrow),
timeString = tomorrowStr
) {
timeState.value = tomorrow
setTime(tomorrow)
}
}
@ -233,7 +236,7 @@ class DateTimeCompose(val bundle: Bundle) {
label = stringResource(R.string.this_weekend),
timeString = thisWeekendStr
) {
timeState.value = thisWeekend
setTime(thisWeekend)
}
}
@ -241,19 +244,24 @@ class DateTimeCompose(val bundle: Bundle) {
label = stringResource(R.string.next_week),
timeString = nextWeekStr
) {
timeState.value = nextWeek
setTime(nextWeek)
}
HorizontalDivider()
}
private fun setTime(localDateTime: LocalDateTime) {
timeState.value = localDateTime
chatViewModel.overrideReminderState()
}
@Composable
private fun Header() {
Row(
modifier = Modifier
.padding(INT_8.dp)
) {
Text("Remind Me Later", modifier = Modifier.weight(1f))
Text(stringResource(R.string.nc_remind), modifier = Modifier.weight(1f))
val reminderState = chatViewModel.getReminderExistState
.asFlow()
@ -269,6 +277,7 @@ class DateTimeCompose(val bundle: Bundle) {
else -> {}
}
if (timeState.value != LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.MIN)) {
Text(timeState.value.format(DateTimeFormatter.ofPattern(PATTERN)))
}
@ -307,9 +316,12 @@ class DateTimeCompose(val bundle: Bundle) {
val day = date.dayOfMonth
val hour = timePickerState.hour
val minute = timePickerState.minute
timeState.value = LocalDateTime.of(year, month, day, hour, minute)
val newTime = LocalDateTime.of(year, month, day, hour, minute)
setTime(newTime)
} else {
timeState.value = LocalDate.now().atTime(timePickerState.hour, timePickerState.minute)
val newTime = LocalDate.now().atTime(timePickerState.hour, timePickerState.minute)
setTime(newTime)
}
}
Submission(shouldDismiss)