Closed migulen closed 1 month ago
The problem is somewhere near here...
But i don't give with the hint.
It's like something it's not correctly compared. It ALWAYS selects the nearest day that is "the same weekday that today is".
I hope it helps. This function to remember messages it's very useful.
Thanks in advance
@mahibi @sowjanyakch @rapterjet2004 @parneet-guraya , can you take a look at this?
private fun setUpTimePicker(year: Int, month: Int, day: Int, weekInYear: Int) { val locale = if (DateFormat.is24HourFormat(requireContext())) TimeFormat.CLOCK_24H else TimeFormat.CLOCK_12H val timePicker = MaterialTimePicker.Builder() .setTitleText(R.string.nc_remind) .setTimeFormat(locale) .build()
timePicker.addOnPositiveButtonClickListener {
val timestamp = getTimeFromCalendar(
year,
month,
day,
timePicker.hour,
timePicker.minute,
weekInYear = weekInYear <------HERE
)
setTimeStamp(getTimeFromTimeStamp(timestamp))
currentTimeStamp = timestamp / ONE_SEC
}
timePicker.show(this.parentFragmentManager, TAG)
}
/**
* You can use `weekDay` or `daysToAdd` or neither but don't use both b/c it messes up the calendar <----HERE
*/
@Suppress("LongParameterList")
private fun getTimeFromCalendar(
year: Int = Calendar.getInstance().get(Calendar.YEAR),
month: Int = Calendar.getInstance().get(Calendar.MONTH),
day: Int = Calendar.getInstance().get(Calendar.DAY_OF_YEAR),
hour: Int = Calendar.getInstance().get(Calendar.HOUR_OF_DAY),
minute: Int = Calendar.getInstance().get(Calendar.MINUTE),
daysToAdd: Int = 0,
weekInYear: Int = Calendar.getInstance().get(Calendar.WEEK_OF_YEAR),
weekDay: Int = -1
): Long {
val calendar: Calendar = Calendar.getInstance().apply {
set(Calendar.YEAR, year)
set(Calendar.MONTH, month)
if (weekDay > -1) set(Calendar.DAY_OF_WEEK, weekDay) else set(Calendar.DAY_OF_YEAR, day) <-----HERE
if (daysToAdd > 0) add(Calendar.DAY_OF_YEAR, daysToAdd) else set(Calendar.WEEK_OF_YEAR, weekInYear) <----HERE
set(Calendar.HOUR_OF_DAY, hour)
set(Calendar.MINUTE, minute)
set(Calendar.SECOND, 0)
}
return calendar.timeInMillis
}
The logic of this function is working correctly ?
Excuse me by the insistency, but it's a very annoying bug that could be it's quick to fix with more experience.
I tried it but couldn't reproduce, maybe I'm not doing it correctly. Would you mind posting a screen recording of reproducing it?
I tried it but couldn't reproduce, maybe I'm not doing it correctly. Would you mind posting a screen recording of reproducing it?
@parneet-guraya Yes, for sure. Wait a moment. I post it.
https://github.com/user-attachments/assets/c7210940-88ba-48d8-b7b4-83eb8ecd3dbc
@parneet-guraya , now. The 10MB space limit for files has done bad joke.
The original reminder was set to 27/09/2024 at 22:00, but I selected the new reminder to 24/09/2024 at 13:00. The hour changed correctly from 22:00 to 13:00, but the day doesn't changed from 27/09/2024 to 24/09/2024.
If I have selected any new reminder from a day that is friday, like today is, then the change of the reminder will be perfect to the new date. This is because TODAY IS FRIDAY, and the destination day is friday too. I'll try to send you a video of this.
Mail me at: gurayaparneet@gmail.com
@parneet-guraya At last I could upload it. Now I upload another video showing that a change to a friday works perfectly.
https://github.com/user-attachments/assets/96f9beab-3cc1-42b6-b7b4-a1e23b8c4571
@migulen Okay, I can see it. I'll push the fix as soon as I can. Thanks for the extra info :+1
thank you @migulen and @parneet-guraya ! :1st_place_medal:
thank you @migulen and @parneet-guraya ! 🥇
@mahibi It would have been very interesting if this fix had been applied in v20.0.2
This bug can cause a bad user experience if you trust its correct functionality. This bug tricks you. He did it with me.
thank you @migulen and @parneet-guraya ! 🥇
@mahibi It would have been very interesting if this fix had been applied in v20.0.2
This bug can cause a bad user experience if you trust its correct functionality. This bug tricks you. He did it with me.
well, after the release is before the next release ;) 20.0.3 will come next week with more fixes if everything works out
Steps to reproduce
Expected behaviour
The personalized date and hour is correctly selected on the selector and so established.
Actual behaviour
The personalized date is correctly selected on the selector, but when you accept it's not correctly establised/saved. The time(hour & minutes) is correctly selected. The day selected is "changed automatically to something wrong".
Example:
Today (current date) is 19/09/2024 (Thursday).
Select a personalized remember date and time (hour & minutes) for a message, like 23/9/2024 at 16:48.
The date and time that the selector shows is "26/09/2024 16:48" (Thursday).
Device brand and model
S24
Android version
14
Nextcloud Talk app version
v20.0.1
Nextcloud server version
28.0.10
Talk version
v18.0.11
Custom Signaling server configured
None
Custom TURN server configured
None
Custom STUN server configured
None
Android logs
No response
Server log
No response
Additional information
No response