implement default entries for command tool. change add button to add/duplicate
This commit is contained in:
@@ -8,6 +8,7 @@
|
||||
|
||||
#import "AppDelegate.h"
|
||||
#import "MainFrameViewController.h"
|
||||
#import "Moonlight-Swift.h"
|
||||
|
||||
@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 {
|
||||
_pcUuidToLoad = (NSString*)[shortcutItem.userInfo objectForKey:@"UUID"];
|
||||
_shortcutCompletionHandler = completionHandler;
|
||||
|
||||
@@ -230,6 +230,20 @@ import UIKit
|
||||
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] {
|
||||
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)" : {
|
||||
"extractionState" : "manual",
|
||||
"localizations" : {
|
||||
|
||||
@@ -65,7 +65,7 @@ import UIKit
|
||||
tableView.rowHeight = 60
|
||||
tableView.separatorColor = highlightColor
|
||||
// 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)
|
||||
editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Edit"), for: .normal)
|
||||
exitButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Exit"), for: .normal)
|
||||
|
||||
Reference in New Issue
Block a user