Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,17 @@ fun sortByChannel(): Comparator<WiFiDetail> =
fun sortByDefault(): Comparator<WiFiDetail> =
compareBy<WiFiDetail> { it.wiFiIdentifier.ssid }.thenBy { it.wiFiIdentifier.bssid }

fun sortByStandard(): Comparator<WiFiDetail> =
compareByDescending<WiFiDetail> { it.wiFiSignal.extra.wiFiStandard.wiFiStandardId }
.thenByDescending { it.wiFiSignal.level }
Comment on lines +39 to +41
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sortByStandard() currently sorts by wiFiStandardId descending, which will place 802.11ad (id=7) ahead of 802.11ax (id=6). This doesn’t match the PR description’s stated Wi‑Fi generation order (7 → 6 → 5 → 4 → Legacy → Unknown). Consider defining an explicit ranking (e.g., mapping WiFiStandard to a sort key) so the sort order matches the intended UX, and treat 11ad/WiGig explicitly (either between 7 and 6 by design, or below 6).

Copilot uses AI. Check for mistakes.
.thenBy { it.wiFiIdentifier.ssid }
.thenBy { it.wiFiIdentifier.bssid }

enum class SortBy(
val sort: Comparator<WiFiDetail>,
) {
STRENGTH(sortByStrength()),
SSID(sortBySSID()),
CHANNEL(sortByChannel()),
STANDARD(sortByStandard()),
}
6 changes: 4 additions & 2 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,15 @@
<string-array name="sort_by_index_array" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>2</item>
<item>3</item>
</string-array>
Comment on lines 35 to 40
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These newly added <item> lines are indented with tab characters, while the surrounding XML uses spaces. Please replace tabs with spaces to keep formatting consistent and avoid whitespace-only diffs/noise in future changes.

Copilot uses AI. Check for mistakes.

<string-array name="sort_by_array">
<item>@string/sort_by_signal_strength</item>
<item>@string/sort_by_ssid</item>
<item>@string/sort_by_channel</item>
<item>@string/sort_by_channel</item>
<item>@string/sort_by_standard</item>
</string-array>
Comment on lines 42 to 47
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new entries in sort_by_array are indented with tabs, unlike the rest of this file which uses spaces. Please normalize indentation (spaces) for consistency.

Copilot uses AI. Check for mistakes.

<string-array name="connection_view_index_array" translatable="false">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@
<string name="security_wps" translatable="false">"WPS"</string>
<string name="selected_menu_key" translatable="false">"selected_menu"</string>
<string name="sort_by_channel">"Channel"</string>
<string name="sort_by_standard" translatable="false">"Standard"</string>
Copy link

Copilot AI Apr 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort_by_standard is marked translatable="false", but the other user-visible sort labels nearby (e.g., sort_by_channel, sort_by_signal_strength) are translatable. If this label should be localized like the others, remove translatable="false" (or otherwise align the translation policy across the sort-by labels).

Suggested change
<string name="sort_by_standard" translatable="false">"Standard"</string>
<string name="sort_by_standard">"Standard"</string>

Copilot uses AI. Check for mistakes.
<string name="sort_by_default" translatable="false">"0"</string>
<string name="sort_by_key" translatable="false">"sort_by"</string>
<string name="sort_by_signal_strength">"Signal Strength"</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,16 @@ class SortByTest {
@Test
fun sortBy() {
assertThat(SortBy.entries)
.hasSize(3)
.containsExactly(SortBy.STRENGTH, SortBy.SSID, SortBy.CHANNEL)
.hasSize(4)
.containsExactly(SortBy.STRENGTH, SortBy.SSID, SortBy.CHANNEL, SortBy.STANDARD)
}

@Test
fun sortByOrdinal() {
assertThat(SortBy.STRENGTH.ordinal).isEqualTo(0)
assertThat(SortBy.SSID.ordinal).isEqualTo(1)
assertThat(SortBy.CHANNEL.ordinal).isEqualTo(2)
assertThat(SortBy.STANDARD.ordinal).isEqualTo(3)
}

@Test
Expand All @@ -49,5 +50,9 @@ class SortByTest {
SortBy.CHANNEL.sort.javaClass
.isInstance(sortByChannel()),
).isTrue
assertThat(
SortBy.STANDARD.sort.javaClass
.isInstance(sortByStandard()),
).isTrue
}
}
Loading