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

bug: contentMode switch not working because of .lowercased() #100

Closed
nomadminded opened this issue Aug 7, 2024 · 4 comments · Fixed by #101
Closed

bug: contentMode switch not working because of .lowercased() #100

nomadminded opened this issue Aug 7, 2024 · 4 comments · Fixed by #101
Labels
bug/fix Something isn't working

Comments

@nomadminded
Copy link
Contributor

nomadminded commented Aug 7, 2024

Plugin version:
5.1.1

Platform(s):
iOS

Current behavior:
contentMode in config is not working because of the error in the following switch:

private static func getContentModeFromString(_ contentMode: String?) -> UIView.ContentMode? {
        switch contentMode?.lowercased() {
        case "center": return .center
        case "scaleAspectFill": return .scaleAspectFill
        case "scaleAspectFit": return .scaleAspectFit
        case "scaleToFill": return .scaleToFill
        default: return nil
        }
    }

Expected behavior:

cases should be all lowercased

private static func getContentModeFromString(_ contentMode: String?) -> UIView.ContentMode? {
        switch contentMode?.lowercased() {
        case "center": return .center
        case "scaleaspectfill": return .scaleAspectFill
        case "scaleaspectfit": return .scaleAspectFit
        case "scaletofill": return .scaleToFill
        default: return nil
        }
    }

Steps to reproduce:
set contentMode to scaleAspectFill / scaleAspectFit / scaleToFill

Related code:
PrivacyScreen.swift

@nomadminded
Copy link
Contributor Author

nomadminded commented Aug 7, 2024

the pr that was made to integrate contentMode already contained correct lowercased code version, so probably this unintentional bug was created during merge?

@robingenz
Copy link
Member

Feel free to create a PR.

@robingenz robingenz added bug/fix Something isn't working and removed needs: triage labels Aug 7, 2024
@nomadminded
Copy link
Contributor Author

created pr #101

@nomadminded
Copy link
Contributor Author

is it ok to merge? can you finish the merge please? thank you

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug/fix Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants