Improve media alt edit

This commit is contained in:
Thomas Ricouard 2024-05-15 08:28:05 +02:00
parent a996aace80
commit 86c053344b
1 changed files with 6 additions and 4 deletions

View File

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