localize send command view
This commit is contained in:
1 parent
b00d836c13
commit
46e3f85903
2 files changed
+228
-17
No files matched your search
@@ -107,6 +107,18 @@
|
|||||||
"state" : "translated",
|
"state" : "translated",
|
||||||
"value" : "新增"
|
"value" : "新增"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "添加"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "添加"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -133,6 +145,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Alias" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "别名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "别名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "别名"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Bitrate: %.1f Mbps" : {
|
"Bitrate: %.1f Mbps" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -179,6 +214,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Command" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "命令"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Connecting" : {
|
"Connecting" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -438,6 +496,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Delete" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "删除"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "删除"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "删除"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Delete Buttons Here" : {
|
"Delete Buttons Here" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -461,6 +542,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Done" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "完成"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "完成"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "完成"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Drag and drop buttons onto this trash can to remove them from the interface" : {
|
"Drag and drop buttons onto this trash can to remove them from the interface" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -484,6 +588,52 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Edit" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "编辑"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "编辑"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "编辑"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Enter a new command and alias" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "输入新命令和对应的别名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "输入新命令和对应的别名"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "输入新命令和对应的别名"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Enter Custom Resolution" : {
|
"Enter Custom Resolution" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -559,6 +709,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Exit" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "退出"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "退出"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "退出"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Failed to quit app. If this app was started by another device, you'll need to quit from that device." : {
|
"Failed to quit app. If this app was started by another device, you'll need to quit from that device." : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -743,9 +916,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Key" : {
|
|
||||||
"extractionState" : "manual"
|
|
||||||
},
|
|
||||||
"Launch App" : {
|
"Launch App" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -1069,6 +1239,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"New Command" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新建命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新建命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新建命令"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"No video received from host." : {
|
"No video received from host." : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -1742,6 +1935,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Send Commands" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "发送命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "发送命令"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "发送命令"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Set PC/Game resolution:" : {
|
"Set PC/Game resolution:" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -173,9 +173,9 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
@objc private func addButtonTapped() {
|
@objc private func addButtonTapped() {
|
||||||
let alert = UIAlertController(title: "New Command", message: "Enter a new command and alias", preferredStyle: .alert)
|
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "New Command"), message: SwiftLocalizationHelper.localizedString(forKey: "Enter a new command and alias"), preferredStyle: .alert)
|
||||||
alert.addTextField { $0.placeholder = "Command" }
|
alert.addTextField { $0.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Command") }
|
||||||
alert.addTextField { $0.placeholder = "Alias" }
|
alert.addTextField { $0.placeholder = SwiftLocalizationHelper.localizedString(forKey: "Alias") }
|
||||||
alert.textFields?[0].keyboardType = .asciiCapable
|
alert.textFields?[0].keyboardType = .asciiCapable
|
||||||
alert.textFields?[0].autocorrectionType = .no
|
alert.textFields?[0].autocorrectionType = .no
|
||||||
alert.textFields?[0].spellCheckingType = .no
|
alert.textFields?[0].spellCheckingType = .no
|
||||||
@@ -183,9 +183,7 @@ import UIKit
|
|||||||
alert.textFields?[1].autocorrectionType = .no
|
alert.textFields?[1].autocorrectionType = .no
|
||||||
alert.textFields?[1].spellCheckingType = .no
|
alert.textFields?[1].spellCheckingType = .no
|
||||||
|
|
||||||
|
let submitAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Add"), style: .default) { [unowned alert] _ in
|
||||||
|
|
||||||
let submitAction = UIAlertAction(title: "Add", style: .default) { [unowned alert] _ in
|
|
||||||
let keyboardCmdString = alert.textFields?[0].text ?? ""
|
let keyboardCmdString = alert.textFields?[0].text ?? ""
|
||||||
let alias = alert.textFields?[1].text ?? keyboardCmdString
|
let alias = alert.textFields?[1].text ?? keyboardCmdString
|
||||||
let newCommand = RemoteCommand(keyboardCmdString: keyboardCmdString, alias: alias)
|
let newCommand = RemoteCommand(keyboardCmdString: keyboardCmdString, alias: alias)
|
||||||
@@ -193,14 +191,14 @@ import UIKit
|
|||||||
//self.reloadTableView() // don't know why but this reload has to be called from the CommandManager, it doesn't work here.
|
//self.reloadTableView() // don't know why but this reload has to be called from the CommandManager, it doesn't work here.
|
||||||
}
|
}
|
||||||
|
|
||||||
let cancelAction = UIAlertAction(title: "Cancel", style: .cancel)
|
let cancelAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey:"Cancel"), style: .cancel)
|
||||||
alert.addAction(submitAction)
|
alert.addAction(submitAction)
|
||||||
alert.addAction(cancelAction)
|
alert.addAction(cancelAction)
|
||||||
|
|
||||||
if let selectedIndexPath = self.tableView.indexPathForSelectedRow {
|
if let selectedIndexPath = self.tableView.indexPathForSelectedRow {
|
||||||
let selectedCommand = CommandManager.shared.getAllCommands()[selectedIndexPath.row]
|
let selectedCommand = CommandManager.shared.getAllCommands()[selectedIndexPath.row]
|
||||||
alert.textFields?[0].text = selectedCommand.keyboardCmdString // load selected keyboard cmd string
|
alert.textFields?[0].text = selectedCommand.keyboardCmdString // load selected keyboard cmd string
|
||||||
//alert.textFields?[1].text = selectedCommand.alias
|
//alert.textFields?[1].text = selectedCommand.alias // leave the alias input field empty
|
||||||
}
|
}
|
||||||
|
|
||||||
self.present(alert, animated: true)
|
self.present(alert, animated: true)
|
||||||
@@ -251,8 +249,7 @@ import UIKit
|
|||||||
let selectedBackgroundView = UIView()
|
let selectedBackgroundView = UIView()
|
||||||
selectedBackgroundView.backgroundColor = highlightColor // Color for the selected state
|
selectedBackgroundView.backgroundColor = highlightColor // Color for the selected state
|
||||||
cell.selectedBackgroundView = selectedBackgroundView
|
cell.selectedBackgroundView = selectedBackgroundView
|
||||||
|
|
||||||
|
|
||||||
let command = CommandManager.shared.getAllCommands()[indexPath.row]
|
let command = CommandManager.shared.getAllCommands()[indexPath.row]
|
||||||
cell.textLabel?.text = command.alias
|
cell.textLabel?.text = command.alias
|
||||||
return cell
|
return cell
|
||||||
@@ -275,7 +272,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !isEditingMode {
|
if !isEditingMode {
|
||||||
// Call the dummy method for key-value sending implementation
|
// Sending keyboard command
|
||||||
let command = CommandManager.shared.getAllCommands()[indexPath.row]
|
let command = CommandManager.shared.getAllCommands()[indexPath.row]
|
||||||
sendKeyboardCommand(command)
|
sendKeyboardCommand(command)
|
||||||
if !viewPinned { dismiss(animated: false, completion: nil) } // dimiss the view in sending mode & the view is not pinned
|
if !viewPinned { dismiss(animated: false, completion: nil) } // dimiss the view in sending mode & the view is not pinned
|
||||||
@@ -283,9 +280,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
private func sendKeyboardCommand(_ cmd: RemoteCommand) {
|
private func sendKeyboardCommand(_ cmd: RemoteCommand) {
|
||||||
// Dummy implementation
|
|
||||||
print("Sending key-value")
|
print("Sending key-value")
|
||||||
|
|
||||||
let keyboardCmdStrings = CommandManager.shared.extractKeyStrings(from: cmd.keyboardCmdString)
|
let keyboardCmdStrings = CommandManager.shared.extractKeyStrings(from: cmd.keyboardCmdString)
|
||||||
sendKeyDownEventWithDelay(keyboardCmdStrings: keyboardCmdStrings!)
|
sendKeyDownEventWithDelay(keyboardCmdStrings: keyboardCmdStrings!)
|
||||||
}
|
}
|
||||||
@@ -306,7 +301,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
// 发送当前键的键盘按下事件
|
// 发送当前键的键盘按下事件
|
||||||
LiSendKeyboardEvent(keyCode,Int8(KEY_ACTION_DOWN), 0)
|
LiSendKeyboardEvent(keyCode,Int8(KEY_ACTION_DOWN), 0)
|
||||||
// 使用 asyncAfter 在指定延迟后发送下一个键的键盘按下事件
|
// 使用 asyncAfter 在指定异步延迟后发送下一个键的键盘按下事件
|
||||||
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
|
DispatchQueue.main.asyncAfter(deadline: .now() + delay) {
|
||||||
self.sendKeyDownEventWithDelay(keyboardCmdStrings: keyboardCmdStrings, delay: delay, index: index+1) // 跳过当前键,继续下一个
|
self.sendKeyDownEventWithDelay(keyboardCmdStrings: keyboardCmdStrings, delay: delay, index: index+1) // 跳过当前键,继续下一个
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user