[network/kdeconnect-ios] KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand: RunCommand: sort command list alphabetically by name

Nobodys Tools <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit b15211703d89e48bc283b10c06b31f488142d658 by Nobodys Tools.
Committed on 03/08/2026 at 14:57.
Pushed by albertvaka into branch 'master'.

RunCommand: sort command list alphabetically by name

The command entries were produced by mapping directly over the received
commands dictionary, so they appeared in an unspecified order that
changed between refreshes. Sort the entries by their display name
(case-insensitive, locale-aware) so the list is stable and predictable.

M  +2    -1    KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommand.swift

https://invent.kde.org/network/kdeconnect-ios/-/commit/b15211703d89e48bc283b10c06b31f488142d658

diff --git a/KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommand.swift b/KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommand.swift
index 547bc22..2261432 100644
--- a/KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommand.swift	
+++ b/KDE Connect/KDE Connect/Plugins and Plugin Views/RunCommand/RunCommand.swift	
@@ -86,7 +86,7 @@ import SwiftUI
     }
     
     private func processCommandsDict(_ commandsDict: CommandsDictionary) -> [CommandEntry] {
-        return commandsDict.compactMap { commandKey, commandInfo in
+        return commandsDict.compactMap { commandKey, commandInfo -> CommandEntry? in
             if let commandName = commandInfo["name"],
                let command = commandInfo["command"] {
                 let commandEntry = CommandEntry(name: commandName, command: command, key: commandKey)
@@ -96,5 +96,6 @@ import SwiftUI
                 return nil
             }
         }
+        .sorted { $0.name.localizedCaseInsensitiveCompare($1.name) == .orderedAscending }
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.