mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-03-30 19:20:09 +02:00
fix #745, properly handle toggling reminder vibrations
This commit is contained in:
parent
a659d8d3e3
commit
98c1151680
@ -211,7 +211,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken
|
// create a new channel for every new sound uri as the new Android Oreo notification system is fundamentally broken
|
||||||
if (soundUri != config.lastSoundUri) {
|
if (soundUri != config.lastSoundUri || config.lastVibrateOnReminder != config.vibrateOnReminder) {
|
||||||
config.lastReminderChannel = System.currentTimeMillis()
|
config.lastReminderChannel = System.currentTimeMillis()
|
||||||
config.lastSoundUri = soundUri
|
config.lastSoundUri = soundUri
|
||||||
}
|
}
|
||||||
@ -231,7 +231,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||||||
setBypassDnd(true)
|
setBypassDnd(true)
|
||||||
enableLights(true)
|
enableLights(true)
|
||||||
lightColor = event.color
|
lightColor = event.color
|
||||||
enableVibration(false)
|
enableVibration(config.vibrateOnReminder)
|
||||||
setSound(Uri.parse(soundUri), audioAttributes)
|
setSound(Uri.parse(soundUri), audioAttributes)
|
||||||
notificationManager.createNotificationChannel(this)
|
notificationManager.createNotificationChannel(this)
|
||||||
}
|
}
|
||||||
@ -266,6 +266,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
|
|||||||
if (config.loopReminders) {
|
if (config.loopReminders) {
|
||||||
notification.flags = notification.flags or Notification.FLAG_INSISTENT
|
notification.flags = notification.flags or Notification.FLAG_INSISTENT
|
||||||
}
|
}
|
||||||
|
config.lastVibrateOnReminder = config.vibrateOnReminder
|
||||||
return notification
|
return notification
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package com.simplemobiletools.calendar.pro.helpers
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import com.simplemobiletools.calendar.pro.R
|
import com.simplemobiletools.calendar.pro.R
|
||||||
|
import com.simplemobiletools.calendar.pro.extensions.config
|
||||||
import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync
|
import com.simplemobiletools.calendar.pro.extensions.scheduleCalDAVSync
|
||||||
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
|
import com.simplemobiletools.commons.extensions.getDefaultAlarmTitle
|
||||||
import com.simplemobiletools.commons.extensions.getDefaultAlarmUri
|
import com.simplemobiletools.commons.extensions.getDefaultAlarmUri
|
||||||
@ -168,4 +169,8 @@ class Config(context: Context) : BaseConfig(context) {
|
|||||||
var pullToRefresh: Boolean
|
var pullToRefresh: Boolean
|
||||||
get() = prefs.getBoolean(PULL_TO_REFRESH, false)
|
get() = prefs.getBoolean(PULL_TO_REFRESH, false)
|
||||||
set(pullToRefresh) = prefs.edit().putBoolean(PULL_TO_REFRESH, pullToRefresh).apply()
|
set(pullToRefresh) = prefs.edit().putBoolean(PULL_TO_REFRESH, pullToRefresh).apply()
|
||||||
|
|
||||||
|
var lastVibrateOnReminder: Boolean
|
||||||
|
get() = prefs.getBoolean(LAST_VIBRATE_ON_REMINDER, context.config.vibrateOnReminder)
|
||||||
|
set(lastVibrateOnReminder) = prefs.edit().putBoolean(LAST_VIBRATE_ON_REMINDER, lastVibrateOnReminder).apply()
|
||||||
}
|
}
|
||||||
|
@ -67,6 +67,7 @@ const val DEFAULT_REMINDER_1 = "default_reminder_1"
|
|||||||
const val DEFAULT_REMINDER_2 = "default_reminder_2"
|
const val DEFAULT_REMINDER_2 = "default_reminder_2"
|
||||||
const val DEFAULT_REMINDER_3 = "default_reminder_3"
|
const val DEFAULT_REMINDER_3 = "default_reminder_3"
|
||||||
const val PULL_TO_REFRESH = "pull_to_refresh"
|
const val PULL_TO_REFRESH = "pull_to_refresh"
|
||||||
|
const val LAST_VIBRATE_ON_REMINDER = "last_vibrate_on_reminder"
|
||||||
|
|
||||||
// repeat_rule for monthly and yearly repetition
|
// repeat_rule for monthly and yearly repetition
|
||||||
const val REPEAT_SAME_DAY = 1 // i.e. 25th every month, or 3rd june (if 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