mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-19 11:39:42 +01:00
Impl changes, unable to replicate 1.)
Signed-off-by: rapterjet2004 <juliuslinus1@gmail.com>
This commit is contained in:
parent
a8f1d37236
commit
490cd32c25
@ -150,6 +150,7 @@ class ChatViewModel @Inject constructor(
|
|||||||
|
|
||||||
object GetReminderStartState : ViewState
|
object GetReminderStartState : ViewState
|
||||||
open class GetReminderExistState(val reminder: Reminder) : ViewState
|
open class GetReminderExistState(val reminder: Reminder) : ViewState
|
||||||
|
object GetReminderStateSet : ViewState
|
||||||
|
|
||||||
private val _getReminderExistState: MutableLiveData<ViewState> = MutableLiveData(GetReminderStartState)
|
private val _getReminderExistState: MutableLiveData<ViewState> = MutableLiveData(GetReminderStartState)
|
||||||
|
|
||||||
@ -310,6 +311,10 @@ class ChatViewModel @Inject constructor(
|
|||||||
?.subscribe(GetReminderObserver())
|
?.subscribe(GetReminderObserver())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun overrideReminderState() {
|
||||||
|
_getReminderExistState.value = GetReminderStateSet
|
||||||
|
}
|
||||||
|
|
||||||
fun deleteReminder(user: User, roomToken: String, messageId: String, chatApiVersion: Int) {
|
fun deleteReminder(user: User, roomToken: String, messageId: String, chatApiVersion: Int) {
|
||||||
chatNetworkDataSource.deleteReminder(user, roomToken, messageId, chatApiVersion)
|
chatNetworkDataSource.deleteReminder(user, roomToken, messageId, chatApiVersion)
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
@ -754,7 +759,7 @@ class ChatViewModel @Inject constructor(
|
|||||||
val model = ConversationModel.mapToConversationModel(it, userProvider.currentUser.blockingGet())
|
val model = ConversationModel.mapToConversationModel(it, userProvider.currentUser.blockingGet())
|
||||||
ConversationUtils.isNoteToSelfConversation(model)
|
ConversationUtils.isNoteToSelfConversation(model)
|
||||||
}
|
}
|
||||||
_getNoteToSelfAvailability.value = NoteToSelfAvailableState(noteToSelf.token!!)
|
_getNoteToSelfAvailability.value = NoteToSelfAvailableState(noteToSelf.token)
|
||||||
} catch (e: NoSuchElementException) {
|
} catch (e: NoSuchElementException) {
|
||||||
_getNoteToSelfAvailability.value = NoteToSelfNotAvailableState
|
_getNoteToSelfAvailability.value = NoteToSelfNotAvailableState
|
||||||
Log.e(TAG, "Note to self not found $e")
|
Log.e(TAG, "Note to self not found $e")
|
||||||
|
@ -88,6 +88,9 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
@Inject
|
@Inject
|
||||||
lateinit var viewThemeUtils: ViewThemeUtils
|
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
|
@Composable
|
||||||
fun GetDateTimeDialog(shouldDismiss: MutableState<Boolean>, context: Context) {
|
fun GetDateTimeDialog(shouldDismiss: MutableState<Boolean>, context: Context) {
|
||||||
if (shouldDismiss.value) {
|
if (shouldDismiss.value) {
|
||||||
@ -144,7 +147,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
.weight(CUBED_PADDING)
|
.weight(CUBED_PADDING)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
"Delete",
|
stringResource(R.string.nc_delete),
|
||||||
color = Color.Red
|
color = Color.Red
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -163,7 +166,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(CUBED_PADDING)
|
.weight(CUBED_PADDING)
|
||||||
) {
|
) {
|
||||||
Text("Set")
|
Text(stringResource(R.string.set))
|
||||||
}
|
}
|
||||||
|
|
||||||
TextButton(
|
TextButton(
|
||||||
@ -173,7 +176,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.weight(CUBED_PADDING)
|
.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),
|
label = stringResource(R.string.later_today),
|
||||||
timeString = laterTodayStr
|
timeString = laterTodayStr
|
||||||
) {
|
) {
|
||||||
timeState.value = laterToday
|
setTime(laterToday)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,7 +227,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
label = stringResource(R.string.tomorrow),
|
label = stringResource(R.string.tomorrow),
|
||||||
timeString = tomorrowStr
|
timeString = tomorrowStr
|
||||||
) {
|
) {
|
||||||
timeState.value = tomorrow
|
setTime(tomorrow)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,7 +236,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
label = stringResource(R.string.this_weekend),
|
label = stringResource(R.string.this_weekend),
|
||||||
timeString = thisWeekendStr
|
timeString = thisWeekendStr
|
||||||
) {
|
) {
|
||||||
timeState.value = thisWeekend
|
setTime(thisWeekend)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -241,19 +244,24 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
label = stringResource(R.string.next_week),
|
label = stringResource(R.string.next_week),
|
||||||
timeString = nextWeekStr
|
timeString = nextWeekStr
|
||||||
) {
|
) {
|
||||||
timeState.value = nextWeek
|
setTime(nextWeek)
|
||||||
}
|
}
|
||||||
|
|
||||||
HorizontalDivider()
|
HorizontalDivider()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun setTime(localDateTime: LocalDateTime) {
|
||||||
|
timeState.value = localDateTime
|
||||||
|
chatViewModel.overrideReminderState()
|
||||||
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
private fun Header() {
|
private fun Header() {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.padding(INT_8.dp)
|
.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
|
val reminderState = chatViewModel.getReminderExistState
|
||||||
.asFlow()
|
.asFlow()
|
||||||
@ -269,6 +277,7 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
else -> {}
|
else -> {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (timeState.value != LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.MIN)) {
|
if (timeState.value != LocalDateTime.ofEpochSecond(0, 0, ZoneOffset.MIN)) {
|
||||||
Text(timeState.value.format(DateTimeFormatter.ofPattern(PATTERN)))
|
Text(timeState.value.format(DateTimeFormatter.ofPattern(PATTERN)))
|
||||||
}
|
}
|
||||||
@ -307,9 +316,12 @@ class DateTimeCompose(val bundle: Bundle) {
|
|||||||
val day = date.dayOfMonth
|
val day = date.dayOfMonth
|
||||||
val hour = timePickerState.hour
|
val hour = timePickerState.hour
|
||||||
val minute = timePickerState.minute
|
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 {
|
} else {
|
||||||
timeState.value = LocalDate.now().atTime(timePickerState.hour, timePickerState.minute)
|
val newTime = LocalDate.now().atTime(timePickerState.hour, timePickerState.minute)
|
||||||
|
setTime(newTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Submission(shouldDismiss)
|
Submission(shouldDismiss)
|
||||||
|
Loading…
Reference in New Issue
Block a user