Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Description

Running dart run splash_master create multiple times duplicated elements in LaunchScreen.storyboard, causing invalid XML that breaks iOS builds.

Changes

  • Fix duplicate background image element (lib/cmd/ios_splash.dart)

    • Added check for existing background image element with id edQ-YT-iED before creating a new one
    • Prevents duplicate background image elements from accumulating on subsequent runs
    • Calls getBackgroundImageElement(subViews) to verify element doesn't exist before creation
  • Fix constraint cleanup logic (lib/cmd/ios_splash.dart)

    • Changed from remove(getElement()) to removeWhere() at lines 178-183 and 216-221
    • Previous implementation only removed first constraints element; new implementation removes all instances before adding new ones

This makes the command idempotent—multiple runs produce identical, valid output without duplicate elements.

Checklist

  • The title of my PR starts with a Conventional Commit prefix (fix:, feat:, docs: etc).
  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Closes #80

Original prompt

This section details on the original issue you should resolve

<issue_title>Executing create command always updates storyboard</issue_title>
<issue_description>Describe the bug
Running the command dart run splash_master create always updates the LaunchScreen.storyboard file by adding duplicate entries. After running the command multiple times, these duplicate nodes accumulate and cause the storyboard to become invalid.

To Reproduce
Steps to reproduce the behavior:

  1. Run dart run splash_master create
  2. Run the same command again
  3. Open and inspect the LaunchScreen.storyboard file
  4. Notice that duplicate entries have been added

Expected behavior
The command should check whether the corresponding fields or nodes already exist in the storyboard.
If an entry exists, it should be replaced or updated, It should not append a new duplicate entry. This ensures the storyboard remains valid even when the command is executed multiple times.

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix issue with duplicate entries in LaunchScreen.storyboard fix: prevent duplicate constraints in LaunchScreen.storyboard on repeated runs Dec 3, 2025
<constraint firstAttribute="trailing" secondItem="YRO-k0-Ey4" secondAttribute="trailing" id="TQA-XW-tRk"/>
<constraint firstItem="YRO-k0-Ey4" firstAttribute="bottom" secondItem="Ze5-6b-2t3" secondAttribute="bottom" id="duK-uY-Gun"/>
<constraint firstAttribute="bottom" secondItem="edQ-YT-iED" secondAttribute="bottom" id="e2S-gZ-2jl"/>
<constraint firstAttribute="bottom" secondItem="edQ-YT-iED" secondAttribute="bottom" id="wnX-KJ-aN5"/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

dont remove this constraint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Restored the constraint in commit d214e27.

Copy link
Collaborator

Choose a reason for hiding this comment

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

the command adds duplicate image with id edQ-YT-iED

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed in commit d214e27. Added logic to check for existing background image element in the storyboard before creating a new one, preventing duplicates.

Co-authored-by: ujas-m-simformsolutions <[email protected]>
Copilot AI changed the title fix: prevent duplicate constraints in LaunchScreen.storyboard on repeated runs fix: prevent duplicate elements in LaunchScreen.storyboard on repeated runs Dec 3, 2025
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.

Executing create command always updates storyboard

2 participants