mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 17:51:01 +00:00
Various fixes for Xcode 15.3
This commit is contained in:
parent
bc2a09891a
commit
9a7e6b7cb0
15 changed files with 22 additions and 54 deletions
|
@ -7,6 +7,7 @@ import Observation
|
|||
import StatusKit
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
@Observable class DisplaySettingsLocalValues {
|
||||
var tintColor = Theme.shared.tintColor
|
||||
var primaryBackgroundColor = Theme.shared.primaryBackgroundColor
|
||||
|
|
|
@ -2,6 +2,7 @@ import DesignSystem
|
|||
import Env
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
struct SidebarEntriesSettingsView: View {
|
||||
@Environment(Theme.self) private var theme
|
||||
@Environment(UserPreferences.self) private var userPreferences
|
||||
|
|
|
@ -157,6 +157,7 @@ enum Tab: Int, Identifiable, Hashable, CaseIterable, Codable {
|
|||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Observable
|
||||
class SidebarTabs {
|
||||
struct SidedebarTab: Hashable, Codable {
|
||||
|
@ -202,6 +203,7 @@ class SidebarTabs {
|
|||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
@Observable
|
||||
class iOSTabs {
|
||||
enum TabEntries: String {
|
||||
|
|
|
@ -371,6 +371,7 @@ public struct AccountDetailView: View {
|
|||
}
|
||||
|
||||
extension View {
|
||||
@MainActor
|
||||
func applyAccountDetailsRowStyle(theme: Theme) -> some View {
|
||||
listRowInsets(.init())
|
||||
.listRowSeparator(.hidden)
|
||||
|
|
|
@ -33,11 +33,11 @@ public struct AppAccountsSelectorView: View {
|
|||
|
||||
public init(routerPath: RouterPath,
|
||||
accountCreationEnabled: Bool = true,
|
||||
avatarConfig: AvatarView.FrameConfig = .badge)
|
||||
avatarConfig: AvatarView.FrameConfig? = nil)
|
||||
{
|
||||
self.routerPath = routerPath
|
||||
self.accountCreationEnabled = accountCreationEnabled
|
||||
self.avatarConfig = avatarConfig
|
||||
self.avatarConfig = avatarConfig ?? .badge
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
|
|
|
@ -2,7 +2,7 @@ import Combine
|
|||
import UIKit
|
||||
|
||||
@Observable
|
||||
public class SceneDelegate: NSObject, UIWindowSceneDelegate, Sendable {
|
||||
@MainActor public class SceneDelegate: NSObject, UIWindowSceneDelegate, Sendable {
|
||||
public var window: UIWindow?
|
||||
#if os(visionOS)
|
||||
public private(set) var windowWidth: CGFloat = 0
|
||||
|
@ -47,12 +47,12 @@ public class SceneDelegate: NSObject, UIWindowSceneDelegate, Sendable {
|
|||
}
|
||||
|
||||
private static var observedSceneDelegate: Set<SceneDelegate> = []
|
||||
private static let observer = Task {
|
||||
private static let observer = Task { @MainActor in
|
||||
while true {
|
||||
try? await Task.sleep(for: .seconds(0.1))
|
||||
for delegate in observedSceneDelegate {
|
||||
#if os(visionOS)
|
||||
let newWidth = delegate.window?.bounds.size.width ?? 0
|
||||
let newWidth = delegate.window?.bounds.size.width ?? 0
|
||||
if delegate.windowWidth != newWidth {
|
||||
delegate.windowWidth = newWidth
|
||||
}
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
import Combine
|
||||
import SwiftUI
|
||||
|
||||
@Observable public class Theme {
|
||||
class ThemeStorage {
|
||||
@MainActor
|
||||
@Observable
|
||||
public final class Theme {
|
||||
final class ThemeStorage {
|
||||
enum ThemeKey: String {
|
||||
case colorScheme, tint, label, primaryBackground, secondaryBackground
|
||||
case avatarPosition2, avatarShape2, statusActionsDisplay, statusDisplayStyle
|
||||
|
|
|
@ -4,7 +4,7 @@ import SwiftUI
|
|||
#endif
|
||||
|
||||
public extension View {
|
||||
func applyTheme(_ theme: Theme) -> some View {
|
||||
@MainActor func applyTheme(_ theme: Theme) -> some View {
|
||||
modifier(ThemeApplier(theme: theme))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import Nuke
|
|||
import NukeUI
|
||||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
struct AccountPopoverView: View {
|
||||
let account: Account
|
||||
let theme: Theme // using `@Environment(Theme.self) will crash the SwiftUI preview
|
||||
|
|
|
@ -33,7 +33,8 @@ public struct AvatarView: View {
|
|||
self.config = config
|
||||
}
|
||||
|
||||
public struct FrameConfig: Equatable {
|
||||
@MainActor
|
||||
public struct FrameConfig: Equatable, Sendable {
|
||||
public let size: CGSize
|
||||
public var width: CGFloat { size.width }
|
||||
public var height: CGFloat { size.height }
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import SwiftUI
|
||||
|
||||
@MainActor
|
||||
public struct NextPageView: View {
|
||||
@State private var isLoadingNextPage: Bool = false
|
||||
@State private var showRetry: Bool = false
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/*! @copyright 2021 Medium */
|
||||
|
||||
import SwiftUI
|
||||
|
||||
// Source: https://www.fivestars.blog/articles/scrollview-offset/
|
||||
|
||||
public struct ScrollViewOffsetReader<Content: View>: View {
|
||||
let onOffsetChange: (CGFloat) -> Void
|
||||
let content: () -> Content
|
||||
|
||||
public init(
|
||||
onOffsetChange: @escaping (CGFloat) -> Void,
|
||||
@ViewBuilder content: @escaping () -> Content
|
||||
) {
|
||||
self.onOffsetChange = onOffsetChange
|
||||
self.content = content
|
||||
}
|
||||
|
||||
public var body: some View {
|
||||
ScrollView {
|
||||
offsetReader
|
||||
content()
|
||||
.padding(.top, -8)
|
||||
}
|
||||
.coordinateSpace(name: "frameLayer")
|
||||
.onPreferenceChange(OffsetPreferenceKey.self, perform: onOffsetChange)
|
||||
}
|
||||
|
||||
var offsetReader: some View {
|
||||
GeometryReader { proxy in
|
||||
Color.clear
|
||||
.preference(
|
||||
key: OffsetPreferenceKey.self,
|
||||
value: proxy.frame(in: .named("frameLayer")).minY
|
||||
)
|
||||
}
|
||||
.frame(height: 0)
|
||||
}
|
||||
}
|
||||
|
||||
private struct OffsetPreferenceKey: PreferenceKey {
|
||||
static var defaultValue: CGFloat = .zero
|
||||
static func reduce(value _: inout CGFloat, nextValue _: () -> CGFloat) {}
|
||||
}
|
|
@ -67,6 +67,7 @@ extension Models.Notification.NotificationType {
|
|||
}
|
||||
}
|
||||
|
||||
@MainActor
|
||||
func tintColor(isPrivate: Bool) -> Color {
|
||||
if isPrivate {
|
||||
return Color.orange.opacity(0.80)
|
||||
|
|
|
@ -2,6 +2,7 @@ import DesignSystem
|
|||
import SwiftUI
|
||||
import Env
|
||||
|
||||
@MainActor
|
||||
public struct TimelineContentFilterView: View {
|
||||
@Environment(Theme.self) private var theme
|
||||
@Environment(CurrentInstance.self) private var currentInstance
|
||||
|
|
|
@ -14,7 +14,7 @@ actor TimelineDatasource {
|
|||
}
|
||||
|
||||
func getFiltered() async -> [Status] {
|
||||
let contentFilter = TimelineContentFilter.shared
|
||||
let contentFilter = await TimelineContentFilter.shared
|
||||
let showReplies = await contentFilter.showReplies
|
||||
let showBoosts = await contentFilter.showBoosts
|
||||
let showThreads = await contentFilter.showThreads
|
||||
|
|
Loading…
Reference in a new issue