Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix xcassets icon generation (correct image sizes) + stop overriding user defined assets once generated #951

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Novfensec
Copy link

Introduction

This pull-request is related to the below bug;

Changes

  • Reworked the _buildimage function in kivy_ios.tools.external.xcassets to build correct image sizes.
  • Made an adjustment to stop kivy-ios from overriding user defined assets like Images.xcassets.AppIcon.appiconset and Images.xcassets.LaunchImage.launchimage if they are already present.
  • Test workflow run at https://github.com/Novfensec/Tic-Tac-Toe-Android/actions/runs/12210952062
  • Hopefully passing all steps nicely.

With kivy_ios merging the below pull-requests along with this makes it usable along with buildozer:

Testing

@Novfensec
Copy link
Author

Hey @AndreMiras , I fixed the icon generation issues within the icon and _generate function. You can test build using branch patch-2 of https://github.com/Novfensec/kivy-ios/tree/patch-2 .

buildozer -v ios debug

@AndreMiras
Copy link
Member

AndreMiras commented Dec 10, 2024

Thank you for spending time on that one 🙏
Would you mind editing the PR to not touch the formatting and address only the bug you mentioned in _buildimage()
Honestly I wish we had a formatter in the CI so it didn't have to be a recurring topic

@Novfensec
Copy link
Author

Thank you for spending time on that one 🙏
Would you mind editing the PR to not touch the formatting and address only the bug you mentioned in _buildimage()
Honestly I wish we had a formatter in the CI so it didn't have to be a recurring topic

I used black for formatting. So, I'll just realign the list back to their original style. Please wait!!

@Novfensec
Copy link
Author

@AndreMiras Reverted Dict formatting to original.

Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

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

@Novfensec I see we still have some indentation that breaks the original style, can you please take a look?

@Novfensec
Copy link
Author

Novfensec commented Jan 2, 2025

Ahhh. Sorry for that I just overlooked, just a second!

@Novfensec
Copy link
Author

@Novfensec I see we still have some indentation that breaks the original style, can you please take a look?

@misl6
Now is it okay?? All other changes are made to fix the overall process of generating images and icons nicely if there is no predefined Images.xcassets folder from the user side.

@Novfensec
Copy link
Author

Novfensec commented Jan 6, 2025

Hey, @misl6 @AndreMiras , I earlier thought of a mechanism which adds specific checks for each required icon file in the Appicon.appiconset and Launchimage.launchimage and generate it if its not already present.

These are the major steps :-

  • Check for directories Appicon.appiconset and Launchimage.launchimage under Images.xcassets.
  • Read the contents.json if present elsewise clear the directories and regenerate all icons and files with custom contents.json.
  • If present then check for all defined files, attributes and sizes, generate if not present with the name or add any missed file entry and generate too.

This is a huge automation of the process, but this is likely to be very rarely used.
Beacause most of us won't specify these directories from ourselves.

For now it has only basic checks for directories not for specific files.

@misl6 misl6 changed the title Bug fixes xcassets Fix xcassets icon generation (correct image sizes) + stop overriding user defined assets once generated Jan 6, 2025
Copy link
Member

@misl6 misl6 left a comment

Choose a reason for hiding this comment

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

From your explanation I got what we're trying to achieve and how we can make the appropriate changes.

kivy-ios overriding the generated files is not necessarily a bug, actually that could be a wanted feature (or at least now is an undocumented feature that someone might be taking advantage of).

But, I also agree that in certain cases (like when used in buildozer automations) kivy-ios overriding user-defined assets might be unexpected.

Can we split the PRs in two parts?

  • Fix correct image sizes
  • Allow through a flag to not overwrite an already-existing asset (defaults to overwrite for backward compatibility)

Then, in buildozer, feel free to open a PR which adds an option to not overwrite an existing asset.

@Novfensec
Copy link
Author

From your explanation I got what we're trying to achieve and how we can make the appropriate changes.

kivy-ios overriding the generated files is not necessarily a bug, actually that could be a wanted feature (or at least now is an undocumented feature that someone might be taking advantage of).

But, I also agree that in certain cases (like when used in buildozer automations) kivy-ios overriding user-defined assets might be unexpected.

Can we split the PRs in two parts?

  • Fix correct image sizes
  • Allow through a flag to not overwrite an already-existing asset (defaults to overwrite for backward compatibility)

Then, in buildozer, feel free to open a PR which adds an option to not overwrite an existing asset.

Yes, so should I unindent the code blocks or you'll undo those changes after merging, and make a new pull ??

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.

3 participants