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)
|
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)
|
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 {
|
extension EnvironmentValues {
|
||||||
/// Used to access and inject the room context without observing it
|
/// Used to access and inject the room context without observing it
|
||||||
var timelineContext: TimelineViewModel.Context? {
|
@Entry var timelineContext: TimelineViewModel.Context?
|
||||||
get { self[TimelineContextKey.self] }
|
|
||||||
set { self[TimelineContextKey.self] = newValue }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// An event ID which will be non-nil when a timeline item should show as focussed.
|
/// An event ID which will be non-nil when a timeline item should show as focussed.
|
||||||
var focussedEventID: String? {
|
@Entry var focussedEventID: String?
|
||||||
get { self[FocussedEventID.self] }
|
|
||||||
set { self[FocussedEventID.self] = newValue }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum SlashCommand: String, CaseIterable {
|
private enum SlashCommand: String, CaseIterable {
|
||||||
|
@ -26,13 +26,6 @@ enum TimelineGroupStyle: Hashable {
|
|||||||
|
|
||||||
// MARK: - Environment
|
// MARK: - Environment
|
||||||
|
|
||||||
private struct TimelineGroupStyleKey: EnvironmentKey {
|
|
||||||
static let defaultValue = TimelineGroupStyle.single
|
|
||||||
}
|
|
||||||
|
|
||||||
extension EnvironmentValues {
|
extension EnvironmentValues {
|
||||||
var timelineGroupStyle: TimelineGroupStyle {
|
@Entry var timelineGroupStyle: TimelineGroupStyle = .single
|
||||||
get { self[TimelineGroupStyleKey.self] }
|
|
||||||
set { self[TimelineGroupStyleKey.self] = newValue }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -7,13 +7,6 @@
|
|||||||
|
|
||||||
import SwiftUI
|
import SwiftUI
|
||||||
|
|
||||||
private struct AnalyticsServiceKey: EnvironmentKey {
|
|
||||||
static let defaultValue: AnalyticsService = ServiceLocator.shared.analytics
|
|
||||||
}
|
|
||||||
|
|
||||||
extension EnvironmentValues {
|
extension EnvironmentValues {
|
||||||
var analyticsService: AnalyticsService {
|
@Entry var analyticsService: AnalyticsService = ServiceLocator.shared.analytics
|
||||||
get { self[AnalyticsServiceKey.self] }
|
|
||||||
set { self[AnalyticsServiceKey.self] = newValue }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user