【问题标题】:How do you get a Bixby confirmation view to show up?如何显示 Bixby 确认视图?
【发布时间】:2019-05-21 21:11:42
【问题描述】:

我花了很长时间查看文档,但在运行我的操作之前无法显示确认视图。向胶囊中添加确认视图的步骤是什么?

我有一个名为Evaluate 的操作和一个地址输入,我会自动从用户的个人资料中提取。我想在运行Evaluate之前确认这个地址,以防用户想使用不同的地址

这是我所做的:

1) 在 capsule.bxb 中导入 viv.common:

import (viv.common) {
      as (common)
      version (3.30.0)
    }

2) 在 Evaluate 操作中添加确认/按语句:

confirm {
    by (common.Confirmation)
  }

3) 添加一个与评估操作匹配的确认视图:

confirmation-view {
    match: common.Confirmation {
      confirming {Evaluate (action) }
    }
    mode (PositiveEmphasis)
    message ("Is this the correct address?")

    render {
      layout {
        section {
          content{
            paragraph {
              style (Title_XS)
              value {
                template (
                "#{value(action.address)}}?"
                )
              }
            }
          }
        }
      }
    }
    confirm-options {        
        label ("Yes")
    }
    abort-options {
        label ("Try another Address")
        on-abort {
            intent {
              goal: InputAddress
            }
        }
    }
}

我希望这样做,但我想我还缺少其他东西。有什么想法吗?

【问题讨论】:

    标签: bixby


    【解决方案1】:

    我一直在研究这个问题,我的猜测是 它不适用于 Calculation 操作(或 Constructor 操作),您需要一个事务操作,基于confirmation-view documentation中的以下句子:

    必须有相应的事务操作要求使用确认键进行确认。

    查看示例胶囊capsule-sample-bank。提交传输会提示用户进行确认。他们使用两个确认提示:

    • 第一个是在评估CreateTransfer 之前提示用户确认并生成Transfer 模型。这就是您要找的那个。
    • 第二个使用transaction-supportmatch { Transfer } 完成,以匹配第一个的输出,并在用户确认后在CommitTransfer 上启动一个新意图。

    文件夹结构中的相关文件有:

    +-- models/
    |  +-- actions/
    |  |  +-- CreateTransfer.model.bxb
    +-- resources/
    |  +-- base/
    |  |  +-- dialog/
    |  |  |  +-- CreateTransfer_Confirmation.dialog.bxb
    |  |  |  +-- Transfer_Result.dialog.bxb
    |  |  +-- transactions/
    |  |  |  +-- precommit.transaction.bxb
    |  |  +-- views/
    |  |  |  +-- CreateTransfer_Confirmation.view.bxb
    

    也许 Bixby 开发团队的某个人可以扩展这个答案。我看不出为什么不能对 Calculation 操作使用确认。

    【讨论】:

    • 很好的答案!此外,您可以查看github.com/bixbydevelopers/capsule-sample-shirt 示例。它具有以单击操作为模型的 Confirmation.view.bxb。不同的动作类型是为了帮助 Bixby 在内部规划路线。计算是,嗯,简单的计算。
    • 感谢@BixbyDevSupport-Tokonyan 的回答。是否有可能以某种方式在 CalculationConstructor 操作上实现确认?
    • 你可以试试,但就像 C 带指针的索引超出范围一样,后果自负。它可能有一天会奏效,可能会在前一天彻底崩溃。
    猜你喜欢
    • 1970-01-01
    • 2018-06-24
    • 2021-03-12
    • 1970-01-01
    • 1970-01-01
    • 2019-11-10
    • 1970-01-01
    • 2014-08-04
    • 1970-01-01
    相关资源
    最近更新 更多