home indicator interaction fix

This commit is contained in:
True Zhuanjia committed 2026-05-16 22:45:45 +08:00
1 parent 5a9bcab368
commit 1630f7987a
4 files changed
+48 -11

No files matched your search

+37 -9
View File
@@ -17,8 +17,9 @@ import ObjectiveC.runtime
} }
@objc public static var mapping: [Int16:OnScreenWidgetView] = [:] @objc public static var mapping: [Int16:OnScreenWidgetView] = [:]
@objc public static var isRestoring: Bool = false @objc public static var isRestoringFolderStates: Bool = false
@objc public static var hasRestoredFromAutoDock: Bool = false @objc public static var deferSlideGestureDueToAutoDockRestore: Bool = false
@objc public static var deferScreenEdgeSysGesturesDueToOnScreenWidgets: Bool = false
@objc public static var autoDockRestoreInitByViewResize: Bool = false @objc public static var autoDockRestoreInitByViewResize: Bool = false
@objc public static func set(widget:OnScreenWidgetView, for key:Int16) { @objc public static func set(widget:OnScreenWidgetView, for key:Int16) {
mapping[key] = widget mapping[key] = widget
@@ -3296,9 +3297,9 @@ import ObjectiveC.runtime
@objc private func vl_autoDock_touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) { @objc private func vl_autoDock_touchesEnded(_ touches: Set<UITouch>, with event: UIEvent?) {
OnScreenWidgetView.autoDockOriginalTouchesEndedIMP?(self, #selector(OnScreenWidgetView.touchesEnded(_:with:)), touches, event) OnScreenWidgetView.autoDockOriginalTouchesEndedIMP?(self, #selector(OnScreenWidgetView.touchesEnded(_:with:)), touches, event)
guard autoDockEnabled else { return } guard autoDockEnabled else { return }
if OnScreenWidgetView.hasRestoredFromAutoDock { if OnScreenWidgetView.deferSlideGestureDueToAutoDockRestore {
DispatchQueue.global().asyncAfter(deadline: .now() + 0.02){ DispatchQueue.global().asyncAfter(deadline: .now() + 0.02){
OnScreenWidgetView.hasRestoredFromAutoDock = false OnScreenWidgetView.deferSlideGestureDueToAutoDockRestore = false
} }
} }
autoDockRestartCountdownIfNeeded() autoDockRestartCountdownIfNeeded()
@@ -3459,6 +3460,11 @@ import ObjectiveC.runtime
) { ) {
self.frame = targetFrame self.frame = targetFrame
self.transform = CGAffineTransform(scaleX: 0.985, y: 0.985) self.transform = CGAffineTransform(scaleX: 0.985, y: 0.985)
if ControllerUtil.activeGCControllers.count > 0, !GenericUtils.iOS26Available {
self.parentViewController?.setNeedsUpdateOfHomeIndicatorAutoHidden()
}
} completion: { _ in } completion: { _ in
UIView.animate(withDuration: 0.1, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) { UIView.animate(withDuration: 0.1, delay: 0, options: [.allowUserInteraction, .curveEaseOut]) {
self.autoDockApplyTemporarySize() self.autoDockApplyTemporarySize()
@@ -3480,12 +3486,14 @@ import ObjectiveC.runtime
} }
private func autoDockRestoreWidget(animated: Bool) { private func autoDockRestoreWidget(animated: Bool) {
OnScreenWidgetView.deferScreenEdgeSysGesturesDueToOnScreenWidgets = true
self.parentViewController?.setNeedsUpdateOfHomeIndicatorAutoHidden()
guard autoDockIsDocked else { guard autoDockIsDocked else {
restartAutoDockCountdown() restartAutoDockCountdown()
return return
} }
let restoreCenter = storedCenter let restoreCenter = storedCenter
OnScreenWidgetView.hasRestoredFromAutoDock = true OnScreenWidgetView.deferSlideGestureDueToAutoDockRestore = true
autoDockStopCountdown() autoDockStopCountdown()
autoDockStopSettledAlphaTimer() autoDockStopSettledAlphaTimer()
autoDockRestoreOriginalSize() autoDockRestoreOriginalSize()
@@ -3515,8 +3523,9 @@ import ObjectiveC.runtime
self.restartAutoDockCountdown() self.restartAutoDockCountdown()
if OnScreenWidgetView.autoDockRestoreInitByViewResize { if OnScreenWidgetView.autoDockRestoreInitByViewResize {
OnScreenWidgetView.autoDockRestoreInitByViewResize = false OnScreenWidgetView.autoDockRestoreInitByViewResize = false
OnScreenWidgetView.hasRestoredFromAutoDock = false OnScreenWidgetView.deferSlideGestureDueToAutoDockRestore = false
} }
OnScreenWidgetView.deferScreenEdgeSysGesturesDueToOnScreenWidgets = false
} }
) )
} }
@@ -3647,7 +3656,7 @@ import ObjectiveC.runtime
setCollection(hidden: folded, for: folder) setCollection(hidden: folded, for: folder)
if !folded, folder.revealMode == .exclusive { if !folded, folder.revealMode == .exclusive {
OnScreenWidgetView.unfoldedExclusiveFolderSequence = folder.sequence OnScreenWidgetView.unfoldedExclusiveFolderSequence = folder.sequence
if(!isRestoring) {OnScreenWidgetView.postExclusiveUnfoldedSequences.removeAll()} if(!isRestoringFolderStates) {OnScreenWidgetView.postExclusiveUnfoldedSequences.removeAll()}
let currentRootFolder = OnScreenWidgetView.getRootFolder(of: folder) ?? folder let currentRootFolder = OnScreenWidgetView.getRootFolder(of: folder) ?? folder
var offshootRootFolders:Set<OnScreenWidgetView> = Set() var offshootRootFolders:Set<OnScreenWidgetView> = Set()
folder.forEachWidget{ widget in folder.forEachWidget{ widget in
@@ -3710,6 +3719,25 @@ import ObjectiveC.runtime
return false return false
} }
@objc static var onlyRootFolderVisible: Bool {
var visibleNonFolerCount:Int = 0
var visibleFolderCount:Int = 0
for widget in OnScreenWidgetView.mapping.values {
if widget.isHidden {continue}
if widget.isFolder {
visibleFolderCount += 1
if visibleFolderCount > 1 {return false}
continue
}
else {
visibleNonFolerCount += 1
if visibleNonFolerCount > 0 {return false}
continue
}
}
return true
}
private static func putWidget(_ widget:OnScreenWidgetView, into folder:OnScreenWidgetView){ private static func putWidget(_ widget:OnScreenWidgetView, into folder:OnScreenWidgetView){
guard !OnScreenWidgetView.getParentFolders(of: folder).contains(widget), !folder.isHidden else { return } guard !OnScreenWidgetView.getParentFolders(of: folder).contains(widget), !folder.isHidden else { return }
let parentFolder = OnScreenWidgetView.mapping[widget.parentSequence] let parentFolder = OnScreenWidgetView.mapping[widget.parentSequence]
@@ -3744,7 +3772,7 @@ import ObjectiveC.runtime
} }
@objc static func restoreFoldedStates(){ @objc static func restoreFoldedStates(){
isRestoring = true isRestoringFolderStates = true
var unfoldedExclusiveFolder: OnScreenWidgetView? var unfoldedExclusiveFolder: OnScreenWidgetView?
if unfoldedExclusiveFolderSequence != -1 { if unfoldedExclusiveFolderSequence != -1 {
unfoldedExclusiveFolder = OnScreenWidgetView.mapping[unfoldedExclusiveFolderSequence] unfoldedExclusiveFolder = OnScreenWidgetView.mapping[unfoldedExclusiveFolderSequence]
@@ -3767,7 +3795,7 @@ import ObjectiveC.runtime
OnScreenWidgetView.set(folded: false, for: folder) OnScreenWidgetView.set(folded: false, for: folder)
} }
isRestoring = false isRestoringFolderStates = false
} }
@objc static func getMaxSequence() -> Int16{ @objc static func getMaxSequence() -> Int16{
+8
View File
@@ -418,6 +418,14 @@ import UIKit
return false return false
} }
@objc static let iOS26Available: Bool = {
if #available(iOS 26.0, tvOS 26.0, *) {
return true
} else {
return false
}
}()
@objc static let liquidGlassEnabled: Bool = { @objc static let liquidGlassEnabled: Bool = {
if #available(iOS 26.0, tvOS 26.0, *) { if #available(iOS 26.0, tvOS 26.0, *) {
let useLegacyUI = Bundle.main.object(forInfoDictionaryKey: "UIDesignRequiresCompatibility") as? Bool let useLegacyUI = Bundle.main.object(forInfoDictionaryKey: "UIDesignRequiresCompatibility") as? Bool
@@ -53,7 +53,7 @@ CGFloat startPointX;
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { - (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {
// [super touchesEnded:touches withEvent:event]; // [super touchesEnded:touches withEvent:event];
if(_excludePencilEvent && touches.anyObject.type != UITouchTypeDirect) return; if(_excludePencilEvent && touches.anyObject.type != UITouchTypeDirect) return;
if(OnScreenWidgetView.hasRestoredFromAutoDock) return; if(OnScreenWidgetView.deferSlideGestureDueToAutoDockRestore) return;
if([touches containsObject:capturedUITouch]){ if([touches containsObject:capturedUITouch]){
CGFloat _endPointX = [capturedUITouch locationInView:self.view].x; CGFloat _endPointX = [capturedUITouch locationInView:self.view].x;
CGFloat screenWidthInPoints = self.view.frame.size.width; CGFloat screenWidthInPoints = self.view.frame.size.width;
@@ -2029,7 +2029,8 @@
} }
- (BOOL)prefersHomeIndicatorAutoHidden { - (BOOL)prefersHomeIndicatorAutoHidden {
if ( [_controllerSupport getConnectedGamepadCount] > 0 && [_streamView getCurrentOscState] == OnScreenControlsLevelOff && if(OnScreenWidgetView.deferScreenEdgeSysGesturesDueToOnScreenWidgets) return NO;
if ( [_controllerSupport getConnectedGamepadCount] > 0 &&
_userIsInteracting == NO) { _userIsInteracting == NO) {
// Autohide the home bar when a gamepad is connected // Autohide the home bar when a gamepad is connected
// and the on-screen controls are disabled. We can't // and the on-screen controls are disabled. We can't