-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Accessible Mark Read Indicator (#1543)
- Loading branch information
1 parent
f673171
commit e50d2cf
Showing
14 changed files
with
198 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// | ||
// ReadPostIndicator.swift | ||
// Mlem | ||
// | ||
// Created by Eric Andrews on 2024-12-25. | ||
// | ||
|
||
import Foundation | ||
|
||
enum ReadPostIndicator: String, CaseIterable, Codable { | ||
case outline, checkmark, none | ||
|
||
var label: LocalizedStringResource { | ||
switch self { | ||
case .outline: "Outline" | ||
case .checkmark: "Checkmark" | ||
case .none: "None" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Mlem/App/Views/Root/Tabs/Settings/AccessibilitySettingsView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// AccessibilitySettingsView.swift | ||
// Mlem | ||
// | ||
// Created by Eric Andrews on 2024-12-25. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct AccessibilitySettingsView: View { | ||
|
||
@Environment(\.accessibilityDifferentiateWithoutColor) var differentiateWithoutColor | ||
|
||
@Setting(\.readPostIndicator) var readPostIndicator | ||
@Setting(\.readOutlineThickness) var readOutlineThickness | ||
|
||
@State var readBarThicknessSlider: Double | ||
|
||
init() { | ||
@Setting(\.readOutlineThickness) var readOutlineThickness | ||
self._readBarThicknessSlider = .init(wrappedValue: Double(readOutlineThickness)) | ||
} | ||
|
||
var body: some View { | ||
List { | ||
Section("Differentiate Without Color") { | ||
Picker("Read Post Indicator", selection: $readPostIndicator) { | ||
ForEach(ReadPostIndicator.allCases, id: \.self) { item in | ||
Text(item.label) | ||
} | ||
} | ||
|
||
if readPostIndicator == .outline { | ||
VStack(alignment: .leading) { | ||
Text("Outline Thickness") | ||
|
||
Slider( | ||
value: $readBarThicknessSlider, | ||
in: 1 ... 5, | ||
step: 1 | ||
) { | ||
Text("Outline Thickness") | ||
} minimumValueLabel: { | ||
Text(verbatim: "1") | ||
} maximumValueLabel: { | ||
Text(verbatim: "5") | ||
} onEditingChanged: { editing in | ||
if !editing { | ||
readOutlineThickness = Int(readBarThicknessSlider) | ||
} | ||
} | ||
} | ||
} | ||
} footer: { | ||
Text("These settings control how Mlem behaves when the system-wide \"Differentiate Without Color\" option is enabled.") | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.