diff --git a/Modules/InboxCoreUI/Sources/LongPressFormBigButton.swift b/Modules/InboxCoreUI/Sources/LongPressFormBigButton.swift index 767c163f48..6f11f062a1 100644 --- a/Modules/InboxCoreUI/Sources/LongPressFormBigButton.swift +++ b/Modules/InboxCoreUI/Sources/LongPressFormBigButton.swift @@ -45,9 +45,31 @@ public struct LongPressFormBigButton: View { symbol: .none ) .textSelection(.enabled) - .onLongPressGesture(perform: {}, onPressingChanged: { changed in isPressed = changed }) + .conditionalLongPress(onPressingChanged: { changed in isPressed = changed }) .onTapGesture(perform: onTap) .background(isPressed && hasAccentTextColor ? DS.Color.InteractionWeak.pressed : .clear) .background(DS.Color.BackgroundInverted.secondary) } } + +private extension View { + + func conditionalLongPress(onPressingChanged: ((Bool) -> Void)?) -> some View { + modifier(ConditionalLongPress(onPressingChanged: onPressingChanged)) + } + +} + +private struct ConditionalLongPress: ViewModifier { + let onPressingChanged: ((Bool) -> Void)? + + func body(content: Content) -> some View { + if #available(iOS 18, *) { + content + .onLongPressGesture(perform: {}, onPressingChanged: onPressingChanged) + } else { + content + } + } + +}