Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fallback and requires properties on elements #2019

Closed
6 of 7 tasks
andrewleader opened this issue Oct 10, 2018 · 1 comment
Closed
6 of 7 tasks

Fallback and requires properties on elements #2019

andrewleader opened this issue Oct 10, 2018 · 1 comment

Comments

@andrewleader
Copy link
Contributor

andrewleader commented Oct 10, 2018

Release Renderer status Tasks status
1.2 ✔️ .NET (#2418)
✔️ Android (#2419)
✔️ iOS (#2420)
✔️ TS (#2421)
✔️ UWP (#2125)
✔️ Shared (#2624)
🔄 Designer (#2502)

Solves requests

Summary

Add a fallback and requires property to all elements

Schema

New properties on all elements

Property Type Required Description
fallback "drop" or AdaptiveElement false Fallback content or action if the element cannot be rendered. If not provided and an ancestor element has a fallback, the ancestor's fallback will be triggered. Otherwise, the element itself will be dropped.
requires Dictionary<string, string> false Requirements for the element to be rendered. In the format of <feature, version>, where the version number uses NuGet package manager version syntax to allow specifying min/max/etc

New properties on all actions (only difference is the allowed fallback object type of Action rather than Element)

Property Type Required Description
fallback "drop" or AdaptiveAction false Fallback content or action if the element cannot be rendered. If not provided and an ancestor element has a fallback, the ancestor's fallback will be triggered. Otherwise, the element itself will be dropped.
requires Dictionary<string, string> false Requirements for the element to be rendered. In the format of <feature, version>, where the version number uses NuGet package manager version syntax to allow specifying min/max/etc

Example

Alternative media content

{
  "type": "Media",
  "poster": "https://...",
  "sources": [ ],
  "fallback": {
    "type": "Image",
    "url": "https://movies.com/thumbnail"
  }
}

Drop a group of dependent content

The text doesn't make sense without the graph, so we want all of this to be dropped together.

On the entire container, the author specifies "fallback": "drop".

When the child Graph fails to render, since it doesn't have a fallback of its own, the error will be bubbled up to the parent container, where the error will be caught by the fallback the author specified.

        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "This text block makes no sense without the graph below it."
                },
                {
                    "type": "Graph",
                    "xAxis": "Profit"
                }
            ],
            "fallback": "drop"
        }

Alternate content for a group of dependent content

If the graph isn't supported, both the graph and the text need to change.

Since the child must be rendered (but cannot), the container will display its fallback.

        {
            "type": "Container",
            "items": [
                {
                    "type": "TextBlock",
                    "text": "This text block makes no sense without the graph below it."
                },
                {
                    "type": "Graph",
                    "xAxis": "Profit"
                }
            ],
            "fallback": {
                "type": "Container",
                "items": [
                    {
                        "type": "TextBlock",
                        "text": "To view a graph, click this card"
                    }
                ]
            }
        }

Require AAD sign on token and at least Adaptive version 1.2

If either AAD sign on or Adaptive Card 1.2 isn't supported, the fallback will be employed.

Version numbers use NuGet package manager version string syntax.

{
    "type": "Container",
    "requires": {
      "-ms-aadSignOn": "*",
      "adaptiveCard": "1.2"
    },
    "items": [
        {
            "type": "TextBlock",
            "text": "This text block makes no sense without the graph below it."
        },
        {
            "type": "Graph",
            "xAxis": "Profit"
        }
    ],
    "fallback": {
        "type": "Container",
        "items": [
            {
                "type": "TextBlock",
                "text": "To view a graph, click this card"
            }
        ]
    }
}

Host Config

None.

Down-level impact

No change from today.

Host burden

None.

Auto-generated task status

  • Shared
  • Designer
  • .NET
  • Android
  • iOS
  • TS
  • UWP
@andrewleader andrewleader changed the title Proposal: Fallback property on elements Proposal: Fallback and requires properties on elements Oct 10, 2018
@andrewleader andrewleader changed the title Proposal: Fallback and requires properties on elements Spec: Fallback and requires properties on elements Oct 17, 2018
@khouzam khouzam added the Epic label Oct 26, 2018
@andrewleader andrewleader mentioned this issue Feb 20, 2019
13 tasks
@andrewleader andrewleader changed the title Spec: Fallback and requires properties on elements Fallback and requires properties on elements Feb 20, 2019
@andrewleader
Copy link
Contributor Author

Closing as this was done in 1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants