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

Commit c36e80c1 authored by Philipp Heckel's avatar Philipp Heckel
Browse files

Wording, hide for older Android versions

parent f327c8ff
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -73,6 +73,10 @@ class NotificationService(val context: Context) {
        maybeDeleteNotificationGroup(groupId)
    }

    fun channelsSupported(): Boolean {
        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
    }

    private fun subscriptionGroupId(subscription: Subscription): String {
        return subscription.id.toString()
    }
@@ -339,7 +343,7 @@ class NotificationService(val context: Context) {
    }

    private fun maybeCreateNotificationChannel(group: String, priority: Int) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (channelsSupported()) {
            // Note: To change a notification channel, you must delete the old one and create a new one!

            val channelId = toChannelId(group, priority)
@@ -378,19 +382,19 @@ class NotificationService(val context: Context) {
    }

    private fun maybeDeleteNotificationChannel(group: String, priority: Int) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (channelsSupported()) {
            notificationManager.deleteNotificationChannel(toChannelId(group, priority))
        }
    }

    private fun maybeCreateNotificationGroup(id: String, name: String) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (channelsSupported()) {
            notificationManager.createNotificationChannelGroup(NotificationChannelGroup(id, name))
        }
    }

    private fun maybeDeleteNotificationGroup(id: String) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
        if (channelsSupported()) {
            notificationManager.deleteNotificationChannelGroup(id)
        }
    }
+4 −2
Original line number Diff line number Diff line
@@ -115,13 +115,15 @@ class DetailSettingsActivity : AppCompatActivity() {
        private fun loadView() {
            if (subscription.upAppId == null) {
                loadInstantPref()
                loadDedicatedChannelsPrefs()
                loadOpenChannelsPrefs()
                loadMutedUntilPref()
                loadMinPriorityPref()
                loadAutoDeletePref()
                loadIconSetPref()
                loadIconRemovePref()
                if (notificationService.channelsSupported()) {
                    loadDedicatedChannelsPrefs()
                    loadOpenChannelsPrefs()
                }
            } else {
                val notificationsHeaderId = context?.getString(R.string.detail_settings_notifications_header_key) ?: return
                val notificationsHeader: PreferenceCategory? = findPreference(notificationsHeaderId)
+4 −4
Original line number Diff line number Diff line
@@ -350,10 +350,10 @@
    <string name="detail_settings_notifications_instant_title">Instant delivery</string>
    <string name="detail_settings_notifications_instant_summary_on">Notifications are delivered instantly. Requires a foreground service and consumes more battery.</string>
    <string name="detail_settings_notifications_instant_summary_off">Notifications are delivered using Firebase. Delivery may be delayed, but consumes less battery.</string>
    <string name="detail_settings_notifications_dedicated_channels_title">Use dedicated channels</string>
    <string name="detail_settings_notifications_dedicated_channels_summary_on">Use dedicated notification channels for this subscription</string>
    <string name="detail_settings_notifications_dedicated_channels_summary_off">Use default notification channels</string>
    <string name="detail_settings_notifications_open_channels_title">Configure dedicated channels</string>
    <string name="detail_settings_notifications_dedicated_channels_title">Custom notification settings</string>
    <string name="detail_settings_notifications_dedicated_channels_summary_on">Using dedicated notification channels for this subscription</string>
    <string name="detail_settings_notifications_dedicated_channels_summary_off">Using default settings (sounds, Do Not Disturb override, etc.)</string>
    <string name="detail_settings_notifications_open_channels_title">Configure notification settings</string>
    <string name="detail_settings_notifications_open_channels_summary">Do Not Disturb (DND) override, sounds, etc.</string>
    <string name="detail_settings_appearance_header">Appearance</string>
    <string name="detail_settings_appearance_icon_set_title">Subscription icon</string>