Skip to content

Commit

Permalink
Message composer icon and scroll to bottom button dark mode (#562)
Browse files Browse the repository at this point in the history
Remove animations on the composer when entering/exiting edit/reply mode too.
  • Loading branch information
pixlwave authored Feb 10, 2023
1 parent 60ca1c5 commit d0960cf
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 38 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"images" : [
{
"filename" : "timelineComposerSendMessage.svg",
"filename" : "send.svg",
"idiom" : "universal"
}
],
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
1 change: 0 additions & 1 deletion ElementX/Sources/Generated/Assets.swift
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ internal enum Asset {
internal static let appLogo = ImageAsset(name: "Images/app-logo")
internal static let closeCircle = ImageAsset(name: "Images/close_circle")
internal static let timelineComposerSendMessage = ImageAsset(name: "Images/timelineComposerSendMessage")
internal static let timelineScrollToBottom = ImageAsset(name: "Images/timelineScrollToBottom")
}
}
// swiftlint:enable identifier_name line_length nesting type_body_length type_name
Expand Down
18 changes: 12 additions & 6 deletions ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@ struct MessageComposer: View {
@Binding var focused: Bool
let sendingDisabled: Bool
let type: RoomScreenComposerMode
@State private var isMultiline = false

let sendAction: () -> Void
let replyCancellationAction: () -> Void
let editCancellationAction: () -> Void

@State private var isMultiline = false
@ScaledMetric private var sendButtonIconSize = 16

var body: some View {
let roundedRectangle = RoundedRectangle(cornerRadius: borderRadius)
VStack(alignment: .leading, spacing: -6) {
Expand All @@ -48,14 +50,13 @@ struct MessageComposer: View {
.symbolVariant(.fill)
.font(.element.body)
.foregroundColor(sendingDisabled ? .element.quaternaryContent : .global.white)
.padding(5)
.background {
Circle()
.foregroundColor(sendingDisabled ? .clear : .element.brand)
}
}
.disabled(sendingDisabled)
.animation(.elementDefault, value: sendingDisabled)
.animation(.linear(duration: 0.1), value: sendingDisabled)
.keyboardShortcut(.return, modifiers: [.command])
.padding([.vertical, .trailing], 6)
}
Expand All @@ -70,7 +71,9 @@ struct MessageComposer: View {
.opacity(focused ? 1 : 0)
}
}
.animation(.elementDefault, value: type)
// Explicitly disable all animations to fix weirdness with the header immediately
// appearing whilst the text field and keyboard are still animating up to it.
.animation(.noAnimation, value: type)
}

@ViewBuilder
Expand All @@ -93,9 +96,12 @@ struct MessageComposer: View {
.fontWeight(.medium)
.accessibilityLabel(ElementL10n.actionConfirm)
.accessibilityHidden(!type.isEdit)
Image(systemName: "paperplane")
.offset(x: -1, y: 0)
Image(asset: Asset.Images.timelineComposerSendMessage)
.resizable()
.frame(width: sendButtonIconSize, height: sendButtonIconSize)
.padding(EdgeInsets(top: 7, leading: 8, bottom: 7, trailing: 6))
.opacity(type.isEdit ? 0 : 1)
.accessibilityLabel(ElementL10n.actionSend)
.accessibilityHidden(type.isEdit)
}
}
Expand Down
14 changes: 12 additions & 2 deletions ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,18 @@ struct RoomScreen: View {

var scrollToBottomButton: some View {
Button { context.viewState.scrollToBottomPublisher.send(()) } label: {
Image(uiImage: Asset.Images.timelineScrollToBottom.image)
.shadow(radius: 2.0)
Image(systemName: "chevron.down")
.font(.element.body)
.fontWeight(.semibold)
.foregroundColor(.element.secondaryContent)
.padding(13)
.offset(y: 1)
.background {
Circle()
.fill(Color.element.background)
// Intentionally using system primary colour to get white/black.
.shadow(color: .primary.opacity(0.33), radius: 2.0)
}
.padding()
}
.opacity(context.scrollToBottomButtonVisible ? 1.0 : 0.0)
Expand Down

0 comments on commit d0960cf

Please sign in to comment.