Skip to content

Commit

Permalink
Merge branch 'hotfix/1.1.2' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
mouredev committed Aug 9, 2021
2 parents 66a2207 + 4968530 commit 4977418
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ android {
applicationId "com.mouredev.twitimer"
minSdkVersion 23
targetSdkVersion 30
versionCode 5
versionName "1.1.1"
versionCode 7
versionName "1.1.2"

testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ data class UserSchedule(
val updatedDate = components.time
date = updatedDate

date = date.next(nextWeekday, true)
date = date.next(nextWeekday, true, save = true)
}

return mutableMapOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fun Date.shortFormat(): String {
return DateFormat.getTimeInstance(DateFormat.SHORT, Locale.getDefault()).format(this).format(this).uppercaseFirst()
}

fun Date.next(weekday: Weekday, considerToday: Boolean = false, referenceDate: Date? = null, duration: Int? = null): Date {
fun Date.next(weekday: Weekday, considerToday: Boolean = false, referenceDate: Date? = null, duration: Int? = null, save: Boolean = false): Date {

val dayName = weekday.englishName
val weekdaysName = getWeekDaysInEnglish().map { it.lowercase() }
Expand All @@ -43,7 +43,9 @@ fun Date.next(weekday: Weekday, considerToday: Boolean = false, referenceDate: D
if (considerToday && dayOfWeek == searchWeekdayIndex) {
if (referenceDate != null && duration != null && Date(referenceDate.time + (1000 * 60 * 60 * duration)) > this) {
return referenceDate
} else if (this > Date()) {
} else if (Date(this.time + (1000 * 60 * 60 * (duration ?: 0))) <= Date()) {
return this
} else if (save && this > Date()) {
return this
}
}
Expand Down

0 comments on commit 4977418

Please sign in to comment.