more tips for on screen widgets

This commit is contained in:
True Zhuanjia committed 2026-05-11 22:57:47 +08:00
1 parent fe6954cb9c
commit 77e0048c57
22 files changed
+616 -383

No files matched your search

+6 -6
View File
@@ -36,7 +36,7 @@
18FCADAF2ECAC23200787A96 /* PencilHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18FCADAE2ECAC23200787A96 /* PencilHandler.swift */; }; 18FCADAF2ECAC23200787A96 /* PencilHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18FCADAE2ECAC23200787A96 /* PencilHandler.swift */; };
2A7113FD2F5A6C65001D852D /* ThemeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A7113FC2F5A6C65001D852D /* ThemeManager.swift */; }; 2A7113FD2F5A6C65001D852D /* ThemeManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A7113FC2F5A6C65001D852D /* ThemeManager.swift */; };
2AAA4E822F7666C5001E20DC /* ControllerUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A765BC2ECD51FB004784AA /* ControllerUtil.swift */; }; 2AAA4E822F7666C5001E20DC /* ControllerUtil.swift in Sources */ = {isa = PBXBuildFile; fileRef = 18A765BC2ECD51FB004784AA /* ControllerUtil.swift */; };
2AAA4E842F7666EE001E20DC /* SwiftLocalizationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */; }; 2AAA4E842F7666EE001E20DC /* LocalizationHelperExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* LocalizationHelperExtension.swift */; };
2AC1E3832F507D80004F76C0 /* GenericUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1E3822F507D80004F76C0 /* GenericUtils.swift */; }; 2AC1E3832F507D80004F76C0 /* GenericUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1E3822F507D80004F76C0 /* GenericUtils.swift */; };
2AC1EAFB2F92260F004EDA80 /* UIStackExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1EAFA2F922602004EDA80 /* UIStackExtension.swift */; }; 2AC1EAFB2F92260F004EDA80 /* UIStackExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1EAFA2F922602004EDA80 /* UIStackExtension.swift */; };
2AC1EAFC2F922889004EDA80 /* UIStackExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1EAFA2F922602004EDA80 /* UIStackExtension.swift */; }; 2AC1EAFC2F922889004EDA80 /* UIStackExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1EAFA2F922602004EDA80 /* UIStackExtension.swift */; };
@@ -62,7 +62,7 @@
848F456A2DDCD12500581E36 /* HostCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 848F45692DDCD12500581E36 /* HostCardView.m */; }; 848F456A2DDCD12500581E36 /* HostCardView.m in Sources */ = {isa = PBXBuildFile; fileRef = 848F45692DDCD12500581E36 /* HostCardView.m */; };
84E1CDEC2C4F67D300547904 /* CommandManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEB2C4F67D300547904 /* CommandManager.swift */; }; 84E1CDEC2C4F67D300547904 /* CommandManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEB2C4F67D300547904 /* CommandManager.swift */; };
84E1CDEF2C4F688E00547904 /* ToolboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEE2C4F688E00547904 /* ToolboxViewController.swift */; }; 84E1CDEF2C4F688E00547904 /* ToolboxViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDEE2C4F688E00547904 /* ToolboxViewController.swift */; };
84E1CDFA2C4FE83400547904 /* SwiftLocalizationHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */; }; 84E1CDFA2C4FE83400547904 /* LocalizationHelperExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 84E1CDF92C4FE83400547904 /* LocalizationHelperExtension.swift */; };
84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */; }; 84FD0B512C31338D006B5BE5 /* LocalizationHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */; };
84FD0B542C3134A6006B5BE5 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */; }; 84FD0B542C3134A6006B5BE5 /* Localizable.xcstrings in Resources */ = {isa = PBXBuildFile; fileRef = 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */; };
9777AAF32E2CF7A400D7FBAF /* Shaders-Linear.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9777AAF22E2CF7A400D7FBAF /* Shaders-Linear.metal */; }; 9777AAF32E2CF7A400D7FBAF /* Shaders-Linear.metal in Sources */ = {isa = PBXBuildFile; fileRef = 9777AAF22E2CF7A400D7FBAF /* Shaders-Linear.metal */; };
@@ -246,7 +246,7 @@
84D8EB932C5146AD00FC10A9 /* VoidLink-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VoidLink-Bridging-Header.h"; sourceTree = "<group>"; }; 84D8EB932C5146AD00FC10A9 /* VoidLink-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "VoidLink-Bridging-Header.h"; sourceTree = "<group>"; };
84E1CDEB2C4F67D300547904 /* CommandManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManager.swift; sourceTree = "<group>"; }; 84E1CDEB2C4F67D300547904 /* CommandManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CommandManager.swift; sourceTree = "<group>"; };
84E1CDEE2C4F688E00547904 /* ToolboxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolboxViewController.swift; sourceTree = "<group>"; }; 84E1CDEE2C4F688E00547904 /* ToolboxViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToolboxViewController.swift; sourceTree = "<group>"; };
84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftLocalizationHelper.swift; sourceTree = "<group>"; }; 84E1CDF92C4FE83400547904 /* LocalizationHelperExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocalizationHelperExtension.swift; sourceTree = "<group>"; };
84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalizationHelper.h; sourceTree = "<group>"; }; 84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalizationHelper.h; sourceTree = "<group>"; };
84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizationHelper.m; sourceTree = "<group>"; }; 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = LocalizationHelper.m; sourceTree = "<group>"; };
84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; }; 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */ = {isa = PBXFileReference; lastKnownFileType = text.json.xcstrings; path = Localizable.xcstrings; sourceTree = "<group>"; };
@@ -534,8 +534,8 @@
children = ( children = (
84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */, 84FD0B4F2C313343006B5BE5 /* LocalizationHelper.h */,
84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */, 84FD0B502C31338D006B5BE5 /* LocalizationHelper.m */,
84E1CDF92C4FE83400547904 /* LocalizationHelperExtension.swift */,
84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */, 84FD0B532C3134A6006B5BE5 /* Localizable.xcstrings */,
84E1CDF92C4FE83400547904 /* SwiftLocalizationHelper.swift */,
); );
path = Localization; path = Localization;
sourceTree = "<group>"; sourceTree = "<group>";
@@ -1114,7 +1114,7 @@
isa = PBXSourcesBuildPhase; isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;
files = ( files = (
2AAA4E842F7666EE001E20DC /* SwiftLocalizationHelper.swift in Sources */, 2AAA4E842F7666EE001E20DC /* LocalizationHelperExtension.swift in Sources */,
2AAA4E822F7666C5001E20DC /* ControllerUtil.swift in Sources */, 2AAA4E822F7666C5001E20DC /* ControllerUtil.swift in Sources */,
2AC1EAFB2F92260F004EDA80 /* UIStackExtension.swift in Sources */, 2AC1EAFB2F92260F004EDA80 /* UIStackExtension.swift in Sources */,
); );
@@ -1211,7 +1211,7 @@
FB9AFD371A7E02DB00872C98 /* HttpRequest.m in Sources */, FB9AFD371A7E02DB00872C98 /* HttpRequest.m in Sources */,
1888C1932E24C41000108730 /* AboutView.swift in Sources */, 1888C1932E24C41000108730 /* AboutView.swift in Sources */,
FB4678ED1A50C40900377732 /* OnScreenControls.m in Sources */, FB4678ED1A50C40900377732 /* OnScreenControls.m in Sources */,
84E1CDFA2C4FE83400547904 /* SwiftLocalizationHelper.swift in Sources */, 84E1CDFA2C4FE83400547904 /* LocalizationHelperExtension.swift in Sources */,
FB290D0019B2C406004C83CF /* main.m in Sources */, FB290D0019B2C406004C83CF /* main.m in Sources */,
9896219723D15C7000211983 /* X1Kit.swift in Sources */, 9896219723D15C7000211983 /* X1Kit.swift in Sources */,
FBD3494319FC9C04002D2A60 /* AppAssetManager.m in Sources */, FBD3494319FC9C04002D2A60 /* AppAssetManager.m in Sources */,
+8 -8
View File
@@ -53,7 +53,7 @@ public struct AboutView: View {
} }
// 说明文字 // 说明文字
Text(SwiftLocalizationHelper.localizedString(forKey: "From the player community, to the player community.")) Text(LocalizationHelper.localizedString(forKey: "From the player community, to the player community."))
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(Font.caption.italic()) .font(Font.caption.italic())
.lineLimit(nil) .lineLimit(nil)
@@ -61,7 +61,7 @@ public struct AboutView: View {
.padding() .padding()
Text(SwiftLocalizationHelper.localizedString(forKey: "VoidLink delivers better performance now!")) Text(LocalizationHelper.localizedString(forKey: "VoidLink delivers better performance now!"))
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
.font(Font.callout.bold()) .font(Font.callout.bold())
.lineLimit(nil) .lineLimit(nil)
@@ -69,11 +69,11 @@ public struct AboutView: View {
// 链接按钮 // 链接按钮
if #available(iOS 14.0, *) { if #available(iOS 14.0, *) {
Link(SwiftLocalizationHelper.localizedString(forKey: "Learn more & join us"), destination: URL(string: SwiftLocalizationHelper.localizedString(forKey: "supportLink"))!) Link(LocalizationHelper.localizedString(forKey: "Learn more & join us"), destination: URL(string: LocalizationHelper.localizedString(forKey: "supportLink"))!)
.padding(.top, 10) .padding(.top, 10)
Spacer() Spacer()
// OK 按钮 // OK 按钮
Button(SwiftLocalizationHelper.localizedString(forKey: "OK")) { Button(LocalizationHelper.localizedString(forKey: "OK")) {
aboutVC.dismiss(animated:true) aboutVC.dismiss(animated:true)
} }
.padding() .padding()
@@ -83,9 +83,9 @@ public struct AboutView: View {
.cornerRadius(12) .cornerRadius(12)
} else { } else {
HStack(spacing: 20) { HStack(spacing: 20) {
Button(SwiftLocalizationHelper.localizedString(forKey: "Join us")) { Button(LocalizationHelper.localizedString(forKey: "Join us")) {
// 打开链接 // 打开链接
if let url = URL(string: SwiftLocalizationHelper.localizedString(forKey: "supportLink")) { if let url = URL(string: LocalizationHelper.localizedString(forKey: "supportLink")) {
UIApplication.shared.open(url) UIApplication.shared.open(url)
} }
} }
@@ -96,7 +96,7 @@ public struct AboutView: View {
.frame(height: 33) .frame(height: 33)
.frame(minWidth: 100) .frame(minWidth: 100)
/* /*
Button(SwiftLocalizationHelper.localizedString(forKey: "OK")) { Button(LocalizationHelper.localizedString(forKey: "OK")) {
presentationMode.wrappedValue.dismiss() presentationMode.wrappedValue.dismiss()
} }
.padding() .padding()
@@ -105,7 +105,7 @@ public struct AboutView: View {
.cornerRadius(12) .cornerRadius(12)
.frame(height: 33) .frame(height: 33)
.frame(minWidth: 100)*/ .frame(minWidth: 100)*/
Button(SwiftLocalizationHelper.localizedString(forKey: "OK")) { Button(LocalizationHelper.localizedString(forKey: "OK")) {
aboutVC.dismiss(animated:true) aboutVC.dismiss(animated:true)
} }
.padding() .padding()
+1 -1
View File
@@ -59,7 +59,7 @@ import UIKit
cancelButtonString = "Cancel" cancelButtonString = "Cancel"
} }
let cancelAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: cancelButtonString), style: .cancel) { _ in let cancelAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: cancelButtonString), style: .cancel) { _ in
isAlertDismissed = true isAlertDismissed = true
actionCancelled = true actionCancelled = true
completion?() completion?()
@@ -411,7 +411,7 @@ final class AbstractGamepadOverlayView: UIView {
title: GenericUtils.gamepadOverlayFeatureTipTitle(), title: GenericUtils.gamepadOverlayFeatureTipTitle(),
message: GenericUtils.gamepadOverlayFeatureTipMessage(), message: GenericUtils.gamepadOverlayFeatureTipMessage(),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "This tip won't be shown again"), buttonTitle: LocalizationHelper.localizedString(forKey: "This tip won't be shown again"),
countdown: 6 countdown: 6
) )
} }
+10 -10
View File
@@ -175,10 +175,10 @@ import Foundation
case .x: return "X" case .x: return "X"
case .y: return "Y" case .y: return "Y"
case .dpadUp: return SwiftLocalizationHelper.localizedString(forKey: "Up") case .dpadUp: return LocalizationHelper.localizedString(forKey: "Up")
case .dpadDown: return SwiftLocalizationHelper.localizedString(forKey: "Down") case .dpadDown: return LocalizationHelper.localizedString(forKey: "Down")
case .dpadLeft: return SwiftLocalizationHelper.localizedString(forKey: "Left") case .dpadLeft: return LocalizationHelper.localizedString(forKey: "Left")
case .dpadRight: return SwiftLocalizationHelper.localizedString(forKey: "Right") case .dpadRight: return LocalizationHelper.localizedString(forKey: "Right")
case .leftShoulder: return "LB" case .leftShoulder: return "LB"
case .rightShoulder: return "RB" case .rightShoulder: return "RB"
@@ -190,17 +190,17 @@ import Foundation
case .back: return "Back" case .back: return "Back"
case .special: return "Home" case .special: return "Home"
case .paddle1: return SwiftLocalizationHelper.localizedString(forKey: "Paddle1") case .paddle1: return LocalizationHelper.localizedString(forKey: "Paddle1")
case .paddle2: return SwiftLocalizationHelper.localizedString(forKey: "Paddle2") case .paddle2: return LocalizationHelper.localizedString(forKey: "Paddle2")
case .paddle3: return SwiftLocalizationHelper.localizedString(forKey: "Paddle3") case .paddle3: return LocalizationHelper.localizedString(forKey: "Paddle3")
case .paddle4: return SwiftLocalizationHelper.localizedString(forKey: "Paddle4") case .paddle4: return LocalizationHelper.localizedString(forKey: "Paddle4")
case .touchpadButton: return SwiftLocalizationHelper.localizedString(forKey: "Touch button") case .touchpadButton: return LocalizationHelper.localizedString(forKey: "Touch button")
case .misc: return "Misc" case .misc: return "Misc"
case .leftTrigger: return "LT" case .leftTrigger: return "LT"
case .rightTrigger: return "RT" case .rightTrigger: return "RT"
case .null: return SwiftLocalizationHelper.localizedString(forKey: "Null") case .null: return LocalizationHelper.localizedString(forKey: "Null")
default: return "UNKNOWN" default: return "UNKNOWN"
} }
+3 -3
View File
@@ -275,10 +275,10 @@ private final class InputAccessoryCapsuleButton: UIButton {
InputAccessoryBar.isFirstTap = false InputAccessoryBar.isFirstTap = false
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self.parentViewController!, in: self.parentViewController!,
title: SwiftLocalizationHelper.localizedString(forKey: "Soft Keyboard Toolbar"), title: LocalizationHelper.localizedString(forKey: "Soft Keyboard Toolbar"),
message: SwiftLocalizationHelper.localizedString(forKey:"inputAccessoryBarTip"), message: LocalizationHelper.localizedString(forKey:"inputAccessoryBarTip"),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "Got it!"), buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 6, countdown: 6,
completion: { completion: {
}) })
+4 -4
View File
@@ -110,12 +110,12 @@ public class MicHandler: NSObject {
private static func showSettingsAlert() { private static func showSettingsAlert() {
guard let topVC = topViewController() else { return } guard let topVC = topViewController() else { return }
let alert = UIAlertController( let alert = UIAlertController(
title: SwiftLocalizationHelper.localizedString(forKey: "Microphone Permission") , title: LocalizationHelper.localizedString(forKey: "Microphone Permission") ,
message: SwiftLocalizationHelper.localizedString(forKey: "micPermissionTip"), message: LocalizationHelper.localizedString(forKey: "micPermissionTip"),
preferredStyle: .alert preferredStyle: .alert
) )
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Cancel"), style: .cancel, handler: nil)) alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Cancel"), style: .cancel, handler: nil))
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Go to Settings") , style: .default, handler: { _ in alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Go to Settings") , style: .default, handler: { _ in
openSettings() openSettings()
})) }))
topVC.present(alert, animated: true, completion: nil) topVC.present(alert, animated: true, completion: nil)
+8 -35
View File
@@ -235,7 +235,6 @@ import ObjectiveC.runtime
@objc public var hasNonEditableLabel: Bool = false @objc public var hasNonEditableLabel: Bool = false
@objc public var isMagnifier: Bool = false @objc public var isMagnifier: Bool = false
private var isFirstTappingMagnifier: Bool = true
@objc public var animatesTransition: Bool = true @objc public var animatesTransition: Bool = true
// for all stick pads // for all stick pads
@@ -300,7 +299,6 @@ import ObjectiveC.runtime
@objc public var pitchFactor: CGFloat = 1.0 @objc public var pitchFactor: CGFloat = 1.0
@objc public var rollFactor: CGFloat = 1.0 @objc public var rollFactor: CGFloat = 1.0
private var gyroControlPreviousStatus: NSMutableDictionary = NSMutableDictionary() private var gyroControlPreviousStatus: NSMutableDictionary = NSMutableDictionary()
private var isFirstTappingOnscreenGyroButton: Bool = true
private var superViewWidth: CGFloat = 0 private var superViewWidth: CGFloat = 0
private var superViewHeight: CGFloat = 0 private var superViewHeight: CGFloat = 0
@@ -965,7 +963,7 @@ import ObjectiveC.runtime
} }
@objc func setupAtrributedText(){ @objc func setupAtrributedText(){
var text = self.widgetLabel.contains("#") ? "\(self.widgetLabel.split(separator: "#").first ?? "")" : SwiftLocalizationHelper.localizedString(forKey: self.widgetLabel) var text = self.widgetLabel.contains("#") ? "\(self.widgetLabel.split(separator: "#").first ?? "")" : LocalizationHelper.localizedString(forKey: self.widgetLabel)
if !OnScreenWidgetView.editMode, self.widgetType == .touchPad { if !OnScreenWidgetView.editMode, self.widgetType == .touchPad {
text = "" text = ""
@@ -975,9 +973,9 @@ import ObjectiveC.runtime
switch cmdString { switch cmdString {
case "DISABLETOUCH": case "DISABLETOUCH":
self.nonEditableWidgetLabel = SwiftLocalizationHelper.localizedString(forKey: touchDisabledFLag ? "=EnableTouch" : "=DisableTouch" ) self.nonEditableWidgetLabel = LocalizationHelper.localizedString(forKey: touchDisabledFLag ? "=EnableTouch" : "=DisableTouch" )
case "GAMEPADOVERLAY": case "GAMEPADOVERLAY":
self.nonEditableWidgetLabel = SwiftLocalizationHelper.localizedString(forKey: OnScreenWidgetView.gamepadOverlayFLag ? "=GamepadOverlayOn" : "=GamepadOverlayOff" ) self.nonEditableWidgetLabel = LocalizationHelper.localizedString(forKey: OnScreenWidgetView.gamepadOverlayFLag ? "=GamepadOverlayOn" : "=GamepadOverlayOff" )
default: default:
nonEditableWidgetLabel = "" nonEditableWidgetLabel = ""
} }
@@ -1909,6 +1907,7 @@ import ObjectiveC.runtime
if self.widgetType == WidgetTypeEnum.touchPad && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews if self.widgetType == WidgetTypeEnum.touchPad && touches.count == 1{ // don't use event?.allTouches?.count here, it will counts all touches including the ones captured by other UIViews
switch self.touchPadString { switch self.touchPadString {
case "LSWHEEL","RSWHEEL": case "LSWHEEL","RSWHEEL":
GenericUtils.handleStickWheelTip(in: self.parentViewController)
self.getVector(touch: touch) self.getVector(touch: touch)
self.handleStickWheelMove(touch: touch) self.handleStickWheelMove(touch: touch)
if quickDoubleTapDetected { if quickDoubleTapDetected {
@@ -1921,6 +1920,7 @@ import ObjectiveC.runtime
self.showl3r3Indicator() self.showl3r3Indicator()
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)} self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)}
case "RSVPAD": case "RSVPAD":
GenericUtils.handleVelocityBasedTouchpadTip(in: self.parentViewController)
self.clearRightStickTouchPadFlag() self.clearRightStickTouchPadFlag()
self.inertialScroller.timer?.pause() self.inertialScroller.timer?.pause()
if quickDoubleTapDetected { if quickDoubleTapDetected {
@@ -1954,10 +1954,7 @@ import ObjectiveC.runtime
self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings) self.sendComboButtonsDownEvent(comboStrings: self.comboButtonStrings)
} }
case "MAGNIFIER": case "MAGNIFIER":
if self.isFirstTappingMagnifier, GenericUtils.isFirstTappingMagnifier() { GenericUtils.handleMagnifierTip(in: self.parentViewController)
self.popMagnifierTip()
}
self.isFirstTappingMagnifier = false
if quickDoubleTapDetected && allSpawnedTouchesCount == 1 { if quickDoubleTapDetected && allSpawnedTouchesCount == 1 {
OnScreenWidgetView.profileChangedDuringStreaming = true OnScreenWidgetView.profileChangedDuringStreaming = true
self.functionalWidgetDelegate?.resetMagnifierStreamView(animated: self.animatesTransition) self.functionalWidgetDelegate?.resetMagnifierStreamView(animated: self.animatesTransition)
@@ -2580,10 +2577,7 @@ import ObjectiveC.runtime
} }
private func handleMotionControlButtonDown(){ private func handleMotionControlButtonDown(){
if isFirstTappingOnscreenGyroButton, GenericUtils.isFirstTappingOnscreenGyroButton() { GenericUtils.handleGyroButtonTip(in: self.parentViewController)
self.popGyroButtonTip()
}
isFirstTappingOnscreenGyroButton = false
switch self.motionControlButtonString { switch self.motionControlButtonString {
case "GYRO": case "GYRO":
self.motionHandler?.startGyroByOnScreenButton(self, yawFactor: yawFactor, pitchFactor: pitchFactor, rollFactor: rollFactor) self.motionHandler?.startGyroByOnScreenButton(self, yawFactor: yawFactor, pitchFactor: pitchFactor, rollFactor: rollFactor)
@@ -2638,6 +2632,7 @@ import ObjectiveC.runtime
switch self.functionalButtonString { switch self.functionalButtonString {
case "FOLDER": case "FOLDER":
if self.buttonMode != .slideAndHold {break} if self.buttonMode != .slideAndHold {break}
GenericUtils.handleSlideAndHoldFolderButtonTip(in: self.parentViewController)
self.folded = false self.folded = false
OnScreenWidgetView.set(folded: false, for: self) OnScreenWidgetView.set(folded: false, for: self)
case "ABSTCHDRAG": case "ABSTCHDRAG":
@@ -3169,28 +3164,6 @@ import ObjectiveC.runtime
return true return true
} }
private func popMagnifierTip() {
AlertControllerUtil.showAlert(
in: self.parentViewController,
title: SwiftLocalizationHelper.localizedString(forKey: "Magnifier"),
message: "\n\(SwiftLocalizationHelper.localizedString(forKey: "magnifierTip"))\n\n\(SwiftLocalizationHelper.localizedString(forKey: "magnifierPersistTip"))",
withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
)
}
private func popGyroButtonTip() {
AlertControllerUtil.showAlert(
in: self.parentViewController,
title: SwiftLocalizationHelper.localizedString(forKey: "Gyro Button"),
message: "\n\(SwiftLocalizationHelper.localizedString(forKey: "gyroButtonTip"))",
withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
)
}
// MARK: - Auto Dock // MARK: - Auto Dock
private static let autoDockExposedEdgeLength: CGFloat = GenericUtils.isIPhone() ? 90 : 90 private static let autoDockExposedEdgeLength: CGFloat = GenericUtils.isIPhone() ? 90 : 90
private static let autoDockExposedThickness: CGFloat = 22 private static let autoDockExposedThickness: CGFloat = 22
+28 -28
View File
@@ -436,7 +436,7 @@ import UIKit
pickerViewController.tabIdentifiers = ["keyboard"] pickerViewController.tabIdentifiers = ["keyboard"]
pickerViewController.initialTabIdentifier = "keyboard" pickerViewController.initialTabIdentifier = "keyboard"
pickerViewController.shortcutIdentifier = "eraser" pickerViewController.shortcutIdentifier = "eraser"
pickerViewController.shortcutPickerTipText = SwiftLocalizationHelper.localizedString(forKey: "Select eraser shortcut keys") pickerViewController.shortcutPickerTipText = LocalizationHelper.localizedString(forKey: "Select eraser shortcut keys")
let nav = UINavigationController(rootViewController: pickerViewController) let nav = UINavigationController(rootViewController: pickerViewController)
nav.modalPresentationStyle = .overFullScreen nav.modalPresentationStyle = .overFullScreen
viewController.present(nav, animated: true) viewController.present(nav, animated: true)
@@ -444,19 +444,19 @@ import UIKit
} }
/* /*
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "Eraser Shortcut"), let alert = UIAlertController(title: LocalizationHelper.localizedString(forKey: "Eraser Shortcut"),
message: SwiftLocalizationHelper.localizedString(forKey: "Enter eraser keyboard shortcut:"), message: LocalizationHelper.localizedString(forKey: "Enter eraser keyboard shortcut:"),
preferredStyle: .alert) preferredStyle: .alert)
alert.addTextField { textField in alert.addTextField { textField in
textField.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Example: e, ctrl+e, alt+e ...") textField.placeholder = LocalizationHelper.localizedString(forKey:"Example: e, ctrl+e, alt+e ...")
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.spellCheckingType = .no textField.spellCheckingType = .no
textField.text = selectedProfile.eraserShortcut textField.text = selectedProfile.eraserShortcut
} }
let okAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in let okAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in
let comboButtons = alert.textFields?[0].text ?? "" let comboButtons = alert.textFields?[0].text ?? ""
let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons) let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons)
if keyStrings?.count ?? 0 > 0 || comboButtons == "" { if keyStrings?.count ?? 0 > 0 || comboButtons == "" {
@@ -465,8 +465,8 @@ import UIKit
enterBrushShortcut(in: viewController) enterBrushShortcut(in: viewController)
} }
let learnMoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in let learnMoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in
if let url = URL(string: SwiftLocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) { if let url = URL(string: LocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
} }
@@ -488,26 +488,26 @@ import UIKit
pickerViewController.tabIdentifiers = ["keyboard"] pickerViewController.tabIdentifiers = ["keyboard"]
pickerViewController.initialTabIdentifier = "keyboard" pickerViewController.initialTabIdentifier = "keyboard"
pickerViewController.shortcutIdentifier = "brush" pickerViewController.shortcutIdentifier = "brush"
pickerViewController.shortcutPickerTipText = SwiftLocalizationHelper.localizedString(forKey: "Select brush shortcut keys") pickerViewController.shortcutPickerTipText = LocalizationHelper.localizedString(forKey: "Select brush shortcut keys")
let nav = UINavigationController(rootViewController: pickerViewController) let nav = UINavigationController(rootViewController: pickerViewController)
nav.modalPresentationStyle = .overFullScreen nav.modalPresentationStyle = .overFullScreen
viewController.present(nav, animated: true) viewController.present(nav, animated: true)
return return
/* /*
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "Brush Shortcut"), let alert = UIAlertController(title: LocalizationHelper.localizedString(forKey: "Brush Shortcut"),
message: SwiftLocalizationHelper.localizedString(forKey: "Enter brush keyboard shortcut:"), message: LocalizationHelper.localizedString(forKey: "Enter brush keyboard shortcut:"),
preferredStyle: .alert) preferredStyle: .alert)
alert.addTextField { textField in alert.addTextField { textField in
textField.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Example: b, ctrl+b, alt+b ...") textField.placeholder = LocalizationHelper.localizedString(forKey:"Example: b, ctrl+b, alt+b ...")
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.spellCheckingType = .no textField.spellCheckingType = .no
textField.text = selectedProfile?.brushShortcut textField.text = selectedProfile?.brushShortcut
} }
let okAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in let okAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in
let comboButtons = alert.textFields?[0].text ?? "" let comboButtons = alert.textFields?[0].text ?? ""
let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons) let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons)
if keyStrings?.count ?? 0 > 0 || comboButtons == "" { if keyStrings?.count ?? 0 > 0 || comboButtons == "" {
@@ -524,8 +524,8 @@ import UIKit
} }
} }
let learnMoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in let learnMoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in
if let url = URL(string: SwiftLocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) { if let url = URL(string: LocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
} }
@@ -550,7 +550,7 @@ import UIKit
pickerViewController.tabIdentifiers = ["keyboard"] pickerViewController.tabIdentifiers = ["keyboard"]
pickerViewController.initialTabIdentifier = "keyboard" pickerViewController.initialTabIdentifier = "keyboard"
pickerViewController.shortcutIdentifier = "squeezePress" pickerViewController.shortcutIdentifier = "squeezePress"
pickerViewController.shortcutPickerTipText = SwiftLocalizationHelper.localizedString(forKey: "squeezePressShortcutPickerTip") pickerViewController.shortcutPickerTipText = LocalizationHelper.localizedString(forKey: "squeezePressShortcutPickerTip")
let nav = UINavigationController(rootViewController: pickerViewController) let nav = UINavigationController(rootViewController: pickerViewController)
nav.modalPresentationStyle = .overFullScreen nav.modalPresentationStyle = .overFullScreen
viewController.present(nav, animated: true) viewController.present(nav, animated: true)
@@ -560,19 +560,19 @@ import UIKit
selectedProfile = oscProfileMan.getSelectedProfile() selectedProfile = oscProfileMan.getSelectedProfile()
guard let selectedProfile = selectedProfile else {return} guard let selectedProfile = selectedProfile else {return}
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "Squeeze Shortcut"), let alert = UIAlertController(title: LocalizationHelper.localizedString(forKey: "Squeeze Shortcut"),
message: SwiftLocalizationHelper.localizedString(forKey: "enterSqueezePressShort"), message: LocalizationHelper.localizedString(forKey: "enterSqueezePressShort"),
preferredStyle: .alert) preferredStyle: .alert)
alert.addTextField { textField in alert.addTextField { textField in
textField.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Example: e, ctrl+e, alt+e ...") textField.placeholder = LocalizationHelper.localizedString(forKey:"Example: e, ctrl+e, alt+e ...")
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.spellCheckingType = .no textField.spellCheckingType = .no
textField.text = selectedProfile.squeezeStartShortcut textField.text = selectedProfile.squeezeStartShortcut
} }
let okAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in let okAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in
let comboButtons = alert.textFields?[0].text ?? "" let comboButtons = alert.textFields?[0].text ?? ""
let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons) let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons)
if keyStrings?.count ?? 0 > 0 || comboButtons == "" { if keyStrings?.count ?? 0 > 0 || comboButtons == "" {
@@ -581,8 +581,8 @@ import UIKit
enterSqueezeEndShortcut(in: viewController) enterSqueezeEndShortcut(in: viewController)
} }
let learnMoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in let learnMoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in
if let url = URL(string: SwiftLocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) { if let url = URL(string: LocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
} }
@@ -603,26 +603,26 @@ import UIKit
pickerViewController.tabIdentifiers = ["keyboard"] pickerViewController.tabIdentifiers = ["keyboard"]
pickerViewController.initialTabIdentifier = "keyboard" pickerViewController.initialTabIdentifier = "keyboard"
pickerViewController.shortcutIdentifier = "squeezeRelease" pickerViewController.shortcutIdentifier = "squeezeRelease"
pickerViewController.shortcutPickerTipText = SwiftLocalizationHelper.localizedString(forKey: "squeezeReleaseShortcutPickerTip") pickerViewController.shortcutPickerTipText = LocalizationHelper.localizedString(forKey: "squeezeReleaseShortcutPickerTip")
let nav = UINavigationController(rootViewController: pickerViewController) let nav = UINavigationController(rootViewController: pickerViewController)
nav.modalPresentationStyle = .overFullScreen nav.modalPresentationStyle = .overFullScreen
viewController.present(nav, animated: true) viewController.present(nav, animated: true)
} }
/* /*
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "Squeeze Shortcut"), let alert = UIAlertController(title: LocalizationHelper.localizedString(forKey: "Squeeze Shortcut"),
message: SwiftLocalizationHelper.localizedString(forKey: "enterSqueezeReleaseShort"), message: LocalizationHelper.localizedString(forKey: "enterSqueezeReleaseShort"),
preferredStyle: .alert) preferredStyle: .alert)
alert.addTextField { textField in alert.addTextField { textField in
textField.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Example: b, ctrl+b, alt+b ...") textField.placeholder = LocalizationHelper.localizedString(forKey:"Example: b, ctrl+b, alt+b ...")
textField.keyboardType = .asciiCapable textField.keyboardType = .asciiCapable
textField.autocorrectionType = .no textField.autocorrectionType = .no
textField.spellCheckingType = .no textField.spellCheckingType = .no
textField.text = selectedProfile?.squeezeEndShortcut textField.text = selectedProfile?.squeezeEndShortcut
} }
let okAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in let okAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default) { _ in
let comboButtons = alert.textFields?[0].text ?? "" let comboButtons = alert.textFields?[0].text ?? ""
let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons) let keyStrings = CommandManager.shared.extractAutoReleaseButtonStrings(from: comboButtons)
if keyStrings?.count ?? 0 > 0 || comboButtons == "" { if keyStrings?.count ?? 0 > 0 || comboButtons == "" {
@@ -639,8 +639,8 @@ import UIKit
} }
} }
let learnMoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in let learnMoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in
if let url = URL(string: SwiftLocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) { if let url = URL(string: LocalizationHelper.localizedString(forKey: "pencilKeyboardCmdURL")) {
UIApplication.shared.open(url, options: [:], completionHandler: nil) UIApplication.shared.open(url, options: [:], completionHandler: nil)
} }
} }
+29 -29
View File
@@ -590,13 +590,13 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
override func viewDidAppear(_ animated: Bool) { override func viewDidAppear(_ animated: Bool) {
/* /*
AlertControllerUtil.cancelButtonString = SwiftLocalizationHelper.localizedString(forKey: "No") AlertControllerUtil.cancelButtonString = LocalizationHelper.localizedString(forKey: "No")
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: SwiftLocalizationHelper.localizedString(forKey: "Pen Pressure Curve"), title: LocalizationHelper.localizedString(forKey: "Pen Pressure Curve"),
message: SwiftLocalizationHelper.localizedString(forKey:"Reset the pen pressure curve by starting from the pen pressure test?"), message: LocalizationHelper.localizedString(forKey:"Reset the pen pressure curve by starting from the pen pressure test?"),
withCancel: true, withCancel: true,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "Yes"), buttonTitle: LocalizationHelper.localizedString(forKey: "Yes"),
countdown: 0, countdown: 0,
action: {}, action: {},
completion: { completion: {
@@ -721,7 +721,7 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
@objc func hookFilterDepthSliderMoved(_ sender: UISlider) { @objc func hookFilterDepthSliderMoved(_ sender: UISlider) {
phase1StrokeSampleIndexEnd = Int32(sender.value.rounded()) phase1StrokeSampleIndexEnd = Int32(sender.value.rounded())
hookFilterLabel.text = "\(SwiftLocalizationHelper.localizedString(forKey: "Stroke start hook filtering depth: "))\(String(format: "%d", Int32(sender.value)))"; hookFilterLabel.text = "\(LocalizationHelper.localizedString(forKey: "Stroke start hook filtering depth: "))\(String(format: "%d", Int32(sender.value)))";
if sender.value > strokeEqualizationDepthSlider.value { if sender.value > strokeEqualizationDepthSlider.value {
strokeEqualizationDepthSlider.value = sender.value strokeEqualizationDepthSlider.value = sender.value
strokeEqualizationDepthSliderMoved(strokeEqualizationDepthSlider) strokeEqualizationDepthSliderMoved(strokeEqualizationDepthSlider)
@@ -731,12 +731,12 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
@objc func strokeEqualizationDepthSliderMoved(_ sender: UISlider) { @objc func strokeEqualizationDepthSliderMoved(_ sender: UISlider) {
sender.value = max(sender.value, hookFilterSlider.value) sender.value = max(sender.value, hookFilterSlider.value)
phase2StrokeSampleIndexEnd = Int32(sender.value.rounded()) phase2StrokeSampleIndexEnd = Int32(sender.value.rounded())
strokeEqualizationDepthLabel.text = "\(SwiftLocalizationHelper.localizedString(forKey: "Stroke start equalization depth: "))\(String(format: "%d", Int32(sender.value)))"; strokeEqualizationDepthLabel.text = "\(LocalizationHelper.localizedString(forKey: "Stroke start equalization depth: "))\(String(format: "%d", Int32(sender.value)))";
} }
@objc func strokeEqualizationStrengthSliderMoved(_ sender: UISlider) { @objc func strokeEqualizationStrengthSliderMoved(_ sender: UISlider) {
// sender.value = sender.value // sender.value = sender.value
strokeEqualizationStrengthLabel.text = "\(SwiftLocalizationHelper.localizedString(forKey: "Stroke start force scaling: "))\(String(format: "%.2f", sender.value))"; strokeEqualizationStrengthLabel.text = "\(LocalizationHelper.localizedString(forKey: "Stroke start force scaling: "))\(String(format: "%.2f", sender.value))";
} }
@@ -773,20 +773,20 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
]) ])
if curveView.testStage == .curveStage { if curveView.testStage == .curveStage {
let resetButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Reset"), style: .plain, target: self, action: #selector(resetTapped)) let resetButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Reset"), style: .plain, target: self, action: #selector(resetTapped))
let undoButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Undo"), style: .plain, target: self, action: #selector(undoTapped)) let undoButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Undo"), style: .plain, target: self, action: #selector(undoTapped))
let rangeTestButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Pressure-range-test"), style: .plain, target: self, action: #selector(pressureRangeTest)) let rangeTestButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Pressure-range-test"), style: .plain, target: self, action: #selector(pressureRangeTest))
// curvePhaseButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Initial-touch-curve"), style: .plain, target: self, action: #selector(curvePhaseButtonTapped)) // curvePhaseButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Initial-touch-curve"), style: .plain, target: self, action: #selector(curvePhaseButtonTapped))
curvePhase = .stroke curvePhase = .stroke
saveButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Save"), style: .plain, target: self, action: #selector(saveTapped)) saveButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Save"), style: .plain, target: self, action: #selector(saveTapped))
// let quitButton = UIBarButtonItem(title: SwiftLocalizationHelper.localizedString(forKey: "Exit"), style: .plain, target: self, action: #selector(exitTapped)) // let quitButton = UIBarButtonItem(title: LocalizationHelper.localizedString(forKey: "Exit"), style: .plain, target: self, action: #selector(exitTapped))
navItem.leftBarButtonItems = [resetButton, undoButton, rangeTestButton,] navItem.leftBarButtonItems = [resetButton, undoButton, rangeTestButton,]
navItem.rightBarButtonItems = [saveButton] navItem.rightBarButtonItems = [saveButton]
} }
if curveView.testStage == .drawingStage { if curveView.testStage == .drawingStage {
navItem = UINavigationItem(title: SwiftLocalizationHelper.localizedString(forKey: "Pressure Range Test")) navItem = UINavigationItem(title: LocalizationHelper.localizedString(forKey: "Pressure Range Test"))
} }
if #available(iOS 26.0, *) { if #available(iOS 26.0, *) {
@@ -810,10 +810,10 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
public func showCurveStageTips() { public func showCurveStageTips() {
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: SwiftLocalizationHelper.localizedString(forKey: "Pen Pressure Curve"), title: LocalizationHelper.localizedString(forKey: "Pen Pressure Curve"),
message: SwiftLocalizationHelper.localizedString(forKey:"Adjust the pressure curve by adding or dragging the purple squares."), message: LocalizationHelper.localizedString(forKey:"Adjust the pressure curve by adding or dragging the purple squares."),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "This tip won't be shown again"), buttonTitle: LocalizationHelper.localizedString(forKey: "This tip won't be shown again"),
countdown: 6 countdown: 6
) )
} }
@@ -840,9 +840,9 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: "", title: "",
message: SwiftLocalizationHelper.localizedString(forKey:"PencilProPackLowOSVersionTip"), message: LocalizationHelper.localizedString(forKey:"PencilProPackLowOSVersionTip"),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "OK"), buttonTitle: LocalizationHelper.localizedString(forKey: "OK"),
countdown: 0) countdown: 0)
} }
} }
@@ -850,10 +850,10 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
@objc private func pressureRangeTest() { @objc private func pressureRangeTest() {
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: SwiftLocalizationHelper.localizedString(forKey: "Pressure Range Test"), title: LocalizationHelper.localizedString(forKey: "Pressure Range Test"),
message: SwiftLocalizationHelper.localizedString(forKey:"pressureRangeTestTip"), message: LocalizationHelper.localizedString(forKey:"pressureRangeTestTip"),
withCancel: true, withCancel: true,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "OK"), buttonTitle: LocalizationHelper.localizedString(forKey: "OK"),
countdown: 0, countdown: 0,
completion:{ completion:{
if AlertControllerUtil.actionCancelled { return } if AlertControllerUtil.actionCancelled { return }
@@ -870,10 +870,10 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
switch curvePhase { switch curvePhase {
case .initialTouch: case .initialTouch:
// initialTouchCurvePoints = curveView.curve.polylinePoints // initialTouchCurvePoints = curveView.curve.polylinePoints
curvePhaseButton.title = SwiftLocalizationHelper.localizedString(forKey:"Initial-touch-curve") curvePhaseButton.title = LocalizationHelper.localizedString(forKey:"Initial-touch-curve")
case .stroke: case .stroke:
strokeCurvePoints = curveView.curve.polylinePoints strokeCurvePoints = curveView.curve.polylinePoints
curvePhaseButton.title = SwiftLocalizationHelper.localizedString(forKey:"Stroke-curve") curvePhaseButton.title = LocalizationHelper.localizedString(forKey:"Stroke-curve")
} }
curvePhase = curvePhase.next() curvePhase = curvePhase.next()
displayCurve() displayCurve()
@@ -908,10 +908,10 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
if self.isFirstLaunch { if self.isFirstLaunch {
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: SwiftLocalizationHelper.localizedString(forKey: "Pen Pressure Curve"), title: LocalizationHelper.localizedString(forKey: "Pen Pressure Curve"),
message: SwiftLocalizationHelper.localizedString(forKey:"firstPressureCurvePersistTip"), message: LocalizationHelper.localizedString(forKey:"firstPressureCurvePersistTip"),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "This tip won't be shown again"), buttonTitle: LocalizationHelper.localizedString(forKey: "This tip won't be shown again"),
countdown: 11, countdown: 11,
completion: { completion: {
PencilHandler.shared?.setupPressureLUT() PencilHandler.shared?.setupPressureLUT()
@@ -922,8 +922,8 @@ class PressureCurveViewController: UIViewController, UIGestureRecognizerDelegate
AlertControllerUtil.autoCompletion = true AlertControllerUtil.autoCompletion = true
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: self, in: self,
title: SwiftLocalizationHelper.localizedString(forKey: ""), title: LocalizationHelper.localizedString(forKey: ""),
message: SwiftLocalizationHelper.localizedString(forKey:"Pressure curve saved"), message: LocalizationHelper.localizedString(forKey:"Pressure curve saved"),
withCancel: false, withCancel: false,
buttonTitle: "", buttonTitle: "",
countdown: 1, countdown: 1,
+159 -14
View File
@@ -6379,25 +6379,25 @@
"en" : { "en" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "Before you start, please navigate to 'Settings Menu → Motion Control Section → Map Gyro to’ to confirm whether the gyroscope output is set to mouse or controller stick." "value" : "This is a gyro switch button\nBefore you start, please navigate to 'Settings Menu → Motion Control Section → Map Gyro to’ to confirm whether the gyroscope output is set to mouse or controller stick."
} }
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "开始之前,请先前往 “设置菜单 → 体感控制分区 → 陀螺仪映射为” 选项确认陀螺仪输出为鼠标还是手柄摇杆。" "value" : "这是一个陀螺仪开关按键。\n开始之前,请先前往 “设置菜单 → 体感控制分区 → 陀螺仪映射为” 选项,确认陀螺仪输出为鼠标还是手柄摇杆。"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "開始之前,請先前往「設定選單 → 體感控制分區 → 陀螺儀映射為」選項,確認陀螺儀輸出為滑鼠還是手把搖桿。" "value" : "這是一個陀螺儀開關按鍵。\n開始之前,請先前往「設定選單 → 體感控制分區 → 陀螺儀映射為」選項,確認陀螺儀輸出為滑鼠還是手把搖桿。"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "開始之前,請先前往「設定選單 → 體感控制分區 → 陀螺儀映射為」選項,確認陀螺儀輸出為滑鼠還是手把搖桿。" "value" : "這是一個陀螺儀開關按鍵。\n開始之前,請先前往「設定選單 → 體感控制分區 → 陀螺儀映射為」選項,確認陀螺儀輸出為滑鼠還是手把搖桿。"
} }
} }
} }
@@ -6805,19 +6805,19 @@
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "长按任意按键2秒后,可拖拽调整按键顺序、删除按键" "value" : "长按任意按键2秒后,可拖拽调整按键顺序、删除按键"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "長按任意按鍵2秒後,可拖曳調整按鍵順序、刪除按鍵" "value" : "長按任意按鍵2秒後,可拖曳調整按鍵順序、刪除按鍵"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "needs_review", "state" : "translated",
"value" : "長按任意按鍵2秒後,可拖曳調整按鍵順序、刪除按鍵" "value" : "長按任意按鍵2秒後,可拖曳調整按鍵順序、刪除按鍵"
} }
} }
@@ -7664,25 +7664,25 @@
"en" : { "en" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "Single touch pans stream view; two-finger pinch zooms stream view. Double tap to reset." "value" : "Single touch pans stream view; two-finger pinch zooms stream view. Double tap to reset.\n\nMetal rendering does not support magnifier widget."
} }
}, },
"zh-Hans" : { "zh-Hans" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "单指平移/竖移串流视图,双指捏合缩放串流视图。双击复原串流视图。" "value" : "单指平移/竖移串流视图,双指捏合缩放串流视图。双击复原串流视图。\n\n目前 Metal 渲染模式下无法使用放大镜控件"
} }
}, },
"zh-Hant" : { "zh-Hant" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "單指平移/豎移串流視圖,雙指捏合縮放串流視圖。雙擊復原串流視圖。" "value" : "單指平移/豎移串流視圖,雙指捏合縮放串流視圖。雙擊復原串流視圖。\n\n目前 Metal 渲染模式下無法使用放大鏡控制項。"
} }
}, },
"zh-HK" : { "zh-HK" : {
"stringUnit" : { "stringUnit" : {
"state" : "translated", "state" : "translated",
"value" : "單指平移/豎移串流視圖,雙指捏合縮放串流視圖。雙擊復原串流視圖。" "value" : "單指平移/豎移串流視圖,雙指捏合縮放串流視圖。雙擊復原串流視圖。\n\n目前 Metal 渲染模式下無法使用放大鏡控制項。"
} }
} }
} }
@@ -11859,6 +11859,35 @@
} }
} }
}, },
"slideHoldFolderButtonTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This is a “slide-hold” folder button. During streaming, double-tap and keep holding to drag and reposition it."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "这是一个“滑动时保持按下”的 folder 控件夹按键。 在串流过程中双击并保持长按,可拖动改变其位置。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個「滑動時保持按下」的 Folder 控制項夾按鍵。在串流過程中雙擊並保持長按,可拖曳改變其位置。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個「滑動時保持按下」的 Folder 控制項夾按鍵。在串流過程中雙擊並保持長按,可拖曳改變其位置。"
}
}
}
},
"slideToSettingsDistanceStackTip" : { "slideToSettingsDistanceStackTip" : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -12298,6 +12327,64 @@
} }
} }
}, },
"stickWheelLink" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/pw0ok5cls8piwham"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/rgbk4c7nzzf044eb"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/rgbk4c7nzzf044eb"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "needs_review",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/rgbk4c7nzzf044eb"
}
}
}
},
"stickWheelTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This is a left stick direction wheel. It is recommended to check the tutorial before use."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "这是一个左摇杆方向轮。建议在使用先前查看教程。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個左搖桿方向輪。建議在使用前先查看教學。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個左搖桿方向輪。建議在使用前先查看教學。"
}
}
}
},
"Stroke start equalization depth: " : { "Stroke start equalization depth: " : {
"extractionState" : "manual", "extractionState" : "manual",
"localizations" : { "localizations" : {
@@ -13346,6 +13433,64 @@
} }
} }
}, },
"velocityBasedTouchpadLink" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/zw100ykch1ut4i1m"
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/ot4v6dgc6s1g23os"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/ot4v6dgc6s1g23os"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "https://voidlink.yuque.com/org-wiki-voidlink-znirha/fa3tgr/ot4v6dgc6s1g23os"
}
}
}
},
"velocityBasedTouchpadTip" : {
"extractionState" : "manual",
"localizations" : {
"en" : {
"stringUnit" : {
"state" : "translated",
"value" : "This is a velocity based, transparent right stick touchpad (RsvPad). Please increase the in-game right stick sensitivity first, then adjust the RsvPad sensitivity itself."
}
},
"zh-Hans" : {
"stringUnit" : {
"state" : "translated",
"value" : "这是一个透明的速度矢量型右摇杆触控板(RsvPad)。请先将游戏内的右摇杆灵敏度调大,再调整RsvPad自身灵敏度。"
}
},
"zh-Hant" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個透明的速度向量型右搖桿觸控板(RsvPad)。請先將遊戲內的右搖桿靈敏度調高,再調整 RsvPad 自身的靈敏度。"
}
},
"zh-HK" : {
"stringUnit" : {
"state" : "translated",
"value" : "這是一個透明的速度向量型右搖桿觸控板(RsvPad)。請先將遊戲內的右搖桿靈敏度調高,再調整 RsvPad 自身的靈敏度。"
}
}
}
},
"Version %@" : { "Version %@" : {
}, },
@@ -1,15 +1,12 @@
// //
// SwiftLocalizationHelper.swift // LocalizationHelper.swift
// VoidLink // VoidLink
// //
// Created by True砖家 on 2024/7/23. // Created by True砖家 on 2024/7/23.
// Copyright © True砖家 on Bilibili. All rights reserved. // Copyright © True砖家 on Bilibili. All rights reserved.
// //
import Foundation extension LocalizationHelper {
class SwiftLocalizationHelper {
static func localizedString(forKey key: String, _ args: CVarArg...) -> String { static func localizedString(forKey key: String, _ args: CVarArg...) -> String {
let format = NSLocalizedString(key, tableName: "Localizable", bundle: .main, value: "", comment: "") let format = NSLocalizedString(key, tableName: "Localizable", bundle: .main, value: "", comment: "")
return String(format: format, arguments: args) return String(format: format, arguments: args)
+1 -1
View File
@@ -266,7 +266,7 @@ static UIImage* noImage;
return; return;
} }
NSLog(@"appview update loop %f", CACurrentMediaTime()); // NSLog(@"appview update loop %f", CACurrentMediaTime());
// Update the app image if neccessary // Update the app image if neccessary
if ((_appOverlay != nil && ![_app.id isEqualToString:_app.host.currentGame]) || if ((_appOverlay != nil && ![_app.id isEqualToString:_app.host.currentGame]) ||
+133 -7
View File
@@ -32,7 +32,7 @@ import UIKit
return true return true
} }
@objc static func handleKeyboardOrMouseConnectionTip(in vc: UIViewController) { @objc static func handleKeyboardOrMouseConnectionTip(in vc: UIViewController?) {
if isRunningOnMacAsiPadApp { if isRunningOnMacAsiPadApp {
return return
} }
@@ -43,10 +43,10 @@ import UIKit
else if isFirstHardwareKeyboardOrMouseConnection() { else if isFirstHardwareKeyboardOrMouseConnection() {
AlertControllerUtil.showAlert( AlertControllerUtil.showAlert(
in: vc, in: vc,
title: SwiftLocalizationHelper.localizedString(forKey: "Keyboard/Mouse Connected"), title: LocalizationHelper.localizedString(forKey: "Keyboard/Mouse Connected"),
message: SwiftLocalizationHelper.localizedString(forKey:"keyboard&MouseStreamingTip"), message: LocalizationHelper.localizedString(forKey:"keyboard&MouseStreamingTip"),
withCancel: false, withCancel: false,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "This tip won't be shown again"), buttonTitle: LocalizationHelper.localizedString(forKey: "This tip won't be shown again"),
countdown: 11, countdown: 11,
completion: {}) completion: {})
} }
@@ -125,7 +125,10 @@ import UIKit
return false return false
} }
@objc static var hasTappedMagnifier = false
@objc static func isFirstTappingMagnifier() -> Bool { @objc static func isFirstTappingMagnifier() -> Bool {
guard !hasTappedMagnifier else { return false }
hasTappedMagnifier = true
let key = "hasTappedMagnifier2" let key = "hasTappedMagnifier2"
let defaults = UserDefaults.standard let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key) let launchedBefore = defaults.bool(forKey: key)
@@ -135,8 +138,81 @@ import UIKit
} }
return false return false
} }
@objc static func handleMagnifierTip(in vc: UIViewController?) {
if isFirstTappingMagnifier() {
AlertControllerUtil.showAlert(
in: vc,
title: LocalizationHelper.localizedString(forKey: "Magnifier"),
message: "\n\(LocalizationHelper.localizedString(forKey: "magnifierTip"))\n\n\(LocalizationHelper.localizedString(forKey: "magnifierPersistTip"))",
withCancel: false,
buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
)
}
}
@objc static var hasTappedVelocityBasedTouchpad = false
@objc static func isFirstTappingVelocityBasedTouchpad() -> Bool {
guard !hasTappedVelocityBasedTouchpad else { return false }
hasTappedVelocityBasedTouchpad = true
let key = "hasTappedVelocityBasedTouchpad6"
let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key)
if !launchedBefore {
defaults.set(true, forKey: key)
return true
}
return false
}
@objc static func handleVelocityBasedTouchpadTip(in vc: UIViewController?) {
if isFirstTappingVelocityBasedTouchpad() {
AlertControllerUtil.cancelButtonString = LocalizationHelper.localizedString(forKey: "Detailed Tutorial")
AlertControllerUtil.showAlert(
in: vc,
title: LocalizationHelper.localizedString(forKey: "Tips"),
message: "\n\(LocalizationHelper.localizedString(forKey: "velocityBasedTouchpadTip"))",
withCancel: true,
buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
completion: {
if AlertControllerUtil.actionCancelled {
GenericUtils.openUrl(LocalizationHelper.localizedString(forKey: "velocityBasedTouchpadLink"))
}
}
)
}
}
@objc static var hasTappedSlideAndHoldFolderButton = false
@objc static func isFirstTappingSlideAndHoldFolderButton() -> Bool {
guard !hasTappedSlideAndHoldFolderButton else { return false }
hasTappedSlideAndHoldFolderButton = true
let key = "hasTappedSlideAndHoldFolderButton2"
let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key)
if !launchedBefore {
defaults.set(true, forKey: key)
return true
}
return false
}
@objc static func handleSlideAndHoldFolderButtonTip(in vc: UIViewController?) {
if isFirstTappingSlideAndHoldFolderButton() {
AlertControllerUtil.showAlert(
in: vc,
title: LocalizationHelper.localizedString(forKey: "Tips"),
message: "\n\(LocalizationHelper.localizedString(forKey: "slideHoldFolderButtonTip"))",
withCancel: false,
buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
)
}
}
@objc static var hasTappedOnscreenGyroButton = false
@objc static func isFirstTappingOnscreenGyroButton() -> Bool { @objc static func isFirstTappingOnscreenGyroButton() -> Bool {
guard !hasTappedOnscreenGyroButton else { return false }
hasTappedOnscreenGyroButton = true
let key = "hasTappedOnscreenGyroButton" let key = "hasTappedOnscreenGyroButton"
let defaults = UserDefaults.standard let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key) let launchedBefore = defaults.bool(forKey: key)
@@ -146,6 +222,56 @@ import UIKit
} }
return false return false
} }
@objc static func handleGyroButtonTip(in vc: UIViewController?) {
if isFirstTappingOnscreenGyroButton() {
AlertControllerUtil.cancelButtonString = LocalizationHelper.localizedString(forKey: "Detailed Tutorial")
AlertControllerUtil.showAlert(
in: vc,
title: LocalizationHelper.localizedString(forKey: "Tips"),
message: "\n\(LocalizationHelper.localizedString(forKey: "gyroButtonTip"))",
withCancel: true,
buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
completion: {
if AlertControllerUtil.actionCancelled {
GenericUtils.openUrl(LocalizationHelper.localizedString(forKey: "yourMotionControlSoution"))
}
}
)
}
}
@objc static var hasTappedStickWheel = false
@objc static func isFirstTappingStickWheel() -> Bool {
guard !hasTappedStickWheel else { return false }
hasTappedStickWheel = true
let key = "hasTappedStickWheel"
let defaults = UserDefaults.standard
let launchedBefore = defaults.bool(forKey: key)
if !launchedBefore {
defaults.set(true, forKey: key)
return true
}
return false
}
@objc static func handleStickWheelTip(in vc: UIViewController?) {
if isFirstTappingStickWheel() {
AlertControllerUtil.cancelButtonString = LocalizationHelper.localizedString(forKey: "Detailed Tutorial")
AlertControllerUtil.showAlert(
in: vc,
title: LocalizationHelper.localizedString(forKey: "Tips"),
message: "\n\(LocalizationHelper.localizedString(forKey: "stickWheelTip"))",
withCancel: true,
buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5,
completion: {
if AlertControllerUtil.actionCancelled {
GenericUtils.openUrl(LocalizationHelper.localizedString(forKey: "stickWheelLink"))
}
}
)
}
}
@objc static func isFirstTappingInputAccessoryBar() -> Bool { @objc static func isFirstTappingInputAccessoryBar() -> Bool {
let key = "isFirstTappingInputAccessoryBar" let key = "isFirstTappingInputAccessoryBar"
@@ -172,15 +298,15 @@ import UIKit
@objc static func gamepadOverlayFeatureTipTitle() -> String { @objc static func gamepadOverlayFeatureTipTitle() -> String {
SwiftLocalizationHelper.localizedString(forKey: "Gamepad Overlay") LocalizationHelper.localizedString(forKey: "Gamepad Overlay")
} }
@objc static func gamepadOverlayFeatureTipMessage() -> String { @objc static func gamepadOverlayFeatureTipMessage() -> String {
SwiftLocalizationHelper.localizedString(forKey: "gamepadOverlayFeatureTip") LocalizationHelper.localizedString(forKey: "gamepadOverlayFeatureTip")
} }
@objc static func gamepadOverlayFeatureTipButtonTitle() -> String { @objc static func gamepadOverlayFeatureTipButtonTitle() -> String {
SwiftLocalizationHelper.localizedString(forKey: "Got it!") LocalizationHelper.localizedString(forKey: "Got it!")
} }
@objc static func isIPhone() -> Bool { @objc static func isIPhone() -> Bool {
+7 -7
View File
@@ -57,7 +57,7 @@ import StoreKit
func productName() -> String { func productName() -> String {
switch self { switch self {
case .PencilProPack: case .PencilProPack:
return SwiftLocalizationHelper.localizedString(forKey: "Drawing Toolkit") return LocalizationHelper.localizedString(forKey: "Drawing Toolkit")
default: default:
return "" return ""
} }
@@ -66,7 +66,7 @@ import StoreKit
func productURL() -> String { func productURL() -> String {
switch self { switch self {
case .PencilProPack: case .PencilProPack:
return SwiftLocalizationHelper.localizedString(forKey: "PencilProPackURL") return LocalizationHelper.localizedString(forKey: "PencilProPackURL")
default: default:
return "" return ""
} }
@@ -75,7 +75,7 @@ import StoreKit
func productDescription() -> String { func productDescription() -> String {
switch self { switch self {
case .PencilProPack: case .PencilProPack:
return SwiftLocalizationHelper.localizedString(forKey: "PencilProPackDescription") return LocalizationHelper.localizedString(forKey: "PencilProPackDescription")
default: default:
return "" return ""
} }
@@ -372,14 +372,14 @@ import StoreKit
@objc static public func inAppPurchaseAction(viewController: UIViewController, product: AddOnProduct){ @objc static public func inAppPurchaseAction(viewController: UIViewController, product: AddOnProduct){
let alert = UIAlertController(title: product.productName(), let alert = UIAlertController(title: product.productName(),
message: SwiftLocalizationHelper.localizedString(forKey: "No purchase found", product.productName()), message: LocalizationHelper.localizedString(forKey: "No purchase found", product.productName()),
preferredStyle: .alert) preferredStyle: .alert)
let unlockAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Purchase Now"), style: .default) { _ in let unlockAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Purchase Now"), style: .default) { _ in
IAPManager.shared.purchase(product) IAPManager.shared.purchase(product)
} }
let restoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Restore Purchase"), style: .default) { _ in let restoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Restore Purchase"), style: .default) { _ in
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
Task{ Task{
do { do {
@@ -398,7 +398,7 @@ import StoreKit
} }
} }
let learnMoreAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in let learnMoreAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Learn More"), style: .default) { _ in
NotificationCenter.default.post(name: product.purchaseAbortedNotification(), object: PurchaseInterruption.learnMore, userInfo:["interruption": PurchaseInterruption.learnMore.rawValue]) NotificationCenter.default.post(name: product.purchaseAbortedNotification(), object: PurchaseInterruption.learnMore, userInfo:["interruption": PurchaseInterruption.learnMore.rawValue])
GenericUtils.openUrl(product.productURL()) GenericUtils.openUrl(product.productURL())
return return
@@ -11,13 +11,6 @@
import UIKit import UIKit
private extension LocalizationHelper {
static func localizedString(forKey key: String, _ args: CVarArg...) -> String {
let format = NSLocalizedString(key, tableName: "Localizable", bundle: .main, value: "", comment: "")
return String(format: format, arguments: args)
}
}
@objcMembers @objcMembers
final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidgetView.OnScreenWidgetLayoutUpdateDelegate, UITextFieldDelegate { final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidgetView.OnScreenWidgetLayoutUpdateDelegate, UITextFieldDelegate {
private enum AlphaSliderMode: Int { private enum AlphaSliderMode: Int {
@@ -549,7 +542,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
} }
@IBAction func importFromOtherButtonTapped(_ sender: Any?) { @IBAction func importFromOtherButtonTapped(_ sender: Any?) {
// importFromOtherButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Import"), for: .normal) // importFromOtherButton.setTitle(LocalizationHelper.localizedString(forKey: "Import"), for: .normal)
presentProfilesTableView(with: .pickProfileData) { [weak self] profile in presentProfilesTableView(with: .pickProfileData) { [weak self] profile in
if profile.name == self?.profilesManager.getSelectedProfile().name {return} if profile.name == self?.profilesManager.getSelectedProfile().name {return}
self?.loadWidgets(from: profile, to: self?.selectedWidgetView) self?.loadWidgets(from: profile, to: self?.selectedWidgetView)
@@ -1034,7 +1027,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
title: LocalizationHelper.localizedString(forKey: "Folder Button"), title: LocalizationHelper.localizedString(forKey: "Folder Button"),
message: LocalizationHelper.localizedString(forKey: "folderTutorialTip"), message: LocalizationHelper.localizedString(forKey: "folderTutorialTip"),
withCancel: true, withCancel: true,
buttonTitle: SwiftLocalizationHelper.localizedString(forKey: "Got it!"), buttonTitle: LocalizationHelper.localizedString(forKey: "Got it!"),
countdown: 5, countdown: 5,
completion: { completion: {
if AlertControllerUtil.actionCancelled { if AlertControllerUtil.actionCancelled {
@@ -1897,7 +1890,7 @@ final class LayoutOnScreenControlsViewController: UIViewController, OnScreenWidg
} }
private func applyTitle(_ title:String, for button: UIButton, state: UIControl.State = .normal) { private func applyTitle(_ title:String, for button: UIButton, state: UIControl.State = .normal) {
let title = SwiftLocalizationHelper.localizedString(forKey: title) let title = LocalizationHelper.localizedString(forKey: title)
let attr: [NSAttributedString.Key: Any] = [ let attr: [NSAttributedString.Key: Any] = [
.foregroundColor: UIColor(red: 115/255.0, green: 224/255.0, blue: 251/255.0, alpha: 1.0), .foregroundColor: UIColor(red: 115/255.0, green: 224/255.0, blue: 251/255.0, alpha: 1.0),
.font: UIFont.systemFont(ofSize: 11, weight: .medium) .font: UIFont.systemFont(ofSize: 11, weight: .medium)
@@ -182,32 +182,32 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
@IBAction func duplicateTapped(_ sender: Any?) { @IBAction func duplicateTapped(_ sender: Any?) {
let inputAlert = UIAlertController( let inputAlert = UIAlertController(
title: SwiftLocalizationHelper.localizedString(forKey: "Enter the name you want to save this profile as"), title: LocalizationHelper.localizedString(forKey: "Enter the name you want to save this profile as"),
message: "", message: "",
preferredStyle: .alert preferredStyle: .alert
) )
inputAlert.addTextField { textField in inputAlert.addTextField { textField in
textField.placeholder = SwiftLocalizationHelper.localizedString(forKey: "name") textField.placeholder = LocalizationHelper.localizedString(forKey: "name")
if #available(iOS 13.0, *) { if #available(iOS 13.0, *) {
// textField.textColor = .label // textField.textColor = .label
} }
textField.clearButtonMode = .whileEditing textField.clearButtonMode = .whileEditing
textField.borderStyle = .none textField.borderStyle = .none
} }
inputAlert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Cancel"), style: .default) { _ in inputAlert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Cancel"), style: .default) { _ in
inputAlert.dismiss(animated: false) inputAlert.dismiss(animated: false)
}) })
inputAlert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Save"), style: .default) { [weak self] _ in inputAlert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Save"), style: .default) { [weak self] _ in
guard let self else { return } guard let self else { return }
let enteredProfileName = inputAlert.textFields?.first?.text ?? "" let enteredProfileName = inputAlert.textFields?.first?.text ?? ""
if enteredProfileName == "Default" { if enteredProfileName == "Default" {
let alert = UIAlertController( let alert = UIAlertController(
title: "", title: "",
message: SwiftLocalizationHelper.localizedString(forKey: "Saving over the 'Default' profile is not allowed"), message: LocalizationHelper.localizedString(forKey: "Saving over the 'Default' profile is not allowed"),
preferredStyle: .alert preferredStyle: .alert
) )
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in
alert.dismiss(animated: false) { alert.dismiss(animated: false) {
self.present(inputAlert, animated: true) self.present(inputAlert, animated: true)
} }
@@ -216,10 +216,10 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
} else if enteredProfileName.isEmpty { } else if enteredProfileName.isEmpty {
let alert = UIAlertController( let alert = UIAlertController(
title: "", title: "",
message: SwiftLocalizationHelper.localizedString(forKey: "Profile name cannot be blank!"), message: LocalizationHelper.localizedString(forKey: "Profile name cannot be blank!"),
preferredStyle: .alert preferredStyle: .alert
) )
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in
alert.dismiss(animated: false) { alert.dismiss(animated: false) {
self.present(inputAlert, animated: true) self.present(inputAlert, animated: true)
} }
@@ -228,19 +228,19 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
} else if self.profilesManager.profileNameAlreadyExist(enteredProfileName) { } else if self.profilesManager.profileNameAlreadyExist(enteredProfileName) {
let alert = UIAlertController( let alert = UIAlertController(
title: "", title: "",
message: SwiftLocalizationHelper.localizedString(forKey: "Profile name already exists"), message: LocalizationHelper.localizedString(forKey: "Profile name already exists"),
preferredStyle: .alert preferredStyle: .alert
) )
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Ok"), style: .default)) alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Ok"), style: .default))
self.present(alert, animated: true) self.present(alert, animated: true)
} else { } else {
self.profilesManager.duplicateSelectedProfile(withName: enteredProfileName) self.profilesManager.duplicateSelectedProfile(withName: enteredProfileName)
let alert = UIAlertController( let alert = UIAlertController(
title: "", title: "",
message: SwiftLocalizationHelper.localizedString(forKey: "Profile %@ duplicated from current layout", enteredProfileName), message: LocalizationHelper.localizedString(forKey: "Profile %@ duplicated from current layout", enteredProfileName),
preferredStyle: .alert preferredStyle: .alert
) )
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in
alert.dismiss(animated: false) alert.dismiss(animated: false)
self.profileViewRefresh() self.profileViewRefresh()
}) })
@@ -336,16 +336,16 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
let profilesEncoded = try NSKeyedUnarchiver.unarchivedObject(ofClasses: classes, from: fileData) as? NSMutableArray let profilesEncoded = try NSKeyedUnarchiver.unarchivedObject(ofClasses: classes, from: fileData) as? NSMutableArray
let restoredAlert = UIAlertController( let restoredAlert = UIAlertController(
title: SwiftLocalizationHelper.localizedString(forKey: ""), title: LocalizationHelper.localizedString(forKey: ""),
message: SwiftLocalizationHelper.localizedString(forKey: "Pofiles imported"), message: LocalizationHelper.localizedString(forKey: "Pofiles imported"),
preferredStyle: .alert preferredStyle: .alert
) )
let failedAlert = UIAlertController( let failedAlert = UIAlertController(
title: SwiftLocalizationHelper.localizedString(forKey: ""), title: LocalizationHelper.localizedString(forKey: ""),
message: SwiftLocalizationHelper.localizedString(forKey: "Failed to import profiles"), message: LocalizationHelper.localizedString(forKey: "Failed to import profiles"),
preferredStyle: .alert preferredStyle: .alert
) )
let okAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default) let okAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default)
if restoreFailed || profilesEncoded == nil { if restoreFailed || profilesEncoded == nil {
failedAlert.addAction(okAction) failedAlert.addAction(okAction)
@@ -361,11 +361,11 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
} catch { } catch {
restoreFailed = true restoreFailed = true
let failedAlert = UIAlertController( let failedAlert = UIAlertController(
title: SwiftLocalizationHelper.localizedString(forKey: ""), title: LocalizationHelper.localizedString(forKey: ""),
message: SwiftLocalizationHelper.localizedString(forKey: "Failed to import profiles"), message: LocalizationHelper.localizedString(forKey: "Failed to import profiles"),
preferredStyle: .alert preferredStyle: .alert
) )
failedAlert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "OK"), style: .default)) failedAlert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "OK"), style: .default))
present(failedAlert, animated: true) present(failedAlert, animated: true)
profileViewRefresh() profileViewRefresh()
NSLog("解码失败: \(error)") NSLog("解码失败: \(error)")
@@ -425,7 +425,7 @@ final class OSCProfilesTableViewController: UIViewController, UITableViewDelegat
if let profile = profiles.object(at: indexPath.row) as? OSCProfile, profile.name == "Default" { if let profile = profiles.object(at: indexPath.row) as? OSCProfile, profile.name == "Default" {
let alert = UIAlertController(title: "", message: "Deleting the 'Default' profile is not allowed", preferredStyle: .alert) let alert = UIAlertController(title: "", message: "Deleting the 'Default' profile is not allowed", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in alert.addAction(UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Ok"), style: .default) { _ in
alert.dismiss(animated: false) alert.dismiss(animated: false)
}) })
present(alert, animated: true) present(alert, animated: true)
@@ -1662,7 +1662,6 @@ BOOL isCustomResolution(int resolutionSelected) {
onlineDocLink = [LocalizationHelper localizedStringForKey:@"yourMotionControlSoution"]; onlineDocLink = [LocalizationHelper localizedStringForKey:@"yourMotionControlSoution"];
} }
if([sender.superview.accessibilityIdentifier isEqualToString: @"renderingBackendStack"]){ if([sender.superview.accessibilityIdentifier isEqualToString: @"renderingBackendStack"]){
tipText = [LocalizationHelper localizedStringForKey:@"renderingBackendStackTip"]; tipText = [LocalizationHelper localizedStringForKey:@"renderingBackendStackTip"];
showOnlineDocAction = false; showOnlineDocAction = false;
@@ -34,12 +34,12 @@ import UIKit
@objc public var specialEntries : NSMutableArray = ["widgetSwitchTool", "widgetLayoutTool", "bringUpSoftKeyboard", "enterPip", "toggleStatsOverlay", "disconnectAndQuitApp"] @objc public var specialEntries : NSMutableArray = ["widgetSwitchTool", "widgetLayoutTool", "bringUpSoftKeyboard", "enterPip", "toggleStatsOverlay", "disconnectAndQuitApp"]
private let specialEntryAliasDic : [String:String] = [ private let specialEntryAliasDic : [String:String] = [
"widgetSwitchTool":SwiftLocalizationHelper.localizedString(forKey: "[ Switch game profile ]"), "widgetSwitchTool":LocalizationHelper.localizedString(forKey: "[ Switch game profile ]"),
"widgetLayoutTool":SwiftLocalizationHelper.localizedString(forKey: "[ Edit on-screen widget layout ]"), "widgetLayoutTool":LocalizationHelper.localizedString(forKey: "[ Edit on-screen widget layout ]"),
"bringUpSoftKeyboard":SwiftLocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"), "bringUpSoftKeyboard":LocalizationHelper.localizedString(forKey: "[ Bring up soft keyboard ]"),
"enterPip":SwiftLocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]"), "enterPip":LocalizationHelper.localizedString(forKey: "[ Enter picture-in-picture mode ]"),
"toggleStatsOverlay":SwiftLocalizationHelper.localizedString(forKey: "[ Toggle stats overlay ]"), "toggleStatsOverlay":LocalizationHelper.localizedString(forKey: "[ Toggle stats overlay ]"),
"disconnectAndQuitApp":SwiftLocalizationHelper.localizedString(forKey: "[ Disconnect & quit app ]") "disconnectAndQuitApp":LocalizationHelper.localizedString(forKey: "[ Disconnect & quit app ]")
] ]
private var viewPinned: Bool = false private var viewPinned: Bool = false
@@ -104,7 +104,7 @@ import UIKit
contentView.layer.masksToBounds = true contentView.layer.masksToBounds = true
// Set up the title label // Set up the title label
titleLabel.text = SwiftLocalizationHelper.localizedString(forKey: "Toolbox") titleLabel.text = LocalizationHelper.localizedString(forKey: "Toolbox")
titleLabel.font = UIFont.boldSystemFont(ofSize: 20) // Adjust font size as needed titleLabel.font = UIFont.boldSystemFont(ofSize: 20) // Adjust font size as needed
titleLabel.textColor = UIColor.white // Adjust color as needed titleLabel.textColor = UIColor.white // Adjust color as needed
titleLabel.textAlignment = .center titleLabel.textAlignment = .center
@@ -124,10 +124,10 @@ import UIKit
tableView.separatorInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10) tableView.separatorInset = UIEdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
// Configure buttons // Configure buttons
addButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Add"), for: .normal) addButton.setTitle(LocalizationHelper.localizedString(forKey: "Add"), for: .normal)
deleteButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Delete"), for: .normal) deleteButton.setTitle(LocalizationHelper.localizedString(forKey: "Delete"), for: .normal)
editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Edit"), for: .normal) editButton.setTitle(LocalizationHelper.localizedString(forKey: "Edit"), for: .normal)
exitButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Exit"), for: .normal) exitButton.setTitle(LocalizationHelper.localizedString(forKey: "Exit"), for: .normal)
pinButton.setTitle("📌", for: .normal) pinButton.setTitle("📌", for: .normal)
addButton.titleLabel?.font = UIFont.systemFont(ofSize: 20) // Adjust the size as needed addButton.titleLabel?.font = UIFont.systemFont(ofSize: 20) // Adjust the size as needed
deleteButton.titleLabel?.font = UIFont.systemFont(ofSize: 20) deleteButton.titleLabel?.font = UIFont.systemFont(ofSize: 20)
@@ -244,8 +244,8 @@ import UIKit
private func updateEditingMode() { private func updateEditingMode() {
addButton.isEnabled = isEditingMode addButton.isEnabled = isEditingMode
deleteButton.isEnabled = isEditingMode deleteButton.isEnabled = isEditingMode
if(isEditingMode){ editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Done"), for: .normal) } if(isEditingMode){ editButton.setTitle(LocalizationHelper.localizedString(forKey: "Done"), for: .normal) }
else{ editButton.setTitle(SwiftLocalizationHelper.localizedString(forKey: "Edit"), for: .normal) } else{ editButton.setTitle(LocalizationHelper.localizedString(forKey: "Edit"), for: .normal) }
} }
@objc private func pinButtonTapped() { @objc private func pinButtonTapped() {
@@ -298,9 +298,9 @@ import UIKit
return return
} }
else{ else{
let alert = UIAlertController(title: SwiftLocalizationHelper.localizedString(forKey: "New Command"), message: SwiftLocalizationHelper.localizedString(forKey: "Enter a new command and alias"), preferredStyle: .alert) let alert = UIAlertController(title: LocalizationHelper.localizedString(forKey: "New Command"), message: LocalizationHelper.localizedString(forKey: "Enter a new command and alias"), preferredStyle: .alert)
alert.addTextField { $0.placeholder = SwiftLocalizationHelper.localizedString(forKey:"Command") } alert.addTextField { $0.placeholder = LocalizationHelper.localizedString(forKey:"Command") }
alert.addTextField { $0.placeholder = SwiftLocalizationHelper.localizedString(forKey: "Alias (optional)") } alert.addTextField { $0.placeholder = LocalizationHelper.localizedString(forKey: "Alias (optional)") }
alert.textFields?[0].keyboardType = .asciiCapable alert.textFields?[0].keyboardType = .asciiCapable
alert.textFields?[0].autocorrectionType = .no alert.textFields?[0].autocorrectionType = .no
alert.textFields?[0].spellCheckingType = .no alert.textFields?[0].spellCheckingType = .no
@@ -308,11 +308,11 @@ import UIKit
alert.textFields?[1].autocorrectionType = .no alert.textFields?[1].autocorrectionType = .no
alert.textFields?[1].spellCheckingType = .no alert.textFields?[1].spellCheckingType = .no
let submitAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey: "Add"), style: .default) { [unowned alert] _ in let submitAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey: "Add"), style: .default) { [unowned alert] _ in
self.createEntry(cmdString: alert.textFields?[0].text ?? "", alias: alert.textFields?[1].text) self.createEntry(cmdString: alert.textFields?[0].text ?? "", alias: alert.textFields?[1].text)
} }
let cancelAction = UIAlertAction(title: SwiftLocalizationHelper.localizedString(forKey:"Cancel"), style: .cancel) let cancelAction = UIAlertAction(title: LocalizationHelper.localizedString(forKey:"Cancel"), style: .cancel)
alert.addAction(submitAction) alert.addAction(submitAction)
alert.addAction(cancelAction) alert.addAction(cancelAction)
+31 -31
View File
@@ -125,34 +125,34 @@ enum GamepadWidget: Hashable {
var description: String { var description: String {
switch self { switch self {
case .a: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad A") case .a: return LocalizationHelper.localizedString(forKey: "Gamepad A")
case .b: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad B") case .b: return LocalizationHelper.localizedString(forKey: "Gamepad B")
case .x: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad X") case .x: return LocalizationHelper.localizedString(forKey: "Gamepad X")
case .y: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Y") case .y: return LocalizationHelper.localizedString(forKey: "Gamepad Y")
case .select: return SwiftLocalizationHelper.localizedString(forKey: "Select") case .select: return LocalizationHelper.localizedString(forKey: "Select")
case .start: return SwiftLocalizationHelper.localizedString(forKey: "Start") case .start: return LocalizationHelper.localizedString(forKey: "Start")
case .home: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Home") case .home: return LocalizationHelper.localizedString(forKey: "Gamepad Home")
case .dPad: return SwiftLocalizationHelper.localizedString(forKey: "Dpad") case .dPad: return LocalizationHelper.localizedString(forKey: "Dpad")
case .up: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Up") case .up: return LocalizationHelper.localizedString(forKey: "Gamepad Up")
case .down: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Down") case .down: return LocalizationHelper.localizedString(forKey: "Gamepad Down")
case .left: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Left") case .left: return LocalizationHelper.localizedString(forKey: "Gamepad Left")
case .right: return SwiftLocalizationHelper.localizedString(forKey: "Gamepad Right") case .right: return LocalizationHelper.localizedString(forKey: "Gamepad Right")
case .ls: return SwiftLocalizationHelper.localizedString(forKey: "LS/L3 button") case .ls: return LocalizationHelper.localizedString(forKey: "LS/L3 button")
case .lswheel: return SwiftLocalizationHelper.localizedString(forKey: "Left stick wheel") case .lswheel: return LocalizationHelper.localizedString(forKey: "Left stick wheel")
case .lsPad: return SwiftLocalizationHelper.localizedString(forKey: "Displacement-based left stick pad") case .lsPad: return LocalizationHelper.localizedString(forKey: "Displacement-based left stick pad")
case .lsvPad: return SwiftLocalizationHelper.localizedString(forKey: "Velocity-based left stick pad") case .lsvPad: return LocalizationHelper.localizedString(forKey: "Velocity-based left stick pad")
case .rs: return SwiftLocalizationHelper.localizedString(forKey: "RS/R3 button") case .rs: return LocalizationHelper.localizedString(forKey: "RS/R3 button")
case .rsPad: return SwiftLocalizationHelper.localizedString(forKey: "Displacement-based right stick pad") case .rsPad: return LocalizationHelper.localizedString(forKey: "Displacement-based right stick pad")
case .rsvPad: return SwiftLocalizationHelper.localizedString(forKey: "Velocity-based right stick pad") case .rsvPad: return LocalizationHelper.localizedString(forKey: "Velocity-based right stick pad")
case .rsWheel: return SwiftLocalizationHelper.localizedString(forKey: "Right stick wheel") case .rsWheel: return LocalizationHelper.localizedString(forKey: "Right stick wheel")
case .leftShoulder: return SwiftLocalizationHelper.localizedString(forKey: "LB/L1") case .leftShoulder: return LocalizationHelper.localizedString(forKey: "LB/L1")
case .rightShoulder: return SwiftLocalizationHelper.localizedString(forKey: "RB/R1") case .rightShoulder: return LocalizationHelper.localizedString(forKey: "RB/R1")
case .leftTrigger: return SwiftLocalizationHelper.localizedString(forKey: "LT/L2 button") case .leftTrigger: return LocalizationHelper.localizedString(forKey: "LT/L2 button")
case .ltPad: return SwiftLocalizationHelper.localizedString(forKey: "Left trigger pad") case .ltPad: return LocalizationHelper.localizedString(forKey: "Left trigger pad")
case .rightTrigger: return SwiftLocalizationHelper.localizedString(forKey: "RT/R2 button") case .rightTrigger: return LocalizationHelper.localizedString(forKey: "RT/R2 button")
case .rtPad: return SwiftLocalizationHelper.localizedString(forKey: "Right trigger pad") case .rtPad: return LocalizationHelper.localizedString(forKey: "Right trigger pad")
case .ds4Touchpad: return SwiftLocalizationHelper.localizedString(forKey: "DS4 touchpad") case .ds4Touchpad: return LocalizationHelper.localizedString(forKey: "DS4 touchpad")
case .ds4TouchpadButton: return SwiftLocalizationHelper.localizedString(forKey: "DS4 touchpad button") case .ds4TouchpadButton: return LocalizationHelper.localizedString(forKey: "DS4 touchpad button")
} }
} }
} }
@@ -1304,7 +1304,7 @@ struct GamepadWidgetPickerOverlay: View {
VStack(spacing: 0) { VStack(spacing: 0) {
VStack(spacing: cardSpacing) { VStack(spacing: cardSpacing) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Select Control")) Text(LocalizationHelper.localizedString(forKey: "Select Control"))
.font(.system(size: titleFontSize, weight: .bold, design: .rounded)) .font(.system(size: titleFontSize, weight: .bold, design: .rounded))
.foregroundColor(.white) .foregroundColor(.white)
@@ -1346,7 +1346,7 @@ struct GamepadWidgetPickerOverlay: View {
Button(action: { Button(action: {
onCancel() onCancel()
}) { }) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Cancel")) Text(LocalizationHelper.localizedString(forKey: "Cancel"))
.font(.system(size: actionButtonFontSize, weight: .bold, design: .rounded)) .font(.system(size: actionButtonFontSize, weight: .bold, design: .rounded))
.foregroundColor(Color.white.opacity(0.9)) .foregroundColor(Color.white.opacity(0.9))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
@@ -1365,7 +1365,7 @@ struct GamepadWidgetPickerOverlay: View {
Button(action: { Button(action: {
onReset() onReset()
}) { }) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Reset")) Text(LocalizationHelper.localizedString(forKey: "Reset"))
.font(.system(size: actionButtonFontSize, weight: .bold, design: .rounded)) .font(.system(size: actionButtonFontSize, weight: .bold, design: .rounded))
.foregroundColor(Color.white.opacity(0.9)) .foregroundColor(Color.white.opacity(0.9))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
+41 -41
View File
@@ -461,7 +461,7 @@ struct VirtualKeyboardView: View {
), ),
KeyboardWidgetOption( KeyboardWidgetOption(
command: "WASDPAD", command: "WASDPAD",
description: SwiftLocalizationHelper.localizedString(forKey: "WASD direction pad"), description: LocalizationHelper.localizedString(forKey: "WASD direction pad"),
highlightedLabels: ["W", "A", "S", "D"], highlightedLabels: ["W", "A", "S", "D"],
family: .wasd, family: .wasd,
selectionState: .pad selectionState: .pad
@@ -478,7 +478,7 @@ struct VirtualKeyboardView: View {
), ),
KeyboardWidgetOption( KeyboardWidgetOption(
command: "ARROWPAD", command: "ARROWPAD",
description: SwiftLocalizationHelper.localizedString(forKey: "Arrow direction pad"), description: LocalizationHelper.localizedString(forKey: "Arrow direction pad"),
highlightedLabels: ["↑", "↓", "←", "→"], highlightedLabels: ["↑", "↓", "←", "→"],
family: .arrow, family: .arrow,
selectionState: .pad selectionState: .pad
@@ -493,10 +493,10 @@ struct VirtualKeyboardView: View {
return key.label return key.label
case .arrow: case .arrow:
switch key.label { switch key.label {
case "↑": return SwiftLocalizationHelper.localizedString(forKey: "Up Arrow") case "↑": return LocalizationHelper.localizedString(forKey: "Up Arrow")
case "↓": return SwiftLocalizationHelper.localizedString(forKey: "Down Arrow") case "↓": return LocalizationHelper.localizedString(forKey: "Down Arrow")
case "←": return SwiftLocalizationHelper.localizedString(forKey: "Left Arrow") case "←": return LocalizationHelper.localizedString(forKey: "Left Arrow")
case "→": return SwiftLocalizationHelper.localizedString(forKey: "Right Arrow") case "→": return LocalizationHelper.localizedString(forKey: "Right Arrow")
default: return key.label default: return key.label
} }
} }
@@ -801,8 +801,8 @@ struct VirtualKeyboardView: View {
KeyView( KeyView(
key: Key( key: Key(
label: showsMouseWidgets label: showsMouseWidgets
? SwiftLocalizationHelper.localizedString(forKey: "Mouse Widgets") ? LocalizationHelper.localizedString(forKey: "Mouse Widgets")
: SwiftLocalizationHelper.localizedString(forKey: "Numpad"), : LocalizationHelper.localizedString(forKey: "Numpad"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
sfSymbolName: showsMouseWidgets sfSymbolName: showsMouseWidgets
? "computermouse.fill" ? "computermouse.fill"
@@ -820,8 +820,8 @@ struct VirtualKeyboardView: View {
KeyView( KeyView(
key: Key( key: Key(
label: showsMouseWidgets label: showsMouseWidgets
? SwiftLocalizationHelper.localizedString(forKey: "numpad") ? LocalizationHelper.localizedString(forKey: "numpad")
: SwiftLocalizationHelper.localizedString(forKey: "mouse widgets"), : LocalizationHelper.localizedString(forKey: "mouse widgets"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "NULL", winCmdString: "NULL",
macCmdString: "NULL", macCmdString: "NULL",
@@ -908,7 +908,7 @@ struct VirtualKeyboardView: View {
HStack(spacing: spacing) { HStack(spacing: spacing) {
KeyView( KeyView(
key: Key( key: Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Left Button"), label: LocalizationHelper.localizedString(forKey: "Left Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MLEFT", winCmdString: "MLEFT",
macCmdString: "MLEFT", macCmdString: "MLEFT",
@@ -919,7 +919,7 @@ struct VirtualKeyboardView: View {
keyboardType: keyboardType, keyboardType: keyboardType,
mode: mode, mode: mode,
highlightStyle: highlightStyle(for: Key( highlightStyle: highlightStyle(for: Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Left Button"), label: LocalizationHelper.localizedString(forKey: "Left Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MLEFT", winCmdString: "MLEFT",
macCmdString: "MLEFT", macCmdString: "MLEFT",
@@ -928,7 +928,7 @@ struct VirtualKeyboardView: View {
)), )),
action: { action: {
handleKeyTap(Key( handleKeyTap(Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Left Button"), label: LocalizationHelper.localizedString(forKey: "Left Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MLEFT", winCmdString: "MLEFT",
macCmdString: "MLEFT", macCmdString: "MLEFT",
@@ -940,7 +940,7 @@ struct VirtualKeyboardView: View {
KeyView( KeyView(
key: Key( key: Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Right Button"), label: LocalizationHelper.localizedString(forKey: "Right Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MRIGHT", winCmdString: "MRIGHT",
macCmdString: "MRIGHT", macCmdString: "MRIGHT",
@@ -951,7 +951,7 @@ struct VirtualKeyboardView: View {
keyboardType: keyboardType, keyboardType: keyboardType,
mode: mode, mode: mode,
highlightStyle: highlightStyle(for: Key( highlightStyle: highlightStyle(for: Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Right Button"), label: LocalizationHelper.localizedString(forKey: "Right Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MRIGHT", winCmdString: "MRIGHT",
macCmdString: "MRIGHT", macCmdString: "MRIGHT",
@@ -960,7 +960,7 @@ struct VirtualKeyboardView: View {
)), )),
action: { action: {
handleKeyTap(Key( handleKeyTap(Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Right Button"), label: LocalizationHelper.localizedString(forKey: "Right Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MRIGHT", winCmdString: "MRIGHT",
macCmdString: "MRIGHT", macCmdString: "MRIGHT",
@@ -974,7 +974,7 @@ struct VirtualKeyboardView: View {
HStack(spacing: spacing) { HStack(spacing: spacing) {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Middle Button"), label: LocalizationHelper.localizedString(forKey: "Middle Button"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MMIDDLE", winCmdString: "MMIDDLE",
macCmdString: "MMIDDLE", macCmdString: "MMIDDLE",
@@ -985,7 +985,7 @@ struct VirtualKeyboardView: View {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "X1"), label: LocalizationHelper.localizedString(forKey: "X1"),
width: unit, width: unit,
winCmdString: "MX1", winCmdString: "MX1",
macCmdString: "MX1", macCmdString: "MX1",
@@ -996,7 +996,7 @@ struct VirtualKeyboardView: View {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "X2"), label: LocalizationHelper.localizedString(forKey: "X2"),
width: unit, width: unit,
winCmdString: "MX2", winCmdString: "MX2",
macCmdString: "MX2", macCmdString: "MX2",
@@ -1010,7 +1010,7 @@ struct VirtualKeyboardView: View {
HStack(spacing: spacing) { HStack(spacing: spacing) {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nUp"), label: LocalizationHelper.localizedString(forKey: "Wheel\nUp"),
width: unit, width: unit,
winCmdString: "WHEELDOWN", winCmdString: "WHEELDOWN",
macCmdString: "WHEELDOWN", macCmdString: "WHEELDOWN",
@@ -1021,7 +1021,7 @@ struct VirtualKeyboardView: View {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nDown"), label: LocalizationHelper.localizedString(forKey: "Wheel\nDown"),
width: unit, width: unit,
winCmdString: "WHEELUP", winCmdString: "WHEELUP",
macCmdString: "WHEELUP", macCmdString: "WHEELUP",
@@ -1034,7 +1034,7 @@ struct VirtualKeyboardView: View {
HStack(spacing: spacing) { HStack(spacing: spacing) {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nUp"), label: LocalizationHelper.localizedString(forKey: "Wheel\nUp"),
width: unit, width: unit,
winCmdString: "WHEELDOWN", winCmdString: "WHEELDOWN",
macCmdString: "WHEELDOWN", macCmdString: "WHEELDOWN",
@@ -1045,7 +1045,7 @@ struct VirtualKeyboardView: View {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nDown"), label: LocalizationHelper.localizedString(forKey: "Wheel\nDown"),
width: unit, width: unit,
winCmdString: "WHEELUP", winCmdString: "WHEELUP",
macCmdString: "WHEELUP", macCmdString: "WHEELUP",
@@ -1056,7 +1056,7 @@ struct VirtualKeyboardView: View {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "WheelPad"), label: LocalizationHelper.localizedString(forKey: "WheelPad"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "WHEEL", winCmdString: "WHEEL",
macCmdString: "WHEEL", macCmdString: "WHEEL",
@@ -1071,7 +1071,7 @@ struct VirtualKeyboardView: View {
HStack(spacing: spacing) { HStack(spacing: spacing) {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "MousePad"), label: LocalizationHelper.localizedString(forKey: "MousePad"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "MOUSEPAD", winCmdString: "MOUSEPAD",
macCmdString: "MOUSEPAD", macCmdString: "MOUSEPAD",
@@ -1083,7 +1083,7 @@ struct VirtualKeyboardView: View {
VStack(spacing: spacing) { VStack(spacing: spacing) {
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Absolute MousePad"), label: LocalizationHelper.localizedString(forKey: "Absolute MousePad"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "ABSMOUSEPAD", winCmdString: "ABSMOUSEPAD",
macCmdString: "ABSMOUSEPAD", macCmdString: "ABSMOUSEPAD",
@@ -1093,7 +1093,7 @@ struct VirtualKeyboardView: View {
) )
keyboardKeyView( keyboardKeyView(
Key( Key(
label: SwiftLocalizationHelper.localizedString(forKey: "Trackball"), label: LocalizationHelper.localizedString(forKey: "Trackball"),
width: unit * 2 + spacing, width: unit * 2 + spacing,
winCmdString: "TRACKBALL", winCmdString: "TRACKBALL",
macCmdString: "TRACKBALL", macCmdString: "TRACKBALL",
@@ -1275,17 +1275,17 @@ struct VirtualKeyboardView: View {
private var mouseWidgetKeys: [Key] { private var mouseWidgetKeys: [Key] {
var keys = [ var keys = [
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Left Button"), width: unit * 2 + spacing, winCmdString: "MLEFT", macCmdString: "MLEFT", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Left Button"), width: unit * 2 + spacing, winCmdString: "MLEFT", macCmdString: "MLEFT", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Right Button"), width: unit * 2 + spacing, winCmdString: "MRIGHT", macCmdString: "MRIGHT", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Right Button"), width: unit * 2 + spacing, winCmdString: "MRIGHT", macCmdString: "MRIGHT", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Middle Button"), width: unit * 2 + spacing, winCmdString: "MMIDDLE", macCmdString: "MMIDDLE", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Middle Button"), width: unit * 2 + spacing, winCmdString: "MMIDDLE", macCmdString: "MMIDDLE", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "X1"), width: unit, winCmdString: "MX1", macCmdString: "MX1", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "X1"), width: unit, winCmdString: "MX1", macCmdString: "MX1", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "X2"), width: unit, winCmdString: "MX2", macCmdString: "MX2", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "X2"), width: unit, winCmdString: "MX2", macCmdString: "MX2", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nUp"), width: unit, winCmdString: "WHEELDOWN", macCmdString: "WHEELDOWN", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Wheel\nUp"), width: unit, winCmdString: "WHEELDOWN", macCmdString: "WHEELDOWN", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Wheel\nDown"), width: unit, winCmdString: "WHEELUP", macCmdString: "WHEELUP", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Wheel\nDown"), width: unit, winCmdString: "WHEELUP", macCmdString: "WHEELUP", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "WheelPad"), width: unit * 2 + spacing, winCmdString: "WHEEL", macCmdString: "WHEEL", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "WheelPad"), width: unit * 2 + spacing, winCmdString: "WHEEL", macCmdString: "WHEEL", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "MousePad"), width: unit * 2 + spacing, winCmdString: "MOUSEPAD", macCmdString: "MOUSEPAD", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "MousePad"), width: unit * 2 + spacing, winCmdString: "MOUSEPAD", macCmdString: "MOUSEPAD", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Absolute MousePad"), width: unit * 2 + spacing, winCmdString: "ABSMOUSEPAD", macCmdString: "ABSMOUSEPAD", winKeyCode: 0xFF, macKeyCode: 0xFF), Key(label: LocalizationHelper.localizedString(forKey: "Absolute MousePad"), width: unit * 2 + spacing, winCmdString: "ABSMOUSEPAD", macCmdString: "ABSMOUSEPAD", winKeyCode: 0xFF, macKeyCode: 0xFF),
Key(label: SwiftLocalizationHelper.localizedString(forKey: "Trackball"), width: unit * 2 + spacing, winCmdString: "TRACKBALL", macCmdString: "TRACKBALL", winKeyCode: 0xFF, macKeyCode: 0xFF) Key(label: LocalizationHelper.localizedString(forKey: "Trackball"), width: unit * 2 + spacing, winCmdString: "TRACKBALL", macCmdString: "TRACKBALL", winKeyCode: 0xFF, macKeyCode: 0xFF)
] ]
if mode == .shortcutPicker { if mode == .shortcutPicker {
keys.removeAll { key in keys.removeAll { key in
@@ -1505,7 +1505,7 @@ struct KeyboardWidgetPickerOverlay: View {
} }
VStack(spacing: 14) { VStack(spacing: 14) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Select Control")) Text(LocalizationHelper.localizedString(forKey: "Select Control"))
.font(.system(size: 18, weight: .bold, design: .rounded)) .font(.system(size: 18, weight: .bold, design: .rounded))
.foregroundColor(.white) .foregroundColor(.white)
@@ -1544,7 +1544,7 @@ struct KeyboardWidgetPickerOverlay: View {
Button(action: { Button(action: {
onCancel() onCancel()
}) { }) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Cancel")) Text(LocalizationHelper.localizedString(forKey: "Cancel"))
.font(.system(size: 15, weight: .bold, design: .rounded)) .font(.system(size: 15, weight: .bold, design: .rounded))
.foregroundColor(Color.white.opacity(0.9)) .foregroundColor(Color.white.opacity(0.9))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
@@ -1563,7 +1563,7 @@ struct KeyboardWidgetPickerOverlay: View {
Button(action: { Button(action: {
onReset() onReset()
}) { }) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Reset")) Text(LocalizationHelper.localizedString(forKey: "Reset"))
.font(.system(size: 15, weight: .bold, design: .rounded)) .font(.system(size: 15, weight: .bold, design: .rounded))
.foregroundColor(Color.white.opacity(0.9)) .foregroundColor(Color.white.opacity(0.9))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)
+102 -102
View File
@@ -36,11 +36,11 @@ enum WidgetPickerTab: String, CaseIterable, Identifiable, Equatable {
var title: String { var title: String {
switch self { switch self {
case .gamepad: case .gamepad:
return SwiftLocalizationHelper.localizedString(forKey: "Gamepad") return LocalizationHelper.localizedString(forKey: "Gamepad")
case .keyboard: case .keyboard:
return SwiftLocalizationHelper.localizedString(forKey: "Keyboard / Mouse") return LocalizationHelper.localizedString(forKey: "Keyboard / Mouse")
case .functional: case .functional:
return SwiftLocalizationHelper.localizedString(forKey: "Functional Widgets") return LocalizationHelper.localizedString(forKey: "Functional Widgets")
} }
} }
@@ -138,18 +138,18 @@ private enum WidgetPickerSubmissionAction: String {
var confirmationTitle: String { var confirmationTitle: String {
switch self { switch self {
case .create: case .create:
return SwiftLocalizationHelper.localizedString(forKey: "Create New") return LocalizationHelper.localizedString(forKey: "Create New")
case .modify: case .modify:
return SwiftLocalizationHelper.localizedString(forKey: "Modify") return LocalizationHelper.localizedString(forKey: "Modify")
} }
} }
var poolActionTitle: String { var poolActionTitle: String {
switch self { switch self {
case .create: case .create:
return SwiftLocalizationHelper.localizedString(forKey: "Create New") return LocalizationHelper.localizedString(forKey: "Create New")
case .modify: case .modify:
return SwiftLocalizationHelper.localizedString(forKey: "Modify") return LocalizationHelper.localizedString(forKey: "Modify")
} }
} }
} }
@@ -164,9 +164,9 @@ enum WidgetCreateComboMode: String, CaseIterable, Identifiable {
var title: String { var title: String {
switch self { switch self {
case .skill: case .skill:
return SwiftLocalizationHelper.localizedString(forKey: "Skill combo") return LocalizationHelper.localizedString(forKey: "Skill combo")
case .shortcut: case .shortcut:
return SwiftLocalizationHelper.localizedString(forKey: "Shortcut combo") return LocalizationHelper.localizedString(forKey: "Shortcut combo")
} }
} }
} }
@@ -181,9 +181,9 @@ private enum ShortcutPickerButtonMode: String, CaseIterable, Identifiable {
var title: String { var title: String {
switch self { switch self {
case .normal: case .normal:
return SwiftLocalizationHelper.localizedString(forKey: "Normal") return LocalizationHelper.localizedString(forKey: "Normal")
case .tapToToggle: case .tapToToggle:
return SwiftLocalizationHelper.localizedString(forKey: "Tap to toggle") return LocalizationHelper.localizedString(forKey: "Tap to toggle")
} }
} }
} }
@@ -198,9 +198,9 @@ private enum WidgetCreateShape: String, CaseIterable, Identifiable {
var title: String { var title: String {
switch self { switch self {
case .round: case .round:
return SwiftLocalizationHelper.localizedString(forKey: "Circle") return LocalizationHelper.localizedString(forKey: "Circle")
case .square: case .square:
return SwiftLocalizationHelper.localizedString(forKey: "Square") return LocalizationHelper.localizedString(forKey: "Square")
} }
} }
} }
@@ -473,15 +473,15 @@ struct WidgetPickerView: View {
_tipMessage = SwiftUI.State( _tipMessage = SwiftUI.State(
initialValue: (keyboardPickerMode == .shortcutPicker && !(shortcutPickerTipText ?? "").isEmpty) initialValue: (keyboardPickerMode == .shortcutPicker && !(shortcutPickerTipText ?? "").isEmpty)
? (shortcutPickerTipText ?? "") ? (shortcutPickerTipText ?? "")
: SwiftLocalizationHelper.localizedString(forKey: "Tap any control to add it") : LocalizationHelper.localizedString(forKey: "Tap any control to add it")
) )
} }
private let functionalButtonOptions: [FunctionalButtonOption] = [ private let functionalButtonOptions: [FunctionalButtonOption] = [
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Settings"), label: LocalizationHelper.localizedString(forKey: "Settings"),
cmd: "SETTINGS", cmd: "SETTINGS",
tip: SwiftLocalizationHelper.localizedString(forKey: "Expands setting menu during streaming"), tip: LocalizationHelper.localizedString(forKey: "Expands setting menu during streaming"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -489,9 +489,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Disconnect"), label: LocalizationHelper.localizedString(forKey: "Disconnect"),
cmd: "DISCONNECT", cmd: "DISCONNECT",
tip: SwiftLocalizationHelper.localizedString(forKey: "Disconnect current connection"), tip: LocalizationHelper.localizedString(forKey: "Disconnect current connection"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -499,9 +499,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Quit app"), label: LocalizationHelper.localizedString(forKey: "Quit app"),
cmd: "QUITAPP", cmd: "QUITAPP",
tip: SwiftLocalizationHelper.localizedString(forKey: "Disconnect and quit current app"), tip: LocalizationHelper.localizedString(forKey: "Disconnect and quit current app"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -509,9 +509,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Enter PiP"), label: LocalizationHelper.localizedString(forKey: "Enter PiP"),
cmd: "PIP", cmd: "PIP",
tip: SwiftLocalizationHelper.localizedString(forKey: "Enter picture-in-picture mode"), tip: LocalizationHelper.localizedString(forKey: "Enter picture-in-picture mode"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -519,9 +519,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Folder"), label: LocalizationHelper.localizedString(forKey: "Folder"),
cmd: "FOLDER", cmd: "FOLDER",
tip: SwiftLocalizationHelper.localizedString(forKey: "Collect other widgets or subfolders. Button-combo available."), tip: LocalizationHelper.localizedString(forKey: "Collect other widgets or subfolders. Button-combo available."),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
allowsGamepadCombination: true, allowsGamepadCombination: true,
allowsSkillCombo: true, allowsSkillCombo: true,
@@ -529,9 +529,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Toolbox"), label: LocalizationHelper.localizedString(forKey: "Toolbox"),
cmd: "TOOLBOX", cmd: "TOOLBOX",
tip: SwiftLocalizationHelper.localizedString(forKey: "Activate toolbox menu during streaming"), tip: LocalizationHelper.localizedString(forKey: "Activate toolbox menu during streaming"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -539,9 +539,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Edit layout"), label: LocalizationHelper.localizedString(forKey: "Edit layout"),
cmd: "WIDGETTOOL", cmd: "WIDGETTOOL",
tip: SwiftLocalizationHelper.localizedString(forKey: "Open on-screen widget layout tool"), tip: LocalizationHelper.localizedString(forKey: "Open on-screen widget layout tool"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -549,9 +549,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Pick profile"), label: LocalizationHelper.localizedString(forKey: "Pick profile"),
cmd: "PICKPRFL", cmd: "PICKPRFL",
tip: SwiftLocalizationHelper.localizedString(forKey: "Pick a game/on-screen-widget profile"), tip: LocalizationHelper.localizedString(forKey: "Pick a game/on-screen-widget profile"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -559,9 +559,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Profiles"), label: LocalizationHelper.localizedString(forKey: "Profiles"),
cmd: "PROFILES", cmd: "PROFILES",
tip: SwiftLocalizationHelper.localizedString(forKey: "Select a game/on-screen-widget profile"), tip: LocalizationHelper.localizedString(forKey: "Select a game/on-screen-widget profile"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -569,9 +569,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "SoftKeyboard"), label: LocalizationHelper.localizedString(forKey: "SoftKeyboard"),
cmd: "SOFTKEYBOARD", cmd: "SOFTKEYBOARD",
tip: SwiftLocalizationHelper.localizedString(forKey: "Bring up softkeyboard"), tip: LocalizationHelper.localizedString(forKey: "Bring up softkeyboard"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -580,9 +580,9 @@ struct WidgetPickerView: View {
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Disable touch"), label: LocalizationHelper.localizedString(forKey: "Disable touch"),
cmd: "DISABLETOUCH", cmd: "DISABLETOUCH",
tip: SwiftLocalizationHelper.localizedString(forKey: "Temporarily disable touch input for stream view"), tip: LocalizationHelper.localizedString(forKey: "Temporarily disable touch input for stream view"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -590,9 +590,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "🎮 overlay switch"), label: LocalizationHelper.localizedString(forKey: "🎮 overlay switch"),
cmd: "GAMEPADOVERLAY", cmd: "GAMEPADOVERLAY",
tip: SwiftLocalizationHelper.localizedString(forKey: "Switch on/off a floating gamepad overlay with live input feedback"), tip: LocalizationHelper.localizedString(forKey: "Switch on/off a floating gamepad overlay with live input feedback"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -600,9 +600,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Pressure curve"), label: LocalizationHelper.localizedString(forKey: "Pressure curve"),
cmd: "PRESSURECURVE", cmd: "PRESSURECURVE",
tip: SwiftLocalizationHelper.localizedString(forKey: "Opens pencil pressure curve tool"), tip: LocalizationHelper.localizedString(forKey: "Opens pencil pressure curve tool"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -610,9 +610,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Pencil hover"), label: LocalizationHelper.localizedString(forKey: "Pencil hover"),
cmd: "PENCILHOVER", cmd: "PENCILHOVER",
tip: SwiftLocalizationHelper.localizedString(forKey: "Force pencil entering hovering on host"), tip: LocalizationHelper.localizedString(forKey: "Force pencil entering hovering on host"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -620,9 +620,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Brush shortcut"), label: LocalizationHelper.localizedString(forKey: "Brush shortcut"),
cmd: "BRUSH", cmd: "BRUSH",
tip: SwiftLocalizationHelper.localizedString(forKey: "Combine this with a brush keyboard shortcut for PC software"), tip: LocalizationHelper.localizedString(forKey: "Combine this with a brush keyboard shortcut for PC software"),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
allowsGamepadCombination: true, allowsGamepadCombination: true,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -630,9 +630,9 @@ struct WidgetPickerView: View {
forcedComboMode: .shortcut forcedComboMode: .shortcut
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Eraser shortcut"), label: LocalizationHelper.localizedString(forKey: "Eraser shortcut"),
cmd: "ERASER", cmd: "ERASER",
tip: SwiftLocalizationHelper.localizedString(forKey: "Combine this with a eraser keyboard shortcut for PC software"), tip: LocalizationHelper.localizedString(forKey: "Combine this with a eraser keyboard shortcut for PC software"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -640,9 +640,9 @@ struct WidgetPickerView: View {
forcedComboMode: .shortcut forcedComboMode: .shortcut
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Disable single point touch"), label: LocalizationHelper.localizedString(forKey: "Disable single point touch"),
cmd: "NOSINGLETOUCH", cmd: "NOSINGLETOUCH",
tip: SwiftLocalizationHelper.localizedString(forKey: "Disable single finger touch for stream view"), tip: LocalizationHelper.localizedString(forKey: "Disable single finger touch for stream view"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -650,9 +650,9 @@ struct WidgetPickerView: View {
forcedComboMode: nil forcedComboMode: nil
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Absolute touch drag"), label: LocalizationHelper.localizedString(forKey: "Absolute touch drag"),
cmd: "ABSTCHDRAG", cmd: "ABSTCHDRAG",
tip: SwiftLocalizationHelper.localizedString(forKey: "Replace mouse button action in single point touch mode with another button temporarily"), tip: LocalizationHelper.localizedString(forKey: "Replace mouse button action in single point touch mode with another button temporarily"),
allowsKeyboardCombination: true, allowsKeyboardCombination: true,
allowsGamepadCombination: true, allowsGamepadCombination: true,
allowsSkillCombo: true, allowsSkillCombo: true,
@@ -660,9 +660,9 @@ struct WidgetPickerView: View {
forcedComboMode: .skill forcedComboMode: .skill
), ),
FunctionalButtonOption( FunctionalButtonOption(
label: SwiftLocalizationHelper.localizedString(forKey: "Magnifier"), label: LocalizationHelper.localizedString(forKey: "Magnifier"),
cmd: "MAGNIFIER", cmd: "MAGNIFIER",
tip: SwiftLocalizationHelper.localizedString(forKey: "magnifierTip"), tip: LocalizationHelper.localizedString(forKey: "magnifierTip"),
allowsKeyboardCombination: false, allowsKeyboardCombination: false,
allowsGamepadCombination: false, allowsGamepadCombination: false,
allowsSkillCombo: false, allowsSkillCombo: false,
@@ -675,7 +675,7 @@ struct WidgetPickerView: View {
if isShortcutPickerMode, let shortcutPickerTipText, !shortcutPickerTipText.isEmpty { if isShortcutPickerMode, let shortcutPickerTipText, !shortcutPickerTipText.isEmpty {
return shortcutPickerTipText return shortcutPickerTipText
} }
return SwiftLocalizationHelper.localizedString(forKey: "Tap any control to add it") return LocalizationHelper.localizedString(forKey: "Tap any control to add it")
} }
private var tipMessageColor: Color { private var tipMessageColor: Color {
@@ -744,19 +744,19 @@ struct WidgetPickerView: View {
if poolItems.isEmpty { if poolItems.isEmpty {
resetTipMessage() resetTipMessage()
} else if movementPadNeedsWalkKeyTip { } else if movementPadNeedsWalkKeyTip {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Please select a sprint key")) setTipMessage(LocalizationHelper.localizedString(forKey: "Please select a sprint key"))
} else if movementPadNeedsSprintKeyTip { } else if movementPadNeedsSprintKeyTip {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Sprint key set. Select a walk key (optional, you can skip and create)")) setTipMessage(LocalizationHelper.localizedString(forKey: "Sprint key set. Select a walk key (optional, you can skip and create)"))
} else if movementPadHasReachedSingleKeyLimit { } else if movementPadHasReachedSingleKeyLimit {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Sprint and walk keys are set")) setTipMessage(LocalizationHelper.localizedString(forKey: "Sprint and walk keys are set"))
} else if hasButtonThenPadCombination { } else if hasButtonThenPadCombination {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "A button with touchpad functionality will be created")) setTipMessage(LocalizationHelper.localizedString(forKey: "A button with touchpad functionality will be created"))
} else if hasPadThenButtonCombination { } else if hasPadThenButtonCombination {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "A touchpad with double-tap button triggering will be created")) setTipMessage(LocalizationHelper.localizedString(forKey: "A touchpad with double-tap button triggering will be created"))
} else if let selectedFunctionalButtonOption { } else if let selectedFunctionalButtonOption {
setTipMessage(selectedFunctionalButtonOption.tip) setTipMessage(selectedFunctionalButtonOption.tip)
} else if hasAnySingleItem || hasMultipleButtonItemsOnly { } else if hasAnySingleItem || hasMultipleButtonItemsOnly {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "You can continue adding controls to this combination")) setTipMessage(LocalizationHelper.localizedString(forKey: "You can continue adding controls to this combination"))
} else { } else {
resetTipMessage() resetTipMessage()
} }
@@ -866,7 +866,7 @@ struct WidgetPickerView: View {
return ZStack(alignment: .topTrailing) { return ZStack(alignment: .topTrailing) {
VStack(alignment: .leading, spacing: pickerSectionSpacing) { VStack(alignment: .leading, spacing: pickerSectionSpacing) {
HStack(alignment: .center, spacing: 10) { HStack(alignment: .center, spacing: 10) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Widget Picker")) Text(LocalizationHelper.localizedString(forKey: "Widget Picker"))
.font(.system(size: pickerTitleFontSize, weight: .bold, design: .rounded)) .font(.system(size: pickerTitleFontSize, weight: .bold, design: .rounded))
.foregroundColor(Color.black.opacity(0.82)) .foregroundColor(Color.black.opacity(0.82))
.lineLimit(1) .lineLimit(1)
@@ -1053,14 +1053,14 @@ struct WidgetPickerView: View {
return VStack(alignment: .leading, spacing: metrics.poolSectionSpacing) { return VStack(alignment: .leading, spacing: metrics.poolSectionSpacing) {
VStack(alignment: .leading, spacing: poolHeaderSpacing) { VStack(alignment: .leading, spacing: poolHeaderSpacing) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Widget Pool")) Text(LocalizationHelper.localizedString(forKey: "Widget Pool"))
.font(.system(size: poolTitleFontSize, weight: .bold, design: .rounded)) .font(.system(size: poolTitleFontSize, weight: .bold, design: .rounded))
.foregroundColor(Color.black.opacity(0.82)) .foregroundColor(Color.black.opacity(0.82))
.lineLimit(1) .lineLimit(1)
.minimumScaleFactor(0.8) .minimumScaleFactor(0.8)
Text(SwiftLocalizationHelper.localizedString(forKey: "Selected widgets are queued here in tap order.")) Text(LocalizationHelper.localizedString(forKey: "Selected widgets are queued here in tap order."))
.font(.system(size: poolSubtitleFontSize, weight: .medium, design: .rounded)) .font(.system(size: poolSubtitleFontSize, weight: .medium, design: .rounded))
.foregroundColor(Color.black.opacity(0.48)) .foregroundColor(Color.black.opacity(0.48))
.lineLimit(metrics.isPhone ? 1 : 2) .lineLimit(metrics.isPhone ? 1 : 2)
@@ -1081,7 +1081,7 @@ struct WidgetPickerView: View {
if keyboardPickerMode != .shortcutPicker { if keyboardPickerMode != .shortcutPicker {
PoolActionChip( PoolActionChip(
title: SwiftLocalizationHelper.localizedString(forKey: "Gyro switch button"), title: LocalizationHelper.localizedString(forKey: "Gyro switch button"),
isPrimary: false, isPrimary: false,
height: poolChipHeight, height: poolChipHeight,
fontSize: poolChipFontSize, fontSize: poolChipFontSize,
@@ -1117,10 +1117,10 @@ struct WidgetPickerView: View {
HStack(spacing: metrics.isPhone ? 8 : 12) { HStack(spacing: metrics.isPhone ? 8 : 12) {
PoolActionChip( PoolActionChip(
title: isShortcutPickerMode title: isShortcutPickerMode
? SwiftLocalizationHelper.localizedString(forKey: "Create shortcut") ? LocalizationHelper.localizedString(forKey: "Create shortcut")
: (isEditMode : (isEditMode
? WidgetPickerSubmissionAction.create.poolActionTitle ? WidgetPickerSubmissionAction.create.poolActionTitle
: SwiftLocalizationHelper.localizedString(forKey: "Create widget")), : LocalizationHelper.localizedString(forKey: "Create widget")),
isPrimary: true, isPrimary: true,
height: poolChipHeight, height: poolChipHeight,
fontSize: poolChipFontSize, fontSize: poolChipFontSize,
@@ -1142,7 +1142,7 @@ struct WidgetPickerView: View {
} }
PoolActionChip( PoolActionChip(
title: SwiftLocalizationHelper.localizedString(forKey: "Reset"), title: LocalizationHelper.localizedString(forKey: "Reset"),
isPrimary: false, isPrimary: false,
height: poolChipHeight, height: poolChipHeight,
fontSize: poolChipFontSize, fontSize: poolChipFontSize,
@@ -1475,7 +1475,7 @@ struct WidgetPickerView: View {
if movementPadHasReachedSingleKeyLimit { if movementPadHasReachedSingleKeyLimit {
setTipMessage( setTipMessage(
SwiftLocalizationHelper.localizedString(forKey: "Walk and sprint keys are already set. No more keys can be added"), LocalizationHelper.localizedString(forKey: "Walk and sprint keys are already set. No more keys can be added"),
type: .error type: .error
) )
return false return false
@@ -1490,12 +1490,12 @@ struct WidgetPickerView: View {
) )
if occupiedSlots + candidate.span > maxPoolSlots { if occupiedSlots + candidate.span > maxPoolSlots {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Widget pool is full"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Widget pool is full"), type: .error)
return false return false
} }
if isPad(candidate), poolItems.contains(where: isPad) { if isPad(candidate), poolItems.contains(where: isPad) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Cannot select two touchpad controls at the same time"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Cannot select two touchpad controls at the same time"), type: .error)
return false return false
} }
@@ -1507,7 +1507,7 @@ struct WidgetPickerView: View {
|| (isDirectionPadSingleCommand(cmd) && isDirectionPadContainerCommand(existing.cmd)) || (isDirectionPadSingleCommand(cmd) && isDirectionPadContainerCommand(existing.cmd))
) )
}) { }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Direction pad cannot be combined with their inner button"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Direction pad cannot be combined with their inner button"), type: .error)
return false return false
} }
@@ -1515,37 +1515,37 @@ struct WidgetPickerView: View {
poolItems.contains(where: { existing in poolItems.contains(where: { existing in
triggerGroup(for: existing.cmd) == candidateTriggerGroup && existing.cmd != cmd triggerGroup(for: existing.cmd) == candidateTriggerGroup && existing.cmd != cmd
}) { }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Trigger button cannot be combined with trigger pad"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Trigger button cannot be combined with trigger pad"), type: .error)
return false return false
} }
if directionPadPriorityCommands.contains(cmd), poolItems.contains(where: { gyroCommands.contains($0.cmd) }) { if directionPadPriorityCommands.contains(cmd), poolItems.contains(where: { gyroCommands.contains($0.cmd) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Direction pad cannot be combined with gyro button"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Direction pad cannot be combined with gyro button"), type: .error)
return false return false
} }
if gyroCommands.contains(cmd), poolItems.contains(where: { directionPadPriorityCommands.contains($0.cmd) }) { if gyroCommands.contains(cmd), poolItems.contains(where: { directionPadPriorityCommands.contains($0.cmd) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Gyro widgets cannot be combined with direction pad"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Gyro widgets cannot be combined with direction pad"), type: .error)
return false return false
} }
if cmd == "LSWHEEL", !poolItems.isEmpty { if cmd == "LSWHEEL", !poolItems.isEmpty {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "LS wheel must be placed alone"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "LS wheel must be placed alone"), type: .error)
return false return false
} }
if !poolItems.isEmpty, poolItems.contains(where: { $0.cmd == "LSWHEEL" }) { if !poolItems.isEmpty, poolItems.contains(where: { $0.cmd == "LSWHEEL" }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "LsWheel cannot be combined with other widgets"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "LsWheel cannot be combined with other widgets"), type: .error)
return false return false
} }
if cmd == "RSWHEEL", !poolItems.isEmpty { if cmd == "RSWHEEL", !poolItems.isEmpty {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "RS wheel must be placed alone"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "RS wheel must be placed alone"), type: .error)
return false return false
} }
if !poolItems.isEmpty, poolItems.contains(where: { $0.cmd == "RSWHEEL" }) { if !poolItems.isEmpty, poolItems.contains(where: { $0.cmd == "RSWHEEL" }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "RsWheel cannot be combined with other widgets"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "RsWheel cannot be combined with other widgets"), type: .error)
return false return false
} }
@@ -1556,50 +1556,50 @@ struct WidgetPickerView: View {
} }
if poolItems.contains(where: isPad) { if poolItems.contains(where: isPad) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error)
return false return false
} }
if poolItems.contains(where: { $0.source == .functional }) { if poolItems.contains(where: { $0.source == .functional }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with other functional widgets"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with other functional widgets"), type: .error)
return false return false
} }
if !option.allowsKeyboardCombination, if !option.allowsKeyboardCombination,
poolItems.contains(where: { $0.source == .keyboard && !isPad($0) }) { poolItems.contains(where: { $0.source == .keyboard && !isPad($0) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with keyboard or mouse buttons"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with keyboard or mouse buttons"), type: .error)
return false return false
} }
if !option.allowsGamepadCombination, if !option.allowsGamepadCombination,
poolItems.contains(where: { $0.source == .gamepad && !isPad($0) }) { poolItems.contains(where: { $0.source == .gamepad && !isPad($0) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with gamepad buttons"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with gamepad buttons"), type: .error)
return false return false
} }
} }
if source == .keyboard || source == .gamepad { if source == .keyboard || source == .gamepad {
if poolItems.contains(where: isPad) && poolItems.contains(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }) { if poolItems.contains(where: isPad) && poolItems.contains(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error)
return false return false
} }
if let existingFunctionalItem = poolItems.first(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }), if let existingFunctionalItem = poolItems.first(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }),
let option = functionalButtonOption(for: existingFunctionalItem.cmd) { let option = functionalButtonOption(for: existingFunctionalItem.cmd) {
if source == .keyboard && !option.allowsKeyboardCombination { if source == .keyboard && !option.allowsKeyboardCombination {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with keyboard or mouse buttons"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with keyboard or mouse buttons"), type: .error)
return false return false
} }
if source == .gamepad && !option.allowsGamepadCombination { if source == .gamepad && !option.allowsGamepadCombination {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with gamepad buttons"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "This functional widget cannot be combined with gamepad buttons"), type: .error)
return false return false
} }
} }
if isPad(candidate), if isPad(candidate),
poolItems.contains(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }) { poolItems.contains(where: { $0.source == .functional && !gyroCommands.contains($0.cmd) }) {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Functional widgets cannot be combined with touchpad controls"), type: .error)
return false return false
} }
} }
@@ -1620,11 +1620,11 @@ struct WidgetPickerView: View {
[ [
GyroButtonOption( GyroButtonOption(
cmd: "GYRO", cmd: "GYRO",
description: SwiftLocalizationHelper.localizedString(forKey: "Gyro on while activated") description: LocalizationHelper.localizedString(forKey: "Gyro on while activated")
), ),
GyroButtonOption( GyroButtonOption(
cmd: "GYROPAUSE", cmd: "GYROPAUSE",
description: SwiftLocalizationHelper.localizedString(forKey: "Gyro off while activated") description: LocalizationHelper.localizedString(forKey: "Gyro off while activated")
) )
] ]
} }
@@ -1679,9 +1679,9 @@ struct WidgetPickerView: View {
VStack(alignment: .leading, spacing: sectionSpacing) { VStack(alignment: .leading, spacing: sectionSpacing) {
if targetWidgetKind == .button { if targetWidgetKind == .button {
if showsButtonLabelField { if showsButtonLabelField {
createWidgetSection(title: SwiftLocalizationHelper.localizedString(forKey: "Button label")) { createWidgetSection(title: LocalizationHelper.localizedString(forKey: "Button label")) {
InteractiveTextField( InteractiveTextField(
placeholder: SwiftLocalizationHelper.localizedString(forKey: "Enter label(optional)"), placeholder: LocalizationHelper.localizedString(forKey: "Enter label(optional)"),
text: $widgetButtonLabel text: $widgetButtonLabel
) )
.frame(height: fieldHeight) .frame(height: fieldHeight)
@@ -1691,7 +1691,7 @@ struct WidgetPickerView: View {
if showsComboModeControl { if showsComboModeControl {
createInteractiveControlSection( createInteractiveControlSection(
title: SwiftLocalizationHelper.localizedString(forKey: "Combination mode"), title: LocalizationHelper.localizedString(forKey: "Combination mode"),
controlHeight: segmentedControlHeight controlHeight: segmentedControlHeight
) { ) {
Picker("", selection: widgetComboModeBinding) { Picker("", selection: widgetComboModeBinding) {
@@ -1710,7 +1710,7 @@ struct WidgetPickerView: View {
if showsShortcutButtonModeControl { if showsShortcutButtonModeControl {
createInteractiveControlSection( createInteractiveControlSection(
title: SwiftLocalizationHelper.localizedString(forKey: "Button mode"), title: LocalizationHelper.localizedString(forKey: "Button mode"),
controlHeight: segmentedControlHeight controlHeight: segmentedControlHeight
) { ) {
Picker("", selection: $shortcutPickerButtonMode) { Picker("", selection: $shortcutPickerButtonMode) {
@@ -1727,7 +1727,7 @@ struct WidgetPickerView: View {
if showsIntervalSlider { if showsIntervalSlider {
createInteractiveControlSection( createInteractiveControlSection(
title: "\(SwiftLocalizationHelper.localizedString(forKey: "Trigger interval")): \(effectiveTriggerIntervalValue) ms", title: "\(LocalizationHelper.localizedString(forKey: "Trigger interval")): \(effectiveTriggerIntervalValue) ms",
controlHeight: fieldHeight controlHeight: fieldHeight
) { ) {
Slider( Slider(
@@ -1745,7 +1745,7 @@ struct WidgetPickerView: View {
if targetWidgetKind == .button, showsShapeControl { if targetWidgetKind == .button, showsShapeControl {
createInteractiveControlSection( createInteractiveControlSection(
title: SwiftLocalizationHelper.localizedString(forKey: "Shape"), title: LocalizationHelper.localizedString(forKey: "Shape"),
controlHeight: segmentedControlHeight controlHeight: segmentedControlHeight
) { ) {
Picker("", selection: $widgetShape) { Picker("", selection: $widgetShape) {
@@ -1763,7 +1763,7 @@ struct WidgetPickerView: View {
HStack(spacing: actionSpacing) { HStack(spacing: actionSpacing) {
PoolActionChip( PoolActionChip(
title: SwiftLocalizationHelper.localizedString(forKey: "Cancel"), title: LocalizationHelper.localizedString(forKey: "Cancel"),
isPrimary: false, isPrimary: false,
height: actionHeight, height: actionHeight,
fontSize: actionFontSize, fontSize: actionFontSize,
@@ -2031,7 +2031,7 @@ struct WidgetPickerView: View {
widgetButtonLabel = initialButtonLabel widgetButtonLabel = initialButtonLabel
} else if targetWidgetKind == .button, } else if targetWidgetKind == .button,
let selectedFunctionalButtonOption { let selectedFunctionalButtonOption {
widgetButtonLabel = selectedFunctionalButtonOption.cmd == "FOLDER" ? SwiftLocalizationHelper.localizedString(forKey: "=Folder") : selectedFunctionalButtonOption.label widgetButtonLabel = selectedFunctionalButtonOption.cmd == "FOLDER" ? LocalizationHelper.localizedString(forKey: "=Folder") : selectedFunctionalButtonOption.label
} else { } else {
widgetButtonLabel = "" widgetButtonLabel = ""
} }
@@ -2050,7 +2050,7 @@ struct WidgetPickerView: View {
private func presentCreateWidgetSheet(for submissionAction: WidgetPickerSubmissionAction) { private func presentCreateWidgetSheet(for submissionAction: WidgetPickerSubmissionAction) {
guard isShortcutPickerMode || !poolItems.isEmpty else { guard isShortcutPickerMode || !poolItems.isEmpty else {
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Select at least one command before creating a widget"), type: .error) setTipMessage(LocalizationHelper.localizedString(forKey: "Select at least one command before creating a widget"), type: .error)
return return
} }
@@ -2068,7 +2068,7 @@ struct WidgetPickerView: View {
let payload = makeWidgetPayload() let payload = makeWidgetPayload()
persistCurrentTabSelection() persistCurrentTabSelection()
lastCreatedWidgetPayload = payload lastCreatedWidgetPayload = payload
setTipMessage(SwiftLocalizationHelper.localizedString(forKey: "Widget config generated")) setTipMessage(LocalizationHelper.localizedString(forKey: "Widget config generated"))
onWidgetCreated?(payload) onWidgetCreated?(payload)
print("widgetPicker payload =", payload as NSDictionary) print("widgetPicker payload =", payload as NSDictionary)
setCreateWidgetSheetVisible(false) setCreateWidgetSheetVisible(false)
@@ -2117,7 +2117,7 @@ struct WidgetPickerView: View {
private func defaultWidgetButtonLabel() -> String { private func defaultWidgetButtonLabel() -> String {
if let selectedFunctionalButtonOption { if let selectedFunctionalButtonOption {
return selectedFunctionalButtonOption.cmd == "FOLDER" return selectedFunctionalButtonOption.cmd == "FOLDER"
? SwiftLocalizationHelper.localizedString(forKey: "=Folder") ? LocalizationHelper.localizedString(forKey: "=Folder")
: selectedFunctionalButtonOption.label : selectedFunctionalButtonOption.label
} }
@@ -2140,7 +2140,7 @@ struct WidgetPickerView: View {
case .functional: case .functional:
if let option = functionalButtonOption(for: item.cmd) { if let option = functionalButtonOption(for: item.cmd) {
return option.cmd == "FOLDER" return option.cmd == "FOLDER"
? SwiftLocalizationHelper.localizedString(forKey: "=Folder") ? LocalizationHelper.localizedString(forKey: "=Folder")
: option.label : option.label
} }
let label = item.displayCmd.trimmingCharacters(in: .whitespacesAndNewlines) let label = item.displayCmd.trimmingCharacters(in: .whitespacesAndNewlines)
@@ -2585,11 +2585,11 @@ struct GyroButtonPickerOverlay: View {
} }
VStack(spacing: 14) { VStack(spacing: 14) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Select Gyro Button")) Text(LocalizationHelper.localizedString(forKey: "Select Gyro Button"))
.font(.system(size: 18, weight: .bold, design: .rounded)) .font(.system(size: 18, weight: .bold, design: .rounded))
.foregroundColor(.white) .foregroundColor(.white)
Text(SwiftLocalizationHelper.localizedString(forKey: "Choose a gyro control style")) Text(LocalizationHelper.localizedString(forKey: "Choose a gyro control style"))
.font(.system(size: 13, weight: .medium, design: .rounded)) .font(.system(size: 13, weight: .medium, design: .rounded))
.foregroundColor(Color.white.opacity(0.78)) .foregroundColor(Color.white.opacity(0.78))
.multilineTextAlignment(.center) .multilineTextAlignment(.center)
@@ -2628,7 +2628,7 @@ struct GyroButtonPickerOverlay: View {
Button(action: { Button(action: {
onCancel() onCancel()
}) { }) {
Text(SwiftLocalizationHelper.localizedString(forKey: "Cancel")) Text(LocalizationHelper.localizedString(forKey: "Cancel"))
.font(.system(size: 15, weight: .bold, design: .rounded)) .font(.system(size: 15, weight: .bold, design: .rounded))
.foregroundColor(Color.white.opacity(0.9)) .foregroundColor(Color.white.opacity(0.9))
.frame(maxWidth: .infinity) .frame(maxWidth: .infinity)