Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,16 @@ data class NotificationContent(
iconJsonString?.let { putString(PrefsKey.NOTIFICATION_CONTENT_ICON, it) }
buttonsJsonString?.let { putString(PrefsKey.NOTIFICATION_CONTENT_BUTTONS, it) }
initialRoute?.let { putString(PrefsKey.NOTIFICATION_INITIAL_ROUTE, it) }
sound?.let { putString(PrefsKey.NOTIFICATION_SOUND, it) }
vibratePattern?.let {
putString(PrefsKey.NOTIFICATION_VIBRATE_PATTERN, it)
// Som e vibração valem só para este update, como no iOS.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit / documentação (não bloqueante): o fix está correto e o comentário explica bem o motivo da diferença em relação aos outros campos, que continuam usando ?.let.

Só lembrando que isso muda o comportamento da API pública do plugin no Android. Antes, o som e a vibração ficavam salvos entre updates. Agora valem só para o updateService em que foram passados. Algum consumidor que mandava notificationSound/notificationVibratePattern uma vez e esperava que eles continuassem valendo vai deixar de ouvir o som nos updates seguintes.

Sugestão: colocar uma entrada no CHANGELOG.md (ex.: * [**FIX-Android**] Clear notification sound/vibrate pattern on updateService when not provided, matching iOS behavior), para quem atualizar a versão do plugin ficar sabendo da mudança.

if (sound != null) {
putString(PrefsKey.NOTIFICATION_SOUND, sound)
} else {
remove(PrefsKey.NOTIFICATION_SOUND)
}
if (vibratePattern != null) {
putString(PrefsKey.NOTIFICATION_VIBRATE_PATTERN, vibratePattern)
} else {
remove(PrefsKey.NOTIFICATION_VIBRATE_PATTERN)
}
largeIconPath?.let {
putString(PrefsKey.NOTIFICATION_LARGE_ICON_PATH, it)
Expand Down
Loading