- button widget skill combo enhanced to macro

- widget picker view UI fixes
This commit is contained in:
True Zhuanjia
2026-05-21 14:18:50 +08:00
parent a7088c70e5
commit 2c2088e4b1
11 changed files with 2057 additions and 312 deletions
@@ -74,8 +74,12 @@ public final class WidgetPickerViewController: UIViewController {
view.addSubview(hostingViewController.view)
hostingViewController.didMove(toParent: self)
let hostingTopAnchor = UIDevice.current.userInterfaceIdiom == .phone
? view.safeAreaLayoutGuide.topAnchor
: view.topAnchor
NSLayoutConstraint.activate([
hostingViewController.view.topAnchor.constraint(equalTo: view.safeAreaLayoutGuide.topAnchor),
hostingViewController.view.topAnchor.constraint(equalTo: hostingTopAnchor),
hostingViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor),
hostingViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor),
hostingViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor),
@@ -89,11 +93,31 @@ public final class WidgetPickerViewController: UIViewController {
navigationController?.setNavigationBarHidden(true, animated: false)
}
public override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
presentationState.hasHostAppeared = false
}
public override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
presentationState.hasHostAppeared = true
}
public override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
super.viewWillTransition(to: size, with: coordinator)
presentationState.hasHostAppeared = false
coordinator.animate(alongsideTransition: nil) { [weak self] context in
guard let self else { return }
guard !context.isCancelled else {
self.presentationState.hasHostAppeared = true
return
}
self.presentationState.hasHostAppeared = true
}
}
private func resolvedTabs() -> [WidgetPickerTab] {
let tabs = tabIdentifiers.compactMap(WidgetPickerTab.init(identifier:))
return tabs.isEmpty ? WidgetPickerTab.allCases : tabs
@@ -104,6 +128,11 @@ public final class WidgetPickerViewController: UIViewController {
return WidgetPickerTab(identifier: initialTabIdentifier)
}
public func presentOverFullScreen(from presenter: UIViewController, animated: Bool = true) {
modalPresentationStyle = .overFullScreen
presenter.present(self, animated: animated)
}
public func presentAsOverlay(in parentViewController: UIViewController, animated: Bool = true) {
guard parent == nil else { return }
guard let originalAppWindow = parentViewController.view.window,