minor improvement for command tool

This commit is contained in:
True Zhuanjia committed 2024-07-28 10:03:38 +08:00
1 parent 07d08918a3
commit 98db99b3ff
2 files changed
+15 -6

No files matched your search

+3 -2
View File
@@ -308,14 +308,15 @@ import UIKit
}
@objc public func addCommand(_ command: RemoteCommand) {
@objc public func addCommand(_ command: RemoteCommand) -> Bool {
command.keyboardCmdString = command.keyboardCmdString.uppercased() // convert all letters to upper case
if(command.alias.trimmingCharacters(in: .whitespacesAndNewlines).count == 0) {command.alias = command.keyboardCmdString} // copy cmd string as alias when alias is empty
let keyStrings = extractKeyStrings(from: command.keyboardCmdString)
if (keyStrings == nil) {return} // in case of non-keyboard command strings, return
if (keyStrings == nil) {return false} // in case of non-keyboard command strings, return false
commands.append(command)
saveCommands()
viewController?.reloadTableView() // don't know why but this reload has to be called from the CommandManager, doesn't work by calling it in the viewcontroller, probably related with the dialog box.
return true
}
@objc public func deleteCommand(at index: Int) {