-
Couldn't load subscription status.
- Fork 111
Enhance UI elements #1022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Enhance UI elements #1022
Changes from all commits
e5d590f
55b5a0b
2e568c5
562d874
b00daff
19e65dc
82cd117
0360af4
9781f20
2f171a3
b2be7fa
49ae19a
2e0846d
0ade1eb
a406060
53227c7
0fe4ac9
7c91fb8
389d7dd
8112754
f11c47d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -132,19 +132,15 @@ public struct ChatChannelSwipeableListItem<Factory: ViewFactory, ChannelListItem | |
| } | ||
|
|
||
| private var showTrailingSwipeActions: Bool { | ||
| #if DEBUG | ||
| let view = factory.makeTrailingSwipeActionsView( | ||
| channel: channel, | ||
| offsetX: offsetX, | ||
| buttonWidth: buttonWidth, | ||
| swipedChannelId: $swipedChannelId, | ||
| leftButtonTapped: trailingLeftButtonTapped, | ||
| rightButtonTapped: trailingRightButtonTapped | ||
| ) | ||
| return !(view is EmptyView) | ||
| #else | ||
| return !(trailingSwipeActions is EmptyView) | ||
| #endif | ||
| ) as? TrailingSwipeActionsView | ||
| return view?.hasActions ?? true | ||
|
Comment on lines
+142
to
+143
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are we changing this? |
||
| } | ||
|
|
||
| private var leadingSwipeActions: some View { | ||
|
|
@@ -276,20 +272,27 @@ public struct TrailingSwipeActionsView: View { | |
| var buttonWidth: CGFloat | ||
| var leftButtonTapped: (ChatChannel) -> Void | ||
| var rightButtonTapped: (ChatChannel) -> Void | ||
|
|
||
| var hasActions: Bool { | ||
| channel.ownCapabilities.contains(.moreOptionsChannel) || | ||
| channel.ownCapabilities.contains(.deleteChannel) | ||
| } | ||
|
|
||
| public var body: some View { | ||
| HStack { | ||
| Spacer() | ||
| ZStack { | ||
| HStack(spacing: 0) { | ||
| ActionItemButton(imageName: "ellipsis", action: { | ||
| withAnimation { | ||
| leftButtonTapped(channel) | ||
| } | ||
| }) | ||
| .frame(width: buttonWidth) | ||
| .foregroundColor(Color(colors.text)) | ||
| .background(Color(colors.background1)) | ||
| if channel.ownCapabilities.contains(.moreOptionsChannel) { | ||
| ActionItemButton(imageName: "ellipsis", action: { | ||
| withAnimation { | ||
| leftButtonTapped(channel) | ||
| } | ||
| }) | ||
| .frame(width: buttonWidth) | ||
| .foregroundColor(Color(colors.text)) | ||
| .background(Color(colors.background1)) | ||
| } | ||
|
|
||
| if channel.ownCapabilities.contains(.deleteChannel) { | ||
| ActionItemButton(imageName: "trash", action: { | ||
|
|
@@ -331,3 +334,11 @@ public struct ActionItemButton: View { | |
| } | ||
| } | ||
| } | ||
|
|
||
| /* | ||
| If you wanna add this button to 'ChannelCapability' of ChatChannel manual | ||
| */ | ||
| extension ChannelCapability { | ||
| /// Ability to add more Options the channel. | ||
| public static let moreOptionsChannel: Self = "moreOptions-channel" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where did you see this capability? I can't find it here: https://getstream.io/chat/docs/ios-swift/channel_capabilities/ There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added .moreOptionsChannel as a custom capability to control the visibility of the “more options” button when swiping on a channel in the list. Is there a recommended or built-in way in the Stream SDK to achieve this behavior (conditionally hiding this button) without introducing a custom capability? UI Update – Channel More Options ButtonAfter Change
Before Change
|
||
| } | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a breaking change of the SDK, so we can't change this at the moment. Can you find an alternative?