diff --git a/VoidLink/GamepadNavigationIllustrationHud.swift b/VoidLink/GamepadNavigationIllustrationHud.swift index 5aa00725..8cb2c00b 100644 --- a/VoidLink/GamepadNavigationIllustrationHud.swift +++ b/VoidLink/GamepadNavigationIllustrationHud.swift @@ -108,13 +108,13 @@ final class GamepadNavigationIllustrationHud: UIView { } } - @objc static func updateHud() { + @objc static func updateHud(forceDisplay: Bool = false) { let elements = ControllerNavigator.uiNavigationDelegate?.getNavigationElements() ?? [] /* for element in elements { print("element \(element.action)") } */ - updateNavigationElements(elements) + updateNavigationElements(elements, forceDisplay: forceDisplay) } static func updateActionState(for control: ControllerElement, isInAction: Bool) { @@ -157,7 +157,7 @@ final class GamepadNavigationIllustrationHud: UIView { backgroundColor = isDark ? UIColor(red: 28.0 / 255.0, green: 28.0 / 255.0, blue: 30.0 / 255.0, alpha: 0.62) - : UIColor.white.withAlphaComponent(0.6) + : (PublicUtils.isIPhone ? UIColor.white.withAlphaComponent(0.75) : UIColor.white.withAlphaComponent(0.6)) layer.borderColor = (isDark ? UIColor.white.withAlphaComponent(0.10) : UIColor.black.withAlphaComponent(0.06)).cgColor layer.shadowColor = UIColor.black.cgColor layer.shadowOpacity = isDark ? 0.34 : 0.12 @@ -419,7 +419,7 @@ final class GamepadNavigationIllustrationHud: UIView { keyLabel.translatesAutoresizingMaskIntoConstraints = false keyLabel.text = text keyLabel.textAlignment = .center - keyLabel.font = UIFont.roundedSystemFont(ofSize: 12, weight: .medium) + keyLabel.font = UIFont.roundedSystemFont(ofSize: 12, weight: PublicUtils.isIPhone ? .semibold : .medium) keyLabel.adjustsFontSizeToFitWidth = true keyLabel.minimumScaleFactor = 0.2 keyLabel.numberOfLines = 1 diff --git a/VoidLink/Input/ControllerNavigator.swift b/VoidLink/Input/ControllerNavigator.swift index 13ebe096..8145dc4a 100644 --- a/VoidLink/Input/ControllerNavigator.swift +++ b/VoidLink/Input/ControllerNavigator.swift @@ -603,8 +603,9 @@ final class ControllerNavigator: NSObject { ControllerUtil.stopListeningPrimaryController() if let mainFrameVC = radialMenuDelegate as? MainFrameViewController { let streamFrameVC = StreamFrameViewController.sharedInstance() - let showRadiaMenu = mainFrameVC.isStreaming() ? streamFrameVC?.hasNoPresentedVC == true : mainFrameVC.hasNoPresentedVC - if showRadiaMenu { + let showRadialMenu = mainFrameVC.isStreaming() ? streamFrameVC?.hasNoPresentedVC == true : (mainFrameVC.hasNoPresentedVC || mainFrameVC.presentedViewController is LoadingFrameViewController) + + if showRadialMenu { radialMenuView?.removeFromSuperview() RadialMenuOverlayView.menuSectors.removeAll() @@ -685,9 +686,10 @@ final class ControllerNavigator: NSObject { } } - private static var radialMenuButtonPressed: Bool = false + @objc static var radialMenuButtonPressed: Bool = false private static var radialMenuDelayTimer: SafeTimer? private static var radialMenuState: RadialMenuState = .main + private static var radialMenuPressDownTimestamp: TimeInterval = 0.0 @objc static func listenToRadialMenuButton() { guard enabled else {return} guard let mainFrameVC = radialMenuDelegate as? MainFrameViewController else {return} @@ -696,9 +698,10 @@ final class ControllerNavigator: NSObject { ControllerUtil.listenPrimaryControllerButton(radialMenuButton) { pressed in GamepadNavigationIllustrationHud.updateActionState(for: radialMenuButton, isInAction: pressed) if pressed { + radialMenuPressDownTimestamp = CACurrentMediaTime() + radialMenuDelayTimer?.clean() radialMenuButtonPressed = true - let delayRadialMenu = (mainFrameVC.isStreaming() && !mainFrameVC.settingsExpandedInStreamView) || - streamingRadialMenuDelay < 0.03 + let delayRadialMenu = (mainFrameVC.isStreaming() && !mainFrameVC.settingsExpandedInStreamView) || streamingRadialMenuDelay < 0.03 streamingRadialMenuDelay = max(streamingRadialMenuDelay, 0.032) if delayRadialMenu { @@ -718,6 +721,9 @@ final class ControllerNavigator: NSObject { } } else { + guard CACurrentMediaTime() - radialMenuPressDownTimestamp > 0.035 else { + return + } radialMenuButtonPressed = false radialMenuDelayTimer?.clean() stickReleasedInRadialMenu = false diff --git a/VoidLink/Localization/Localizable.xcstrings b/VoidLink/Localization/Localizable.xcstrings index 2918d9f5..b2209062 100644 --- a/VoidLink/Localization/Localizable.xcstrings +++ b/VoidLink/Localization/Localizable.xcstrings @@ -14636,29 +14636,6 @@ } } }, - "Press the same or a different button for controller navigation during streaming." : { - "extractionState" : "manual", - "localizations" : { - "zh-Hans" : { - "stringUnit" : { - "state" : "translated", - "value" : "请按下相同或不同的按键,作为串流时的手柄导航键。" - } - }, - "zh-Hant" : { - "stringUnit" : { - "state" : "translated", - "value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。" - } - }, - "zh-HK" : { - "stringUnit" : { - "state" : "translated", - "value" : "請按下相同或不同的按鍵,作為串流時的手掣導覽鍵。" - } - } - } - }, "Pressed for %dms" : { "extractionState" : "manual", "localizations" : { @@ -15293,25 +15270,25 @@ "en" : { "stringUnit" : { "state" : "translated", - "value" : "Please choose and press one of [Select, Start, bumpers, triggers, the Home button, or Xbox back paddles] as the radial menu button.\n\nNote: if you want to designate the Home button, double tap to pass it through to VoidLink app on iOS 26+." + "value" : "Please choose and press one of [Select, Start, bumpers, triggers, Xbox back paddles] as the radial menu button." } }, "zh-Hans" : { "stringUnit" : { "state" : "translated", - "value" : "请在 [Select, Start, 肩键, 板机, Home键, Xbox背键] 之中,选择并按下作为手柄导航键。\n\n注意:如果需要指定 Home 键,在 iOS 26+ 系统上需要双击将该按键透传至 VoidLink。" + "value" : "请在 [Select, Start, 肩键, 板机, Xbox背键] 之中,选择并按下作为手柄导航键。" } }, "zh-Hant" : { "stringUnit" : { - "state" : "needs_review", - "value" : "請在 [Select、Start、LB/RB、LT/RT、Home 鍵、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。" + "state" : "translated", + "value" : "請在 [Select、Start、LB/RB、LT/RT、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。" } }, "zh-HK" : { "stringUnit" : { "state" : "translated", - "value" : "請在 [Select、Start、LB/RB、LT/RT、Home 鍵、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。\n\n注意:如果需要指定 Home 鍵,在 iOS 26+ 系統上需要雙擊將該按鍵透傳至 VoidLink。" + "value" : "請在 [Select、Start、LB/RB、LT/RT、Xbox 背鍵] 之中,選擇並按下作為手把導覽鍵。" } } } @@ -17631,6 +17608,35 @@ } } }, + "streamingRadialMenuButtonTip" : { + "extractionState" : "manual", + "localizations" : { + "en" : { + "stringUnit" : { + "state" : "translated", + "value" : "Press the same or a different button for controller navigation during streaming. [Home] button is also available.\n\nNote: if you want to designate the Home button, double tap to pass it through to VoidLink app on iOS 26+." + } + }, + "zh-Hans" : { + "stringUnit" : { + "state" : "translated", + "value" : "请按下相同或不同的按键,作为串流时的手柄导航键。\n您也可以指定 [Home] 鍵。\n\n注意:iOS 26+ 系统中,需要双击Home键才能将该按键透传至 VoidLink。" + } + }, + "zh-Hant" : { + "stringUnit" : { + "state" : "translated", + "value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。 \n您也可以指定 [Home] 鍵。\n\n注意:在 iOS 26 以上系統中,需要雙擊 Home 鍵才能將該按鍵透傳至 VoidLink。" + } + }, + "zh-HK" : { + "stringUnit" : { + "state" : "translated", + "value" : "請按下相同或不同的按鍵,作為串流時的手把導覽鍵。 \n您也可以指定 [Home] 鍵。\n\n注意:在 iOS 26 以上系統中,需要雙擊 Home 鍵才能將該按鍵透傳至 VoidLink。" + } + } + } + }, "Stroke start equalization depth: " : { "extractionState" : "manual", "localizations" : { diff --git a/VoidLink/ViewControllers/SettingsViewController.m b/VoidLink/ViewControllers/SettingsViewController.m index 90cc25da..f9280584 100644 --- a/VoidLink/ViewControllers/SettingsViewController.m +++ b/VoidLink/ViewControllers/SettingsViewController.m @@ -1933,7 +1933,7 @@ BOOL isCustomResolution(int resolutionSelected) { dispatch_async(dispatch_get_main_queue(), ^{ if (@available(iOS 13.0, *)) { if(ControllerNavigator.radialMenuView.superview) [ControllerNavigator updateRadialMenu]; - [GamepadNavigationIllustrationHud updateHud]; + [GamepadNavigationIllustrationHud updateHudWithForceDisplay:false]; if(ControllerUtil.primaryGCController){ [ControllerNavigator restoreSettingsModeSwitchHighlight]; }; @@ -1957,7 +1957,7 @@ BOOL isCustomResolution(int resolutionSelected) { dispatch_async(dispatch_get_main_queue(), ^{ if (@available(iOS 13.0, *)){ if(ControllerNavigator.radialMenuView.superview) [ControllerNavigator updateRadialMenu]; - [GamepadNavigationIllustrationHud updateHud]; + [GamepadNavigationIllustrationHud updateHudWithForceDisplay:false]; if(ControllerUtil.primaryGCController){ [ControllerNavigator restoreSettingsModeSwitchHighlight]; }; @@ -2968,7 +2968,7 @@ BOOL isCustomResolution(int resolutionSelected) { if (@available(iOS 13.0, *)) [ControllerNavigator updateHudForCustomRadialMenuButtonPosition]; return; } - AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"Press the same or a different button for controller navigation during streaming."]; + AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"streamingRadialMenuButtonTip"]; return; } @@ -3001,7 +3001,7 @@ BOOL isCustomResolution(int resolutionSelected) { if(!metRadialButtonWithUndefinedPosition){ if (@available(iOS 13.0, *)) [GamepadNavigationIllustrationHud clearHud]; - AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"Press the same or a different button for controller navigation during streaming."]; + AlertControllerUtil.alertController.message = [LocalizationHelper localizedStringForKey:@"streamingRadialMenuButtonTip"]; return; } } diff --git a/VoidLink/ViewControllers/StreamFrameViewController.m b/VoidLink/ViewControllers/StreamFrameViewController.m index 32bdf002..da206327 100644 --- a/VoidLink/ViewControllers/StreamFrameViewController.m +++ b/VoidLink/ViewControllers/StreamFrameViewController.m @@ -1376,6 +1376,8 @@ static __weak StreamFrameViewController *VLSharedStreamFrameViewController = nil }); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [ControllerNavigator restoreUINavigationHighlight]; + // ControllerNavigator.radialMenuButtonPressed = false; + if(ControllerNavigator.streamingRadialMenuButton == ControllerElementSpecial) [GamepadNavigationIllustrationHud updateHudWithForceDisplay:true]; }); dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [ControllerNavigator restoreUINavigationHighlight]; diff --git a/VoidLink/VoidLink-Bridging-Header.h b/VoidLink/VoidLink-Bridging-Header.h index 0aca0770..3d6fe28a 100644 --- a/VoidLink/VoidLink-Bridging-Header.h +++ b/VoidLink/VoidLink-Bridging-Header.h @@ -5,6 +5,7 @@ #include #import "SettingsViewController.h" #import "MainFrameViewController.h" +#import "LoadingFrameViewController.h" #import "StreamFrameViewController.h" #import "ControllerSupport.h" #import "OnScreenControls.h"