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

Added placeholder support #4897

Merged
merged 3 commits into from Oct 22, 2020
Merged

Added placeholder support #4897

merged 3 commits into from Oct 22, 2020

Conversation

jwoo-msft
Copy link
Member

@jwoo-msft jwoo-msft commented Oct 9, 2020

Related Issue

Fixed #4665 and Fixed #4682

Description

  • Added support for placeholder image.
  • Fixed card elongation issue.
  • refactored code

How Verified

How you verified the fix, including one or all of the following:

  1. Existing relevant unit is ran
  2. Created cards with cashed images.
Microsoft Reviewers: Open in CodeFlow

@ghost ghost added the no-recent-activity label Oct 14, 2020
@ghost ghost assigned paulcam206 Oct 14, 2020
@ghost
Copy link

ghost commented Oct 14, 2020

Hi @jwoo-msft. This non-spec pull request has had no recent activity for the past 5 days . Please take the necessary actions (review, address feedback or commit if reviewed already) to move this along. #Closed

@ghost
Copy link

ghost commented Oct 21, 2020

Hi @jwoo-msft; Thanks for taking action on your previously stale pull request. Resetting staleness. #Closed

@shalinijoshi19
Copy link
Member

shalinijoshi19 commented Oct 21, 2020

Out of curiosity, is this something that was missed on iOS but is available on the pther platforms? #Closed

@shalinijoshi19
Copy link
Member

Nit/typo: *cached

@jwoo-msft
Copy link
Member Author

jwoo-msft commented Oct 21, 2020

Out of curiosity, is this something that was missed on iOS but is available on the pther platforms?

i don't believe we support placeholder images while the image is loading on other platforms. The usage here is unique to Cisco. They know exactly the size of the image they are using before rendering the card, and they don't want to dynamically size their card because then they have to refresh the layout on the super view of an adaptivecard view. #Closed


if (img.size.width > 0) {
heightToWidthRatio = img.size.height / img.size.width;
contentholdingview = (ACRContentHoldingUIView *)[rootView getImageView:mediaKey];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ACRContentHoldingUIView *)[ [](start = 29, length = 28)

Curious: Is there something like a safe casting in ObjectiveC? Do we have the right level of compiler flags enabled to catch potential issues?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Objective-C is a superset of c, but there are no other ways of casting.

heightToWidthRatio = img.size.height / img.size.width;
contentholdingview = (ACRContentHoldingUIView *)[rootView getImageView:mediaKey];
if (contentholdingview) {
view = contentholdingview.subviews[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ews[0]; [](start = 43, length = 7)

Is there ever a chance that the subviews array is empty so that accessing the first element will result in an error/av? Should we be checking for it upfront or adding an assert condition before trying to index into it?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ACRContentHoldingUIView is a wrapper view to hold a subview such as UIImageView. The content view is created when there is an image view to add to the image view map. before the image view is added to the map, the view is added to the content view.

// process play icon image
NSString *piikey = [NSString stringWithCString:[acoConfig getHostConfig] -> GetMedia().playButton.c_str() encoding:[NSString defaultCStringEncoding]];
UIImage *playIconImage = imageViewMap[piikey];
NSString *playIconKey = makeKeyForImage(acoConfig, @"media-playicon-image", pieces);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

media-playicon-image [](start = 57, length = 20)

Avoid hard coded literals in the code - where is this coming from? Also is this going to have potential localization impact? SHould this be out in its own const strings class for easy localizability potentially?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there will be no localization impact. the strings are only used internally.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general bad practice to hard code literals - whether they are to be localized or not.


In reply to: 509830950 [](ancestors = 509830950)

@shalinijoshi19
Copy link
Member

Is this going to cause our renderers to be inconsistent at this point?


In reply to: 713932386 [](ancestors = 713932386)

Copy link
Member

@shalinijoshi19 shalinijoshi19 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@jwoo-msft jwoo-msft merged commit d66028e into main Oct 22, 2020
@jwoo-msft jwoo-msft deleted the jwoo/ios-elongation-fix branch October 22, 2020 02:03
rankush pushed a commit to rankush/AdaptiveCards that referenced this pull request May 8, 2024
* Added placeholder suport

* Updated per CR comments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants