Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 246455d1 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

notification fix

parent 2d7b0f63
Loading
Loading
Loading
Loading
Loading
+26 −14
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ if (OCA.Accessibility.highcontrast) {
}
const activeIconColorCode = "007fff";
const whiteColorCode = "ffffff";
const notifButtonSelector = "#header .notifications .notifications-button";

function getSvgLinkCore(folder, svgName, color) {
  if (color.length) {
@@ -56,7 +57,7 @@ function replaceNavbarIcon(appId, currentLi, selector) {
function replaceNotificationIcon(imgSelector) {
  $(imgSelector).hide();
  const src = $(imgSelector).attr("src") || "";
  const notifButtonSelector = "#header .notifications .notifications-button";
  $(notifButtonSelector).css('visibility', 'visible');
  if (src.includes("notifications-new.svg")) {
    $(notifButtonSelector).removeClass("icon-notifications");
    $(notifButtonSelector).addClass("icon-notifications-new");
@@ -86,13 +87,6 @@ function replaceNavbarIcons() {
  /* Empty Search icon(Set through CSS) */
  $("#header .header-right .magnify-icon").empty();

  /* Notifications icon(Replace src on load) */

  const notifImgSelector = "#header .notifications .notifications-button img";
  replaceNotificationIcon(notifImgSelector);
  $(notifImgSelector).on("load", function () {
    replaceNotificationIcon(notifImgSelector);
  });
}

function replaceActivityIcons() {
@@ -109,7 +103,7 @@ function replaceActivityIcons() {
    comments: getSvgLinkCore("actions", "comment", ""),
    deck: getSvgLinkApp("deck", "deck-dark", ""),
    contacts: getSvgLinkCore("places", "contacts", ""),
    user_settings: getSvgLinkApp("e-user-support-center", "app", "")
    user_settings: getSvgLinkApp("e-user-support-center", "app", ""),
  };

  let currentActive = "";
@@ -237,10 +231,28 @@ function replaceSettingsMenuIcons() {
  // TODO: fix the logout icon for highcontrast(it is not working well with SVG Controller)
}

function hideNotificationButton() {
  if (!($(notifButtonSelector).hasClass('icon-notifications') || $(notifButtonSelector).hasClass('icon-notifications-new'))) {
    $(notifButtonSelector).css('visibility', 'hidden');
  }
}

jQuery(window).load(function () {
  /* Notifications icon(Replace src on load) */
  const notifImgSelector = "#header .notifications .notifications-button img";
  replaceNotificationIcon(notifImgSelector);
  $(notifImgSelector).on("load", function () {
    replaceNotificationIcon(notifImgSelector);
  });
});

$(document).ready(function () {
  const bodyId = $("body").attr("id");

  if (bodyId === "body-user" || bodyId === "body-settings") {

    hideNotificationButton();

    /* Navbar and navbar menus */
    replaceNavbarIcons();

@@ -265,6 +277,6 @@ $(document).ready(function () {
      replaceSettingsSectionIcons();
    }
  }
  $('#app-navigation [data-id="trashbin"]').removeClass('pinned first-pinned');
  $('#app-navigation [id="quota"]').addClass('pinned first-pinned');
  $('#app-navigation [data-id="trashbin"]').removeClass("pinned first-pinned");
  $('#app-navigation [id="quota"]').addClass("pinned first-pinned");
});
 No newline at end of file