mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
VoiceOver improvement
This commit is contained in:
parent
872a8722af
commit
8a7bf4ddb6
4 changed files with 29 additions and 8 deletions
|
@ -149,8 +149,10 @@
|
|||
"identities.pending" = "Pending";
|
||||
"lists.new-list-title" = "New List Title";
|
||||
"load-more" = "Load More";
|
||||
"load-more.newer.accessibility-label" = "Load newer items";
|
||||
"load-more.older.accessibility-label" = "Load older items";
|
||||
"load-more.above.accessibility-label.post" = "Load posts from post above";
|
||||
"load-more.above.accessibility-label.toot" = "Load toots from toot above";
|
||||
"load-more.below.accessibility-label.post" = "Load posts from post below";
|
||||
"load-more.below.accessibility-label.toot" = "Load toots from toot below";
|
||||
"main-navigation.timelines" = "Timelines";
|
||||
"main-navigation.explore" = "Explore";
|
||||
"main-navigation.notifications" = "Notifications";
|
||||
|
|
|
@ -211,7 +211,8 @@ extension CollectionItemsViewModel: CollectionViewModel {
|
|||
|
||||
let viewModel = LoadMoreViewModel(
|
||||
loadMoreService: collectionService.navigationService.loadMoreService(loadMore: loadMore),
|
||||
eventsSubject: eventsSubject)
|
||||
eventsSubject: eventsSubject,
|
||||
identityContext: identityContext)
|
||||
|
||||
viewModelCache[item] = viewModel
|
||||
|
||||
|
|
|
@ -6,14 +6,17 @@ import ServiceLayer
|
|||
public final class LoadMoreViewModel: ObservableObject {
|
||||
public var direction = LoadMore.Direction.up
|
||||
@Published public private(set) var loading = false
|
||||
public let identityContext: IdentityContext
|
||||
|
||||
private let loadMoreService: LoadMoreService
|
||||
private let eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>
|
||||
|
||||
init(loadMoreService: LoadMoreService,
|
||||
eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>) {
|
||||
eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>,
|
||||
identityContext: IdentityContext) {
|
||||
self.loadMoreService = loadMoreService
|
||||
self.eventsSubject = eventsSubject
|
||||
self.identityContext = identityContext
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -110,17 +110,32 @@ private extension LoadMoreView {
|
|||
|
||||
isAccessibilityElement = true
|
||||
accessibilityLabel = NSLocalizedString("load-more", comment: "")
|
||||
|
||||
let aboveAccessibilityActionName: String
|
||||
let belowAccessibilityActionName: String
|
||||
|
||||
switch loadMoreConfiguration.viewModel.identityContext.appPreferences.statusWord {
|
||||
case .toot:
|
||||
aboveAccessibilityActionName = NSLocalizedString("load-more.above.accessibility-label.toot", comment: "")
|
||||
belowAccessibilityActionName = NSLocalizedString("load-more.below.accessibility-label.toot", comment: "")
|
||||
case .post:
|
||||
aboveAccessibilityActionName = NSLocalizedString("load-more.above.accessibility-label.post", comment: "")
|
||||
belowAccessibilityActionName = NSLocalizedString("load-more.below.accessibility-label.post", comment: "")
|
||||
}
|
||||
|
||||
accessibilityCustomActions = [
|
||||
UIAccessibilityCustomAction(
|
||||
name: NSLocalizedString("load-more.older.accessibility-label", comment: "")) { [weak self] _ in
|
||||
self?.loadMoreConfiguration.viewModel.direction = .down
|
||||
name: aboveAccessibilityActionName) { [weak self] _ in
|
||||
self?.directionChange = -Self.directionChangeMax
|
||||
self?.updateDirectionChange(animated: false)
|
||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||
|
||||
return true
|
||||
},
|
||||
UIAccessibilityCustomAction(
|
||||
name: NSLocalizedString("load-more.newer.accessibility-label", comment: "")) { [weak self] _ in
|
||||
self?.loadMoreConfiguration.viewModel.direction = .up
|
||||
name: belowAccessibilityActionName) { [weak self] _ in
|
||||
self?.directionChange = Self.directionChangeMax
|
||||
self?.updateDirectionChange(animated: false)
|
||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||
|
||||
return true
|
||||
|
|
Loading…
Reference in a new issue