Skip to content

Conversation

@gitBingxu
Copy link

I found the bug on Huawei mate30 which userAgent is "... Android 10 ...", Qrcode.js can not get the correct android version on the device because of the reg.

I fixed it and checked it, there are test cases:

const TEST_CASE = [
    {source: 'android 0', expect: 0},
    {source: 'android 0.1', expect: 0.1},
    {source: 'android 0.1.1', expect: 0.1},
    {source: 'android 10', expect: 10},
    {source: 'android 10.0', expect: 10},
    {source: 'android 11.1', expect: 11.1},
    {source: 'android 11.09.1', expect: 11.09},
    {source: 'android 111.1.1', expect: 111.1}
]

const test = (reg) => {
    return TEST_CASE.every(item => {
        return Number.parseFloat(item.source.match(reg)[1]) === item.expect;
    })
}

test(/android (([0-9])+(\.[0-9]+)?)/i);   // true

Could you please approve it, I think the Qrcode.js is very usefull, Thank you guys~

@Wing-9527
Copy link

Wing-9527 commented Nov 22, 2022

reference issue #280

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.

2 participants