Skip to content

Conversation

@kubaflo
Copy link
Contributor

@kubaflo kubaflo commented Feb 13, 2024

Description of Change

The AttributedTitle property of the iOS's native button hasn't been always updated when needed.

Issues Fixed

Fixes #18832
Fixes #21722

Before After
Before.mov
Fixed.mov

@kubaflo kubaflo requested a review from a team as a code owner February 13, 2024 01:15
@ghost ghost added the community ✨ Community Contribution label Feb 13, 2024
@ghost
Copy link

ghost commented Feb 13, 2024

Hey there @kubaflo! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@kubaflo kubaflo force-pushed the ios-button-character-spacing branch from 95005d7 to 789a8fd Compare February 13, 2024 01:21
@ghost ghost added the legacy-area-controls Label, Button, CheckBox, Slider, Stepper, Switch, Picker, Entry, Editor label Feb 13, 2024
@kubaflo kubaflo requested a review from jsuarezruiz February 13, 2024 18:44
}
}

internal static void UpdateAttributedTitle(IButtonHandler handler, ITextStyle textStyle)
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we move this as an extension method in ButtonExtensions?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I just did it. I have one question though. This method needs fontManager which currently is getting resolved by IButtonHandler. Should I keep this line of code: var fontManager = handler.GetRequiredService<IFontManager>(); inside this new extension method or pass IFontManager as a parameter to the UpdateAttributedTitle method and call handler.GetRequiredService<IFontManager>(); before calling UpdateAttributedTitle?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed in the last commit

@kubaflo kubaflo force-pushed the ios-button-character-spacing branch from d627114 to bcf199e Compare February 14, 2024 19:13
@jsuarezruiz
Copy link
Contributor

/azp run MAUI-UITests-public

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Member

@PureWeen PureWeen left a comment

Choose a reason for hiding this comment

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

Let's wait until this PR is merged
#20953

@jsuarezruiz
Copy link
Contributor

Added pending test snapshot.

@PureWeen
Copy link
Member

/rebase

@github-actions github-actions bot force-pushed the ios-button-character-spacing branch from 71c0f08 to 4aad58f Compare April 29, 2024 21:07
#pragma warning restore CA1416
}

public static void UpdateAttributedTitle(this UIButton platformButton, IFontManager fontManager, ITextStyle textStyle)
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to internal?

@kubaflo kubaflo force-pushed the ios-button-character-spacing branch from 4aad58f to 1952c68 Compare May 6, 2024 14:22
Copy link
Member

@tj-devel709 tj-devel709 left a comment

Choose a reason for hiding this comment

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

image
(with gisted code here: https://gist.github.com/tj-devel709/34d29859c873925ac84e7f4556bff305)

This is looking great to me! I was wondering if we can add a font to the UITest as well? Just to catch if we mess up something in the future :)

@tj-devel709
Copy link
Member

I added a fontfamily and textcolor to your test but let me know if that is not wanted!

@tj-devel709
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@kubaflo
Copy link
Contributor Author

kubaflo commented May 9, 2024

I added a fontfamily and textcolor to your test but let me know if that is not wanted!

That's awesome! Thank you

@tj-devel709
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@jsuarezruiz
Copy link
Contributor

Based on the changes, there are several golden tests (comparing an snapshot) with small differences. Waiting the build to complete and review all of them.

@tj-devel709 tj-devel709 force-pushed the ios-button-character-spacing branch from 5cb04ca to c5a6de1 Compare May 22, 2024 19:38
@tj-devel709
Copy link
Member

Rebased to main with the new UITest structure!

@tj-devel709
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

{
// Any text update requires that we update any attributed string formatting
var uiFontAttribute = fontManager.GetFont(textStyle.Font, UIFont.ButtonFontSize);
var attributedString = new NSMutableAttributedString(new NSAttributedString(platformButton.CurrentTitle!));
Copy link
Member

Choose a reason for hiding this comment

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

Looks like there may some situations where this platformButton.CurrentTitle! is null and crashes. Perhaps a null check and bailing could be useful here if the title is not populated yet?

https://gist.github.com/tj-devel709/10346a24bbb84b04a1f8dc4e15777410

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You're right! I've added a null check

@tj-devel709
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@tj-devel709 tj-devel709 force-pushed the ios-button-character-spacing branch from 9366d37 to 23fe76a Compare May 30, 2024 14:10
@tj-devel709
Copy link
Member

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@dotnet dotnet deleted a comment from azure-pipelines bot Jun 11, 2024
@dotnet dotnet deleted a comment from azure-pipelines bot Jun 13, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@PureWeen
Copy link
Member

PureWeen commented Oct 1, 2024

/rebase

1 similar comment
@jsuarezruiz
Copy link
Contributor

/rebase

@kubaflo kubaflo force-pushed the ios-button-character-spacing branch 2 times, most recently from b3e03d9 to e040d14 Compare November 15, 2024 09:36
@jsuarezruiz
Copy link
Contributor

/azp run

@kubaflo kubaflo force-pushed the ios-button-character-spacing branch from 2a1ecb7 to 912eaf4 Compare March 8, 2025 01:23
@kubaflo kubaflo self-assigned this Mar 8, 2025
@rmarinho
Copy link
Member

/azp run

@dotnet dotnet deleted a comment from azure-pipelines bot May 13, 2025
@dotnet dotnet deleted a comment from jsuarezruiz May 13, 2025
@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

@dotnet dotnet deleted a comment from azure-pipelines bot May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[iOS] Button FontFamily not working together with CharacterSpacing [8.0.3][iOS] Button CharacterSpacing make FontSize fixed and large

6 participants