feat: customise linked device name #3325
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Details
The PR implements a functionality for setting a device and/or a browser names of a paired device.
Description
Once you paired the web client, you can see it in your linked devices section in the phone.
The PR adds a possibility to customize names of your linked devices.
By default, the library uses user agent for macOS with Google Chrome platform:
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.67 Safari/537.36'
That's the reason why you see
Google Chrome (MacOS)
in the linked device section.In order to customize it you can provide values for two new properties while creating a new
Client
instance:deviceName
browserName
Tip
Valid values for
browserName
are:'Chrome'
|'Firefox'
|'IE'
|'Opera'
|'Safari'
|'Edge'
1. If you want to change the browser type only:
The preview (click to expand)
2. If you want to change the device name only, the browser type will be retrieved from the user agent (in our case it is Google Chrome):
The preview (click to expand)
3. If you want to change both, the browser type and the device name:
The preview (click to expand)
4. If you want only the device name to be shown, you can do it that way:
The preview (click to expand)
5. If the provided value for the
browserName
will be something else, but not one of the valid values, the linked device will be displayed with a OS type retrieved from the user agent:The preview (click to expand)
How Has This Been Tested
Tested with a code provided in usage examples above.
You can try the feature by running one of the following commands:
Types of changes
Checklist