- update default widget template with profile name localized

- improve widget import
This commit is contained in:
True Zhuanjia
2026-06-06 20:07:01 +08:00
parent 384724ff27
commit 53209ce89e
9 changed files with 285 additions and 31 deletions
+16 -1
View File
@@ -3394,7 +3394,7 @@ import ObjectiveC.runtime
// MARK: - Auto Dock
private static let autoDockExposedEdgeLength: CGFloat = GenericUtils.isIPhone() ? 70 : 90
private static let autoDockExposedThickness: CGFloat = 22
private static let autoDockExposedThickness: CGFloat = 17
private static let autoDockVerticalInset: CGFloat = 12
@objc var autoDockIdleDuration: TimeInterval = 0
@objc var storedAutoDockIdleDuration: TimeInterval = 0
@@ -3901,6 +3901,21 @@ import ObjectiveC.runtime
}
}
@objc static func clearSubWidgets(for folder:OnScreenWidgetView, recursive:Bool = false){
for widget in OnScreenWidgetView.mapping.values where widget.parentSequence == folder.sequence && (!widget.isFolder || widget.sequenceSet.isEmpty) {
folder.sequenceSet.remove(widget.sequence)
OnScreenWidgetView.mapping.removeValue(forKey: widget.sequence)
widget.removeFromSuperview()
}
guard recursive else {return}
for subFolder in OnScreenWidgetView.mapping.values where subFolder.parentSequence == folder.sequence && subFolder.isFolder {
OnScreenWidgetView.clearSubWidgets(for: subFolder, recursive: true)
folder.sequenceSet.remove(subFolder.sequence)
OnScreenWidgetView.mapping.removeValue(forKey: subFolder.sequence)
subFolder.removeFromSuperview()
}
}
private static func getRootFolder(of widget:OnScreenWidgetView) -> OnScreenWidgetView?{
var widgetRef:OnScreenWidgetView? = widget
var parentFolder:OnScreenWidgetView? = OnScreenWidgetView.mapping[widgetRef?.parentSequence ?? -1]