mirror of
https://github.com/element-hq/element-x-ios.git
synced 2025-03-10 21:39:12 +00:00
Use the new @Entry macro everywhere.
Fix analytics service optionality.
This commit is contained in:
parent
e0ee4be834
commit
77e4fae2fb
@ -203,15 +203,3 @@ extension RoomScreenViewModel {
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
}
|
||||
}
|
||||
|
||||
private struct RoomContextKey: EnvironmentKey {
|
||||
@MainActor static let defaultValue: RoomScreenViewModel.Context? = nil
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
/// Used to access and inject the room context without observing it
|
||||
var roomContext: RoomScreenViewModel.Context? {
|
||||
get { self[RoomContextKey.self] }
|
||||
set { self[RoomContextKey.self] = newValue }
|
||||
}
|
||||
}
|
||||
|
@ -865,26 +865,11 @@ extension TimelineViewModel {
|
||||
analyticsService: ServiceLocator.shared.analytics)
|
||||
}
|
||||
|
||||
private struct TimelineContextKey: EnvironmentKey {
|
||||
@MainActor static let defaultValue: TimelineViewModel.Context? = nil
|
||||
}
|
||||
|
||||
private struct FocussedEventID: EnvironmentKey {
|
||||
static let defaultValue: String? = nil
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
/// Used to access and inject the room context without observing it
|
||||
var timelineContext: TimelineViewModel.Context? {
|
||||
get { self[TimelineContextKey.self] }
|
||||
set { self[TimelineContextKey.self] = newValue }
|
||||
}
|
||||
|
||||
@Entry var timelineContext: TimelineViewModel.Context?
|
||||
/// An event ID which will be non-nil when a timeline item should show as focussed.
|
||||
var focussedEventID: String? {
|
||||
get { self[FocussedEventID.self] }
|
||||
set { self[FocussedEventID.self] = newValue }
|
||||
}
|
||||
@Entry var focussedEventID: String?
|
||||
}
|
||||
|
||||
private enum SlashCommand: String, CaseIterable {
|
||||
|
@ -26,13 +26,6 @@ enum TimelineGroupStyle: Hashable {
|
||||
|
||||
// MARK: - Environment
|
||||
|
||||
private struct TimelineGroupStyleKey: EnvironmentKey {
|
||||
static let defaultValue = TimelineGroupStyle.single
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
var timelineGroupStyle: TimelineGroupStyle {
|
||||
get { self[TimelineGroupStyleKey.self] }
|
||||
set { self[TimelineGroupStyleKey.self] = newValue }
|
||||
}
|
||||
@Entry var timelineGroupStyle: TimelineGroupStyle = .single
|
||||
}
|
||||
|
@ -7,13 +7,6 @@
|
||||
|
||||
import SwiftUI
|
||||
|
||||
private struct AnalyticsServiceKey: EnvironmentKey {
|
||||
static let defaultValue: AnalyticsService = ServiceLocator.shared.analytics
|
||||
}
|
||||
|
||||
extension EnvironmentValues {
|
||||
var analyticsService: AnalyticsService {
|
||||
get { self[AnalyticsServiceKey.self] }
|
||||
set { self[AnalyticsServiceKey.self] = newValue }
|
||||
}
|
||||
@Entry var analyticsService: AnalyticsService = ServiceLocator.shared.analytics
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user