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 device_version call with $type float #9

Merged

Conversation

robertfausk
Copy link

...which solves following use case:

<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
    <head>
        ...

        {% if is_device('iOS') and deviceVersion('iOS', 'float') < 15.4  %}
            <link rel="apple-touch-icon" sizes="57x57" href="/build/images/icons/apple-touch-icon-57x57.png">
            <link rel="apple-touch-icon" sizes="60x60" href="/build/images/icons/apple-touch-icon-60x60.png">
            <link rel="apple-touch-icon" sizes="72x72" href="/build/images/icons/apple-touch-icon-72x72.png">
            <link rel="apple-touch-icon" sizes="76x76" href="/build/images/icons/apple-touch-icon-76x76.png">
        {% endif %}

        ...

See also https://firt.dev/notes/pwa-ios/#apple-non-standard-pwa-related-abilities

Currently the follwing error is thrown:
MobileDetectBundle\Twig\Extension\MobileDetectExtension::deviceVersion(): Return value must be of type ?string, float returned
image

@codecov-commenter
Copy link

Codecov Report

Merging #9 (178ff2f) into main (60d0acb) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main       #9   +/-   ##
=======================================
  Coverage   94.23%   94.23%           
=======================================
  Files           7        7           
  Lines         399      399           
=======================================
  Hits          376      376           
  Misses         23       23           
Impacted Files Coverage Δ
src/Twig/Extension/MobileDetectExtension.php 98.43% <100.00%> (ø)

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@tattali tattali merged commit 0ff284d into tattali:main May 28, 2022
@robertfausk robertfausk deleted the fix_device_version_call_with_type_float branch May 29, 2022 05:36
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