Skip to content

Commit

Permalink
Move to @entry
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimillian committed Aug 15, 2024
1 parent a2c3e4f commit 4d0498e
Showing 1 changed file with 11 additions and 90 deletions.
101 changes: 11 additions & 90 deletions Packages/Env/Sources/Env/CustomEnvValues.swift
Original file line number Diff line number Diff line change
@@ -1,94 +1,15 @@
import Foundation
import SwiftUI

private struct SecondaryColumnKey: EnvironmentKey {
static let defaultValue = false
}

private struct ExtraLeadingInset: EnvironmentKey {
static let defaultValue: CGFloat = 0
}

private struct IsCompact: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsMediaCompact: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsModal: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsInCaptureMode: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsSupporter: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsStatusFocused: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IsHomeTimeline: EnvironmentKey {
static let defaultValue: Bool = false
}

private struct IndentationLevel: EnvironmentKey {
static let defaultValue: UInt = 0
}

public extension EnvironmentValues {
var isSecondaryColumn: Bool {
get { self[SecondaryColumnKey.self] }
set { self[SecondaryColumnKey.self] = newValue }
}

var extraLeadingInset: CGFloat {
get { self[ExtraLeadingInset.self] }
set { self[ExtraLeadingInset.self] = newValue }
}

var isCompact: Bool {
get { self[IsCompact.self] }
set { self[IsCompact.self] = newValue }
}

var isMediaCompact: Bool {
get { self[IsMediaCompact.self] }
set { self[IsMediaCompact.self] = newValue }
}

var isModal: Bool {
get { self[IsModal.self] }
set { self[IsModal.self] = newValue }
}

var isInCaptureMode: Bool {
get { self[IsInCaptureMode.self] }
set { self[IsInCaptureMode.self] = newValue }
}

var isSupporter: Bool {
get { self[IsSupporter.self] }
set { self[IsSupporter.self] = newValue }
}

var isStatusFocused: Bool {
get { self[IsStatusFocused.self] }
set { self[IsStatusFocused.self] = newValue }
}

var indentationLevel: UInt {
get { self[IndentationLevel.self] }
set { self[IndentationLevel.self] = newValue }
}

var isHomeTimeline: Bool {
get { self[IsHomeTimeline.self] }
set { self[IsHomeTimeline.self] = newValue }
}
extension EnvironmentValues {
@Entry public var isSecondaryColumn: Bool = false
@Entry public var extraLeadingInset: CGFloat = 0
@Entry public var isCompact: Bool = false
@Entry public var isMediaCompact: Bool = false
@Entry public var isModal: Bool = false
@Entry public var isInCaptureMode: Bool = false
@Entry public var isSupporter: Bool = false
@Entry public var isStatusFocused: Bool = false
@Entry public var isHomeTimeline: Bool = false
@Entry public var indentationLevel: UInt = 0
}

0 comments on commit 4d0498e

Please sign in to comment.