diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 9e4bcddd..fbddb762 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -3837,6 +3837,98 @@ } } }, + "Quit Now" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "立即退出" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "立即退出" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "立即退出" + } + } + } + }, + "Rendering mode change requires app restart" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "更改渲染模式需要重启应用以确保干净启动。您是否要立即退出应用?" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "更改渲染模式需要重新啟動應用程式以確保乾淨啟動。您是否要立即退出應用程式?" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "更改渲染模式需要重新啟動應用程式以確保乾淨啟動。您是否要立即退出應用程式?" + } + } + } + }, + "Restart Required" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "需要重启" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "需要重新啟動" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "需要重新啟動" + } + } + } + }, + "Later" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "稍后" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "稍後" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "稍後" + } + } + } + }, "Read Widget Instruction" : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index e0227033..b07f39ec 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -1636,6 +1636,48 @@ BOOL isCustomResolution(int resolutionSelected) { } - (void)renderingBackendChanged:(UISegmentedControl *)sender { + + // Get the current settings to compare with the new selection + DataManager* dataMan = [[DataManager alloc] init]; + TemporarySettings* currentSettings = [dataMan getSettings]; + NSInteger previousBackend = [currentSettings.renderingBackend integerValue]; + + + // Check if the rendering backend has actually changed + if (previousBackend != sender.selectedSegmentIndex) { + // Show alert to prompt user to restart the app + NSString *message = [LocalizationHelper localizedStringForKey:@"Rendering mode change requires app restart"]; + + UIAlertController *alertController = [UIAlertController alertControllerWithTitle:[LocalizationHelper localizedStringForKey:@"Restart Required"] + message:message + preferredStyle:UIAlertControllerStyleAlert]; + + UIAlertAction *quitAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Quit Now"] + style:UIAlertActionStyleDestructive + handler:^(UIAlertAction * _Nonnull action) { + + DataManager* directDataMan = [[DataManager alloc] init]; + Settings* directSettings = [directDataMan retrieveSettings]; + directSettings.renderingBackend = [NSNumber numberWithInteger:sender.selectedSegmentIndex]; + [directDataMan saveData]; + + [self saveSettings]; + + exit(0); + }]; + + UIAlertAction *laterAction = [UIAlertAction actionWithTitle:[LocalizationHelper localizedStringForKey:@"Later"] + style:UIAlertActionStyleCancel + handler:^(UIAlertAction * _Nonnull action) { + // Save settings immediately to persist the renderer change + [self saveSettings]; + }]; + + [alertController addAction:laterAction]; + [alertController addAction:quitAction]; + [self presentViewController:alertController animated:YES completion:nil]; + } + // Disable PiP toggle when Metal renderer is selected if (sender.selectedSegmentIndex == RENDER_METAL) { // Performance mode (Metal renderer) selected - disable PiP diff --git a/VoidLink/ViewControllers/ToolboxViewController.swift b/VoidLink/ViewControllers/ToolboxViewController.swift index 8f991df1..c32cf9dd 100644 --- a/VoidLink/ViewControllers/ToolboxViewController.swift +++ b/VoidLink/ViewControllers/ToolboxViewController.swift @@ -36,7 +36,7 @@ import UIKit "widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ On-screen widget tool ]"), "bringUpSoftKeyboard":SwiftLocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"), "enterPip":SwiftLocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]"), - "toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay & graphs ]") + "toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay & graphs ]"), "disconnectAndQuitApp":SwiftLocalizationHelper.localizedString(forKey: "[ Disconnect & quit app ]") ]