~ knotless Search/
↑↓ move↵ open⇧↵ all results

geesawra.industries/old-fella

Old people's social media app

0
1

feat(composer): remind users to add alt text

Merged geesawra.industries asked to merge into main from geesawra.industries/old-fella:feat/alt-text-reminder
Sources/Oldsky/OldskyApp.swift+20−1
@@ -836,11 +836,14 @@ struct SettingsView: View {
@AppStorage("hideQuotedPosts") private var hideQuotedPosts = false
@AppStorage("hideReplyContexts") private var hideReplyContexts = false
@AppStorage("showGIFsInline") private var showGIFsInline = true
@AppStorage("remindMissingAltText") private var remindMissingAltText = true
var body: some View {
NavigationStack {
List {
Section("Posts") {
Toggle("Remind me to add alt text", isOn: $remindMissingAltText)
.accessibilityIdentifier("remindMissingAltText")
Toggle("Hide quoted posts", isOn: $hideQuotedPosts)
.accessibilityIdentifier("hideQuotedPosts")
Toggle("Hide reply context", isOn: $hideReplyContexts)
@@ -3170,7 +3173,9 @@ struct ComposeView: View {
@State private var selectedItems: [PhotosPickerItem] = []
@State private var attachments: [ImageAttachment] = []
@State private var isLoadingImages = false
@State private var confirmsMissingAltText = false
@State private var confirmsDiscardUncertainDraft = false
@AppStorage("remindMissingAltText") private var remindMissingAltText = true
@FocusState private var textIsFocused: Bool
private let characterLimit = 300
@@ -3250,7 +3255,11 @@ struct ComposeView: View {
}
ToolbarItem(placement: .topBarTrailing) {
Button {
Task { await publish() }
if remindMissingAltText && attachments.contains(where: { $0.altText.trimmingCharacters(in: .whitespacesAndNewlines).isEmpty }) {
confirmsMissingAltText = true
} else {
Task { await publish() }
}
} label: {
Text("Post")
.fontWeight(.semibold)
@@ -3265,6 +3274,12 @@ struct ComposeView: View {
.accessibilityIdentifier("publishButton")
}
}
.alert("Add alt text?", isPresented: $confirmsMissingAltText) {
Button("Keep editing", role: .cancel) {}
Button("Post without alt text") { Task { await publish() } }
} message: {
Text("Some images do not have alt text. Add descriptions so more people can understand them.")
}
.alert(model.publishResultUnknown ? "Post status unknown" : "Post not sent", isPresented: Binding(
get: { model.publishErrorMessage != nil },
set: { if !$0 { model.clearPublishError() } }
@@ -3290,6 +3305,10 @@ struct ComposeView: View {
if let draft = model.composerDraft(for: draftKey) {
text = draft.text
attachments = draft.attachments
} else if ProcessInfo.processInfo.arguments.contains("-ui-testing"),
ProcessInfo.processInfo.arguments.contains("-ui-testing-compose-images"),
let data = UIImage(systemName: "photo")?.pngData() {
attachments = [ImageAttachment(data: data, altText: "A photo"), ImageAttachment(data: data)]
}
textIsFocused = true
}
Tests/OldskyUITests/OldskyUITests.swift+36−0
@@ -1,6 +1,42 @@
import XCTest
final class OldskyUITests: XCTestCase {
func testMissingAltTextReminderAllowsEditingAndPosting() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images"]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.tabBars.buttons["New post"].tap()
XCTAssertTrue(app.scrollViews["imageAttachments"].waitForExistence(timeout: 5))
app.buttons["publishButton"].tap()
let alert = app.alerts["Add alt text?"]
XCTAssertTrue(alert.waitForExistence(timeout: 5))
alert.buttons["Keep editing"].tap()
XCTAssertTrue(app.textViews["composeTextField"].exists)
app.buttons["publishButton"].tap()
XCTAssertTrue(alert.waitForExistence(timeout: 5))
alert.buttons["Post without alt text"].tap()
XCTAssertTrue(app.navigationBars["Following"].waitForExistence(timeout: 10))
}
func testDisabledMissingAltTextReminderPostsDirectly() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in", "-ui-testing-compose-images"]
app.launch()
XCTAssertTrue(app.buttons["postText-post-1"].waitForExistence(timeout: 10))
app.tabBars.buttons["Settings"].tap()
let toggle = app.switches["remindMissingAltText"]
XCTAssertTrue(toggle.waitForExistence(timeout: 5))
XCTAssertEqual(toggle.value as? String, "1")
toggle.coordinate(withNormalizedOffset: CGVector(dx: 0.95, dy: 0.5)).tap()
XCTAssertEqual(toggle.value as? String, "0")
app.tabBars.buttons["New post"].tap()
XCTAssertTrue(app.scrollViews["imageAttachments"].waitForExistence(timeout: 5))
app.buttons["publishButton"].tap()
XCTAssertTrue(app.navigationBars["Settings"].waitForExistence(timeout: 10))
XCTAssertFalse(app.alerts["Add alt text?"].exists)
}
func testSettingsShowsOpenSourceLicensesAndRepository() {
let app = XCUIApplication()
app.launchArguments = ["-ui-testing", "-ui-testing-signed-in"]
README.md+2−0
@@ -6,6 +6,8 @@ Old Fella is an iPhone app for Bluesky. It keeps the interface small and puts po
Sign in with an existing Bluesky account and an app password. You can read your Following feed, view profiles and conversations, and see notifications inside the app. You can also write posts and replies, attach images, like and repost, quote posts, and follow accounts. Old Fella does not send push notifications.
Old Fella reminds you when an image has no alt text by default. You can turn off the reminder in Settings. When the reminder appears, you can return to editing or post without alt text.
Old Fella has incomplete support for Bluesky content labels and muted words. Do not rely on the app to hide or warn about all content that matches your preferences.
If a report result is unknown, do not send it again. A second report can create a duplicate. Old Fella blocks another report for that subject during the current session. This protection ends when you sign out or restart the app.