This commit is contained in:
parent
3af5d60811
commit
f1431e9a67
7 changed files with 27 additions and 2 deletions
|
@ -190,7 +190,7 @@ class NotificationService(val context: Context) {
|
|||
}
|
||||
}
|
||||
|
||||
class DownloadBroadcastReceiver : android.content.BroadcastReceiver() {
|
||||
class DownloadBroadcastReceiver : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val id = intent.getStringExtra("id") ?: return
|
||||
val action = intent.getStringExtra("action") ?: return
|
||||
|
|
|
@ -358,7 +358,7 @@ class AddFragment : DialogFragment() {
|
|||
activity.runOnUiThread {
|
||||
val topic = subscribeTopicText.text.toString()
|
||||
val baseUrl = getBaseUrl()
|
||||
val instant = !BuildConfig.FIREBASE_AVAILABLE || baseUrl != appBaseUrl
|
||||
val instant = !BuildConfig.FIREBASE_AVAILABLE || baseUrl != appBaseUrl || subscribeInstantDeliveryCheckbox.isChecked
|
||||
subscribeListener.onSubscribe(topic, baseUrl, instant)
|
||||
dialog?.dismiss()
|
||||
}
|
||||
|
|
|
@ -5,9 +5,11 @@ import android.app.AlertDialog
|
|||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.Settings
|
||||
import android.text.TextUtils
|
||||
import android.widget.Button
|
||||
import android.widget.Toast
|
||||
|
@ -200,6 +202,20 @@ class SettingsActivity : AppCompatActivity(), PreferenceFragmentCompat.OnPrefere
|
|||
}
|
||||
}
|
||||
|
||||
// Channel settings
|
||||
val channelPrefsPrefId = context?.getString(R.string.settings_notifications_channel_prefs_key) ?: return
|
||||
val channelPrefs: Preference? = findPreference(channelPrefsPrefId)
|
||||
channelPrefs?.isVisible = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
channelPrefs?.preferenceDataStore = object : PreferenceDataStore() { } // Dummy store to protect from accidentally overwriting
|
||||
channelPrefs?.onPreferenceClickListener = OnPreferenceClickListener {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
startActivity(Intent(Settings.ACTION_APP_NOTIFICATION_SETTINGS).apply {
|
||||
putExtra(Settings.EXTRA_APP_PACKAGE, BuildConfig.APPLICATION_ID)
|
||||
})
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
// Auto download
|
||||
val autoDownloadPrefId = context?.getString(R.string.settings_notifications_auto_download_key) ?: return
|
||||
val autoDownload: ListPreference? = findPreference(autoDownloadPrefId)
|
||||
|
|
|
@ -242,6 +242,8 @@
|
|||
<string name="settings_notifications_priority_default">default</string>
|
||||
<string name="settings_notifications_priority_high">high</string>
|
||||
<string name="settings_notifications_priority_max">max</string>
|
||||
<string name="settings_notifications_channel_prefs_title">Channel settings</string>
|
||||
<string name="settings_notifications_channel_prefs_summary">Manage Do Not Disturb (DND) override, custom sounds, etc.</string>
|
||||
<string name="settings_notifications_auto_download_title">Download attachments</string>
|
||||
<string name="settings_notifications_auto_download_summary_always">Auto-download all attachments</string>
|
||||
<string name="settings_notifications_auto_download_summary_never">Never auto-download attachments</string>
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
<!-- Settings constants -->
|
||||
<string name="settings_notifications_muted_until_key" translatable="false">MutedUntil</string>
|
||||
<string name="settings_notifications_min_priority_key" translatable="false">MinPriority</string>
|
||||
<string name="settings_notifications_channel_prefs_key" translatable="false">ChannelPrefs</string>
|
||||
<string name="settings_notifications_auto_download_key" translatable="false">AutoDownload</string>
|
||||
<string name="settings_notifications_auto_delete_key" translatable="false">AutoDelete</string>
|
||||
<string name="settings_general_default_base_url_key" translatable="false">DefaultBaseURL</string>
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
app:entries="@array/settings_notifications_auto_delete_entries"
|
||||
app:entryValues="@array/settings_notifications_auto_delete_values"
|
||||
app:defaultValue="2592000"/>
|
||||
<Preference
|
||||
app:key="@string/settings_notifications_channel_prefs_key"
|
||||
app:title="@string/settings_notifications_channel_prefs_title"
|
||||
app:summary="@string/settings_notifications_channel_prefs_summary"/>
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory app:title="@string/settings_general_header">
|
||||
<EditTextPreference
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
Features:
|
||||
* Support for ntfy:// deep links (#20, thanks to @Copephobia for reporting)
|
||||
* Fastlane metadata can now be translated too (#198, thanks to @StoyanDimitrov for reporting)
|
||||
* Channel settings option to configure DND override, sounds, etc. (#91)
|
||||
|
||||
Bugs:
|
||||
* Validate URLs when changing default server and server in user management (#193, thanks to @StoyanDimitrov for reporting)
|
||||
* Error in sending test notification in different languages (#209, thanks to @StoyanDimitrov for reporting)
|
||||
* "[x] Instant delivery in doze mode" checkbox does not work properly (#211)
|
||||
|
||||
Additional translations:
|
||||
* Japanese (thanks to @shak)
|
||||
|
|
Loading…
Reference in a new issue