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:
Karina Kwiatek 2023-05-30 22:37:29 +02:00 committed by GitHub
commit b8b4e69963
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -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?),

View File

@ -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);
}
}