This commit is contained in:
fmodf 2024-07-04 10:21:12 +02:00
parent 29f3507986
commit 6818182f66
22 changed files with 86 additions and 86 deletions

View file

@ -26,7 +26,7 @@ struct AddAccountScreen: View {
public var body: some View {
ZStack {
// background
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// content
@ -41,11 +41,11 @@ struct AddAccountScreen: View {
VStack(spacing: 10) {
Text(L10n.Login.title)
.font(.head1l)
.foregroundColor(.Material.tortoiseDark500)
.foregroundColor(.Material.Text.main)
.fixedSize(horizontal: true, vertical: false)
Text(L10n.Login.subtitle)
.font(.body2)
.foregroundColor(.Material.tortoiseDark300)
.foregroundColor(.Material.Text.sub)
.multilineTextAlignment(.center)
.fixedSize(horizontal: false, vertical: true)
}
@ -88,7 +88,7 @@ struct AddAccountScreen: View {
store.dispatch(.changeFlow(.start))
} label: {
Text("\(Image(systemName: "chevron.left")) \(L10n.Global.back)")
.foregroundColor(.Material.tortoiseDark300)
.foregroundColor(.Material.Elements.active)
.font(.body2)
}
}

View file

@ -21,7 +21,7 @@ struct AddContactOrChannelScreen: View {
var body: some View {
ZStack {
// Background color
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// Content
@ -34,7 +34,7 @@ struct AddContactOrChannelScreen: View {
Text(L10n.Contacts.Add.explanation)
.font(.body3)
.foregroundColor(.Main.gray)
.foregroundColor(.Material.Shape.separator)
.multilineTextAlignment(.center)
.padding(.top, 16)
@ -42,7 +42,7 @@ struct AddContactOrChannelScreen: View {
HStack(spacing: 0) {
Text("Use account:")
.font(.body2)
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.frame(alignment: .leading)
Spacer()
}
@ -58,7 +58,7 @@ struct AddContactOrChannelScreen: View {
HStack(spacing: 0) {
Text("Contact JID:")
.font(.body2)
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.frame(alignment: .leading)
Spacer()
}
@ -103,7 +103,7 @@ struct AddContactOrChannelScreen: View {
)
}
.onChange(of: store.state.rostersState.newAddedRosterJid) { jid in
if let _ = jid, isShowingLoader {
if jid != nil, isShowingLoader {
isShowingLoader = false
isPresented = false
}
@ -139,23 +139,23 @@ private struct AddContactsScreenHeader: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundDark
Color.Material.Background.dark
.ignoresSafeArea()
// title
Text(L10n.Contacts.Add.title)
.font(.head2)
.foregroundColor(Color.Main.black)
.foregroundColor(.Material.Text.main)
HStack {
Image(systemName: "chevron.left")
.foregroundColor(Color.Material.greenDark500)
.foregroundColor(Color.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
isPresented = false
}
Spacer()
Image(systemName: "plus.viewfinder")
.foregroundColor(Color.Material.greenDark500)
.foregroundColor(Color.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
print("Scan QR-code")
}

View file

@ -6,18 +6,18 @@ struct AttachmentHeader: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundDark
Color.Material.Background.dark
.ignoresSafeArea()
// title
Text(L10n.Attachment.Prompt.main)
.font(.head2)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
HStack {
Spacer()
Image(systemName: "xmark")
.foregroundColor(Color.Tango.orangeMedium)
.foregroundColor(Color.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
store.dispatch(.conversationAction(.showAttachmentPicker(false)))
}

View file

@ -37,14 +37,14 @@ struct AttachmentMediaPickerView: View {
} label: {
ZStack {
Rectangle()
.fill(Color.Main.backgroundLight)
.fill(Color.Material.Background.light)
.overlay {
VStack {
Image(systemName: "camera")
.foregroundColor(.Material.tortoiseLight300)
.foregroundColor(.Material.Elements.active)
.font(.system(size: 30))
Text("Allow camera access")
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.font(.body3)
}
}
@ -64,14 +64,14 @@ struct AttachmentMediaPickerView: View {
} label: {
ZStack {
Rectangle()
.fill(Color.Main.backgroundLight)
.fill(Color.Material.Background.light)
.overlay {
VStack {
Image(systemName: "photo")
.foregroundColor(.Material.tortoiseLight300)
.foregroundColor(.Material.Elements.active)
.font(.system(size: 30))
Text("Allow gallery access")
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.font(.body3)
}
}
@ -194,7 +194,7 @@ private struct PhotoView: Identifiable, View {
} else {
ZStack {
Rectangle()
.fill(Color.Main.backgroundLight)
.fill(Color.Material.Background.light)
.overlay {
ProgressView()
}

View file

@ -8,7 +8,7 @@ struct AttachmentPickerScreen: View {
var body: some View {
ZStack {
// Background color
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// Content

View file

@ -15,14 +15,14 @@ struct AttachmentTabBar: View {
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 0.2)
.foregroundColor(.Main.separator)
.foregroundColor(.Material.Shape.separator)
HStack(spacing: 0) {
AttachmentTabBarButton(tab: .media, selected: $selectedTab)
AttachmentTabBarButton(tab: .files, selected: $selectedTab)
AttachmentTabBarButton(tab: .location, selected: $selectedTab)
AttachmentTabBarButton(tab: .contacts, selected: $selectedTab)
}
.background(Color.Main.backgroundDark)
.background(Color.Material.Background.dark)
}
.frame(height: 50)
}
@ -36,12 +36,12 @@ private struct AttachmentTabBarButton: View {
ZStack {
VStack(spacing: 2) {
buttonImg
.foregroundColor(selected == tab ? .Material.greenDark500 : .Main.gray)
.foregroundColor(selected == tab ? .Material.Elements.active : .Material.Elements.inactive)
.font(.system(size: 24, weight: .light))
.symbolRenderingMode(.hierarchical)
Text(buttonTitle)
.font(.sub1)
.foregroundColor(selected == tab ? .Main.black : .Main.gray)
.foregroundColor(selected == tab ? .Material.Text.main : .Material.Elements.inactive)
}
Rectangle()
.foregroundColor(.white.opacity(0.01))

View file

@ -6,7 +6,7 @@ struct ChatsListScreen: View {
var body: some View {
ZStack {
// Background color
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// Content
@ -22,7 +22,7 @@ struct ChatsListScreen: View {
}
}
.listStyle(.plain)
.background(Color.Main.backgroundLight)
.background(Color.Material.Background.light)
} else {
Spacer()
}
@ -38,18 +38,18 @@ private struct ChatsScreenHeader: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundDark
Color.Material.Background.dark
.ignoresSafeArea()
// title
Text(L10n.Chats.title)
.font(.head2)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
HStack {
Spacer()
Image(systemName: "plus")
.foregroundColor(.Material.greenDark500)
.foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
print("Add contact")
}
@ -77,7 +77,7 @@ private struct ChatsRow: View {
.font(.body1)
}
Text(chat.participant)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
.font(.body2)
Spacer()
}
@ -86,7 +86,7 @@ private struct ChatsRow: View {
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 1)
.foregroundColor(.Main.backgroundDark)
.foregroundColor(.Material.Background.dark)
}
.sharedListRow()
.onTapGesture {

View file

@ -11,7 +11,7 @@ struct ContactsScreen: View {
var body: some View {
ZStack {
// Background color
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// Content
@ -33,7 +33,7 @@ struct ContactsScreen: View {
}
}
.listStyle(.plain)
.background(Color.Main.backgroundLight)
.background(Color.Material.Background.light)
} else {
Spacer()
}
@ -62,18 +62,18 @@ private struct ContactsScreenHeader: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundDark
Color.Material.Background.dark
.ignoresSafeArea()
// title
Text(L10n.Contacts.title)
.font(.head2)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
HStack {
Spacer()
Image(systemName: "plus")
.foregroundColor(Color.Material.greenDark500)
.foregroundColor(Color.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
addPanelPresented = true
}
@ -107,7 +107,7 @@ private struct ContactsScreenRow: View {
.font(.body1)
}
Text(roster.contactBareJid)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
.font(.body2)
Spacer()
}
@ -116,7 +116,7 @@ private struct ContactsScreenRow: View {
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 1)
.foregroundColor(.Main.backgroundDark)
.foregroundColor(.Material.Background.dark)
}
.sharedListRow()
.onTapGesture {

View file

@ -6,7 +6,7 @@ struct ConversationHeader: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundDark
Color.Material.Background.dark
.ignoresSafeArea()
// title
@ -16,11 +16,11 @@ struct ConversationHeader: View {
) ?? L10n.Chat.title
Text(name)
.font(.head2)
.foregroundColor(Color.Main.black)
.foregroundColor(.Material.Text.main)
HStack {
Image(systemName: "chevron.left")
.foregroundColor(Color.Tango.orangeMedium)
.foregroundColor(.Material.Elements.active)
.tappablePadding(.symmetric(12)) {
store.dispatch(.changeFlow(store.state.previousFlow))
}

View file

@ -7,7 +7,7 @@ struct ConversationMessageContainer: View {
var body: some View {
Text(message.body ?? "...")
.font(.body2)
.foregroundColor(Color.Main.black)
.foregroundColor(.Material.Text.main)
.multilineTextAlignment(.leading)
.padding(10)
}
@ -20,16 +20,16 @@ struct MessageAttr: View {
VStack(alignment: .leading, spacing: 0) {
Text(message.date, style: .time)
.font(.sub2)
.foregroundColor(Color.Main.gray)
.foregroundColor(.Material.Shape.separator)
Spacer()
if message.sentError {
Image(systemName: "exclamationmark.circle")
.font(.body3)
.foregroundColor(Color.Tango.redLight)
.foregroundColor(.Rainbow.red500)
} else if message.pending {
Image(systemName: "clock")
.font(.body3)
.foregroundColor(Color.Main.gray)
.foregroundColor(.Material.Shape.separator)
}
}
}

View file

@ -16,7 +16,7 @@ struct ConversationMessageRow: View {
.padding(.trailing, 4)
}
ConversationMessageContainer(message: message, isOutgoing: isOutgoing())
.background(isOutgoing() ? Color.Material.greenDark100 : Color.Main.white)
.background(isOutgoing() ? Color.Material.Shape.alternate : Color.Material.Shape.white)
.clipShape(ConversationMessageBubble(isOutgoing: isOutgoing()))
if !isOutgoing() {
MessageAttr(message: message)

View file

@ -12,7 +12,7 @@ struct ConversationScreen: View {
var body: some View {
ZStack {
// Background color
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// Content
@ -45,7 +45,7 @@ struct ConversationScreen: View {
}
.rotationEffect(.degrees(180))
.listStyle(.plain)
.background(Color.Main.backgroundLight)
.background(Color.Material.Background.light)
.scrollDismissesKeyboard(.immediately)
.scrollIndicators(.hidden)
.onChange(of: autoScroll) { new in
@ -75,12 +75,12 @@ struct ConversationScreen: View {
} label: {
ZStack {
Circle()
.fill(Color.Main.white)
.fill(Color.Material.Shape.white)
Image(systemName: "arrow.down")
.foregroundColor(.Tango.blueLight)
.foregroundColor(.Material.Elements.active)
}
.frame(width: 40, height: 40)
.shadow(color: .Main.black.opacity(0.2), radius: 4)
.shadow(color: .black.opacity(0.2), radius: 4)
.padding(.trailing, 8)
.padding(.bottom, 8)
}

View file

@ -11,7 +11,7 @@ struct ConversationTextInput: View {
var body: some View {
VStack(spacing: 0) {
Rectangle()
.foregroundColor(.Main.separator)
.foregroundColor(.Material.Shape.separator)
.frame(height: 0.5)
.padding(.bottom, 8)
if !replyText.isEmpty {
@ -19,14 +19,14 @@ struct ConversationTextInput: View {
HStack(alignment: .top) {
Text(replyText)
.font(.body3)
.foregroundColor(Color.Main.black)
.foregroundColor(Color.Material.Text.main)
.multilineTextAlignment(.leading)
.lineLimit(3)
.padding(8)
Spacer()
Image(systemName: "xmark")
.font(.title2)
.foregroundColor(.Tango.blueLight)
.foregroundColor(.Material.Elements.active)
.padding(.leading, 8)
.tappablePadding(.symmetric(8)) {
store.dispatch(.conversationAction(.setReplyText("")))
@ -35,7 +35,7 @@ struct ConversationTextInput: View {
}
.frame(maxWidth: .infinity)
.background(RoundedRectangle(cornerRadius: 4)
.foregroundColor(.Main.backgroundLight)
.foregroundColor(.Material.Background.light)
.shadow(radius: 0.5)
)
.padding(.bottom, 8)
@ -46,7 +46,7 @@ struct ConversationTextInput: View {
HStack {
Image(systemName: "paperclip")
.font(.title2)
.foregroundColor(.Tango.blueLight)
.foregroundColor(.Material.Elements.active)
.padding(.leading, 8)
.tappablePadding(.symmetric(8)) {
store.dispatch(.conversationAction(.showAttachmentPicker(true)))
@ -56,13 +56,13 @@ struct ConversationTextInput: View {
.focused($isFocused)
.padding(.horizontal, 8)
.padding(.vertical, 4)
.background(Color.Main.white)
.background(Color.Material.Shape.white)
.clipShape(RoundedRectangle(cornerRadius: 8))
.padding(.vertical, 4)
let img = messageStr.isEmpty ? "paperplane" : "paperplane.fill"
Image(systemName: img)
.font(.title2)
.foregroundColor(messageStr.isEmpty ? .Main.separator : .Tango.blueLight)
.foregroundColor(messageStr.isEmpty ? .Material.Elements.inactive : .Material.Elements.active)
.padding(.trailing, 8)
.tappablePadding(.symmetric(8)) {
if !messageStr.isEmpty {
@ -82,7 +82,7 @@ struct ConversationTextInput: View {
}
}
.padding(.bottom, 8)
.background(Color.Main.backgroundDark)
.background(Color.Material.Background.dark)
.onChange(of: store.state.conversationsState.replyText) { new in
if !new.isEmpty {
isFocused = true

View file

@ -5,7 +5,7 @@ struct RegistrationScreen: View {
public var body: some View {
ZStack {
Color.Main.backgroundLight
Color.Material.Background.light
Button {
// state.flow = .welcome
} label: {

View file

@ -4,7 +4,7 @@ struct SettingsScreen: View {
var body: some View {
ZStack {
// bg
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// content

View file

@ -5,7 +5,7 @@ struct StartScreen: View {
var body: some View {
ZStack {
Color.Main.backgroundLight
Color.Material.Background.light
Image.logo
.resizable()
.aspectRatio(contentMode: .fit)

View file

@ -6,7 +6,7 @@ struct WelcomeScreen: View {
public var body: some View {
ZStack {
// background
Color.Main.backgroundLight
Color.Material.Background.light
.ignoresSafeArea()
// content
@ -21,11 +21,11 @@ struct WelcomeScreen: View {
VStack(spacing: 10) {
Text(L10n.Global.name)
.font(.head1r)
.foregroundColor(.Material.tortoiseDark500)
.foregroundColor(.Material.Text.main)
.fixedSize(horizontal: true, vertical: false)
Text(L10n.Start.subtitle)
.font(.body2)
.foregroundColor(.Material.tortoiseDark300)
.foregroundColor(.Material.Text.sub)
.fixedSize(horizontal: false, vertical: true)
.multilineTextAlignment(.center)
}

View file

@ -12,6 +12,6 @@ struct SharedListRow: ViewModifier {
.listRowInsets(.zero)
.listRowSeparator(.hidden)
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(Color.Main.backgroundLight)
.background(Color.Material.Background.light)
}
}

View file

@ -6,13 +6,13 @@ struct SharedTabBar: View {
Rectangle()
.frame(maxWidth: .infinity)
.frame(height: 0.2)
.foregroundColor(.Main.separator)
.foregroundColor(.Material.Shape.separator)
HStack(spacing: 0) {
SharedTabBarButton(buttonFlow: .contacts)
SharedTabBarButton(buttonFlow: .chats)
SharedTabBarButton(buttonFlow: .settings)
}
.background(Color.Main.backgroundDark)
.background(Color.Material.Background.dark)
}
.frame(height: 50)
}
@ -27,12 +27,12 @@ private struct SharedTabBarButton: View {
ZStack {
VStack(spacing: 2) {
buttonImg
.foregroundColor(buttonFlow == store.state.currentFlow ? .Material.greenDark500 : .Main.gray)
.foregroundColor(buttonFlow == store.state.currentFlow ? .Material.Elements.active : .Material.Elements.inactive)
.font(.system(size: 24, weight: .light))
.symbolRenderingMode(.hierarchical)
Text(buttonTitle)
.font(.sub1)
.foregroundColor(buttonFlow == store.state.currentFlow ? .Main.black : .Main.gray)
.foregroundColor(buttonFlow == store.state.currentFlow ? .Material.Text.main : .Material.Elements.inactive)
}
Rectangle()
.foregroundColor(.white.opacity(0.01))

View file

@ -43,7 +43,7 @@ extension UniversalInputCollection.TextField: View {
.padding(.horizontal, 8)
.focused(focus, equals: fieldType)
.font(.body2)
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.autocorrectionDisabled(true)
.autocapitalization(.none)
.textContentType(contentType)
@ -72,7 +72,7 @@ extension UniversalInputCollection.SecureField: View {
.padding(.horizontal, 8)
.focused(focus, equals: fieldType)
.font(.body2)
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.autocorrectionDisabled(true)
.autocapitalization(.none)
.textContentType(.password)
@ -100,7 +100,7 @@ extension UniversalInputCollection.DropDownMenu: View {
HStack {
Text(text)
.font(.body2)
.foregroundColor(.Main.black)
.foregroundColor(.Material.Text.main)
.padding(.leading, 8)
Spacer()
}
@ -154,7 +154,7 @@ private struct UniversalInputModifier<T: Hashable>: ViewModifier {
HStack {
Text(isActive ? "" : prompt)
.font(.body2)
.foregroundColor(.Main.gray)
.foregroundColor(.Material.Shape.separator)
.padding(8)
Spacer()
}
@ -166,9 +166,9 @@ private struct UniversalInputModifier<T: Hashable>: ViewModifier {
.background {
ZStack {
RoundedRectangle(cornerRadius: 4)
.foregroundColor(.Main.white)
.foregroundColor(.Material.Shape.white)
RoundedRectangle(cornerRadius: 4)
.stroke(Color.Main.gray)
.stroke(Color.Material.Shape.separator)
}
}
.contentShape(Rectangle())

View file

@ -16,10 +16,10 @@ struct PrimaryButtonStyle: ButtonStyle {
.font(.head2)
.padding(ButtonSizes.padding)
.frame(maxWidth: .infinity)
.foregroundColor(.Main.white)
.foregroundColor(.Material.Shape.white)
.background {
RoundedRectangle(cornerRadius: ButtonSizes.cornerRadius)
.foregroundColor(isEnabled ? .Material.greenDark500 : .Main.separator)
.foregroundColor(isEnabled ? .Material.Elements.active : .Material.Shape.separator)
}
.contentShape(Rectangle())
.scaleEffect(configuration.isPressed ? ButtonSizes.scaleEffect : 1.0)
@ -37,10 +37,10 @@ struct SecondaryButtonStyle: ButtonStyle {
.font(.head2)
.padding(ButtonSizes.padding)
.frame(maxWidth: .infinity)
.foregroundColor(isEnabled ? .Material.greenDark500 : .Main.separator)
.foregroundColor(isEnabled ? .Material.Elements.active : .Material.Shape.separator)
.background {
RoundedRectangle(cornerRadius: ButtonSizes.cornerRadius)
.stroke(isEnabled ? Color.Material.greenDark500 : Color.Main.separator)
.stroke(isEnabled ? Color.Material.Elements.active : Color.Material.Shape.separator)
}
.contentShape(Rectangle())
.scaleEffect(configuration.isPressed ? ButtonSizes.scaleEffect : 1.0)

View file

@ -22,13 +22,13 @@ struct LoadingIndicator: ViewModifier {
private var loadingView: some View {
GeometryReader { proxyReader in
ZStack {
Color.Tango.blueLight.opacity(0.3)
Color.Material.Elements.active.opacity(0.3)
.frame(maxWidth: .infinity, maxHeight: .infinity)
// loader
ProgressView()
.progressViewStyle(
CircularProgressViewStyle(tint: .Material.greenDark800)
CircularProgressViewStyle(tint: .Material.Elements.active)
)
.position(x: proxyReader.size.width / 2, y: proxyReader.size.height / 2)
.controlSize(.large)