Skip to content
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

Document applicationUserAgentPrefix #63

Merged
merged 5 commits into from
Dec 18, 2024
Merged
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
7 changes: 5 additions & 2 deletions _source/android/05_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ Set the JSON converter used for bridge components:
Hotwire.config.jsonConverter = KotlinXJsonConverter()
```

Customize the user agent:
Set a custom user agent application prefix for every `WebView` instance. The library will automatically append a substring to your prefix which includes:
* - `"Hotwire Native Android; Turbo Native Android;"` - for `hotwire_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14)
* - `"bridge-components: [your bridge components];"`
* - The `WebView`'s default Chromium user agent string

```kotlin
Hotwire.config.userAgent = "My Application; ${Hotwire.config.userAgentSubstring()}"
Hotwire.config.applicationUserAgentPrefix = "My Application;"
```
5 changes: 4 additions & 1 deletion _source/ios/05_configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ Hotwire Native provides a few options to customize your iOS app. We recommend ma
## General

* `Hotwire.config.debugLoggingEnabled` - Enable or disable debug logging for Turbo visits and bridge elements connecting, disconnecting, receiving/sending messages, and more.
* `Hotwire.config.userAgent` - Override to set a custom user agent for your app's requests. Make sure to include "Hotwire Native" or "Turbo Native" to use `turbo_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14).
* `Hotwire.config.applicationUserAgentPrefix` - Set a custom user agent application prefix for every `WKWebView` instance. The library will automatically append a substring to your prefix which includes:
* `"Hotwire Native iOS; Turbo Native iOS;"` - for `hotwire_native_app?` on your [Rails server](https://github.com/hotwired/turbo-rails/blob/1aa7ba9d38dee1e1b4078a74404131122b907176/app/controllers/turbo/native/navigation.rb#L14)
* `"bridge-components: [your bridge components];"`
* `WKWebView`'s default user agent string (at the beginning of the user agent)
* `Hotwire.config.showDoneButtonOnModals` - When enabled, adds a `UIBarButtonItem` of type `.done` to the left navigation bar button item on screens presented modally.
* `Hotwire.config.backButtonDisplayMode` - Sets the back button display mode of `HotwireWebViewController`.

Expand Down