mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2025-12-28 07:39:21 +00:00
Compare commits
6 Commits
v2.2.9
...
b6afcd99ec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b6afcd99ec | ||
|
|
76f2aae18b | ||
| f90d8d03d9 | |||
| 36671cb379 | |||
| 68be768763 | |||
| 9546eb5aec |
@@ -1,5 +1,9 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 2.3.0
|
||||||
|
|
||||||
|
* `doWhile` now will guarantee that it will not call `doOnce` more than once for time
|
||||||
|
|
||||||
## 2.2.9
|
## 2.2.9
|
||||||
|
|
||||||
* `Version`:
|
* `Version`:
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ github_release_plugin_version=2.5.2
|
|||||||
|
|
||||||
## Android
|
## Android
|
||||||
|
|
||||||
android_gradle_version=8.1.4
|
android_gradle_version=8.4.0
|
||||||
android_minSdkVersion=21
|
android_minSdkVersion=21
|
||||||
android_compileSdkVersion=34
|
android_compileSdkVersion=34
|
||||||
android_buildToolsVersion=34.0.0
|
android_buildToolsVersion=34.0.0
|
||||||
@@ -36,5 +36,5 @@ androidx_work_version=2.9.0
|
|||||||
|
|
||||||
## Common
|
## Common
|
||||||
|
|
||||||
version=2.2.9
|
version=2.3.0
|
||||||
android_code_version=39
|
android_code_version=40
|
||||||
|
|||||||
@@ -71,9 +71,18 @@ suspend inline fun <T> doOnceTz(
|
|||||||
* Will execute [block] while it will return true as a result of its calculation
|
* Will execute [block] while it will return true as a result of its calculation
|
||||||
*/
|
*/
|
||||||
suspend inline fun KronScheduler.doWhile(block: (DateTime) -> Boolean) {
|
suspend inline fun KronScheduler.doWhile(block: (DateTime) -> Boolean) {
|
||||||
|
var latest: DateTime? = null
|
||||||
do {
|
do {
|
||||||
delay(1L)
|
delay(1L)
|
||||||
} while (doOnce(block))
|
val result = doOnce {
|
||||||
|
if (latest != it) {
|
||||||
|
latest = it
|
||||||
|
block(it)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (result == null || result)
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Will execute [block] while it will return true as a result of its calculation
|
* Will execute [block] while it will return true as a result of its calculation
|
||||||
@@ -85,9 +94,18 @@ suspend inline fun KronScheduler.doWhileLocal(block: (DateTime) -> Boolean) = do
|
|||||||
* Will execute [block] while it will return true as a result of its calculation
|
* Will execute [block] while it will return true as a result of its calculation
|
||||||
*/
|
*/
|
||||||
suspend inline fun KronScheduler.doWhileTz(noinline block: suspend (DateTimeTz) -> Boolean) {
|
suspend inline fun KronScheduler.doWhileTz(noinline block: suspend (DateTimeTz) -> Boolean) {
|
||||||
|
var latest: DateTimeTz? = null
|
||||||
do {
|
do {
|
||||||
delay(1L)
|
delay(1L)
|
||||||
} while (doOnceTz(block))
|
val result = doOnceTz {
|
||||||
|
if (latest != it) {
|
||||||
|
latest = it
|
||||||
|
block(it)
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (result == null || result)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user