mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2024-11-25 09:41:02 +00:00
Add translate for image alt
This commit is contained in:
parent
18a1d17230
commit
a996aace80
1 changed files with 9 additions and 0 deletions
|
@ -258,6 +258,7 @@ struct AltTextButton: View {
|
||||||
@Environment(Theme.self) private var theme
|
@Environment(Theme.self) private var theme
|
||||||
|
|
||||||
@State private var isDisplayingAlert = false
|
@State private var isDisplayingAlert = false
|
||||||
|
@State private var isDisplayingTranslation = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
if !isInCaptureMode,
|
if !isInCaptureMode,
|
||||||
|
@ -278,6 +279,9 @@ struct AltTextButton: View {
|
||||||
.buttonStyle(.borderless)
|
.buttonStyle(.borderless)
|
||||||
.padding(EdgeInsets(top: 5, leading: 7, bottom: 5, trailing: 7))
|
.padding(EdgeInsets(top: 5, leading: 7, bottom: 5, trailing: 7))
|
||||||
.background(.thinMaterial)
|
.background(.thinMaterial)
|
||||||
|
#if canImport(_Translation_SwiftUI)
|
||||||
|
.addTranslateView(isPresented: $isDisplayingTranslation, text: text)
|
||||||
|
#endif
|
||||||
#if os(visionOS)
|
#if os(visionOS)
|
||||||
.clipShape(Capsule())
|
.clipShape(Capsule())
|
||||||
#endif
|
#endif
|
||||||
|
@ -289,6 +293,11 @@ struct AltTextButton: View {
|
||||||
) {
|
) {
|
||||||
Button("alert.button.ok", action: {})
|
Button("alert.button.ok", action: {})
|
||||||
Button("status.action.copy-text", action: { UIPasteboard.general.string = text })
|
Button("status.action.copy-text", action: { UIPasteboard.general.string = text })
|
||||||
|
#if canImport(_Translation_SwiftUI)
|
||||||
|
if #available(iOS 17.4, *) {
|
||||||
|
Button("status.action.translate", action: { isDisplayingTranslation = true })
|
||||||
|
}
|
||||||
|
#endif
|
||||||
} message: {
|
} message: {
|
||||||
Text(text)
|
Text(text)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue