lets try creating a new reminder channel for every sound uri

This commit is contained in:
tibbi 2018-06-12 23:51:59 +02:00
parent 3263eedadd
commit 0c6b749621
3 changed files with 17 additions and 1 deletions

View File

@ -189,7 +189,13 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
grantReadUriPermission(soundUri)
}
val channelId = "my_reminder_channel_$soundUri"
// create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken
if (soundUri != config.lastSoundUri) {
config.lastReminderChannel = System.currentTimeMillis()
config.lastSoundUri = soundUri
}
val channelId = "simple_calendar_${config.lastReminderChannel}"
if (isOreoPlus()) {
val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ALARM)

View File

@ -39,6 +39,14 @@ class Config(context: Context) : BaseConfig(context) {
get() = prefs.getString(REMINDER_SOUND_TITLE, context.getDefaultAlarmTitle(ALARM_SOUND_TYPE_NOTIFICATION))
set(reminderSoundTitle) = prefs.edit().putString(REMINDER_SOUND_TITLE, reminderSoundTitle).apply()
var lastSoundUri: String
get() = prefs.getString(LAST_SOUND_URI, "")
set(lastSoundUri) = prefs.edit().putString(LAST_SOUND_URI, lastSoundUri).apply()
var lastReminderChannel: Long
get() = prefs.getLong(LAST_REMINDER_CHANNEL_ID, 0L)
set(lastReminderChannel) = prefs.edit().putLong(LAST_REMINDER_CHANNEL_ID, lastReminderChannel).apply()
var storedView: Int
get() = prefs.getInt(VIEW, MONTHLY_VIEW)
set(view) = prefs.edit().putInt(VIEW, view).apply()

View File

@ -51,6 +51,8 @@ const val REPLACE_DESCRIPTION = "replace_description"
const val SHOW_GRID = "show_grid"
const val LOOP_REMINDERS = "loop_reminders"
const val DIM_PAST_EVENTS = "dim_past_events"
const val LAST_SOUND_URI = "last_sound_uri"
const val LAST_REMINDER_CHANNEL_ID = "last_reminder_channel_ID"
// repeat_rule for monthly and yearly repetition
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if yearly repetition)