* Add alt text validation option to user preferences * Fix typos/linting issues * Update accessibility setting to match styles * Update the required alt text reminder to go away once it's added --------- Co-authored-by: Emma Fuller <emma@emmafuller.dev>
This commit is contained in:
parent
bc55241c9a
commit
696bffe832
5 changed files with 76 additions and 3 deletions
|
@ -23,6 +23,10 @@ export class GalleryModel {
|
|||
return this.images.length
|
||||
}
|
||||
|
||||
get needsAltText() {
|
||||
return this.images.some(image => image.altText.trim() === '')
|
||||
}
|
||||
|
||||
async add(image_: Omit<RNImage, 'size'>) {
|
||||
if (this.size >= 4) {
|
||||
return
|
||||
|
|
|
@ -53,6 +53,7 @@ export class PreferencesModel {
|
|||
homeFeedRepliesThreshold: number = 2
|
||||
homeFeedRepostsEnabled: boolean = true
|
||||
homeFeedQuotePostsEnabled: boolean = true
|
||||
requireAltTextEnabled: boolean = false
|
||||
|
||||
// used to linearize async modifications to state
|
||||
lock = new AwaitLock()
|
||||
|
@ -72,6 +73,7 @@ export class PreferencesModel {
|
|||
homeFeedRepliesThreshold: this.homeFeedRepliesThreshold,
|
||||
homeFeedRepostsEnabled: this.homeFeedRepostsEnabled,
|
||||
homeFeedQuotePostsEnabled: this.homeFeedQuotePostsEnabled,
|
||||
requireAltTextEnabled: this.requireAltTextEnabled,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,6 +154,13 @@ export class PreferencesModel {
|
|||
) {
|
||||
this.homeFeedQuotePostsEnabled = v.homeFeedQuotePostsEnabled
|
||||
}
|
||||
// check if requiring alt text is enabled in preferences, then hydrate
|
||||
if (
|
||||
hasProp(v, 'requireAltTextEnabled') &&
|
||||
typeof v.requireAltTextEnabled === 'boolean'
|
||||
) {
|
||||
this.requireAltTextEnabled = v.requireAltTextEnabled
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -467,4 +476,8 @@ export class PreferencesModel {
|
|||
toggleHomeFeedQuotePostsEnabled() {
|
||||
this.homeFeedQuotePostsEnabled = !this.homeFeedQuotePostsEnabled
|
||||
}
|
||||
|
||||
toggleRequireAltTextEnabled() {
|
||||
this.requireAltTextEnabled = !this.requireAltTextEnabled
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue