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

Commit f80d8afd authored by uabdullah's avatar uabdullah Committed by Copybara-Service
Browse files

Do not show the voicemail tab if the VM toggle is turned off.

Bug: 73123614
Test: N/A
PiperOrigin-RevId: 187255950
Change-Id: I9ab50a7a8052f325f1743721bf6432e6c4787a4e
parent 4ef51165
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -252,7 +252,7 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
   * Check and return whether the voicemail tab should be shown or not. This includes the following
   * criteria under which we show the voicemail tab:
   * <li>The voicemail number exists (e.g we are able to dial into listen to voicemail or press and
   *     hold 1)
   *     hold 1) (TODO (uabdullah): Handle this case properly)
   * <li>Visual voicemail is enabled from the settings tab
   * <li>Visual voicemail carrier is supported by dialer
   * <li>There is no voicemail carrier app installed.
@@ -265,14 +265,18 @@ public class OldMainActivityPeer implements MainActivityPeer, FragmentUtilListen
    PhoneAccountHandle defaultUserSelectedAccount =
        TelecomUtil.getDefaultOutgoingPhoneAccount(context, PhoneAccount.SCHEME_VOICEMAIL);

    if (isVoicemailAvailable(context, defaultUserSelectedAccount)) {
      return true;
    if (!isVoicemailAvailable(context, defaultUserSelectedAccount)) {
      LogUtil.i("OldMainActivityPeer.canVoicemailTabBeShown", "Voicemail is not available");
      return false;
    }

    if (VoicemailComponent.get(context)
        .getVoicemailClient()
        .isVoicemailEnabled(context, defaultUserSelectedAccount)) {
      LogUtil.i("OldMainActivityPeer.canVoicemailTabBeShown", "Voicemail is not enabled");
      return true;
    }
    LogUtil.i("OldMainActivityPeer.canVoicemailTabBeShown", "returning false");
    return false;
  }