Improve media alt edit

This commit is contained in:
Thomas Ricouard 2024-05-15 08:28:05 +02:00
parent a996aace80
commit 86c053344b

View file

@ -35,8 +35,11 @@ extension StatusEditor {
text: $imageDescription, text: $imageDescription,
axis: .vertical) axis: .vertical)
.focused($isFieldFocused) .focused($isFieldFocused)
generateButton if imageDescription.isEmpty {
translateButton generateButton
} else {
translateButton
}
} }
.listRowBackground(theme.primaryBackgroundColor) .listRowBackground(theme.primaryBackgroundColor)
Section { Section {
@ -113,8 +116,7 @@ extension StatusEditor {
if let description = await generateDescription(url: url) { if let description = await generateDescription(url: url) {
imageDescription = description imageDescription = description
#if canImport(_Translation_SwiftUI) #if canImport(_Translation_SwiftUI)
let lang = preferences.serverPreferences?.postLanguage ?? Locale.current.language.languageCode?.identifier if #available(iOS 17.4, *) {
if #available(iOS 17.4, *), lang != nil, lang != "en", DeepLUserAPIHandler.readKey().isEmpty == false {
withAnimation { withAnimation {
showTranslateButton = true showTranslateButton = true
} }