From d0960cf75cdde46c7ded4d1c939beb6d8f116d86 Mon Sep 17 00:00:00 2001
From: Doug <6060466+pixlwave@users.noreply.github.com>
Date: Fri, 10 Feb 2023 09:48:01 +0000
Subject: [PATCH] Message composer icon and scroll to bottom button dark mode
(#562)
Remove animations on the composer when entering/exiting edit/reply mode too.
---
.../Contents.json | 2 +-
.../send.svg | 3 +++
.../timelineComposerSendMessage.svg | 5 ----
.../Contents.json | 23 ------------------
.../timelineScrollToBottom.png | Bin 735 -> 0 bytes
.../timelineScrollToBottom@2x.png | Bin 1308 -> 0 bytes
.../timelineScrollToBottom@3x.png | Bin 1934 -> 0 bytes
ElementX/Sources/Generated/Assets.swift | 1 -
.../RoomScreen/View/MessageComposer.swift | 18 +++++++++-----
.../Screens/RoomScreen/View/RoomScreen.swift | 14 +++++++++--
10 files changed, 28 insertions(+), 38 deletions(-)
create mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/send.svg
delete mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/timelineComposerSendMessage.svg
delete mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/Contents.json
delete mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom.png
delete mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom@2x.png
delete mode 100644 ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom@3x.png
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/Contents.json b/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/Contents.json
index 538eaa5da..a88d70f2b 100644
--- a/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/Contents.json
+++ b/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/Contents.json
@@ -1,7 +1,7 @@
{
"images" : [
{
- "filename" : "timelineComposerSendMessage.svg",
+ "filename" : "send.svg",
"idiom" : "universal"
}
],
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/send.svg b/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/send.svg
new file mode 100644
index 000000000..1cabb8690
--- /dev/null
+++ b/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/send.svg
@@ -0,0 +1,3 @@
+
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/timelineComposerSendMessage.svg b/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/timelineComposerSendMessage.svg
deleted file mode 100644
index a9d140d06..000000000
--- a/ElementX/Resources/Assets.xcassets/Images/timelineComposerSendMessage.imageset/timelineComposerSendMessage.svg
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
-
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/Contents.json b/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/Contents.json
deleted file mode 100644
index a223dee6c..000000000
--- a/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/Contents.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "images" : [
- {
- "filename" : "timelineScrollToBottom.png",
- "idiom" : "universal",
- "scale" : "1x"
- },
- {
- "filename" : "timelineScrollToBottom@2x.png",
- "idiom" : "universal",
- "scale" : "2x"
- },
- {
- "filename" : "timelineScrollToBottom@3x.png",
- "idiom" : "universal",
- "scale" : "3x"
- }
- ],
- "info" : {
- "author" : "xcode",
- "version" : 1
- }
-}
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom.png b/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom.png
deleted file mode 100644
index 992d1edafceec488f3889497f5afe1994b3089a7..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 735
zcmV<50wDc~P)ucy5u04>1PlEH-dC`)6Vi!=!A{fM#ljSd
zcYPyYSWBPO^nr@IaUIps
z6b&7H5;>MsVHed3BdpSfI5*Ocd8l3#VcUMp1MOIqZ7WSEjx`(+#X-1_*}`X4dYC<$
z6m~1?)x*(0>~ufi|NcHqc)#}2O_~0(i%*{=|XZtNa
z^}orrr*U=R5i+t=GZD79a3v~#|M`pOFJ4V`PKzSfTZ=HjrLfGy&&}m)Sn-!LiA#%G
zz2n0Gw+2I2{2NonrA6IazYSBEE{4c4XtNXSboZj;ix7;kfyM3EjH^AOK03h_~@kO`PVEzp|T
zL0qScEzAxb{%FUTF6dg>bNw`-gwMHusV?9ubz<_ypy%IliWxh*W7?l}8&UsCcX3q&HRC$b*Wvp#o(eZf(_36nRL;
zl0drDflXBGUR&kg>g2~|PT&r5pyIVCS63e5F_tmDIn3aOa8Kfk^tc`jIRF$i&3{qM
R#K!;t002ovPDHLkV1g8RM*aW*
diff --git a/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom@2x.png b/ElementX/Resources/Assets.xcassets/Images/timelineScrollToBottom.imageset/timelineScrollToBottom@2x.png
deleted file mode 100644
index c218462932b91d07823e50ed5d8e17e557258667..0000000000000000000000000000000000000000
GIT binary patch
literal 0
HcmV?d00001
literal 1308
zcmV+%1>^dOP)F$tHBn`J$peRLhH2G8IE*(`q0>>u^G)b4eG)Y8r
zT$)5FvWt+Q0Ca~0q5;+t5+IPc6%9wj@V@p8cx}(Fz3Z`O*Yijtdwm>hKlje-@pxt$
zr~n~ElQv6K7UfobX1v%xA5ih-_8OJG-0n3RjR8ugfs!CeE3{doaul!ROv@gX^Hk1}
zydGv9lH^f2No8M{r%$EB--%g+qlrpaRL8amBie2(5EZ8@Y>YTMsV0@5g}royE#l}z
z)%N7`Q2U&t(M4rM8FNy{W`j%6t_OB*X}4ibD;d}O#0j1(qs
zzq^=!Sqh)Z@~B>rad*j+sE;hhLwLdA46vU6!aNEKG2yrqMy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/ElementX/Sources/Generated/Assets.swift b/ElementX/Sources/Generated/Assets.swift
index c45a0f33d..2a47f393b 100644
--- a/ElementX/Sources/Generated/Assets.swift
+++ b/ElementX/Sources/Generated/Assets.swift
@@ -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
diff --git a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift
index b30c3b605..a0d579518 100644
--- a/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift
+++ b/ElementX/Sources/Screens/RoomScreen/View/MessageComposer.swift
@@ -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) {
@@ -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)
}
@@ -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
@@ -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)
}
}
diff --git a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift
index 85d80a27c..4094cbf07 100644
--- a/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift
+++ b/ElementX/Sources/Screens/RoomScreen/View/RoomScreen.swift
@@ -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)