Skip to content

Commit 81cb3c2

Browse files
jullianmgithub-actions[bot]
authored andcommitted
fix: replace attachment menu with alert - WPB-21656 (#4272)
1 parent 7cf8000 commit 81cb3c2

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

WireMessaging/Sources/WireMessagingUI/Resources/Localization/en.lproj/Localizable.strings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@
109109
"conversation.channelHistory.fetchChannelHistoryDepthOptions.error" = "An error occurred while fetching channel history depth options.";
110110
"conversation.channelHistory.updateHistoryDepth.error" = "An error occurred while updating channel history depth.";
111111
"conversation.file.preview.open" = "Open preview";
112+
"conversation.draft.attachmentMenu.errorTitle" = "Unable to load file";
112113
"conversation.draft.attachmentMenu.retry" = "Retry";
113114
"conversation.draft.attachmentMenu.remove" = "Remove File";
114115

WireMessaging/Sources/WireMessagingUI/WireDrive/Components/AttachmentsCarousel/AttachmentsCarousel.swift

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ private struct AttachmentsCarouselItemView: View {
6767
static let buttonCornerRadius: CGFloat = 24
6868
}
6969

70+
@State private var showErrorAlert = false
71+
7072
let item: AttachmentsCarouselItem
7173
let onTap: () -> Void
7274
let onRemove: () -> Void
@@ -83,7 +85,15 @@ private struct AttachmentsCarouselItemView: View {
8385
.padding(.trailing, Constants.trailingPadding)
8486

8587
cornerButton
86-
}
88+
}.alert(
89+
L10n.Localizable.Conversation.Draft.AttachmentMenu.errorTitle,
90+
isPresented: $showErrorAlert,
91+
actions: {
92+
Button(L10n.Localizable.Conversation.Draft.AttachmentMenu.remove, action: { onRemove() })
93+
Button(L10n.Localizable.Conversation.Draft.AttachmentMenu.retry, action: { onRetry() })
94+
95+
}
96+
)
8797
}
8898

8999
@ViewBuilder var content: some View {
@@ -119,9 +129,8 @@ private struct AttachmentsCarouselItemView: View {
119129
Spacer()
120130

121131
if item.state.isFailed {
122-
Menu {
123-
Button(L10n.Localizable.Conversation.Draft.AttachmentMenu.retry, action: onRetry)
124-
Button(L10n.Localizable.Conversation.Draft.AttachmentMenu.remove, action: onRemove)
132+
Button {
133+
showErrorAlert = true
125134
} label: {
126135
Image(systemName: "ellipsis.circle.fill")
127136
.resizable()

0 commit comments

Comments
 (0)