mirror of
https://github.com/StikDebug/StikDebug.git
synced 2026-10-16 12:30:29 +00:00
fix bugs and add a refresh button
This commit is contained in:
parent
d51f8e9b6c
commit
962106c63d
3 changed files with 25 additions and 0 deletions
|
|
@ -19,6 +19,10 @@ extension UIDocumentPickerViewController {
|
|||
}
|
||||
}
|
||||
|
||||
extension Notification.Name {
|
||||
static let pairingFileImported = Notification.Name("PairingFileImported")
|
||||
}
|
||||
|
||||
extension UserDefaults {
|
||||
enum Keys {
|
||||
/// Forces the app to treat the current device as TXM-capable so scripts always run.
|
||||
|
|
|
|||
|
|
@ -133,7 +133,16 @@ struct HomeView: View {
|
|||
try fileManager.removeItem(at: dest)
|
||||
}
|
||||
try fileManager.copyItem(at: url, to: dest)
|
||||
pubHeartBeat = false
|
||||
startHeartbeatInBackground()
|
||||
NotificationCenter.default.post(name: .pairingFileImported, object: nil)
|
||||
// Dismiss any existing heartbeat error alert
|
||||
if let scene = UIApplication.shared.connectedScenes.first as? UIWindowScene,
|
||||
let root = scene.windows.first?.rootViewController {
|
||||
var top = root
|
||||
while let presented = top.presentedViewController { top = presented }
|
||||
if top is UIAlertController { top.dismiss(animated: true) }
|
||||
}
|
||||
} catch {
|
||||
print("Error copying pairing file: \(error)")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -195,6 +195,15 @@ private enum AppListTab: Int, CaseIterable, Identifiable {
|
|||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button("Done") { dismiss() }.fontWeight(.semibold)
|
||||
}
|
||||
} else {
|
||||
ToolbarItem(placement: .navigationBarTrailing) {
|
||||
Button {
|
||||
viewModel.refreshAppLists()
|
||||
} label: {
|
||||
Image(systemName: "arrow.clockwise")
|
||||
}
|
||||
.disabled(viewModel.isLoading)
|
||||
}
|
||||
}
|
||||
}
|
||||
.onAppear {
|
||||
|
|
@ -233,6 +242,9 @@ private enum AppListTab: Int, CaseIterable, Identifiable {
|
|||
}
|
||||
.onChange(of: selectedTab) { _, _ in prefetchPriorityIcons() }
|
||||
.onChange(of: pinnedSystemApps) { _, _ in prefetchPriorityIcons() }
|
||||
.onReceive(NotificationCenter.default.publisher(for: .pairingFileImported)) { _ in
|
||||
viewModel.refreshAppLists()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: Apps List
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue