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

Commit 40c49430 authored by Nishith  Khanna's avatar Nishith Khanna
Browse files

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

parent 8ee699a9
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 {
+6 −0
Original line number Diff line number Diff line
@@ -226,4 +226,10 @@ This can take a couple of minutes."</string>
    <string name="connect_google_via_tor_network">Connect to Google via Tor network</string>
    <string name="connect_google_via_tor_network_summary">Requires Orbot to be installed\nNot yet supported</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>