Merge pull request #1220 from Retrospring/fix/remove-pwa-badge-when-no-unread-in-inbox
Remove PWA badge when no unread in inbox
This commit is contained in:
commit
b8b4e69963
|
@ -24,7 +24,7 @@ module BootstrapHelper
|
|||
"#{content_tag(:i, '', class: "fa fa-#{options[:icon]}")} #{body}"
|
||||
end
|
||||
end
|
||||
unless options[:badge].nil?
|
||||
if options[:badge].present? || options.dig(:badge_attr, :data)&.has_key?(:controller)
|
||||
badge_class = [
|
||||
"badge",
|
||||
("badge-#{options[:badge_color]}" unless options[:badge_color].nil?),
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class extends Controller<HTMLElement> {
|
|||
|
||||
connect(): void {
|
||||
if (this.isPwa && this.badgeCapable) {
|
||||
const count = Number.parseInt(this.element.innerText);
|
||||
const count = Number.parseInt(this.element.innerText) || 0;
|
||||
navigator.setAppBadge(count);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue