Skip to content

Commit 55fe3f8

Browse files
committed
Fix accessibility issues on home view
Move ContentView logic to HomeView Fix settings button in signing settings and primary outlinedbutton text scaling Fix previews
1 parent a310bad commit 55fe3f8

40 files changed

Lines changed: 328 additions & 325 deletions

RIADigiDoc.xcodeproj/project.pbxproj

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,6 @@
208208
Util/Theme/ThemeSettingsProtocol.swift,
209209
ViewModel/AdvancedSettingsViewModel.swift,
210210
ViewModel/CertificateDetailViewModel.swift,
211-
ViewModel/ContentViewModel.swift,
212211
ViewModel/Crypto/DecryptRootViewModel.swift,
213212
ViewModel/Crypto/DecryptRootViewModelProtocol.swift,
214213
ViewModel/CryptoFileOpeningViewModel.swift,
@@ -230,7 +229,6 @@
230229
ViewModel/MyEid/Shared/SharedMyEidSessionProtocol.swift,
231230
ViewModel/Protocols/AdvancedSettingsViewModelProtocol.swift,
232231
ViewModel/Protocols/CertificateDetailViewModelProtocol.swift,
233-
ViewModel/Protocols/ContentViewModelProtocol.swift,
234232
ViewModel/Protocols/CryptoFileOpeningViewModelProtocol.swift,
235233
ViewModel/Protocols/CryptoHomeViewModelProtocol.swift,
236234
ViewModel/Protocols/DataFilesViewModelProtocol.swift,

RIADigiDoc/ContentView.swift

Lines changed: 1 addition & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -19,92 +19,10 @@
1919

2020
import FactoryKit
2121
import SwiftUI
22-
import UtilsLib
2322

2423
struct ContentView: View {
25-
@Environment(\.scenePhase) private var scenePhase
26-
@AppTheme private var theme
27-
@AppTypography private var typography
28-
@Environment(LanguageSettings.self) private var languageSettings
29-
30-
@Environment(NavigationPathManager.self) private var pathManager
31-
32-
@State private var viewModel: ContentViewModel
33-
34-
@State private var openedUrls: [URL] = []
35-
@State private var showHomeMenuBottomSheetFromButton = false
36-
@State private var showSettingsBottomSheetFromButton = false
37-
38-
@State private var navigateToAccessibility = false
39-
@State private var navigateToInfo = false
40-
@State private var navigateToDiagnostics = false
41-
42-
@State private var sharedFilesLoadingTask: Task<Void, Never>?
43-
44-
private var homeMenuBottomSheetActions: [BottomSheetButton] {
45-
HomeMenuBottomSheetActions.actions(
46-
onInfoClick: {
47-
pathManager.navigate(to: .infoView)
48-
},
49-
onAccessibilityClick: {
50-
pathManager.navigate(to: .accessibilityView)
51-
},
52-
onDiagnosticsClick: {
53-
pathManager.navigate(to: .diagnosticsView)
54-
}
55-
)
56-
}
57-
58-
init() {
59-
_viewModel = State(wrappedValue: Container.shared.contentViewModel())
60-
}
61-
6224
var body: some View {
63-
TopBarContainer(
64-
leftIcon: "ic_m3_menu_48pt_wght400",
65-
leftIconAccessibility: "Menu",
66-
onLeftClick: {
67-
showHomeMenuBottomSheetFromButton = true
68-
},
69-
content: {
70-
ScrollView {
71-
VStack {
72-
HomeView(externalFiles: $openedUrls)
73-
Spacer()
74-
}
75-
}
76-
.background(theme.surface)
77-
.onOpenURL { url in
78-
openedUrls = [url]
79-
}
80-
.onAppear {
81-
if scenePhase == .active {
82-
sharedFilesLoadingTask = Task {
83-
let sharedFiles = await viewModel.getSharedFiles()
84-
if !sharedFiles.isEmpty {
85-
openedUrls = sharedFiles
86-
}
87-
}
88-
}
89-
}
90-
.onChange(of: scenePhase) { _, newPhase in
91-
if newPhase == .active {
92-
sharedFilesLoadingTask?.cancel()
93-
94-
sharedFilesLoadingTask = Task {
95-
let sharedFiles = await viewModel.getSharedFiles()
96-
if !sharedFiles.isEmpty {
97-
openedUrls = sharedFiles
98-
}
99-
}
100-
}
101-
}
102-
.onDisappear {
103-
sharedFilesLoadingTask?.cancel()
104-
}
105-
}
106-
)
107-
.bottomSheet(isPresented: $showHomeMenuBottomSheetFromButton, actions: homeMenuBottomSheetActions)
25+
HomeView()
10826
}
10927
}
11028

RIADigiDoc/DI/AppContainer.swift

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ extension Container {
9090
self { @MainActor in
9191
HomeViewModel(
9292
sharedContainerViewModel: self.sharedContainerViewModel(),
93-
fileManager: self.fileManager()
93+
fileManager: self.fileManager(),
94+
fileUtil: self.fileUtil()
9495
)
9596
}
9697
}
@@ -209,17 +210,6 @@ extension Container {
209210
}
210211
}
211212

212-
@MainActor
213-
var contentViewModel: Factory<ContentViewModel> {
214-
self {
215-
@MainActor in
216-
ContentViewModel(
217-
fileUtil: self.fileUtil(),
218-
fileManager: self.fileManager()
219-
)
220-
}
221-
}
222-
223213
@MainActor
224214
var recentDocumentsViewModel: Factory<RecentDocumentsViewModel> {
225215
self {

RIADigiDoc/Supporting files/Localizable.xcstrings

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4442,74 +4442,74 @@
44424442
}
44434443
}
44444444
},
4445-
"Menu language" : {
4446-
"comment" : "Menu language",
4445+
"Menu language selected" : {
4446+
"comment" : "Menu language selected",
44474447
"extractionState" : "manual",
44484448
"localizations" : {
44494449
"en" : {
44504450
"stringUnit" : {
44514451
"state" : "translated",
4452-
"value" : "Language"
4452+
"value" : "selected"
44534453
}
44544454
},
44554455
"et" : {
44564456
"stringUnit" : {
44574457
"state" : "translated",
4458-
"value" : "Keel"
4458+
"value" : "valitud"
44594459
}
44604460
}
44614461
}
44624462
},
4463-
"Menu language selected" : {
4464-
"comment" : "Menu language selected",
4463+
"Menu language unselected" : {
4464+
"comment" : "Menu language",
44654465
"extractionState" : "manual",
44664466
"localizations" : {
44674467
"en" : {
44684468
"stringUnit" : {
44694469
"state" : "translated",
4470-
"value" : "Language selected"
4470+
"value" : "unselected"
44714471
}
44724472
},
44734473
"et" : {
44744474
"stringUnit" : {
44754475
"state" : "translated",
4476-
"value" : "Keel valitud"
4476+
"value" : "valimata"
44774477
}
44784478
}
44794479
}
44804480
},
4481-
"Menu theme" : {
4482-
"comment" : "Menu theme for accessibility",
4481+
"Menu theme selected" : {
4482+
"comment" : "Menu theme selected for accessibility",
44834483
"extractionState" : "manual",
44844484
"localizations" : {
44854485
"en" : {
44864486
"stringUnit" : {
44874487
"state" : "translated",
4488-
"value" : "Theme"
4488+
"value" : "Theme selected"
44894489
}
44904490
},
44914491
"et" : {
44924492
"stringUnit" : {
44934493
"state" : "translated",
4494-
"value" : "Teema"
4494+
"value" : "Teema valitud"
44954495
}
44964496
}
44974497
}
44984498
},
4499-
"Menu theme selected" : {
4500-
"comment" : "Menu theme selected for accessibility",
4499+
"Menu theme unselected" : {
4500+
"comment" : "Menu theme for accessibility",
45014501
"extractionState" : "manual",
45024502
"localizations" : {
45034503
"en" : {
45044504
"stringUnit" : {
45054505
"state" : "translated",
4506-
"value" : "Theme selected"
4506+
"value" : "Theme unselected"
45074507
}
45084508
},
45094509
"et" : {
45104510
"stringUnit" : {
45114511
"state" : "translated",
4512-
"value" : "Teema valitud"
4512+
"value" : "Teema valimata"
45134513
}
45144514
}
45154515
}

RIADigiDoc/UI/Component/AccessibilityView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,5 @@ struct AccessibilityView: View {
5454
AccessibilityView()
5555
.environment(Container.shared.languageSettings())
5656
.environment(Container.shared.themeSettings())
57+
.environment(NavigationPathManager())
5758
}

RIADigiDoc/UI/Component/AdvancedSettingsView.swift

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,9 @@ struct AdvancedSettingsView: View {
2424
@AppTheme private var theme
2525
@AppTypography private var typography
2626

27+
@Environment(\.accessibilityVoiceOverEnabled) private var voiceOverEnabled
2728
@Environment(LanguageSettings.self) private var languageSettings
28-
2929
@Environment(\.dismiss) private var dismiss
30-
3130
@Environment(NavigationPathManager.self) private var pathManager
3231

3332
@State private var checkedAskRoleAndAddress = false
@@ -105,14 +104,7 @@ struct AdvancedSettingsView: View {
105104
}
106105

107106
Button(
108-
action: {
109-
Task {
110-
await viewModel.restoreDefaultSettings()
111-
Toast.show(
112-
languageSettings.localized("Main settings use default settings message")
113-
)
114-
}
115-
},
107+
action: onRestoreDefaultSettingsClick,
116108
label: {
117109
Text(languageSettings.localized("Main settings use default settings button title"))
118110
.font(typography.labelLarge)
@@ -128,6 +120,20 @@ struct AdvancedSettingsView: View {
128120
}
129121
)
130122
}
123+
124+
private func onRestoreDefaultSettingsClick() {
125+
Task {
126+
await viewModel.restoreDefaultSettings()
127+
let message =
128+
languageSettings.localized("Main settings use default settings message")
129+
if voiceOverEnabled {
130+
var saveButtonAccessibilityAnnouncement = AttributedString(message)
131+
saveButtonAccessibilityAnnouncement.accessibilitySpeechAnnouncementPriority = .high
132+
AccessibilityNotification.Announcement(saveButtonAccessibilityAnnouncement).post()
133+
}
134+
Toast.show(message)
135+
}
136+
}
131137
}
132138

133139
// MARK: - Preview

RIADigiDoc/UI/Component/AdvancedSettingsView/AdvancedSettingsLinkRow.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,13 @@ struct AdvancedSettingsLinkRow: View {
4141
.scaledToFit()
4242
.frame(width: Dimensions.Icon.IconSizeXXS, height: Dimensions.Icon.IconSizeXXS)
4343
.foregroundStyle(theme.onSurface)
44-
.accessibilityLabel(label.lowercased())
44+
.accessibilityHidden(true)
4545
}
4646
.contentShape(Rectangle())
4747
.padding(.vertical, Dimensions.Padding.SPadding)
4848
}
4949
.buttonStyle(.plain)
50+
.accessibilityLabel(label.lowercased())
5051
}
5152
}
5253

RIADigiDoc/UI/Component/Container/CertificateDetailView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,4 +436,5 @@ struct CertificateDetailView: View {
436436
)
437437
.environment(Container.shared.languageSettings())
438438
.environment(Container.shared.themeSettings())
439+
.environment(NavigationPathManager())
439440
}

RIADigiDoc/UI/Component/Container/ContainerNotificationsView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,5 @@ struct ContainerNotificationsView: View {
100100
)
101101
.environment(Container.shared.languageSettings())
102102
.environment(Container.shared.themeSettings())
103+
.environment(NavigationPathManager())
103104
}

RIADigiDoc/UI/Component/Container/Crypto/EncryptView.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,4 +532,5 @@ struct EncryptView: View {
532532
EncryptView()
533533
.environment(Container.shared.languageSettings())
534534
.environment(Container.shared.themeSettings())
535+
.environment(NavigationPathManager())
535536
}

0 commit comments

Comments
 (0)