Skip to content

Commit

Permalink
Move push notification interval text to string so that it can be tran…
Browse files Browse the repository at this point in the history
…slated
  • Loading branch information
Nishith Khanna authored and fynngodau committed Aug 26, 2023
1 parent 1eb6f20 commit 7447141
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,15 @@ class PushNotificationAdvancedFragment : PreferenceFragmentCompat() {
}

private fun getSummaryString(value: Int, learnt: Int): String = when (value) {
-1 -> "OFF"
0 -> "ON / Automatic: " + getHeartbeatString(learnt)
else -> "ON / Manual: " + getHeartbeatString(value * 60000)
-1 -> getString(R.string.push_notifications_summary_off)
0 -> getString(R.string.push_notifications_summary_automatic, getHeartbeatString(learnt))
else -> getString(R.string.push_notifications_summary_manual, getHeartbeatString(value * 60000))
}

private fun getHeartbeatString(heartbeatMs: Int): String {
return if (heartbeatMs < 120000) {
(heartbeatMs / 1000).toString() + " seconds"
} else (heartbeatMs / 60000).toString() + " minutes"
getString(R.string.push_notifications_summary_values_seconds, (heartbeatMs / 1000).toString())
} else getString(R.string.push_notifications_summary_values_minutes, (heartbeatMs / 60000).toString())
}

companion object {
Expand Down
5 changes: 5 additions & 0 deletions play-services-core/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,9 @@ This can take a couple of minutes."</string>
<string name="pref_safetynet_test_no_result">No result</string>
<string name="pref_safetynet_test_invalid_json">Invalid JSON</string>

<string name="push_notifications_summary_off">OFF</string>
<string name="push_notifications_summary_automatic">ON / Automatic: %s</string>
<string name="push_notifications_summary_manual">ON / Manual: %s</string>
<string name="push_notifications_summary_values_seconds">%s seconds</string>
<string name="push_notifications_summary_values_minutes">%s minutes</string>
</resources>

0 comments on commit 7447141

Please sign in to comment.