mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
lets try creating a new reminder channel for every sound uri
This commit is contained in:
parent
3263eedadd
commit
0c6b749621
@ -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)
|
||||
|
@ -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()
|
||||
|
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user