diff --git a/Limelight/Localization/Localizable.xcstrings b/Limelight/Localization/Localizable.xcstrings index 0a30eecd..c7ba29dc 100644 --- a/Limelight/Localization/Localizable.xcstrings +++ b/Limelight/Localization/Localizable.xcstrings @@ -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" : { "extractionState" : "manual", "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" : { "extractionState" : "manual", "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" : { "extractionState" : "manual", "localizations" : { diff --git a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m index a8ee5bf9..aa53b65e 100644 --- a/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m +++ b/Limelight/ViewControllers/CustomOSCViewControl/LayoutOnScreenControlsViewController.m @@ -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{ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"New On-Screen Widget"] @@ -382,12 +403,18 @@ bool noValidSpecialButtonString = ![CommandManager.specialOverlayButtonCmds 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"; else if([widgetShape isEqualToString:@"s"]) widgetShape = @"square"; else if([widgetShape isEqualToString:@""]) widgetShape = @"default"; - else return; + else invalidInput = true; + + if(invalidInput) { + [self presentInvalidWidgetCommandAlert]; + return; + } + //saving & present the keyboard button: 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