Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7335ef29 authored by Nishith  Khanna's avatar Nishith Khanna Committed by Marvin W.
Browse files

Move push notification interval text to string so that it can be translated

parent fcdeb0ab
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -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 {
+5 −0
Original line number Diff line number Diff line
@@ -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>