mirror of
https://github.com/sudoxnym/habitica-android.git
synced 2026-05-23 22:27:15 +00:00
parent
aa54bef02c
commit
941ce87fd9
2 changed files with 17 additions and 0 deletions
|
|
@ -793,4 +793,8 @@
|
|||
<string name="same_day_reminder_text">The more you add, the more you\'ll be rewarded. Even small habits add up to big change.</string>
|
||||
<string name="next_day_reminder_title">Remember to check your tasks!</string>
|
||||
<string name="next_day_reminder_text">There\'s lots of unlock and discover at you level up, so keep up with your tasks and have fun!</string>
|
||||
<string name="daily_tip_0">Use the mobile apps to set reminders for your tasks.</string>
|
||||
<string name="daily_tip_1">Add checklists to your To-Dos to multiply your rewards!</string>
|
||||
<string name="daily_tip_2">Complete all your Dailies to get a Perfect Day Buff that increases your Stats!</string>
|
||||
<string name="daily_tip_3">Occasionally re-evaluate your tasks to make sure they’re up-to-date!</string>
|
||||
</resources>
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ class NotificationPublisher : WakefulBroadcastReceiver() {
|
|||
val notification: Notification
|
||||
val builder = Notification.Builder(thisContext)
|
||||
builder.setContentTitle(thisContext.getString(R.string.reminder_title))
|
||||
builder.setContentText(getRandomDailyTip())
|
||||
if (registrationDate != null) {
|
||||
val registrationCal = Calendar.getInstance()
|
||||
registrationCal.time = registrationDate
|
||||
|
|
@ -119,6 +120,18 @@ class NotificationPublisher : WakefulBroadcastReceiver() {
|
|||
return notification
|
||||
}
|
||||
|
||||
private fun getRandomDailyTip(): String {
|
||||
val thisContext = context ?: return ""
|
||||
val index = Random().nextInt(4)
|
||||
return when (index) {
|
||||
0 -> thisContext.getString(R.string.daily_tip_0)
|
||||
1 -> thisContext.getString(R.string.daily_tip_1)
|
||||
2 -> thisContext.getString(R.string.daily_tip_2)
|
||||
3 -> thisContext.getString(R.string.daily_tip_3)
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
var NOTIFICATION_ID = "notification-id"
|
||||
|
|
|
|||
Loading…
Reference in a new issue