Skip to content

Commit 2e74a07

Browse files
Added a property "AdditionalData" to ACRActionDelegate and sent true with isAtRootLevel key and true for root level overflow target (microsoft#6461)
Co-authored-by: Paul Campbell <[email protected]>
1 parent e9e44ea commit 2e74a07

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

source/ios/AdaptiveCards/ADCIOSVisualizer/ADCIOSVisualizer/ViewController.m

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,7 @@ - (BOOL)onRenderOverflowAction:(UIButton *)button
447447

448448
- (BOOL)onDisplayOverflowActionMenu:(NSArray<ACROverflowMenuItem *> *)menuItems
449449
alertController:(UIAlertController *)alert
450+
additionalData:(NSDictionary *)additionalData
450451
{
451452
// [Option 1] the easiest way is to just present the alert view. It's prepared and presentable ready.
452453
// [self presentViewController: alert];

source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACRActionDelegate.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,6 @@
4848
- "alert": presentable-ready alert controller. Client can just use its view controller to present this. Or client can grab "menuItems" to prepare its own overflow menu
4949
*/
5050
- (BOOL)onDisplayOverflowActionMenu:(NSArray<ACROverflowMenuItem *> *)menuItems
51-
alertController:(UIAlertController *)alert;
51+
alertController:(UIAlertController *)alert
52+
additionalData:(NSDictionary *)additionalData;
5253
@end

source/ios/AdaptiveCards/AdaptiveCards/AdaptiveCards/ACROverflowTarget.mm

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
#import "ACRViewPrivate.h"
1313
#import "UtiliOS.h"
1414

15+
NSString *const ACROverflowTargetIsRootLevelKey = @"isAtRootLevel";
16+
1517
@implementation ACROverflowMenuItem {
1618
__weak ACRView *_rootView;
1719
std::shared_ptr<AdaptiveCards::BaseActionElement> _action;
@@ -104,6 +106,7 @@ @implementation ACROverflowTarget {
104106
__weak ACRView *_rootView;
105107
UIAlertController *_alert;
106108
NSMutableArray<ACROverflowMenuItem *> *_menuItems;
109+
BOOL _isAtRootLevel;
107110
}
108111

109112
- (instancetype)initWithActionElement:(ACOActionOverflow *)actionElement
@@ -112,6 +115,7 @@ - (instancetype)initWithActionElement:(ACOActionOverflow *)actionElement
112115
self = [super init];
113116
if (self) {
114117
_rootView = rootView;
118+
_isAtRootLevel = actionElement.isAtRootLevel;
115119
[self createMenu:actionElement];
116120
}
117121
return self;
@@ -184,9 +188,11 @@ - (void)doSelectAction
184188
{
185189
BOOL shouldDisplay = YES;
186190
if ([_rootView.acrActionDelegate
187-
respondsToSelector:@selector(onDisplayOverflowActionMenu:alertController:)]) {
191+
respondsToSelector:@selector(onDisplayOverflowActionMenu:alertController:additionalData:)]) {
192+
NSDictionary *additionalData = @{ACROverflowTargetIsRootLevelKey: [NSNumber numberWithBool:_isAtRootLevel]};
188193
shouldDisplay = ![_rootView.acrActionDelegate onDisplayOverflowActionMenu:_menuItems
189-
alertController:_alert];
194+
alertController:_alert
195+
additionalData:additionalData];
190196
}
191197

192198
if (shouldDisplay) {

0 commit comments

Comments
 (0)