Verified Commit 88262b00 authored by henry's avatar henry Committed by ma1
Browse files

MB 488: Adjust search engine removal notification for Mullvad Leta.

parent cc2726ba
Loading
Loading
Loading
Loading
Loading
+13 −4
Original line number Diff line number Diff line
@@ -76,8 +76,12 @@ export var SearchUIUtils = {
   *   name of the engine to be moved and replaced.
   * @param {string} newEngine
   *   name of the application default engine to replaced the removed engine.
   * @param {object} [details]
   *   Additional details about the removed search engine.
   * @param {boolean} [details.removedMullvadLeta]
   *   Whether we removed Mullvad Leta.
   */
  async removalOfSearchEngineNotificationBox(oldEngine, newEngine) {
  async removalOfSearchEngineNotificationBox(oldEngine, newEngine, details) {
    let win = lazy.BrowserWindowTracker.getTopWindow();

    let buttons = [
@@ -91,7 +95,12 @@ export var SearchUIUtils = {
          win.gNotificationBox.removeNotification(notificationBox);
        },
      },
      {
      details?.removedMullvadLeta
        ? {
            link: "https://leta.mullvad.net/mullvad-browser",
            "l10n-id": "moz-support-link-text",
          }
        : {
            supportPage: "search-engine-removal",
          },
    ];
+20 −4
Original line number Diff line number Diff line
@@ -1811,7 +1811,11 @@ export class SearchService {

      this._showRemovalOfSearchEngineNotificationBox(
        prevCurrentEngineName || prevAppDefaultEngineName,
        newCurrentEngineName
        newCurrentEngineName,
        {
          removedMullvadLeta:
            (prevCurrentEngineId || prevAppDefaultEngineId) === "mullvad-leta",
        }
      );
    }
  }
@@ -1889,7 +1893,13 @@ export class SearchService {
      // the user changes their locale it causes a change in engines.
      // If there is no update to settings metadata then the engine change was
      // caused by an update to config rather than a user changing their locale.
      if (!this.#didSettingsMetaDataUpdate(prevMetaData)) {
      //
      // For the removal of Mullvad Leta, we show the notification even if the
      // locale also changed because this change is not locale-dependant.
      if (
        (prevCurrentEngineId || prevAppDefaultEngineId) === "mullvad-leta" ||
        !this.#didSettingsMetaDataUpdate(prevMetaData)
      ) {
        return true;
      }
    }
@@ -3728,16 +3738,22 @@ export class SearchService {
   *   The name of the previous default engine that will be replaced.
   * @param {string} newCurrentEngineName
   *   The name of the engine that will be the new default engine.
   * @param {object} [details]
   *   Additional details about the removed search engine.
   * @param {boolean} [details.removedMullvadLeta]
   *   Whether we removed Mullvad Leta.
   */
  _showRemovalOfSearchEngineNotificationBox(
    prevCurrentEngineName,
    newCurrentEngineName
    newCurrentEngineName,
    details
  ) {
    lazy.BrowserUtils.callModulesFromCategory(
      { categoryName: "search-service-notification" },
      "search-engine-removal",
      prevCurrentEngineName,
      newCurrentEngineName
      newCurrentEngineName,
      details
    );
  }