Skip to content

fix: test for Linux, FreeBSD, and OpenBSD in device plugin #2362

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion device/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,6 @@ Get the device's current language locale tag.

#### OperatingSystem

<code>'ios' | 'android' | 'windows' | 'mac' | 'unknown'</code>
<code>'ios' | 'android' | 'windows' | 'mac' | 'linux' | 'freebsd' | 'openbsd' | 'unknown'</code>

</docgen-api>
2 changes: 1 addition & 1 deletion device/src/definitions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export type OperatingSystem = 'ios' | 'android' | 'windows' | 'mac' | 'unknown';
export type OperatingSystem = 'ios' | 'android' | 'windows' | 'mac' | 'linux' | 'freebsd' | 'openbsd' | 'unknown';

export interface DeviceId {
/**
Expand Down
6 changes: 6 additions & 0 deletions device/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,12 @@ export class DeviceWeb extends WebPlugin implements DevicePlugin {
uaFields.operatingSystem = 'windows';
} else if (/Mac/i.test(ua)) {
uaFields.operatingSystem = 'mac';
} else if (/Linux/i.test(ua)) {
uaFields.operatingSystem = 'linux';
} else if (/FreeBSD/i.test(ua)) {
uaFields.operatingSystem = 'freebsd';
} else if (/OpenBSD/i.test(ua)) {
uaFields.operatingSystem = 'openbsd';
} else {
uaFields.operatingSystem = 'unknown';
}
Expand Down