注销后清除导航堆栈-Gmail加载项

我有一个带Cardaction的gmail插件-注销:

注销后清除导航堆栈-Gmail加载项

如果在堆栈导航中只有几张卡片,并且用户进行“注销”-出现“后退箭头”:

注销后清除导航堆栈-Gmail加载项

这是我的logoutaction,可以正常工作,但是您有任何想法如何禁用此后退箭头吗?

function logoutaction(e) {

  var service = getOAuthService();
  service.reset();

  return CardService.newAuthorizationException()
  .setauthorizationUrl(service.getauthorizationUrl())
  .setResourceDisplayName("MY_PROJECT")
  .throwException();
}

这是我的简单Card,我可以在其中使用logoutaction:

function afterImportScreenBuild() {

    var action = CardService.newaction().setfunctionName('logoutaction');

    var cardHeader = CardService.newCardHeader()
        .setTitle("MY_HEADER");

    var viewButton = CardService.newTextButton()
        .setText("BTN")
        .setOpenLink(CardService.newOpenLink()
            .setUrl("https://test.com/"));

    var card = CardService.newCardBuilder()
        .setHeader(cardHeader);

    var section = CardService.newCardSection();

    var textKeyValue = CardService.newKeyValue()
        .setContent("MY_TIMELINE")
        .setButton(viewButton);

    card.addCardaction(CardService.newCardaction().setText('Logout').setOnClickaction(action));
    section.addWidget(textKeyValue);
    card.addSection(section);

    return card.build();
}

如果我的logoutaction返回actionResponseBuilder,我可以使用poptoRoot()

CardService.newactionResponseBuilder().setNavigation( CardService.newNavigation().poptoRoot() ).build()

但是在logoutaction中,我需要返回newAuthorizationException(),但我不知道如何清除导航堆栈。

laodongbei 回答:注销后清除导航堆栈-Gmail加载项

我不确定,但请允许我说几句话

function logoutAction(e) {

  var service = getOAuthService();
  service.reset();

}

使用此功能,您完成了注销过程,因此,我的问题是:

您真的需要在那儿退货吗?

否则,我们就完成了。

如果我们确实需要退货,我们可以随时在newAuthorizationException()上使用setCustomUiCallback(callback)并在那里拨打popToRoot(),显示您想要的卡片,并避免使用返回箭头

本文链接:https://www.f2er.com/3028108.html

大家都在问