Dimillian / IceCubesApp

A SwiftUI Mastodon client
https://apps.apple.com/us/app/ice-cubes-for-mastodon/id6444915884
GNU Affero General Public License v3.0
4.89k stars 461 forks source link

Fix StatusRowContentView invade SwipeActions area #2007

Closed tkgka closed 2 months ago

tkgka commented 3 months ago

Fix issue that StatusRowContentView invade SwipeActions area Issue Bug: Swipe actions are overlapped with images #1845

before:

https://github.com/Dimillian/IceCubesApp/assets/52348220/45702f05-b831-4274-a181-fa9ad178376c

after:

https://github.com/Dimillian/IceCubesApp/assets/52348220/38eb9ac3-eaf3-409c-9b44-968163daf28a

Dimillian commented 3 months ago

Same problem as one of the other PR for me, really too bad the content is cut when the row is not swipped

tkgka commented 3 months ago

Same problem as one of the other PR for me, really too bad the content is cut when the row is not swipped

what if remove padding from the content or add cornerRadius for the section?

Dimillian commented 3 months ago

Same problem as one of the other PR for me, really too bad the content is cut when the row is not swipped

what if remove padding from the content or add cornerRadius for the section?

Worth to try

tkgka commented 3 months ago

@Dimillian which one do you prefer

  1. add cornerRadius

https://github.com/Dimillian/IceCubesApp/assets/52348220/90148aa4-541c-44a8-b90f-1c6ac99a897b

 Group {
      if attachments.count == 1 {
        FeaturedImagePreView(
          attachment: attachments[0],
          maxSize: imageMaxHeight == 300
            ? nil
            : CGSize(width: imageMaxHeight, height: imageMaxHeight),
          sensitive: sensitive
        )
        .accessibilityElement(children: .ignore)
        .accessibilityLabel(Self.accessibilityLabel(for: attachments[0]))
        .accessibilityAddTraits([.isButton, .isImage])
        .onTapGesture { tabAction(for: 0) }
      } else {
        ScrollView(.horizontal, showsIndicators: showsScrollIndicators) {
          HStack {
            ForEach(attachments) { attachment in
              makeAttachmentView(attachment)
            }
          }
          .padding(.bottom, scrollBottomPadding)
        }
      }
    }
    .cornerRadius(8.0) // added
  }
  1. remove padding

https://github.com/Dimillian/IceCubesApp/assets/52348220/7a0accd9-f472-4afd-ac12-45a9255898f5

 Group {
      if attachments.count == 1 {
        FeaturedImagePreView(
          attachment: attachments[0],
          maxSize: imageMaxHeight == 300
            ? nil
            : CGSize(width: imageMaxHeight, height: imageMaxHeight),
          sensitive: sensitive
        )
        .accessibilityElement(children: .ignore)
        .accessibilityLabel(Self.accessibilityLabel(for: attachments[0]))
        .accessibilityAddTraits([.isButton, .isImage])
        .onTapGesture { tabAction(for: 0) }
      } else {
        ScrollView(.horizontal, showsIndicators: showsScrollIndicators) {
          HStack {
            ForEach(attachments) { attachment in
              makeAttachmentView(attachment)
            }
          }
          .padding(.bottom, scrollBottomPadding)
        }
      }
    }
    .padding(.horizontal, -1 * .layoutPadding) // added
  }
Dimillian commented 3 months ago

Unfortunately, both of them have an issue: the one without the padding is too close to the edge. Not sure we can properly fix it without altering the visual too much...

Dimillian commented 3 months ago

I mean I prefer the bug on swipe to the visual downgrade on every carrousel.

tkgka commented 3 months ago

it can simply fix by add padding on the HStack

Group {
      if attachments.count == 1 {
        FeaturedImagePreView(
          attachment: attachments[0],
          maxSize: imageMaxHeight == 300
            ? nil
            : CGSize(width: imageMaxHeight, height: imageMaxHeight),
          sensitive: sensitive
        )
        .padding(.horizontal, .layoutPadding) // added
        .accessibilityElement(children: .ignore)
        .accessibilityLabel(Self.accessibilityLabel(for: attachments[0]))
        .accessibilityAddTraits([.isButton, .isImage])
        .onTapGesture { tabAction(for: 0) }
      } else {
        ScrollView(.horizontal, showsIndicators: showsScrollIndicators) {
          HStack {
            ForEach(attachments) { attachment in
              makeAttachmentView(attachment)
            }
          }
          .padding(.bottom, scrollBottomPadding)
          .padding(.horizontal, .layoutPadding) // added
        }
      }
    }
    .padding(.horizontal, -1 * .layoutPadding) // added

https://github.com/Dimillian/IceCubesApp/assets/52348220/d9f7d41d-8a5b-4f90-97a6-e71dbc2d0263

Dimillian commented 3 months ago

🚀 let's go with this!

tkgka commented 3 months ago

@Dimillian made a commit for that :)