Skip to content

Conversation

@dhidalgofadrique
Copy link
Contributor

@dhidalgofadrique dhidalgofadrique commented Oct 21, 2025

🎟️ Jira ticket

IOS-11935 Allow transparent gradient color in MisticaGradient

πŸ₯… What's the goal?

During a fix to align Android and iOS start screen background overlay in Movistar, we've decided to use a gradient by code instead of an asset. But due to this gradient contains transparency, we've detected that the GradientSwiftUIViewController view controller used to create the gradient has the default view controller background (which is white), not letting see the content under the gradient

🚧 How do we do it?

  • Set the host view controller background to .clear
  • Added snapshot test for transparent gradients (and renamed the current one adding opaque)

πŸ§ͺ How can I verify this?

Unfortunately there is no way to test this in MisticaCatalog. However, you can check the snapshots. The old one (testGradientInView1.png) has been renamed to testOpaqueGradientInView1.png because it remains unchanged, while there is a new snapshot testTranspatentGradientInView1.png that consists in a fully red view with a gradient over it using colors from blue with 10% of trasnparency to blue with 90% of transparency

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

Screenshot tests report

βœ”οΈ All passing

@dhidalgofadrique
Copy link
Contributor Author

dhidalgofadrique commented Oct 21, 2025

Record screenshots on PR comment: succeeded βœ…
https://github.com/Telefonica/mistica-ios/actions/runs/18686339540

}

func testGradientInView() {
func testOpaqueGradientInView() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renamed to opaque

)
}

func testTransparentGradientInView() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

New test for transparent gradients (it consists on a fully red view with an overlay from blue with 10% of alpha to blue with 90% of alpha)

@dhidalgofadrique dhidalgofadrique marked this pull request as ready for review October 21, 2025 14:46
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR enables transparent gradients in MisticaGradient by setting clear backgrounds on the hosting view controller and its views, allowing content beneath transparent gradients to be visible.

Key changes:

  • Set background colors to .clear in GradientSwiftUIViewController for both the main view and the hosting controller view
  • Added snapshot test for transparent gradients and renamed the existing opaque gradient test for clarity

Reviewed Changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 1 comment.

File Description
Sources/MisticaCommon/Components/GradientView+UIKit.swift Added .clear background colors to view controller and hosting controller to support transparent gradients
Tests/MisticaTests/UI/GradientTests.swift Renamed existing test to testOpaqueGradientInView, added new testTransparentGradientInView test, and extracted gradient frame to constants

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

)
}

func testTransparentGradientInView() {
Copy link

Copilot AI Oct 21, 2025

Choose a reason for hiding this comment

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

Corrected spelling of 'Transpatent' to 'Transparent' in function name.

Copilot uses AI. Check for mistakes.
@dhidalgofadrique dhidalgofadrique merged commit 141773c into main Oct 22, 2025
@dhidalgofadrique dhidalgofadrique deleted the IOS-11935-Allow-transparent-gradient-color-in-MisticaGradient branch October 22, 2025 08:16
tuentisre pushed a commit that referenced this pull request Oct 22, 2025
## [36.3.1](v36.3.0...v36.3.1) (2025-10-22)

### Bug Fixes

* **GradientView:** IOS-11935 [Mistica] Allow transparent gradient color in MisticaGradient ([#483](#483)) ([141773c](141773c))
@tuentisre
Copy link
Collaborator

πŸŽ‰ This PR is included in version 36.3.1 πŸŽ‰

The release is available on GitHub release

Your semantic-release bot πŸ“¦πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants