mirror of
https://github.com/nextcloud/talk-android
synced 2025-06-20 03:59:35 +01:00
Null ringtone Uri must be allowed
App would crash on pre-Oreo devices with "No sound" setting Signed-off-by: Dariusz Olszewski <starypatyk@users.noreply.github.com>
This commit is contained in:
parent
d99295118b
commit
c99da0282d
@ -65,7 +65,7 @@ object NotificationUtils {
|
|||||||
channelId: String,
|
channelId: String,
|
||||||
channelName: String,
|
channelName: String,
|
||||||
channelDescription: String,
|
channelDescription: String,
|
||||||
sound: Uri,
|
sound: Uri?,
|
||||||
audioAttributes: AudioAttributes
|
audioAttributes: AudioAttributes
|
||||||
) {
|
) {
|
||||||
|
|
||||||
@ -281,7 +281,7 @@ object NotificationUtils {
|
|||||||
ringtonePreferencesString: String?,
|
ringtonePreferencesString: String?,
|
||||||
defaultRingtoneUri: String,
|
defaultRingtoneUri: String,
|
||||||
channelId: String
|
channelId: String
|
||||||
): Uri {
|
): Uri? {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||||
val channel = getNotificationChannel(context, channelId)
|
val channel = getNotificationChannel(context, channelId)
|
||||||
if (channel != null) {
|
if (channel != null) {
|
||||||
@ -296,7 +296,7 @@ object NotificationUtils {
|
|||||||
try {
|
try {
|
||||||
val ringtoneSettings =
|
val ringtoneSettings =
|
||||||
LoganSquare.parse(ringtonePreferencesString, RingtoneSettings::class.java)
|
LoganSquare.parse(ringtonePreferencesString, RingtoneSettings::class.java)
|
||||||
return ringtoneSettings.ringtoneUri!!
|
return ringtoneSettings.ringtoneUri
|
||||||
} catch (exception: IOException) {
|
} catch (exception: IOException) {
|
||||||
return Uri.parse(defaultRingtoneUri)
|
return Uri.parse(defaultRingtoneUri)
|
||||||
}
|
}
|
||||||
@ -306,7 +306,7 @@ object NotificationUtils {
|
|||||||
fun getCallRingtoneUri(
|
fun getCallRingtoneUri(
|
||||||
context: Context,
|
context: Context,
|
||||||
appPreferences: AppPreferences
|
appPreferences: AppPreferences
|
||||||
): Uri {
|
): Uri? {
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.callRingtoneUri, DEFAULT_CALL_RINGTONE_URI, NOTIFICATION_CHANNEL_CALLS_V4
|
appPreferences.callRingtoneUri, DEFAULT_CALL_RINGTONE_URI, NOTIFICATION_CHANNEL_CALLS_V4
|
||||||
@ -316,7 +316,7 @@ object NotificationUtils {
|
|||||||
fun getMessageRingtoneUri(
|
fun getMessageRingtoneUri(
|
||||||
context: Context,
|
context: Context,
|
||||||
appPreferences: AppPreferences
|
appPreferences: AppPreferences
|
||||||
): Uri {
|
): Uri? {
|
||||||
return getRingtoneUri(
|
return getRingtoneUri(
|
||||||
context,
|
context,
|
||||||
appPreferences.messageRingtoneUri, DEFAULT_MESSAGE_RINGTONE_URI, NOTIFICATION_CHANNEL_MESSAGES_V4
|
appPreferences.messageRingtoneUri, DEFAULT_MESSAGE_RINGTONE_URI, NOTIFICATION_CHANNEL_MESSAGES_V4
|
||||||
|
Loading…
Reference in New Issue
Block a user