我有一个带Cardaction的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()
,但我不知道如何清除导航堆栈。