From 7a02e63a4ee629cd932006443966685bf7d48017 Mon Sep 17 00:00:00 2001 From: Licardo <1014660822@qq.com> Date: Fri, 9 Aug 2024 13:33:04 +0800 Subject: [PATCH 1/4] add "Run App" button --- InjectGUI/View/SidebarView.swift | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/InjectGUI/View/SidebarView.swift b/InjectGUI/View/SidebarView.swift index 265abde..d1c6151 100644 --- a/InjectGUI/View/SidebarView.swift +++ b/InjectGUI/View/SidebarView.swift @@ -38,7 +38,7 @@ struct SidebarView: View { // 应用列表或状态信息 ZStack { if softwareManager.isLoading { - ProgressView("Scanning apps...") + ProgressView("Scanning Apps...") } else if filteredApps.isEmpty { Text("No apps found.") .font(.headline) @@ -77,7 +77,7 @@ struct SidebarView: View { Text(app.detail.name) .font(.headline) - Label("已注入", systemImage: "checkmark.circle.fill") + Label("Injected", systemImage: "checkmark.circle.fill") .font(.caption2) .foregroundStyle(.green) .labelStyle(.iconOnly) @@ -95,6 +95,9 @@ struct SidebarView: View { .padding(.vertical, 4) } .contextMenu { + Button("Run App") { + NSWorkspace.shared.openApplication(at: URL(fileURLWithPath: app.detail.path).deletingLastPathComponent(), configuration: NSWorkspace.OpenConfiguration()) + } Button("Open in Finder") { NSWorkspace.shared.selectFile(nil, inFileViewerRootedAtPath: app.detail.path) } From 17c19ba9072a49ea7503200cfbf9c3e9d6e11ff2 Mon Sep 17 00:00:00 2001 From: Licardo <1014660822@qq.com> Date: Fri, 9 Aug 2024 13:33:08 +0800 Subject: [PATCH 2/4] add Simplified Chinese Localization --- InjectGUI.xcodeproj/project.pbxproj | 30 +- .../xcshareddata/xcschemes/InjectGUI.xcscheme | 4 +- InjectGUI/Backend/Injector.swift | 48 +- InjectGUI/Extension/ViewKit.swift | 20 +- InjectGUI/Localizables/Localizable.xcstrings | 929 ++++++++++++++++++ .../Localizables/en.lproj/Localizable.strings | 174 ---- .../zh-Hans.lproj/Localizable.strings | 175 ---- InjectGUI/View/AdminPrivilegeView.swift | 6 +- InjectGUI/View/AppDetailView.swift | 8 +- InjectGUI/View/StatusView.swift | 8 +- InjectGUI/View/WelcomeView.swift | 4 +- README.md | 2 +- 12 files changed, 988 insertions(+), 420 deletions(-) create mode 100644 InjectGUI/Localizables/Localizable.xcstrings delete mode 100644 InjectGUI/Localizables/en.lproj/Localizable.strings delete mode 100644 InjectGUI/Localizables/zh-Hans.lproj/Localizable.strings diff --git a/InjectGUI.xcodeproj/project.pbxproj b/InjectGUI.xcodeproj/project.pbxproj index 256758d..97253f6 100644 --- a/InjectGUI.xcodeproj/project.pbxproj +++ b/InjectGUI.xcodeproj/project.pbxproj @@ -13,7 +13,6 @@ 381027E02C5F784F00348460 /* Extension+Scene.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027DF2C5F784F00348460 /* Extension+Scene.swift */; }; 381027E22C5F7C4800348460 /* Extension+Font.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027E12C5F7C4800348460 /* Extension+Font.swift */; }; 381027E42C5F7E1100348460 /* Extension+URL.swift in Sources */ = {isa = PBXBuildFile; fileRef = 381027E32C5F7E1100348460 /* Extension+URL.swift */; }; - 381027E72C5F816500348460 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 381027E92C5F816500348460 /* Localizable.strings */; }; 387CEA792C5BD9C400E3A5AC /* AdminPrivilegeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */; }; 387CEA7B2C5DEF0600E3A5AC /* Extension+String.swift in Sources */ = {isa = PBXBuildFile; fileRef = 387CEA7A2C5DEF0600E3A5AC /* Extension+String.swift */; }; 38877A1D2C4A6F83009F5910 /* InjectGUIApp.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38877A1C2C4A6F83009F5910 /* InjectGUIApp.swift */; }; @@ -36,6 +35,7 @@ 38E944F22C5A761B00B252A3 /* Executor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F12C5A761B00B252A3 /* Executor.swift */; }; 38E944F52C5A7F6A00B252A3 /* Cache in Frameworks */ = {isa = PBXBuildFile; productRef = 38E944F42C5A7F6A00B252A3 /* Cache */; }; 38E944F72C5A85E200B252A3 /* Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F62C5A85E200B252A3 /* Cache.swift */; }; + 96BC7ED02C65C5E200149818 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -45,8 +45,6 @@ 381027DF2C5F784F00348460 /* Extension+Scene.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+Scene.swift"; sourceTree = ""; }; 381027E12C5F7C4800348460 /* Extension+Font.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+Font.swift"; sourceTree = ""; }; 381027E32C5F7E1100348460 /* Extension+URL.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+URL.swift"; sourceTree = ""; }; - 381027E82C5F816500348460 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/Localizable.strings; sourceTree = ""; }; - 381027EA2C5F817400348460 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/Localizable.strings"; sourceTree = ""; }; 387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdminPrivilegeView.swift; sourceTree = ""; }; 387CEA7A2C5DEF0600E3A5AC /* Extension+String.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Extension+String.swift"; sourceTree = ""; }; 38877A192C4A6F83009F5910 /* InjectGUI.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = InjectGUI.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -70,6 +68,7 @@ 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 38E944F12C5A761B00B252A3 /* Executor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Executor.swift; sourceTree = ""; }; 38E944F62C5A85E200B252A3 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = ""; }; + 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = InjectGUI/Localizables/Localizable.xcstrings; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -88,7 +87,7 @@ 38877A102C4A6F83009F5910 = { isa = PBXGroup; children = ( - 381027E92C5F816500348460 /* Localizable.strings */, + 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */, 38877A1B2C4A6F83009F5910 /* InjectGUI */, 38877A1A2C4A6F83009F5910 /* Products */, ); @@ -253,8 +252,8 @@ buildActionMask = 2147483647; files = ( 38877A252C4A6F87009F5910 /* Preview Assets.xcassets in Resources */, + 96BC7ED02C65C5E200149818 /* Localizable.xcstrings in Resources */, 380D77842C620464005F3150 /* config.json in Resources */, - 381027E72C5F816500348460 /* Localizable.strings in Resources */, 38877A212C4A6F87009F5910 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -294,19 +293,6 @@ }; /* End PBXSourcesBuildPhase section */ -/* Begin PBXVariantGroup section */ - 381027E92C5F816500348460 /* Localizable.strings */ = { - isa = PBXVariantGroup; - children = ( - 381027E82C5F816500348460 /* en */, - 381027EA2C5F817400348460 /* zh-Hans */, - ); - name = Localizable.strings; - path = InjectGUI/Localizables; - sourceTree = ""; - }; -/* End PBXVariantGroup section */ - /* Begin XCBuildConfiguration section */ 38877A262C4A6F87009F5910 /* Debug */ = { isa = XCBuildConfiguration; @@ -359,10 +345,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; @@ -412,9 +400,11 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; + LOCALIZATION_PREFERS_STRING_CATALOGS = YES; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_OPTIMIZATION_LEVEL = "-O"; }; name = Release; @@ -445,7 +435,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 16.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = "dev.wibus-wee.InjectGUI"; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -484,7 +474,7 @@ IPHONEOS_DEPLOYMENT_TARGET = 16.1; LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks"; "LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 12.0; + MACOSX_DEPLOYMENT_TARGET = 13.0; MARKETING_VERSION = 1.2.0; PRODUCT_BUNDLE_IDENTIFIER = "dev.wibus-wee.InjectGUI"; PRODUCT_NAME = "$(TARGET_NAME)"; diff --git a/InjectGUI.xcodeproj/xcshareddata/xcschemes/InjectGUI.xcscheme b/InjectGUI.xcodeproj/xcshareddata/xcschemes/InjectGUI.xcscheme index d5e2962..70fe3c9 100644 --- a/InjectGUI.xcodeproj/xcshareddata/xcschemes/InjectGUI.xcscheme +++ b/InjectGUI.xcodeproj/xcshareddata/xcschemes/InjectGUI.xcscheme @@ -1,7 +1,7 @@ + version = "1.7"> @@ -28,8 +28,6 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES" shouldAutocreateTestPlan = "YES"> - - (AnyView))? = nil, content: @escaping () -> AnyView, action: @escaping (IsClickPrimaryButton) -> Void? @@ -97,8 +97,8 @@ enum ViewKit { static func useAlert( title: String, message: String, - primaryButton: String = "OK", - secondaryButton: String = "Cancel", + primaryButton: String = String(localized: "OK"), + secondaryButton: String = String(localized: "Cancel"), action: @escaping (IsClickPrimaryButton) -> Void? ) { let alert = NSAlert() @@ -127,8 +127,8 @@ enum ViewKit { static func useFilePanel( title: String, message: String, - primaryButton: String = "OK", - secondaryButton: String = "Cancel", + primaryButton: String = String(localized: "OK"), + secondaryButton: String = String(localized: "Cancel"), action: @escaping (URL?) -> Void ) { let panel = NSOpenPanel() @@ -147,8 +147,8 @@ enum ViewKit { static func useDirectoryPanel( title: String, message: String, - primaryButton: String = "OK", - secondaryButton: String = "Cancel", + primaryButton: String = String(localized: "OK"), + secondaryButton: String = String(localized: "Cancel"), action: @escaping (URL?) -> Void ) { let panel = NSOpenPanel() @@ -167,8 +167,8 @@ enum ViewKit { static func saveFilePanel( title: String, message: String, - primaryButton: String = "OK", - secondaryButton: String = "Cancel", + primaryButton: String = String(localized: "OK"), + secondaryButton: String = String(localized: "Cancel"), action: @escaping (URL?) -> Void ) { let panel = NSSavePanel() diff --git a/InjectGUI/Localizables/Localizable.xcstrings b/InjectGUI/Localizables/Localizable.xcstrings new file mode 100644 index 0000000..f66562a --- /dev/null +++ b/InjectGUI/Localizables/Localizable.xcstrings @@ -0,0 +1,929 @@ +{ + "sourceLanguage" : "en", + "strings" : { + "" : { + "shouldTranslate" : false + }, + "%@" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "%@" + } + } + } + }, + "%@ \n\nPlease check your application integrity and try again.\n\n(Stage: %@)" : { + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "new", + "value" : "%1$@ \n\nPlease check your application integrity and try again.\n\n(Stage: %2$@)" + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "%1$@ \n\n请检查您的应用程序完整性并重试。\n\n(阶段: %2$@)" + } + } + } + }, + "%lld%%" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "%lld%%" + } + } + } + }, + "About" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "关于" + } + } + } + }, + "Are you sure you want to stop injecting?" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "你确定要停止注入吗?" + } + } + } + }, + "Branch" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "分支" + } + } + } + }, + "By wibus. Made with ❤️" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "由 wibus 制作. Made with ❤️" + } + } + } + }, + "Cancel" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "取消" + } + } + } + }, + "Check for Updates…" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "检查更新…" + } + } + } + }, + "Checking Permission and Run" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在检查权限并运行" + } + } + } + }, + "Click here to close this view." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "点击以关闭此视图" + } + } + } + }, + "Command Execution Error" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "命令执行错误" + } + } + } + }, + "Commit" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "提交" + } + } + } + }, + "Compatible Version" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "兼容的版本" + } + } + } + }, + "Copy Bundle ID" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "复制 Bundle ID" + } + } + } + }, + "Copying Executable File as Backup" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在复制可执行文件作为备份" + } + } + } + }, + "Enter password again" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "请再次输入密码" + } + } + } + }, + "Error: %@" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "错误:%@" + } + } + } + }, + "Finished. Close" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "完成. 关闭" + } + } + } + }, + "General" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "通用" + } + } + } + }, + "Handling Auto Handle Helper" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在处理自动处理助手" + } + } + } + }, + "Handling Deep Code Sign" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在处理 Deep Code SIgn" + } + } + } + }, + "Handling Extra Shell" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在处理额外的Shell" + } + } + } + }, + "Handling InjectLib Inject" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "处理 InjectLib 注入" + } + } + } + }, + "Handling Keygen" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在处理 Keygen" + } + } + } + }, + "Handling Tccutil" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "正在处理 Tccutil" + } + } + } + }, + "I have read the document" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "我已阅读该文件" + } + } + } + }, + "Incorrect password" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "密码错误" + } + } + } + }, + "Information About InjectLib" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "关于 InjectLib 的信息" + } + } + } + }, + "Inject" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "注入" + } + } + } + }, + "Inject Configurations" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "注入配置" + } + } + } + }, + "Inject is running" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "注入已经在运行" + } + } + } + }, + "Inject Tools Not Found" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "未找到注入工具" + } + } + } + }, + "Inject tools not found, it may be caused by network issues or the tools are not available. Please try again later." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "未找到注入工具,可能是网络问题或工具不可用造成的,请稍后重试" + } + } + } + }, + "Inject Tools Path Not Found" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "未找到注入工具路径" + } + } + } + }, + "Injected" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "已注入" + } + } + } + }, + "InjectGUI" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "InjectGUI" + } + } + } + }, + "InjectGUI requires your password to perform administrative tasks." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "InjectGUI 需要您的密码来执行任务。" + } + } + } + }, + "Injecting Finished" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "注入完成" + } + } + } + }, + "InjectLib" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "InjectLib" + } + } + } + }, + "It will only show when the injector is running." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这仅在注入器运行时显示。" + } + } + } + }, + "It's a abnormal situation, it shouldn't be running, please report to developer." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这是异常情况,它不应该运行,请向开发人员报告。" + } + } + } + }, + "It's important to read the Setapp inject document first before using the tool. Please" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "在使用该工具之前,首先阅读 Setapp 注入文档非常重要!" + } + } + } + }, + "Local Mode" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "本地模式" + } + } + } + }, + "No apps found." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "找不到软件。" + } + } + } + }, + "OK" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "好的" + } + } + } + }, + "Open in Finder" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "在访达中打开" + } + } + } + }, + "Open Support Folder" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "打开应用支持文件夹" + } + } + } + }, + "Password" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "密码" + } + } + } + }, + "Please contact the developer if you see this view without running the injector." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "如果您在未运行注入器的情况下看到此视图,请联系开发人员。" + } + } + } + }, + "Please enter your password to continue." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "请输入密码以继续" + } + } + } + }, + "Please read the Setapp inject document first" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "请先阅读 Setapp 注入文档" + } + } + } + }, + "Please try again." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "请重试" + } + } + } + }, + "Progress: %lld%%" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "进度:%lld%%" + } + } + } + }, + "Read the document" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "阅读文件" + } + } + } + }, + "Refresh app list" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "刷新软件列表" + } + } + } + }, + "Released under GPLv3. Based on QiuChenly/InjectLib." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "根据 GPLv3 发布. 基于 QiuChenly/InjectLib。" + } + } + } + }, + "Remote InjectLib Branch" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "指定 InjectLib 远程分支" + } + } + } + }, + "Remote InjectLib Commit" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "指定 InjectLib 提交 Commit" + } + } + } + }, + "Remote InjectLib Git URL" : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "指定 InjectLib 远程 Git URL" + } + } + } + }, + "Remote Mode" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "远程模式" + } + } + } + }, + "Restarting the app will require your password again." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "重新启动应用程序将需要再次输入您的密码。" + } + } + } + }, + "Run App" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "启动 App" + } + } + } + }, + "Scanning Apps..." : { + "extractionState" : "manual", + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "扫描所有 App" + } + } + } + }, + "Search all local app" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "搜索所有本地软件" + } + } + } + }, + "Settings" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "设置" + } + } + } + }, + "Settings About InjectGUI" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "关于 InjectGUI 的设置" + } + } + } + }, + "Start Injecting" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "开始注入" + } + } + } + }, + "Status" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "状态" + } + } + } + }, + "Stop" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "停止" + } + } + } + }, + "Stop Injecting" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "停止注入" + } + } + } + }, + "Submit" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "提交" + } + } + } + }, + "The app may not work properly if you stop injecting." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "如果您停止注入,该应用程序可能无法正常工作。" + } + } + } + }, + "This app can use keygen to generate key" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此应用程序可以使用keygen生成密钥" + } + } + } + }, + "This app does not have extraShell" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此软件没有 extraShell" + } + } + } + }, + "This app has extraShell" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此软件有extraShell" + } + } + } + }, + "This app has sub app" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此软件有附属软件" + } + } + } + }, + "This app is supported by InjectLib." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此应用程序由 InjectLib 支持。" + } + } + } + }, + "This app need auto handle helper" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此应用程序需要自动处理Helper" + } + } + } + }, + "This app need deep codesign" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此软件需要 deep codesign" + } + } + } + }, + "This app needs to use tccutil to reset" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "此软件需要使用 tccutil 来重置" + } + } + } + }, + "This is a status view for the injector." : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这是注入器的状态视图。" + } + } + } + }, + "This should not happen here, please report to the developer (Area: MainInject)" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "这里不应该发生这种情况,请向开发人员报告(区域:MainInject)" + } + } + } + }, + "Toggle Sidebar" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "切换侧边栏" + } + } + } + }, + "Universal Version (? Maybe)" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "通用版本(?应该是吧)" + } + } + } + }, + "Update InjectLib & Tools" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "更新 InjectLib & 相关工具" + } + } + } + }, + "URL" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "链接" + } + } + } + }, + "Version: %@" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "版本:%@" + } + } + } + }, + "Welcome to InjectGUI" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "欢迎使用 InjectGUI" + } + } + } + }, + "Why you are seeing this?" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "你怎么看到的?" + } + } + } + }, + "You're in" : { + "localizations" : { + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "您处于" + } + } + } + } + }, + "version" : "1.0" +} \ No newline at end of file diff --git a/InjectGUI/Localizables/en.lproj/Localizable.strings b/InjectGUI/Localizables/en.lproj/Localizable.strings deleted file mode 100644 index e42b858..0000000 --- a/InjectGUI/Localizables/en.lproj/Localizable.strings +++ /dev/null @@ -1,174 +0,0 @@ -/* - Localizable.strings - InjectGUI - - Created by wibus on 2024/8/4. - -*/ -/* No comment provided by engineer. */ -"" = ""; - -/* No comment provided by engineer. */ -"%@" = "%@"; - -/* No comment provided by engineer. */ -"%lld%%" = "%lld%%"; - -/* No comment provided by engineer. */ -"About" = "About"; - -/* No comment provided by engineer. */ -"Branch" = "Branch"; - -/* No comment provided by engineer. */ -"By wibus. Made with ❤️" = "By wibus. Made with ❤️"; - -/* No comment provided by engineer. */ -"Click here to close this view." = "Click here to close this view."; - -/* No comment provided by engineer. */ -"Commit" = "Commit"; - -/* No comment provided by engineer. */ -"Compatible Version" = "Compatible Version"; - -/* No comment provided by engineer. */ -"Copy Bundle ID" = "Copy Bundle ID"; - -/* No comment provided by engineer. */ -"Enter password again" = "Enter password again"; - -/* No comment provided by engineer. */ -"Error: %@" = "Error: %@"; - -/* No comment provided by engineer. */ -"Finished. Close" = "Finished. Close"; - -/* No comment provided by engineer. */ -"General" = "General"; - -/* No comment provided by engineer. */ -"Information About InjectLib" = "Information About InjectLib"; - -/* No comment provided by engineer. */ -"Inject" = "Inject"; - -/* No comment provided by engineer. */ -"Inject Configurations" = "Inject Configurations"; - -/* No comment provided by engineer. */ -"InjectGUI" = "InjectGUI"; - -/* No comment provided by engineer. */ -"InjectGUI requires your password to perform administrative tasks." = "InjectGUI requires your password to perform administrative tasks."; - -/* No comment provided by engineer. */ -"InjectLib" = "InjectLib"; - -/* No comment provided by engineer. */ -"It will only show when the injector is running." = "It will only show when the injector is running."; - -/* No comment provided by engineer. */ -"No apps found." = "No apps found."; - -/* No comment provided by engineer. */ -"Open in Finder" = "Open in Finder"; - -/* No comment provided by engineer. */ -"Open Support Folder" = "Open Support Folder"; - -/* No comment provided by engineer. */ -"Password" = "Password"; - -/* No comment provided by engineer. */ -"Please contact the developer if you see this view without running the injector." = "Please contact the developer if you see this view without running the injector."; - -/* No comment provided by engineer. */ -"Please enter your password to continue." = "Please enter your password to continue."; - -/* No comment provided by engineer. */ -"Progress: %lld%%" = "Progress: %lld%%"; - -/* No comment provided by engineer. */ -"Refresh app list" = "Refresh app list"; - -/* No comment provided by engineer. */ -"Released under GPLv3. Based on QiuChenly/InjectLib." = "Released under GPLv3. Based on QiuChenly/InjectLib."; - -/* No comment provided by engineer. */ -"Restarting the app will require your password again." = "Restarting the app will require your password again."; - -/* No comment provided by engineer. */ -"Search all local app" = "Search all local app"; - -/* No comment provided by engineer. */ -"Settings" = "Settings"; - -/* No comment provided by engineer. */ -"Settings About InjectGUI" = "Settings About InjectGUI"; - -/* No comment provided by engineer. */ -"Status" = "Status"; - -/* No comment provided by engineer. */ -"Stop Injecting" = "Stop Injecting"; - -/* No comment provided by engineer. */ -"Submit" = "Submit"; - -/* No comment provided by engineer. */ -"This app can use keygen to generate key" = "This app can use keygen to generate key"; - -/* No comment provided by engineer. */ -"This app does not have extraShell" = "This app does not have extraShell"; - -/* No comment provided by engineer. */ -"This app has extraShell" = "This app has extraShell"; - -/* No comment provided by engineer. */ -"This app has sub app" = "This app has sub app"; - -/* No comment provided by engineer. */ -"This app is supported by InjectLib." = "This app is supported by InjectLib."; - -/* No comment provided by engineer. */ -"This app need auto handle helper" = "This app need auto handle helper"; - -/* No comment provided by engineer. */ -"This app need deep codesign" = "This app need deep codesign"; - -/* No comment provided by engineer. */ -"This app needs to use tccutil to reset" = "This app needs to use tccutil to reset"; - -/* No comment provided by engineer. */ -"This is a status view for the injector." = "This is a status view for the injector."; - -/* No comment provided by engineer. */ -"Toggle Sidebar" = "Toggle Sidebar"; - -/* No comment provided by engineer. */ -"Universal Version (? Maybe)" = "Universal Version (? Maybe)"; - -/* No comment provided by engineer. */ -"Update InjectLib & Tools" = "Update InjectLib & Tools"; - -/* No comment provided by engineer. */ -"URL" = "URL"; - -/* No comment provided by engineer. */ -"Version: %@" = "Version: %@"; - -/* No comment provided by engineer. */ -"Welcome to InjectGUI" = "Welcome to InjectGUI"; - -/* No comment provided by engineer. */ -"Why you are seeing this?" = "Why you are seeing this?"; - -/* No comment provided by engineer. */ -"Remote InjectLib Git URL" = "Remote InjectLib Git URL"; - -/* No comment provided by engineer. */ -"Remote InjectLib Branch" = "Remote InjectLib Branch"; - -/* No comment provided by engineer. */ -"Remote InjectLib Commit" = "Remote InjectLib Commit"; \ No newline at end of file diff --git a/InjectGUI/Localizables/zh-Hans.lproj/Localizable.strings b/InjectGUI/Localizables/zh-Hans.lproj/Localizable.strings deleted file mode 100644 index fc9f121..0000000 --- a/InjectGUI/Localizables/zh-Hans.lproj/Localizable.strings +++ /dev/null @@ -1,175 +0,0 @@ -/* - Localizable.strings - InjectGUI - - Created by JerryXU on 2024/8/4. - -*/ - -/* No comment provided by engineer. */ -"" = ""; - -/* No comment provided by engineer. */ -"%@" = "%@"; - -/* No comment provided by engineer. */ -"%lld%%" = "%lld%%"; - -/* No comment provided by engineer. */ -"About" = "关于"; - -/* No comment provided by engineer. */ -"Branch" = "分支"; - -/* No comment provided by engineer. */ -"By wibus. Made with ❤️" = "由 wibus 制作. Made with ❤️"; - -/* No comment provided by engineer. */ -"Click here to close this view." = "点击以关闭此视图"; - -/* No comment provided by engineer. */ -"Commit" = "提交"; - -/* No comment provided by engineer. */ -"Compatible Version" = "兼容的版本"; - -/* No comment provided by engineer. */ -"Copy Bundle ID" = "复制 Bundle ID"; - -/* No comment provided by engineer. */ -"Enter password again" = "请再次输入密码"; - -/* No comment provided by engineer. */ -"Error: %@" = "错误:%@"; - -/* No comment provided by engineer. */ -"Finished. Close" = "完成. 关闭"; - -/* No comment provided by engineer. */ -"General" = "通用"; - -/* No comment provided by engineer. */ -"Information About InjectLib" = "关于 InjectLib 的信息"; - -/* No comment provided by engineer. */ -"Inject" = "注入"; - -/* No comment provided by engineer. */ -"Inject Configurations" = "注入配置"; - -/* No comment provided by engineer. */ -"InjectGUI" = "InjectGUI"; - -/* No comment provided by engineer. */ -"InjectGUI requires your password to perform administrative tasks." = "InjectGUI 需要您的密码来执行任务。"; - -/* No comment provided by engineer. */ -"InjectLib" = "InjectLib"; - -/* No comment provided by engineer. */ -"It will only show when the injector is running." = "这仅在注入器运行时显示。"; - -/* No comment provided by engineer. */ -"No apps found." = "找不到软件。"; - -/* No comment provided by engineer. */ -"Open in Finder" = "在访达中打开"; - -/* No comment provided by engineer. */ -"Open Support Folder" = "打开应用支持文件夹"; - -/* No comment provided by engineer. */ -"Password" = "密码"; - -/* No comment provided by engineer. */ -"Please contact the developer if you see this view without running the injector." = "如果您在未运行注入器的情况下看到此视图,请联系开发人员。"; - -/* No comment provided by engineer. */ -"Please enter your password to continue." = "请输入密码以继续"; - -/* No comment provided by engineer. */ -"Progress: %lld%%" = "进度:%lld%%"; - -/* No comment provided by engineer. */ -"Refresh app list" = "刷新软件列表"; - -/* No comment provided by engineer. */ -"Released under GPLv3. Based on QiuChenly/InjectLib." = "根据 GPLv3 发布. 基于 QiuChenly/InjectLib。"; - -/* No comment provided by engineer. */ -"Restarting the app will require your password again." = "重新启动应用程序将需要再次输入您的密码。"; - -/* No comment provided by engineer. */ -"Search all local app" = "搜索所有本地软件"; - -/* No comment provided by engineer. */ -"Settings" = "设置"; - -/* No comment provided by engineer. */ -"Settings About InjectGUI" = "关于 InjectGUI 的设置"; - -/* No comment provided by engineer. */ -"Status" = "状态"; - -/* No comment provided by engineer. */ -"Stop Injecting" = "停止注入"; - -/* No comment provided by engineer. */ -"Submit" = "提交"; - -/* No comment provided by engineer. */ -"This app can use keygen to generate key" = "此应用程序可以使用keygen生成密钥"; - -/* No comment provided by engineer. */ -"This app does not have extraShell" = "此软件没有 extraShell"; - -/* No comment provided by engineer. */ -"This app has extraShell" = "此软件有extraShell"; - -/* No comment provided by engineer. */ -"This app has sub app" = "此软件有附属软件"; - -/* No comment provided by engineer. */ -"This app is supported by InjectLib." = "此应用程序由 InjectLib 支持。"; - -/* No comment provided by engineer. */ -"This app need auto handle helper" = "此应用程序需要自动处理Helper"; - -/* No comment provided by engineer. */ -"This app need deep codesign" = "此软件需要 deep codesign"; - -/* No comment provided by engineer. */ -"This app needs to use tccutil to reset" = "此软件需要使用 tccutil 来重置"; - -/* No comment provided by engineer. */ -"This is a status view for the injector." = "这是注入器的状态视图。"; - -/* No comment provided by engineer. */ -"Toggle Sidebar" = "切换侧边栏"; - -/* No comment provided by engineer. */ -"Universal Version (? Maybe)" = "通用版本(?应该是吧)"; - -/* No comment provided by engineer. */ -"Update InjectLib & Tools" = "更新 InjectLib & 相关工具"; - -/* No comment provided by engineer. */ -"URL" = "链接"; - -/* No comment provided by engineer. */ -"Version: %@" = "版本:%@"; - -/* No comment provided by engineer. */ -"Welcome to InjectGUI" = "欢迎使用 InjectGUI"; - -/* No comment provided by engineer. */ -"Why you are seeing this?" = "你怎么看到的?"; - -/* No comment provided by engineer. */ -"Remote InjectLib Git URL" = "指定 InjectLib 远程 Git URL"; - -/* No comment provided by engineer. */ -"Remote InjectLib Branch" = "指定 InjectLib 远程分支"; - -/* No comment provided by engineer. */ -"Remote InjectLib Commit" = "指定 InjectLib 提交 Commit"; \ No newline at end of file diff --git a/InjectGUI/View/AdminPrivilegeView.swift b/InjectGUI/View/AdminPrivilegeView.swift index 55cce60..9998abf 100644 --- a/InjectGUI/View/AdminPrivilegeView.swift +++ b/InjectGUI/View/AdminPrivilegeView.swift @@ -60,10 +60,10 @@ struct AdminPrivilegeView: View { .sink(receiveCompletion: { completion in if case .failure = completion { let alert = NSAlert() - alert.messageText = "Incorrect password" - alert.informativeText = "Please try again." + alert.messageText = String(localized: "Incorrect password") + alert.informativeText = String(localized: "Please try again.") alert.alertStyle = .warning - alert.addButton(withTitle: "OK") + alert.addButton(withTitle: String(localized: "OK")) alert.runModal() } }, receiveValue: { _ in diff --git a/InjectGUI/View/AppDetailView.swift b/InjectGUI/View/AppDetailView.swift index 1d01794..cb10af2 100644 --- a/InjectGUI/View/AppDetailView.swift +++ b/InjectGUI/View/AppDetailView.swift @@ -74,7 +74,7 @@ struct AppDetailView: View { Text(appDetail.name) .font(.headline) - Label("已注入", systemImage: "checkmark.circle.fill") + Label("Injected", systemImage: "checkmark.circle.fill") .font(.caption2) .foregroundStyle(.green) .opacity(appDetail.isInjected ? 1 : 0) @@ -94,10 +94,10 @@ struct AppDetailView: View { injector.startInjectApp(package: appId) } else { let alert = NSAlert() - alert.messageText = "Inject is running" - alert.informativeText = "It's a abnormal situation, it shouldn't be running, please report to developer." + alert.messageText = String(localized: "Inject is running") + alert.informativeText = String(localized: "It's a abnormal situation, it shouldn't be running, please report to developer.") alert.alertStyle = .warning - alert.addButton(withTitle: "OK") + alert.addButton(withTitle: String(localized: "OK")) alert.runModal() } } diff --git a/InjectGUI/View/StatusView.swift b/InjectGUI/View/StatusView.swift index daede07..237a00c 100644 --- a/InjectGUI/View/StatusView.swift +++ b/InjectGUI/View/StatusView.swift @@ -138,10 +138,10 @@ struct StatusView: View { return } let alert = NSAlert() - alert.messageText = "Are you sure you want to stop injecting?" - alert.informativeText = "The app may not work properly if you stop injecting." - alert.addButton(withTitle: "Stop") - alert.addButton(withTitle: "Cancel") + alert.messageText = String(localized: "Are you sure you want to stop injecting?") + alert.informativeText = String(localized: "The app may not work properly if you stop injecting.") + alert.addButton(withTitle: String(localized: "Stop")) + alert.addButton(withTitle: String(localized: "Cancel")) alert.beginSheetModal(for: NSApp.keyWindow!) { response in if response == .alertFirstButtonReturn { injector.stopInjectApp() diff --git a/InjectGUI/View/WelcomeView.swift b/InjectGUI/View/WelcomeView.swift index c64d69a..ebf1d75 100644 --- a/InjectGUI/View/WelcomeView.swift +++ b/InjectGUI/View/WelcomeView.swift @@ -55,8 +55,8 @@ struct WelcomeView: View { .onTapGesture { let alert = NSAlert() alert.messageText = "InjectGUI" - alert.informativeText = "You're in \(injectConfiguration.mode == injectConfigurationMode.local ? "Local Mode" : "Remote Mode")." - alert.addButton(withTitle: "OK") + alert.informativeText = String(localized: "You're in") + (injectConfiguration.mode == injectConfigurationMode.local ? String(localized: "Local Mode") : String(localized: "Remote Mode")) + alert.addButton(withTitle: String(localized: "OK")) alert.runModal() } } diff --git a/README.md b/README.md index 0b0c0c4..438c338 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ _**New to Swift. Poor code quality.**_ The localization of InjectGUI is in progress, and some content has not been translated yet. PRs are welcome. - [x] English -- [ ] Chinese (Simplified) (Not yet) +- [x] Chinese (Simplified) ## 🌟 Features From a01914b2296047b3c03124a3617696579c609d11 Mon Sep 17 00:00:00 2001 From: Licardo <1014660822@qq.com> Date: Fri, 9 Aug 2024 14:19:20 +0800 Subject: [PATCH 3/4] refactor welcomeview --- InjectGUI.xcodeproj/project.pbxproj | 27 ++++-- InjectGUI/Localizables/Localizable.xcstrings | 14 +-- InjectGUI/View/ContentView.swift | 2 +- InjectGUI/View/Settings/AboutView.swift | 92 +++++++++++++++++++ .../GeneralView.swift} | 87 +++--------------- InjectGUI/View/Settings/SettingsView.swift | 25 +++++ InjectGUI/View/WelcomeView.swift | 67 -------------- 7 files changed, 156 insertions(+), 158 deletions(-) create mode 100644 InjectGUI/View/Settings/AboutView.swift rename InjectGUI/View/{SettingsView.swift => Settings/GeneralView.swift} (78%) create mode 100644 InjectGUI/View/Settings/SettingsView.swift delete mode 100644 InjectGUI/View/WelcomeView.swift diff --git a/InjectGUI.xcodeproj/project.pbxproj b/InjectGUI.xcodeproj/project.pbxproj index 97253f6..61f1dbc 100644 --- a/InjectGUI.xcodeproj/project.pbxproj +++ b/InjectGUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 56; + objectVersion = 70; objects = { /* Begin PBXBuildFile section */ @@ -29,9 +29,7 @@ 38AD95EA2C58E70E0032E79F /* Injector.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD95E92C58E70E0032E79F /* Injector.swift */; }; 38AD95EE2C58F59C0032E79F /* StatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD95ED2C58F59C0032E79F /* StatusView.swift */; }; 38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F522C4B587900C3B60E /* SidebarView.swift */; }; - 38BC1F552C4B622500C3B60E /* WelcomeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F542C4B622500C3B60E /* WelcomeView.swift */; }; 38BC1F5A2C4B98A300C3B60E /* AppDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */; }; - 38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */; }; 38E944F22C5A761B00B252A3 /* Executor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F12C5A761B00B252A3 /* Executor.swift */; }; 38E944F52C5A7F6A00B252A3 /* Cache in Frameworks */ = {isa = PBXBuildFile; productRef = 38E944F42C5A7F6A00B252A3 /* Cache */; }; 38E944F72C5A85E200B252A3 /* Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F62C5A85E200B252A3 /* Cache.swift */; }; @@ -63,14 +61,28 @@ 38AD95E92C58E70E0032E79F /* Injector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Injector.swift; sourceTree = ""; }; 38AD95ED2C58F59C0032E79F /* StatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = ""; }; 38BC1F522C4B587900C3B60E /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = ""; }; - 38BC1F542C4B622500C3B60E /* WelcomeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WelcomeView.swift; sourceTree = ""; }; 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDetailView.swift; sourceTree = ""; }; - 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 38E944F12C5A761B00B252A3 /* Executor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Executor.swift; sourceTree = ""; }; 38E944F62C5A85E200B252A3 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = ""; }; 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = InjectGUI/Localizables/Localizable.xcstrings; sourceTree = ""; }; /* End PBXFileReference section */ +/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ + 96BC7EDA2C65E9A500149818 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { + isa = PBXFileSystemSynchronizedBuildFileExceptionSet; + membershipExceptions = ( + AboutView.swift, + GeneralView.swift, + SettingsView.swift, + ); + target = 38877A182C4A6F83009F5910 /* InjectGUI */; + }; +/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ + +/* Begin PBXFileSystemSynchronizedRootGroup section */ + 96BC7ED92C65E99400149818 /* Settings */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (96BC7EDA2C65E9A500149818 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Settings; sourceTree = ""; }; +/* End PBXFileSystemSynchronizedRootGroup section */ + /* Begin PBXFrameworksBuildPhase section */ 38877A162C4A6F83009F5910 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -142,12 +154,11 @@ 38877A2C2C4A6FD7009F5910 /* View */ = { isa = PBXGroup; children = ( + 96BC7ED92C65E99400149818 /* Settings */, 38877A1E2C4A6F83009F5910 /* ContentView.swift */, 38BC1F522C4B587900C3B60E /* SidebarView.swift */, - 38BC1F542C4B622500C3B60E /* WelcomeView.swift */, 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */, 38AD95ED2C58F59C0032E79F /* StatusView.swift */, - 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */, 387CEA782C5BD9C400E3A5AC /* AdminPrivilegeView.swift */, 380D777C2C61EAB9005F3150 /* CheckForUpdatesView.swift */, ); @@ -277,13 +288,11 @@ 38877A332C4A7222009F5910 /* PublishedStorage.swift in Sources */, 381027E02C5F784F00348460 /* Extension+Scene.swift in Sources */, 38E944F22C5A761B00B252A3 /* Executor.swift in Sources */, - 38BC1F552C4B622500C3B60E /* WelcomeView.swift in Sources */, 38877A2E2C4A6FFA009F5910 /* InjectConfiguration.swift in Sources */, 38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */, 38877A352C4A7254009F5910 /* ViewKit.swift in Sources */, 38877A3A2C4A730F009F5910 /* Constants.swift in Sources */, 381027E42C5F7E1100348460 /* Extension+URL.swift in Sources */, - 38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */, 381027E22C5F7C4800348460 /* Extension+Font.swift in Sources */, 387CEA792C5BD9C400E3A5AC /* AdminPrivilegeView.swift in Sources */, 38AD95EE2C58F59C0032E79F /* StatusView.swift in Sources */, diff --git a/InjectGUI/Localizables/Localizable.xcstrings b/InjectGUI/Localizables/Localizable.xcstrings index f66562a..a6e7a04 100644 --- a/InjectGUI/Localizables/Localizable.xcstrings +++ b/InjectGUI/Localizables/Localizable.xcstrings @@ -70,15 +70,8 @@ } } }, - "By wibus. Made with ❤️" : { - "localizations" : { - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : "由 wibus 制作. Made with ❤️" - } - } - } + "by wibus" : { + "shouldTranslate" : false }, "Cancel" : { "localizations" : { @@ -450,6 +443,9 @@ } } }, + "Made with" : { + "shouldTranslate" : false + }, "No apps found." : { "localizations" : { "zh-Hans" : { diff --git a/InjectGUI/View/ContentView.swift b/InjectGUI/View/ContentView.swift index 1e27964..b54a36e 100644 --- a/InjectGUI/View/ContentView.swift +++ b/InjectGUI/View/ContentView.swift @@ -18,7 +18,7 @@ struct ContentView: View { } .navigationTitle(Constants.appName) - WelcomeView() + AboutView() } .toolbar { ToolbarItem(placement: .navigation) { diff --git a/InjectGUI/View/Settings/AboutView.swift b/InjectGUI/View/Settings/AboutView.swift new file mode 100644 index 0000000..febcec7 --- /dev/null +++ b/InjectGUI/View/Settings/AboutView.swift @@ -0,0 +1,92 @@ +// +// AboutView.swift +// InjectGUI +// +// Created by Licardo on 2024/8/9. +// + +import SwiftUI + +struct AboutView: View { + var version: String { + var ret = "Version: " + + (Constants.appVersion) + + " Build: " + + (Constants.appBuildVersion) + #if DEBUG + ret = "👾 \(ret) 👾" + #endif + return ret + } + + var body: some View { + VStack { + Spacer() + VStack(spacing: 4) { + Image("Avatar") + .antialiased(true) + .resizable() + .aspectRatio(contentMode: .fit) + .frame(width: 128, height: 128) + + Spacer().frame(height: 16) + + if #available(macOS 13.0, *) { + Text("Welcome to InjectGUI") + .font(.system(.title2, design: .rounded, weight: .bold)) + HStack(spacing: 2) { + Text("Made with") + .foregroundColor(.secondary) + if #available(macOS 14.0, *) { + Image(systemName: "heart.fill") + .foregroundColor(.red) + .symbolEffect(.pulse, options: .speed(1)) + } else { + Image(systemName: "heart.fill") + .foregroundColor(.red) + } + Text("by wibus") + .foregroundColor(.secondary) + } + .font(.system(.body, design: .rounded, weight: .bold)) + } else { + Text("Welcome to InjectGUI") + .font(.title) + .fontWeight(.bold) + HStack(spacing: 2) { + Text("Made with") + .foregroundColor(.secondary) + Image(systemName: "heart.fill") + .foregroundColor(.red) + Text("by wibus") + .foregroundColor(.secondary) + } + } + + Spacer().frame(height: 24) + } + Spacer() + VStack { + Text(version) + .font(.system(size: 12, weight: .semibold, design: .rounded)) + .opacity(0.5) + Text("Released under GPLv3. Based on QiuChenly/InjectLib.") + .font(.system(size: 12, weight: .semibold, design: .rounded)) + .opacity(0.5) + } + .onTapGesture { + let alert = NSAlert() + alert.messageText = "InjectGUI" + alert.informativeText = String(localized: "You're in") + (injectConfiguration.mode == injectConfigurationMode.local ? String(localized: "Local Mode") : String(localized: "Remote Mode")) + alert.addButton(withTitle: String(localized: "OK")) + alert.runModal() + } + .padding() + + + } + .tabItem { + Label("About", systemImage: "info.circle") + } + } +} diff --git a/InjectGUI/View/SettingsView.swift b/InjectGUI/View/Settings/GeneralView.swift similarity index 78% rename from InjectGUI/View/SettingsView.swift rename to InjectGUI/View/Settings/GeneralView.swift index 5299a42..2fbfe38 100644 --- a/InjectGUI/View/SettingsView.swift +++ b/InjectGUI/View/Settings/GeneralView.swift @@ -1,16 +1,15 @@ // -// SettingsView.swift +// GeneralView.swift // InjectGUI // -// Created by wibus on 2024/7/20. +// Created by Licardo on 2024/8/9. // -import Foundation import SwiftUI -struct SettingsView: View { +struct GeneralView: View { @StateObject var configuration = Configuration.shared - + var version: String { var ret = "Version: " + (Constants.appVersion) @@ -21,34 +20,8 @@ struct SettingsView: View { #endif return ret } - - private enum Tabs: Hashable { - case general - case about - } - + var body: some View { - return TabView { - generalView - aboutView - } - - .frame(maxWidth: .infinity, maxHeight: .infinity) - } - - func SettingItemView(_ title: String, @ViewBuilder content: @escaping () -> some View) -> some View { - HStack { - Text(title) - Spacer() - content() - } - .padding(10) - .frame(maxWidth: .infinity, alignment: .leading) - .background(.secondary.opacity(0.1)) - .cornerRadius(6) - } - - var generalView: some View { ScrollView { VStack(alignment: .leading) { // Project info @@ -181,47 +154,17 @@ struct SettingsView: View { .tabItem { Label("General", systemImage: "gear") } - .tag(Tabs.general) } - - var aboutView: some View { - ZStack { - VStack(spacing: 4) { - Image("Avatar") - .antialiased(true) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 128, height: 128) - - Spacer().frame(height: 16) - - if #available(macOS 13.0, *) { - Text("InjectGUI") - .font(.system(.title2, design: .rounded, weight: .bold)) - Text("By wibus. Made with ❤️") - .font(.system(.body, design: .rounded, weight: .bold)) - .foregroundColor(.secondary) - } else { - Text("Welcome to InjectGUI") - .font(.title) - .fontWeight(.bold) - Text("By wibus. Made with ❤️") - .foregroundColor(.secondary) - } - - Spacer().frame(height: 24) - } - VStack { - Spacer() - Text("Released under GPLv3. Based on QiuChenly/InjectLib.") - .font(.system(size: 12, weight: .semibold, design: .rounded)) - .opacity(0.5) - } - .padding() - } - .tabItem { - Label("About", systemImage: "info.circle") + + func SettingItemView(_ title: String, @ViewBuilder content: @escaping () -> some View) -> some View { + HStack { + Text(title) + Spacer() + content() } - .tag(Tabs.about) + .padding(10) + .frame(maxWidth: .infinity, alignment: .leading) + .background(.secondary.opacity(0.1)) + .cornerRadius(6) } } diff --git a/InjectGUI/View/Settings/SettingsView.swift b/InjectGUI/View/Settings/SettingsView.swift new file mode 100644 index 0000000..bc71ab9 --- /dev/null +++ b/InjectGUI/View/Settings/SettingsView.swift @@ -0,0 +1,25 @@ +// +// SettingsView.swift +// InjectGUI +// +// Created by wibus on 2024/7/20. +// + +import Foundation +import SwiftUI + +struct SettingsView: View { + private enum Tabs: Hashable { + case general + case about + } + + var body: some View { + return TabView { + GeneralView().tag(Tabs.general) + AboutView().tag(Tabs.about) + } + + .frame(maxWidth: .infinity, maxHeight: .infinity) + } +} diff --git a/InjectGUI/View/WelcomeView.swift b/InjectGUI/View/WelcomeView.swift deleted file mode 100644 index ebf1d75..0000000 --- a/InjectGUI/View/WelcomeView.swift +++ /dev/null @@ -1,67 +0,0 @@ -// -// WelcomeView.swift -// InjectGUI -// -// Created by wibus on 2024/7/20. -// - -import SwiftUI - -struct WelcomeView: View { - var version: String { - var ret = "Version: " + - (Constants.appVersion) - + " Build: " + - (Constants.appBuildVersion) - #if DEBUG - ret = "👾 \(ret) 👾" - #endif - return ret - } - - var body: some View { - ZStack { - VStack(spacing: 4) { - Image("Avatar") - .antialiased(true) - .resizable() - .aspectRatio(contentMode: .fit) - .frame(width: 128, height: 128) - - Spacer().frame(height: 16) - - if #available(macOS 13.0, *) { - Text("Welcome to InjectGUI") - .font(.system(.title2, design: .rounded, weight: .bold)) - Text("By wibus. Made with ❤️") - .font(.system(.body, design: .rounded, weight: .bold)) - .foregroundColor(.secondary) - } else { - Text("Welcome to InjectGUI") - .font(.title) - .fontWeight(.bold) - Text("By wibus. Made with ❤️") - .foregroundColor(.secondary) - } - - - Spacer().frame(height: 24) - } - VStack { - Spacer() - Text(version) - .font(.system(size: 12, weight: .semibold, design: .rounded)) - .opacity(0.5) - .onTapGesture { - let alert = NSAlert() - alert.messageText = "InjectGUI" - alert.informativeText = String(localized: "You're in") + (injectConfiguration.mode == injectConfigurationMode.local ? String(localized: "Local Mode") : String(localized: "Remote Mode")) - alert.addButton(withTitle: String(localized: "OK")) - alert.runModal() - } - } - .padding() - } - .frame(maxWidth: .infinity, maxHeight: .infinity) - } -} From 04f3b1bdbe3e94f7cdd5cae1fe630d4723515c77 Mon Sep 17 00:00:00 2001 From: Licardo <1014660822@qq.com> Date: Fri, 9 Aug 2024 14:23:36 +0800 Subject: [PATCH 4/4] use group instead of folder --- InjectGUI.xcodeproj/project.pbxproj | 39 ++++++++++++++++------------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/InjectGUI.xcodeproj/project.pbxproj b/InjectGUI.xcodeproj/project.pbxproj index 61f1dbc..e4e2968 100644 --- a/InjectGUI.xcodeproj/project.pbxproj +++ b/InjectGUI.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 70; + objectVersion = 56; objects = { /* Begin PBXBuildFile section */ @@ -30,10 +30,13 @@ 38AD95EE2C58F59C0032E79F /* StatusView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38AD95ED2C58F59C0032E79F /* StatusView.swift */; }; 38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F522C4B587900C3B60E /* SidebarView.swift */; }; 38BC1F5A2C4B98A300C3B60E /* AppDetailView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */; }; + 38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */; }; 38E944F22C5A761B00B252A3 /* Executor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F12C5A761B00B252A3 /* Executor.swift */; }; 38E944F52C5A7F6A00B252A3 /* Cache in Frameworks */ = {isa = PBXBuildFile; productRef = 38E944F42C5A7F6A00B252A3 /* Cache */; }; 38E944F72C5A85E200B252A3 /* Cache.swift in Sources */ = {isa = PBXBuildFile; fileRef = 38E944F62C5A85E200B252A3 /* Cache.swift */; }; 96BC7ED02C65C5E200149818 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */; }; + 96BC7ED62C65E7B100149818 /* AboutView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BC7ED52C65E7B100149818 /* AboutView.swift */; }; + 96BC7ED82C65E8C200149818 /* GeneralView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 96BC7ED72C65E8C200149818 /* GeneralView.swift */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -62,27 +65,14 @@ 38AD95ED2C58F59C0032E79F /* StatusView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusView.swift; sourceTree = ""; }; 38BC1F522C4B587900C3B60E /* SidebarView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SidebarView.swift; sourceTree = ""; }; 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDetailView.swift; sourceTree = ""; }; + 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsView.swift; sourceTree = ""; }; 38E944F12C5A761B00B252A3 /* Executor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Executor.swift; sourceTree = ""; }; 38E944F62C5A85E200B252A3 /* Cache.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Cache.swift; sourceTree = ""; }; 96BC7ECF2C65C5E200149818 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; name = Localizable.xcstrings; path = InjectGUI/Localizables/Localizable.xcstrings; sourceTree = ""; }; + 96BC7ED52C65E7B100149818 /* AboutView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AboutView.swift; sourceTree = ""; }; + 96BC7ED72C65E8C200149818 /* GeneralView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GeneralView.swift; sourceTree = ""; }; /* End PBXFileReference section */ -/* Begin PBXFileSystemSynchronizedBuildFileExceptionSet section */ - 96BC7EDA2C65E9A500149818 /* PBXFileSystemSynchronizedBuildFileExceptionSet */ = { - isa = PBXFileSystemSynchronizedBuildFileExceptionSet; - membershipExceptions = ( - AboutView.swift, - GeneralView.swift, - SettingsView.swift, - ); - target = 38877A182C4A6F83009F5910 /* InjectGUI */; - }; -/* End PBXFileSystemSynchronizedBuildFileExceptionSet section */ - -/* Begin PBXFileSystemSynchronizedRootGroup section */ - 96BC7ED92C65E99400149818 /* Settings */ = {isa = PBXFileSystemSynchronizedRootGroup; exceptions = (96BC7EDA2C65E9A500149818 /* PBXFileSystemSynchronizedBuildFileExceptionSet */, ); explicitFileTypes = {}; explicitFolders = (); path = Settings; sourceTree = ""; }; -/* End PBXFileSystemSynchronizedRootGroup section */ - /* Begin PBXFrameworksBuildPhase section */ 38877A162C4A6F83009F5910 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; @@ -154,7 +144,7 @@ 38877A2C2C4A6FD7009F5910 /* View */ = { isa = PBXGroup; children = ( - 96BC7ED92C65E99400149818 /* Settings */, + 96BC7EDB2C65ED2800149818 /* Settings */, 38877A1E2C4A6F83009F5910 /* ContentView.swift */, 38BC1F522C4B587900C3B60E /* SidebarView.swift */, 38BC1F592C4B98A300C3B60E /* AppDetailView.swift */, @@ -195,6 +185,16 @@ path = Util; sourceTree = ""; }; + 96BC7EDB2C65ED2800149818 /* Settings */ = { + isa = PBXGroup; + children = ( + 96BC7ED52C65E7B100149818 /* AboutView.swift */, + 96BC7ED72C65E8C200149818 /* GeneralView.swift */, + 38BC1F5B2C4BB02200C3B60E /* SettingsView.swift */, + ); + path = Settings; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -291,8 +291,11 @@ 38877A2E2C4A6FFA009F5910 /* InjectConfiguration.swift in Sources */, 38BC1F532C4B587A00C3B60E /* SidebarView.swift in Sources */, 38877A352C4A7254009F5910 /* ViewKit.swift in Sources */, + 96BC7ED62C65E7B100149818 /* AboutView.swift in Sources */, 38877A3A2C4A730F009F5910 /* Constants.swift in Sources */, + 96BC7ED82C65E8C200149818 /* GeneralView.swift in Sources */, 381027E42C5F7E1100348460 /* Extension+URL.swift in Sources */, + 38BC1F5C2C4BB02200C3B60E /* SettingsView.swift in Sources */, 381027E22C5F7C4800348460 /* Extension+Font.swift in Sources */, 387CEA792C5BD9C400E3A5AC /* AdminPrivilegeView.swift in Sources */, 38AD95EE2C58F59C0032E79F /* StatusView.swift in Sources */,