mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-25 01:31:02 +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";
|
"identities.pending" = "Pending";
|
||||||
"lists.new-list-title" = "New List Title";
|
"lists.new-list-title" = "New List Title";
|
||||||
"load-more" = "Load More";
|
"load-more" = "Load More";
|
||||||
"load-more.newer.accessibility-label" = "Load newer items";
|
"load-more.above.accessibility-label.post" = "Load posts from post above";
|
||||||
"load-more.older.accessibility-label" = "Load older items";
|
"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.timelines" = "Timelines";
|
||||||
"main-navigation.explore" = "Explore";
|
"main-navigation.explore" = "Explore";
|
||||||
"main-navigation.notifications" = "Notifications";
|
"main-navigation.notifications" = "Notifications";
|
||||||
|
|
|
@ -211,7 +211,8 @@ extension CollectionItemsViewModel: CollectionViewModel {
|
||||||
|
|
||||||
let viewModel = LoadMoreViewModel(
|
let viewModel = LoadMoreViewModel(
|
||||||
loadMoreService: collectionService.navigationService.loadMoreService(loadMore: loadMore),
|
loadMoreService: collectionService.navigationService.loadMoreService(loadMore: loadMore),
|
||||||
eventsSubject: eventsSubject)
|
eventsSubject: eventsSubject,
|
||||||
|
identityContext: identityContext)
|
||||||
|
|
||||||
viewModelCache[item] = viewModel
|
viewModelCache[item] = viewModel
|
||||||
|
|
||||||
|
|
|
@ -6,14 +6,17 @@ import ServiceLayer
|
||||||
public final class LoadMoreViewModel: ObservableObject {
|
public final class LoadMoreViewModel: ObservableObject {
|
||||||
public var direction = LoadMore.Direction.up
|
public var direction = LoadMore.Direction.up
|
||||||
@Published public private(set) var loading = false
|
@Published public private(set) var loading = false
|
||||||
|
public let identityContext: IdentityContext
|
||||||
|
|
||||||
private let loadMoreService: LoadMoreService
|
private let loadMoreService: LoadMoreService
|
||||||
private let eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>
|
private let eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>
|
||||||
|
|
||||||
init(loadMoreService: LoadMoreService,
|
init(loadMoreService: LoadMoreService,
|
||||||
eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>) {
|
eventsSubject: PassthroughSubject<AnyPublisher<CollectionItemEvent, Error>, Never>,
|
||||||
|
identityContext: IdentityContext) {
|
||||||
self.loadMoreService = loadMoreService
|
self.loadMoreService = loadMoreService
|
||||||
self.eventsSubject = eventsSubject
|
self.eventsSubject = eventsSubject
|
||||||
|
self.identityContext = identityContext
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -110,17 +110,32 @@ private extension LoadMoreView {
|
||||||
|
|
||||||
isAccessibilityElement = true
|
isAccessibilityElement = true
|
||||||
accessibilityLabel = NSLocalizedString("load-more", comment: "")
|
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 = [
|
accessibilityCustomActions = [
|
||||||
UIAccessibilityCustomAction(
|
UIAccessibilityCustomAction(
|
||||||
name: NSLocalizedString("load-more.older.accessibility-label", comment: "")) { [weak self] _ in
|
name: aboveAccessibilityActionName) { [weak self] _ in
|
||||||
self?.loadMoreConfiguration.viewModel.direction = .down
|
self?.directionChange = -Self.directionChangeMax
|
||||||
|
self?.updateDirectionChange(animated: false)
|
||||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
},
|
},
|
||||||
UIAccessibilityCustomAction(
|
UIAccessibilityCustomAction(
|
||||||
name: NSLocalizedString("load-more.newer.accessibility-label", comment: "")) { [weak self] _ in
|
name: belowAccessibilityActionName) { [weak self] _ in
|
||||||
self?.loadMoreConfiguration.viewModel.direction = .up
|
self?.directionChange = Self.directionChangeMax
|
||||||
|
self?.updateDirectionChange(animated: false)
|
||||||
self?.loadMoreConfiguration.viewModel.loadMore()
|
self?.loadMoreConfiguration.viewModel.loadMore()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
|
|
Loading…
Reference in a new issue