Skip to content

Commit

Permalink
Import upstream "KaiOS" feature phone detection improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mneudert committed Jan 9, 2025
1 parent 103bf7f commit f6d2729
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Upstream improvements for Linux client detection have been integrated
- Upstream improvements for "Chrome OS" detection have been integrated
- Upstream improvements for "Fire OS" detection have been integrated
- Upstream improvements for "KaiOS" feature phone detection have been integrated
- Upstream improvements for "LeafOS" detection have been integrated
- Upstream improvements for "Meta Horizon" detection have been integrated
- Upstream improvements for "Puffin" browser detection have been integrated
Expand Down
4 changes: 4 additions & 0 deletions lib/ua_inspector/parser.ex
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,10 @@ defmodule UAInspector.Parser do
%{result | device: %{device | type: "feature phone"}}
end

defp maybe_detect_feature_phone(%{device: device, os: %{name: "KaiOS"}} = result) do
%{result | device: %{device | type: "feature phone"}}
end

defp maybe_detect_feature_phone(result), do: result

defp maybe_detect_puffin_browsers(
Expand Down
21 changes: 21 additions & 0 deletions verify/lib/ua_inspector_verify/verify/generic.ex
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,27 @@ defmodule UAInspectorVerify.Verify.Generic do
)
end

def verify(
%{device: %{type: testcase_device_type} = testcase_device, os: %{name: "KaiOS"}} =
testcase,
result
)
when testcase_device_type != "feature phone" do
# improved device type detection in upcoming remote release
verify(
%{testcase | device: %{testcase_device | type: "feature phone"}},
result
)
end

def verify(%{device: :unknown, os: %{name: "KaiOS"}} = testcase, result) do
# improved device type detection in upcoming remote release
verify(
%{testcase | device: %{brand: :unknown, model: :unknown, type: "feature phone"}},
result
)
end

def verify(%{client: _} = testcase, %{client: _} = result) do
# regular user agent
testcase.user_agent == result.user_agent &&
Expand Down

0 comments on commit f6d2729

Please sign in to comment.