Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Added placeholder support#4897

Merged
jwoo-msft merged 3 commits into
mainfrom
jwoo/ios-elongation-fix
Oct 22, 2020
Merged

Added placeholder support#4897
jwoo-msft merged 3 commits into
mainfrom
jwoo/ios-elongation-fix

Conversation

@jwoo-msft

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

Copy link
Copy Markdown
Member

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

ghost commented Oct 14, 2020

Copy link
Copy Markdown

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

@jwoo-msft jwoo-msft requested a review from almedina-ms October 21, 2020 20:33
@ghost ghost removed the no-recent-activity label Oct 21, 2020
@ghost

ghost commented Oct 21, 2020

Copy link
Copy Markdown

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

@shalinijoshi19

shalinijoshi19 commented Oct 21, 2020

Copy link
Copy Markdown

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

@shalinijoshi19

Copy link
Copy Markdown

Nit/typo: *cached

@jwoo-msft

jwoo-msft commented Oct 21, 2020

Copy link
Copy Markdown
Member Author

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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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
Copy Markdown

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
Copy Markdown
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.

@shalinijoshi19 shalinijoshi19 Oct 23, 2020

Copy link
Copy Markdown

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
Copy Markdown

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


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

@shalinijoshi19 shalinijoshi19 left a comment

Copy link
Copy Markdown

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

Development

Successfully merging this pull request may close these issues.

[iOS][Resource Resolver] Add Placeholder Image Support For Resource Resolver [iOS][Image Rendering][ResourceResolvers] Card elongation

3 participants