invalid input msgbox for adding on-screen widget
This commit is contained in:
1 parent
dd0ff298d5
commit
ea0c16e334
2 files changed
+98
-2
No files matched your search
@@ -352,6 +352,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Check the command and parameter." : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "请检查输入的命令和参数"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "请检查输入的命令和参数"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "请检查输入的命令和参数"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Command" : {
|
"Command" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -1100,6 +1123,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Invalid Input" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "无效输入"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "无效输入"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "无效输入"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Launch App" : {
|
"Launch App" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
@@ -1952,6 +1998,29 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"Read Widget Instruction" : {
|
||||||
|
"extractionState" : "manual",
|
||||||
|
"localizations" : {
|
||||||
|
"zh-Hans" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "阅读控件添加说明"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-Hant" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "阅读控件添加说明"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zh-HK" : {
|
||||||
|
"stringUnit" : {
|
||||||
|
"state" : "translated",
|
||||||
|
"value" : "阅读控件添加说明"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"Rebase in Stream View" : {
|
"Rebase in Stream View" : {
|
||||||
"extractionState" : "manual",
|
"extractionState" : "manual",
|
||||||
"localizations" : {
|
"localizations" : {
|
||||||
|
|||||||
+29
-2
@@ -327,6 +327,27 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) presentInvalidWidgetCommandAlert{
|
||||||
|
UIAlertController *savedAlertController = [UIAlertController alertControllerWithTitle: [LocalizationHelper localizedStringForKey:@"Invalid Input"] message: [LocalizationHelper localizedStringForKey:@"Check the command and parameter."] preferredStyle:UIAlertControllerStyleAlert];
|
||||||
|
|
||||||
|
UIAlertAction *readInstruction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Read Widget Instruction"]
|
||||||
|
style:UIAlertActionStyleDefault
|
||||||
|
handler:^(UIAlertAction *action){
|
||||||
|
NSURL *url = [NSURL URLWithString:@"https://b23.tv/J8qEXOr"];
|
||||||
|
if ([[UIApplication sharedApplication] canOpenURL:url]) {
|
||||||
|
[[UIApplication sharedApplication] openURL:url options:@{} completionHandler:nil];
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
|
||||||
|
UIAlertAction *okAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"OK"]
|
||||||
|
style:UIAlertActionStyleDefault
|
||||||
|
handler:nil];
|
||||||
|
[savedAlertController addAction:readInstruction];
|
||||||
|
[savedAlertController addAction:okAction];
|
||||||
|
|
||||||
|
[self presentViewController:savedAlertController animated:YES completion:nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction) addTapped:(id)sender{
|
- (IBAction) addTapped:(id)sender{
|
||||||
|
|
||||||
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"New On-Screen Widget"]
|
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"New On-Screen Widget"]
|
||||||
@@ -382,12 +403,18 @@
|
|||||||
bool noValidSpecialButtonString = ![CommandManager.specialOverlayButtonCmds containsObject:cmdString];
|
bool noValidSpecialButtonString = ![CommandManager.specialOverlayButtonCmds containsObject:cmdString];
|
||||||
bool noValidSpecialGameWidgetString = ![CommandManager.specialGameWidgets containsObject:cmdString];
|
bool noValidSpecialGameWidgetString = ![CommandManager.specialGameWidgets containsObject:cmdString];
|
||||||
|
|
||||||
if(noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString && noValidSpecialButtonString && noValidSuperComboButtonString && noValidSpecialGameWidgetString) return;
|
bool invalidInput = noValidKeyboardString && noValidMouseButtonString && noValidTouchPadString && noValidOscButtonString && noValidSpecialButtonString && noValidSuperComboButtonString && noValidSpecialGameWidgetString;
|
||||||
|
|
||||||
if([widgetShape isEqualToString:@"r"]) widgetShape = @"round";
|
if([widgetShape isEqualToString:@"r"]) widgetShape = @"round";
|
||||||
else if([widgetShape isEqualToString:@"s"]) widgetShape = @"square";
|
else if([widgetShape isEqualToString:@"s"]) widgetShape = @"square";
|
||||||
else if([widgetShape isEqualToString:@""]) widgetShape = @"default";
|
else if([widgetShape isEqualToString:@""]) widgetShape = @"default";
|
||||||
else return;
|
else invalidInput = true;
|
||||||
|
|
||||||
|
if(invalidInput) {
|
||||||
|
[self presentInvalidWidgetCommandAlert];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//saving & present the keyboard button:
|
//saving & present the keyboard button:
|
||||||
OnScreenWidgetView* widgetView = [[OnScreenWidgetView alloc] initWithKeyString:cmdString keyLabel:keyLabel shape:widgetShape];
|
OnScreenWidgetView* widgetView = [[OnScreenWidgetView alloc] initWithKeyString:cmdString keyLabel:keyLabel shape:widgetShape];
|
||||||
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
widgetView.translatesAutoresizingMaskIntoConstraints = NO; // weird but this is mandatory, or you will find no key views added to the right place
|
||||||
|
|||||||
Reference in new issue
Block a user