Periphery cleanup (#5893)

This commit is contained in:
Mauro
2026-07-20 11:16:11 +02:00
committed by GitHub
parent 175aca596e
commit 9093631f8b
275 changed files with 381 additions and 2268 deletions
@@ -19,6 +19,7 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
private let stateMachine: AppCoordinatorStateMachine
private let navigationRootCoordinator: NavigationRootCoordinator
private let userSessionStore: UserSessionStoreProtocol
// periphery:ignore - retaining purpose
private let targetConfiguration: Target.ConfigurationResult
private let appMediator: AppMediator
private let appSettings: AppSettings
@@ -680,7 +681,6 @@ class AppCoordinator: AppCoordinatorProtocol, AuthenticationFlowCoordinatorDeleg
appMediator: appMediator,
appSettings: appSettings,
appHooks: appHooks,
analytics: analyticsService,
userIndicatorController: userIndicatorController)
coordinator.delegate = self
@@ -16,10 +16,6 @@ protocol AppMediatorProtocol {
var appState: UIApplication.State { get }
func beginBackgroundTask(expirationHandler handler: (@MainActor @Sendable () -> Void)?) -> UIBackgroundTaskIdentifier
func endBackgroundTask(_ identifier: UIBackgroundTaskIdentifier)
func open(_ url: URL)
func openAppSettings()
@@ -8,7 +8,6 @@
import Foundation
// periphery:ignore - markdown protocol
protocol FlowCoordinatorProtocol {
func start(animated: Bool)
func handleAppRoute(_ appRoute: AppRoute, animated: Bool)
@@ -85,7 +85,6 @@ import SwiftUI
}
}
// periphery:ignore - might be useful to have
/// The currently displayed fullscreen cover coordinator
var fullScreenCoverCoordinator: (any CoordinatorProtocol)? {
fullScreenCoverModule?.coordinator
@@ -626,7 +625,6 @@ private struct NavigationSplitCoordinatorView: View {
}
}
// periphery:ignore - might be useful to have
/// Present a fullscreen cover on top of the stack. If this NavigationStackCoordinator is embedded within a NavigationSplitCoordinator
/// then the presentation will be proxied to the split
/// - Parameters:
@@ -28,7 +28,6 @@ nonisolated protocol CommonSettingsProtocol: AnyObject, Sendable {
var enableOnlySignedDeviceIsolationMode: Bool { get }
var threadsEnabled: Bool { get }
var globalSearchEnabled: Bool { get }
var hideQuietNotificationAlerts: Bool { get }
}
@@ -8,7 +8,7 @@
import Foundation
public nonisolated protocol UserDefaultsProtocol: AnyObject {
nonisolated protocol UserDefaultsProtocol: AnyObject {
func data(forKey key: String) -> Data?
func object(forKey key: String) -> Any?
func removeObject(forKey key: String)
@@ -7,39 +7,39 @@
import Foundation
public final nonisolated class VolatileUserDefaults: UserDefaultsProtocol, Sendable {
final nonisolated class VolatileUserDefaults: UserDefaultsProtocol, Sendable {
private let lock = NSLock()
private nonisolated(unsafe) var _storage: [String: Any]
public private(set) var storage: [String: Any] {
private(set) var storage: [String: Any] {
get { lock.withLock { _storage } }
set { lock.withLock { _storage = newValue } }
}
public init(initialValues: [String: Any] = [:]) {
init(initialValues: [String: Any] = [:]) {
lock.lock()
defer { lock.unlock() }
_storage = initialValues
}
public func data(forKey key: String) -> Data? {
func data(forKey key: String) -> Data? {
storage[key] as? Data
}
public func object(forKey key: String) -> Any? {
func object(forKey key: String) -> Any? {
storage[key]
}
public func removeObject(forKey key: String) {
func removeObject(forKey key: String) {
storage.removeValue(forKey: key)
}
public func set(_ value: Any?, forKey key: String) {
func set(_ value: Any?, forKey key: String) {
storage[key] = value
}
public func reset() {
func reset() {
storage = [:]
}
}
@@ -12,7 +12,6 @@ import SwiftUI
class WindowManager: SecureWindowManagerProtocol {
private let appDelegate: AppDelegate
weak var mainScene: UIWindowScene?
weak var mainSession: UISceneSession?
weak var delegate: SecureWindowManagerDelegate?
private(set) var mainWindow: UIWindow!
@@ -34,7 +33,6 @@ class WindowManager: SecureWindowManagerProtocol {
[mainWindow, overlayWindow, alternateWindow]
}
// periphery:ignore - auto cancels when reassigned
/// The task used to switch windows, so that we don't get stuck in the wrong state with a quick switch.
@CancellableTask private var switchTask: Task<Void, Error>?
/// A duration that allows window switching to wait a couple of frames to avoid a transition through black.
@@ -62,7 +60,6 @@ class WindowManager: SecureWindowManagerProtocol {
}
mainScene = scene
mainSession = session
// Restore the previous window size on macOS as this isn't automatic.
if let previousSize = mainWindow?.frame.size {
@@ -94,7 +91,6 @@ class WindowManager: SecureWindowManagerProtocol {
func handleSceneDisconnection(_ scene: UIWindowScene) {
if scene == mainScene {
mainScene = nil
mainSession = nil
// Leave the mainWindow so we can reapply it's size on macOS.
}
}