(ua: string, model?: string)
| 139 | |
| 140 | // Detect brand from UA string or model name |
| 141 | function detectBrand(ua: string, model?: string): string | undefined { |
| 142 | const searchString = `${ua} ${model || ''}`; |
| 143 | for (const { pattern, brand } of BRAND_PATTERNS) { |
| 144 | if (pattern.test(searchString)) { |
| 145 | return brand; |
| 146 | } |
| 147 | } |
| 148 | return undefined; |
| 149 | } |
| 150 | |
| 151 | // Check if a model name indicates a phone (not tablet) |
| 152 | function isKnownPhoneModel(model?: string): boolean { |