| 125 | |
| 126 | // Extract app-style UA info (e.g., "Model=Redmi Note 8 Pro; Manufacturer=Xiaomi") |
| 127 | function extractAppStyleInfo(ua: string): { |
| 128 | model?: string; |
| 129 | manufacturer?: string; |
| 130 | } { |
| 131 | const modelMatch = ua.match(APP_MODEL_REGEX); |
| 132 | const manufacturerMatch = ua.match(APP_MANUFACTURER_REGEX); |
| 133 | |
| 134 | return { |
| 135 | model: modelMatch?.[1]?.trim(), |
| 136 | manufacturer: manufacturerMatch?.[1]?.trim(), |
| 137 | }; |
| 138 | } |
| 139 | |
| 140 | // Detect brand from UA string or model name |
| 141 | function detectBrand(ua: string, model?: string): string | undefined { |