braze-swift-sdk icon indicating copy to clipboard operation
braze-swift-sdk copied to clipboard

[Feature]: Allow for configuration of line height in InAppMessageView

Open Ferdzz opened this issue 1 year ago • 3 comments
trafficstars

What problem are you facing?

We have in app messages in our app that use a custom font for the title section. Despite most styling options being available to us when configuring IAPs, we are unable to customize the line height of the title. This line spacing ends up being too large and doesn't match our designs.

Actual Design
image image

Workarounds

No workarounds available when using InAppMessageView. Because ModalTextView.Layout and ModalTextView.textView are private, the only workarounds would involve re-creating these UI elements, which seems like overkill for the issue at hand

Ideal Solution

The ModalTextView used by InAppMessageView has an enum Layout containing line spacing configurations:

    /// Manually-tuned values to get us closer to our visual spec.
    private enum Layout {
      static let headerLineSpacingScaleFactor = 0.78
      static let messageLineSpacingScaleFactor = 0.47
      static let headerMessageSpacingOffset = 1.0
    }

I believe it would be fairly simple to change this Layout private enum to a public struct with the same default values. This way we would be able to inject this Layout object and configure our own line spacing throughout the app.

However, lineSpacing isn't enough in our case, so we'd also appreciate exposing a lineHeightMultiplier. This is because lineSpacing only supports positive values, while our design requests a negative line spacing, which is a common design requirement.

Other Information

No response

Ferdzz avatar Sep 17 '24 15:09 Ferdzz

Hi @Ferdzz, thanks for filing some detailed feedback! To understand your case a little better, you would need access to both the lineSpacing and lineHeightMultiple properties of the header and message text? I've filed a ticket for our team to take a look into how we could support this. We will notify you with any updates as we have them. Thanks!

jerielng avatar Sep 18 '24 13:09 jerielng

Hi @jerielng , thanks for the quick response. Control over lineSpacing would be great, and would get us a little closer to our design, especially since that's something you already use. But adding lineHeightMultiple as well maxLineHeight & minLineHeight configurations would also be a must to have control over the actual line height (rather than just the line spacing) when using some of the larger fonts. Those will get us to perfect match with our designs

Ferdzz avatar Sep 18 '24 14:09 Ferdzz

Hi @jerielng, No rush, but we were wondering if you could give us some feedback on this? Is this planned for an upcoming release?

Ferdzz avatar Oct 04 '24 17:10 Ferdzz

Hey @Ferdzz it's on our radar for sure. I've raised it with the team for prioritization and will get back to you here as soon as we have a clearer timeline. Thanks!

jerielng avatar Oct 07 '24 18:10 jerielng

Hi @Ferdzz, we've just released 11.2.0, which adds some new configurations that will help you accomplish your use case. You can find the full list of properties here, which will be configurable on either Modal and/or Full in-app messages. Additionally, our customization guide has been updated to demonstrate a sample of what this might look like in your code.

Feel free to reach back out to let us know if you have any further questions! Thank you!

jerielng avatar Oct 30 '24 17:10 jerielng

Awesome! Will be trying this out soon. Thank you very much for the quick turnaround!

Ferdzz avatar Oct 31 '24 14:10 Ferdzz