From 89d4e871b1941f6199c2a37f4a37010347355b94 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 17 Dec 2024 14:29:45 -0800 Subject: [PATCH 1/4] Document applicationUserAgentPrefix --- _source/ios/05_configuration.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/_source/ios/05_configuration.md b/_source/ios/05_configuration.md index 9084457..e634751 100644 --- a/_source/ios/05_configuration.md +++ b/_source/ios/05_configuration.md @@ -18,7 +18,10 @@ Hotwire.config.debugLoggingEnabled = true ## General * `debugLoggingEnabled` - Enable or disable debug logging for Turbo visits and bridge elements connecting, disconnecting, receiving/sending messages, and more. -* `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). +* `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) * `showDoneButtonOnModals` - When enabled, adds a `UIBarButtonItem` of type `.done` to the left navigation bar button item on screens presented modally. * `backButtonDisplayMode` - Sets the back button display mode of `HotwireWebViewController`. From a2cf5b1677e970fb92c5bd8d25c46ed7a9e2da01 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 17 Dec 2024 14:41:44 -0800 Subject: [PATCH 2/4] Add Android documentation --- _source/android/05_configuration.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/_source/android/05_configuration.md b/_source/android/05_configuration.md index 26eac5a..9f1150f 100644 --- a/_source/android/05_configuration.md +++ b/_source/android/05_configuration.md @@ -71,5 +71,10 @@ Hotwire.config.jsonConverter = KotlinXJsonConverter() Customize the user agent: ```kotlin -Hotwire.config.userAgent = "My Application; ${Hotwire.config.userAgentSubstring()}" +Hotwire.config.applicationUserAgentPrefix = "My Application;" ``` + +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;" +* - "bridge-components: [your bridge components];" +* - The `WebView`'s default Chromium user agent string From 41195728fcaa3fc22b748af41458c4bf95e2bed2 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 17 Dec 2024 14:42:58 -0800 Subject: [PATCH 3/4] Clean up documentation --- _source/android/05_configuration.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/_source/android/05_configuration.md b/_source/android/05_configuration.md index 9f1150f..d0a3587 100644 --- a/_source/android/05_configuration.md +++ b/_source/android/05_configuration.md @@ -68,13 +68,11 @@ Set the JSON converter used for bridge components: Hotwire.config.jsonConverter = KotlinXJsonConverter() ``` -Customize the user agent: - -```kotlin -Hotwire.config.applicationUserAgentPrefix = "My Application;" -``` - 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;" * - "bridge-components: [your bridge components];" * - The `WebView`'s default Chromium user agent string + +```kotlin +Hotwire.config.applicationUserAgentPrefix = "My Application;" +``` From aaef4d56d416472b7fe606bae0560436b868daec Mon Sep 17 00:00:00 2001 From: Jay Ohms Date: Wed, 18 Dec 2024 08:48:02 -0500 Subject: [PATCH 4/4] Display user agent substrings as code --- _source/android/05_configuration.md | 4 ++-- _source/ios/05_configuration.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/_source/android/05_configuration.md b/_source/android/05_configuration.md index d0a3587..df8a83e 100644 --- a/_source/android/05_configuration.md +++ b/_source/android/05_configuration.md @@ -69,8 +69,8 @@ Hotwire.config.jsonConverter = KotlinXJsonConverter() ``` 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;" -* - "bridge-components: [your bridge components];" +* - `"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 diff --git a/_source/ios/05_configuration.md b/_source/ios/05_configuration.md index 5439335..1f04621 100644 --- a/_source/ios/05_configuration.md +++ b/_source/ios/05_configuration.md @@ -13,8 +13,8 @@ Hotwire Native provides a few options to customize your iOS app. We recommend ma * `Hotwire.config.debugLoggingEnabled` - Enable or disable debug logging for Turbo visits and bridge elements connecting, disconnecting, receiving/sending messages, and more. * `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];" + * `"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`.