Closed zunjae closed 5 years ago
@zunjae Thank you for your issue! I will consider implementing those features next version. :)
@zunjae
Hi, I thought about your multiple variants feature related to repeating a task every X times.
I implemented onLastDo
, onBeforeDone
features for pre and post-processing on version 1.0.2
.
So I think here is the new solution to resolve Variant 1)
only("rating", times = 10) {
onLastDo { // this will be executed after 10 times
if (showPopupAndGetResult() == false) { // if user did not rate
Only.clearOnly(name) // clears rating Only data. This makes repeat again from 0 times onDo task.
}
}
}
Variant 3) is quite similar.
only("repeat", times = 10) {
onLastDo {
Only.clearOnly(name)
// doSomething
}
}
And I implemented marking feature on version 1.0.3
.
I think this is a solution that implementing remind them every 10 app startups 2 times
using marking
.
only("whatsNew", times = 20) {
onDo {
val marking = Only.getMarking(name)!!.toInt()
Only.mark(name, marking + 1)
if (marking % 10 == 0) {
showPopup()
}
}
version("1.0.0.0")
mark(1)
}
But I think it is not too clear and simple for resolving Variant 2) yet. It seems better implementing other feature which related to repeating a task every X times. Anyway, thank you for your issue! :)
Looks good, thank you!
I almost wanted to implement the Once library (https://github.com/jonfinerty/Once) until I found your library. The Once has a feature I'd really like to see in Only and that is repeating a task every X times. There can be multiple variants for this feature.
Variant 1) perform action on the first time (when action has never been performed) and after X times Variant 2) perform action after X times Variant 3) perform action after X times and keep redoing this for Y times or an infinite amount of times
Examples:
1) Ask user to rate app after opening the app 10 times, keep asking again after 10 times until the user has rated the app
2) Notify user about new feature on the app launch and remind them every 10 app startups 2 times (meaning this action is done after 20 app startups)
3) Keep reminding the user about something every X times for-ever
I hope you can consider this functionality and for starters just implement the basic one (variant 1 or 2)