Skip to content

Commit

Permalink
count minute parts
Browse files Browse the repository at this point in the history
Signed-off-by: alperozturk <[email protected]>
  • Loading branch information
alperozturk96 committed Feb 6, 2025
1 parent b13e519 commit 54cc1a4
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -358,12 +358,31 @@ class PassCodeActivity : AppCompatActivity(), Injectable {
timeInSecond
)
else -> {
val minutes = (timeInSecond / 60)
resources.getQuantityString(
R.plurals.delay_message_minutes,
minutes,
minutes
)
val minutes = timeInSecond / 60
val remainingSeconds = timeInSecond % 60

when {
remainingSeconds == 0 -> resources.getQuantityString(
R.plurals.delay_message_minutes,
minutes,
minutes
)
else -> {
val minuteText = resources.getQuantityString(
R.plurals.delay_message_minutes_part,
minutes,
minutes
)
val secondText = resources.getQuantityString(
R.plurals.delay_message_seconds_part,
remainingSeconds,
remainingSeconds
)

val prefixText = "$minuteText $secondText"
getString(R.string.due_to_too_many_wrong_attempts, prefixText)
}
}
}
}
}
Expand Down
13 changes: 13 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,19 @@
<item quantity="other">Delayed %d minutes due to too many wrong attempts</item>
</plurals>

<plurals name="delay_message_minutes_part">
<item quantity="one">Delayed %d minute</item>
<item quantity="other">Delayed %d minutes</item>
</plurals>

<plurals name="delay_message_seconds_part">
<item quantity="one">%d second</item>
<item quantity="other">%d seconds</item>
</plurals>

<string name="due_to_too_many_wrong_attempts">%s due to too many wrong attempts</string>


<string name="brute_force_delay">Delayed due to too many wrong attempts</string>
<string name="create">Create</string>
<string name="select_one_template">Please select one template</string>
Expand Down

0 comments on commit 54cc1a4

Please sign in to comment.