implement default entries for command tool. change add button to add/duplicate
This commit is contained in:
1 parent
69056332d3
commit
b53b0784aa
4 files changed
+46
-1
No files matched your search
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#import "AppDelegate.h"
|
#import "AppDelegate.h"
|
||||||
#import "MainFrameViewController.h"
|
#import "MainFrameViewController.h"
|
||||||
|
#import "Moonlight-Swift.h"
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
|
|
||||||
@@ -44,6 +45,13 @@ static NSString* DB_NAME = @"Limelight_iOS.sqlite";
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
||||||
|
// Override point for customization after application launch.
|
||||||
|
[CommandManager presetDefaultCommands];
|
||||||
|
return YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
|
- (void)application:(UIApplication *)application performActionForShortcutItem:(UIApplicationShortcutItem *)shortcutItem completionHandler:(void (^)(BOOL succeeded))completionHandler {
|
||||||
_pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"];
|
_pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"];
|
||||||
_shortcutCompletionHandler = completionHandler;
|
_shortcutCompletionHandler = completionHandler;
|
||||||
|
|||||||
@@ -230,6 +230,20 @@ import UIKit
|
|||||||
loadCommands()
|
loadCommands()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@objc static func presetDefaultCommands() {
|
||||||
|
let defaults = UserDefaults.standard
|
||||||
|
if defaults.data(forKey: "savedCommands") == nil { // save default entries if the data is empty.
|
||||||
|
let defaultCommands: [RemoteCommand] = [
|
||||||
|
RemoteCommand(keyboardCmdString: "CTRL+A", alias: "Select All"),
|
||||||
|
RemoteCommand(keyboardCmdString: "CTRL+C", alias: "Copy"),
|
||||||
|
RemoteCommand(keyboardCmdString: "CTRL+V", alias: "Paste")
|
||||||
|
]
|
||||||
|
|
||||||
|
let data = try? NSKeyedArchiver.archivedData(withRootObject: defaultCommands, requiringSecureCoding: false)
|
||||||
|
defaults.set(data, forKey: "savedCommands")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@objc public func createTestKeyMappings() -> [String: Int16] {
|
@objc public func createTestKeyMappings() -> [String: Int16] {
|
||||||
return CommandManager.keyMappings
|
return CommandManager.keyMappings
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,6 +145,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Add/Duplicate" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新增/复制"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新增/复制"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "新增/复制"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Alias (optional)" : {
|
"Alias (optional)" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ import UIKit
|
|||||||
tableView.rowHeight = 60
|
tableView.rowHeight = 60
|
||||||
tableView.separatorColor = highlightColor
|
tableView.separatorColor = highlightColor
|
||||||
// Configure buttons
|
// Configure buttons
|
||||||
addButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Add"), for: .normal)
|
addButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Add/Duplicate"), for: .normal)
|
||||||
deleteButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Delete"), for: .normal)
|
deleteButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Delete"), for: .normal)
|
||||||
editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Edit"), for: .normal)
|
editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Edit"), for: .normal)
|
||||||
exitButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Exit"), for: .normal)
|
exitButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Exit"), for: .normal)
|
||||||
|
|||||||
Reference in new issue
Block a user