Skip to content

Commit

Permalink
[UWP Renderer] Update ActionSet fallback (#8233)
Browse files Browse the repository at this point in the history
* Switch to gotFocus (#8148) (#8150)

* Update custom.props

* [UWP] Update custom.props for object model release (#8225)

* Update custom.props for object model release

* Updated Xcode version (#8222)

* removed build step as they are redundant (#8201)

* removed build step as they are redundant

* added pod installation step

Co-authored-by: Joseph Woo <[email protected]>

* [UWP Renderer] Add a null check to inline action rendering (#8228)

* Update custom.props for object model release

* Updated Xcode version (#8222)

* removed build step as they are redundant (#8201)

* removed build step as they are redundant

* added pod installation step

* Add a null check for inline Actions

Co-authored-by: Joseph Woo <[email protected]>

* Update actionSet fallback

* Minor syntax update

* Create new hresult

---------

Co-authored-by: Joseph Woo <[email protected]>
  • Loading branch information
anna-dingler and jwoo-msft authored Mar 20, 2023
1 parent 4037a50 commit 50a7c52
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
39 changes: 26 additions & 13 deletions source/uwp/SharedRenderer/lib/ActionHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -764,12 +764,13 @@ namespace AdaptiveCards::Rendering::Xaml_Rendering::ActionHelpers

case winrt::FallbackType::Content:
action = action.FallbackContent();
actionType = action.ActionType();
XamlHelpers::WarnForFallbackContentElement(renderContext, actionTypeString, action.ActionTypeString());
break; // Go again

case winrt::FallbackType::None:
default:
throw winrt::hresult_error(E_FAIL);
throw winrt::hresult_error(E_FALLBACK_NOT_FOUND);
}
}
}
Expand Down Expand Up @@ -889,18 +890,30 @@ namespace AdaptiveCards::Rendering::Xaml_Rendering::ActionHelpers

if (currentButtonIndex < maxActions && mode == winrt::AdaptiveCards::ObjectModel::Xaml_OM::ActionMode::Primary)
{
// If we have fewer than the maximum number of actions and this action's mode is primary, make a button
actionControl = CreateActionButtonInActionSet(adaptiveCard,
adaptiveActionSet,
action,
currentButtonIndex,
actionsPanel,
showCardsStackPanel,
columnDefinitions,
renderContext,
renderArgs);

currentButtonIndex++;
try
{
// If we have fewer than the maximum number of actions and this action's mode is primary, make a button
actionControl = CreateActionButtonInActionSet(adaptiveCard,
adaptiveActionSet,
action,
currentButtonIndex,
actionsPanel,
showCardsStackPanel,
columnDefinitions,
renderContext,
renderArgs);

currentButtonIndex++;
}
catch (winrt::hresult_error const& ex)
{
// We want to continue if the error is E_FALLBACK_NOT_FOUND
// There was no fallback mechanism for this action, but we need to render the rest of the ActionSet
if (ex.code() != E_FALLBACK_NOT_FOUND)
{
throw ex;
}
}
}
else if (currentButtonIndex >= maxActions &&
(mode == winrt::AdaptiveCards::ObjectModel::Xaml_OM::ActionMode::Primary) && !overflowMaxActions)
Expand Down
1 change: 1 addition & 0 deletions source/uwp/SharedRenderer/lib/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#define FACILITY_ADAPTIVECARDS 0xADA
#define ERRORBASE_ADAPTIVECARDS 0x1000
#define E_PERFORM_FALLBACK MAKE_HRESULT(1, FACILITY_ADAPTIVECARDS, ERRORBASE_ADAPTIVECARDS)
#define E_FALLBACK_NOT_FOUND MAKE_HRESULT(2, FACILITY_ADAPTIVECARDS, ERRORBASE_ADAPTIVECARDS)

#include "dll\CppWinRTIncludes.h"

Expand Down

0 comments on commit 50a7c52

Please sign in to comment.