Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into fix-empty-profile-feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
mplorentz committed Mar 27, 2024
2 parents 5b60a08 + 22093d0 commit 1590ea4
Show file tree
Hide file tree
Showing 75 changed files with 185 additions and 231 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- Updated dark theme colors for card backgrounds, primary text, and secondary text.
- Added a new UI for replying to messages that allows attaching images and setting an expiration date.
- Fixed an issue where Profile pages could display little or no content.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x3A",
"green" : "0x17",
"red" : "0x23"
"blue" : "0x3D",
"green" : "0x18",
"red" : "0x25"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0x4C",
"green" : "0x1E",
"red" : "0x2F"
"blue" : "0x47",
"green" : "0x1C",
"red" : "0x2B"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "1.000",
"green" : "1.000",
"red" : "1.000"
"blue" : "0xFF",
"green" : "0xFF",
"red" : "0xFF"
}
},
"idiom" : "universal"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"color-space" : "srgb",
"components" : {
"alpha" : "1.000",
"blue" : "0xBF",
"green" : "0x79",
"red" : "0x93"
"blue" : "0xD8",
"green" : "0x88",
"red" : "0xA5"
}
},
"idiom" : "universal"
Expand Down
59 changes: 1 addition & 58 deletions Nos/Extensions/Font.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import SwiftUI

// https://stackoverflow.com/a/74416073
extension Font {
static var clarity = clarityRegular(.body)

static func clarity(_ fontWeight: UIFont.Weight, textStyle: UIFont.TextStyle = .body) -> Font {
switch fontWeight {
case .regular:
Expand All @@ -15,16 +13,14 @@ extension Font {
case .bold:
clarityBold(textStyle)
default:
clarity
clarityRegular(textStyle)
}
}

static func clarityRegular(_ textStyle: UIFont.TextStyle) -> Font {
.custom("ClarityCity-Regular", size: UIFont.preferredFont(forTextStyle: textStyle).pointSize)
}

static var clarityMedium = clarityMedium(.body)

static func clarityMedium(_ textStyle: UIFont.TextStyle) -> Font {
.custom("ClarityCity-Medium", size: UIFont.preferredFont(forTextStyle: textStyle).pointSize)
}
Expand All @@ -33,48 +29,9 @@ extension Font {
.custom("ClarityCity-SemiBold", size: UIFont.preferredFont(forTextStyle: textStyle).pointSize)
}

static var clarityBold = clarityBold(.body)

static func clarityBold(_ textStyle: UIFont.TextStyle) -> Font {
.custom("ClarityCity-Bold", size: UIFont.preferredFont(forTextStyle: textStyle).pointSize)
}

static var clarityTitle = Font
.custom("ClarityCity-Bold", size: UIFont.preferredFont(
forTextStyle: .title1
).pointSize)

static var clarityTitle2 = Font
.custom("ClarityCity-Bold", size: UIFont.preferredFont(
forTextStyle: .title2
).pointSize)

static var clarityTitle3 = Font
.custom("ClarityCity-Bold", size: UIFont.preferredFont(
forTextStyle: .title3
).pointSize)

static var clarityCaption = Font
.custom("ClarityCity-Regular", size: UIFont.preferredFont(
forTextStyle: .caption1
).pointSize)

static var clarityCaption2 = Font
.custom("ClarityCity-Regular", size: UIFont.preferredFont(
forTextStyle: .caption2
).pointSize)

static var claritySubheadline = clarity(.medium, textStyle: .subheadline)

static var claritySemiBoldSubheadline = Font
.custom("ClarityCity-SemiBold", size: UIFont.preferredFont(
forTextStyle: .subheadline
).pointSize)

static var brand = Font
.custom("ClarityCity-Regular", size: UIFont.preferredFont(
forTextStyle: .body
).pointSize)
}

extension UIFont {
Expand All @@ -83,17 +40,3 @@ extension UIFont {
size: UIFont.preferredFont(forTextStyle: .body).pointSize
)!
}

// swiftlint:disable identifier_name
func PlainText(_ content: any StringProtocol) -> SwiftUI.Text {
SwiftUI.Text(content)
}

func PlainText(_ localizedStringResource: LocalizedStringResource) -> SwiftUI.Text {
SwiftUI.Text(localizedStringResource)
}

func Text(_ content: any StringProtocol) -> SwiftUI.Text {
.init(content).font(.brand)
}
// swiftlint:enable identifier_name
2 changes: 1 addition & 1 deletion Nos/Views/AboutView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ struct AboutView: View {
.frame(width: 235.45, height: 67.1)
.padding(.top, 155)
.padding(.bottom, 10)
PlainText(.localizable.onboardingTitle)
Text(.localizable.onboardingTitle)
.font(.custom("ClarityCity-Bold", size: 25.21))
.fontWeight(.heavy)
.foregroundStyle(
Expand Down
4 changes: 2 additions & 2 deletions Nos/Views/ActionBanner.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ struct ActionBanner: View {
VStack {
HStack {
Text(messageText)
.font(.clarityBold)
.font(.clarity(.bold))
.foregroundStyle(Color.white)
.lineSpacing(3)
.padding(.top, 8)
Expand All @@ -37,7 +37,7 @@ struct ActionBanner: View {
HStack {
ActionButton(
title: buttonText,
font: .claritySemiBoldSubheadline,
font: .clarity(.semibold, textStyle: .subheadline),
image: buttonImage,
textColor: .actionBannerButtonTxt,
depthEffectColor: .actionBannerButtonEffect,
Expand Down
6 changes: 3 additions & 3 deletions Nos/Views/ActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SwiftUI
struct ActionButton: View {

var title: LocalizedStringResource
var font: Font = .clarityBold
var font: Font = .clarity(.bold)
var image: Image?
var textColor = Color.white
var depthEffectColor = Color(hex: "#A04651")
Expand All @@ -30,7 +30,7 @@ struct ActionButton: View {
}, label: {
HStack {
image
PlainText(title)
Text(title)
.font(font)
.transition(.opacity)
.font(.headline)
Expand Down Expand Up @@ -131,7 +131,7 @@ struct ActionButton_Previews: PreviewProvider {

ActionButton(
title: .localizable.edit,
font: .clarityMedium,
font: .clarity(.medium),
image: Image.editProfile,
textColor: Color(hex: "#f26141"),
depthEffectColor: Color(hex: "#f8d4b6"),
Expand Down
6 changes: 3 additions & 3 deletions Nos/Views/AuthorCard.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct AuthorCard: View {
.padding(.trailing, 12)
VStack(alignment: .leading, spacing: 6) {
HStack {
PlainText(author.safeName)
Text(author.safeName)
.lineLimit(1)
.font(.title3)
.fontWeight(.bold)
Expand All @@ -43,9 +43,9 @@ struct AuthorCard: View {
}

if let bio = author.about {
PlainText(bio)
Text(bio)
.foregroundColor(.secondaryTxt)
.font(.claritySubheadline)
.font(.clarity(.medium, textStyle: .subheadline))
.multilineTextAlignment(.leading)
.lineSpacing(5)
.lineLimit(2)
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/AuthorLabel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct AuthorLabel: View {
var body: some View {
HStack {
AvatarView(imageUrl: author.profilePhotoURL, size: 24)
SwiftUI.Text(attributedAuthor)
Text(attributedAuthor)
.lineLimit(1)
.font(.clarity(.medium))
.multilineTextAlignment(.leading)
Expand Down
4 changes: 2 additions & 2 deletions Nos/Views/AuthorStoryView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,12 @@ struct AuthorStoryView: View {
.frame(width: 25, height: 25)
Text(expirationTime)
.lineLimit(1)
.font(.body)
.font(.clarity(.medium))
.foregroundColor(.secondaryTxt)
} else if let elapsedTime = selectedNote?.createdAt?.distanceString() {
Text(elapsedTime)
.lineLimit(1)
.font(.body)
.font(.clarity(.medium))
.foregroundColor(.secondaryTxt)
}
Spacer()
Expand Down
4 changes: 2 additions & 2 deletions Nos/Views/BigActionButton.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ struct BigActionButton: View {
disabled = false
}
}, label: {
PlainText(title)
.font(.clarityBold)
Text(title)
.font(.clarity(.bold))
.transition(.opacity)
.font(.headline)
})
Expand Down
9 changes: 5 additions & 4 deletions Nos/Views/BioView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct BioView: View {

var body: some View {
VStack(alignment: .leading, spacing: 6) {
SwiftUI.Text(parsedBio)
Text(parsedBio)
.font(font)
.foregroundColor(.primaryTxt)
.tint(.accent)
Expand All @@ -63,7 +63,7 @@ struct BioView: View {
}
}
.background {
SwiftUI.Text(parsedBio)
Text(parsedBio)
.font(font)
.lineSpacing(lineSpacing)
.padding(EdgeInsets(top: 0, leading: 18, bottom: 0, trailing: 18))
Expand All @@ -89,8 +89,8 @@ struct BioView: View {
Button {
showingBio = true
} label: {
PlainText(String(localized: .localizable.readMore).uppercased())
.font(.clarityCaption)
Text(String(localized: .localizable.readMore).uppercased())
.font(.clarity(.regular, textStyle: .caption1))
.foregroundColor(.secondaryTxt)
.padding(EdgeInsets(top: 4, leading: 6, bottom: 4, trailing: 6))
.background(Color.hashtagBg)
Expand All @@ -103,6 +103,7 @@ struct BioView: View {
}
.placeholder(when: isLoading) {
Text(String.loremIpsum(1))
.font(.clarity(.regular))
.lineSpacing(lineSpacing)
.lineLimit(5)
.padding(EdgeInsets(top: 0, leading: 18, bottom: 0, trailing: 18))
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/CardButtonStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ extension View {
Button {
} label: {
VStack {
PlainText("hello world")
Text("hello world")
.padding()
}
.background(Color.cardBgTop.cornerRadius(18))
Expand Down
6 changes: 3 additions & 3 deletions Nos/Views/CompactNoteView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,11 @@ struct CompactNoteView: View {
Group {
switch note.attributedContent {
case .loading:
SwiftUI.Text(note.content ?? "")
Text(note.content ?? "")
.font(.clarity(.regular))
.redacted(reason: .placeholder)
case .loaded(let attributedString):
SwiftUI.Text(attributedString)
Text(attributedString)
}
}
}
Expand Down Expand Up @@ -133,7 +133,7 @@ struct CompactNoteView: View {
isTextTruncated = false
}
} label: {
PlainText(String(localized: .localizable.readMore).uppercased())
Text(String(localized: .localizable.readMore).uppercased())
.font(.caption)
.foregroundColor(.secondaryTxt)
.padding(EdgeInsets(top: 4, leading: 6, bottom: 4, trailing: 6))
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/WizardNavigationStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ struct WizardNavigationStack<Root>: View where Root: View {
#Preview {
Color.clear.sheet(isPresented: .constant(true)) {
WizardNavigationStack {
PlainText("Hello")
Text("Hello")
}
}
}
2 changes: 1 addition & 1 deletion Nos/Views/Components/WizardSheetBadgeText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct WizardSheetBadgeText: View {
}

var body: some View {
SwiftUI.Text(String(localized: localizedStringResource).uppercased())
Text(String(localized: localizedStringResource).uppercased())
.padding(.horizontal, 6)
.padding(.vertical, 5)
.font(.clarity(.bold, textStyle: .footnote))
Expand Down
6 changes: 3 additions & 3 deletions Nos/Views/Components/WizardSheetDescriptionText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ struct WizardSheetDescriptionText: View {
case plainText(LocalizedStringResource)
case markdown(AttributedString)

var text: SwiftUI.Text {
var text: Text {
switch self {
case .plainText(let localizedStringResource):
return SwiftUI.Text(localizedStringResource)
return Text(localizedStringResource)
case .markdown(let attributedString):
return SwiftUI.Text(attributedString)
return Text(attributedString)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/WizardSheetTitleText.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ struct WizardSheetTitleText: View {
}

var body: some View {
SwiftUI.Text(localizedStringResource)
Text(localizedStringResource)
.font(.clarity(.bold, textStyle: .title1))
.foregroundStyle(Color.primaryTxt)
}
Expand Down
2 changes: 1 addition & 1 deletion Nos/Views/Components/WizardSheetVStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ struct WizardSheetVStack<Content>: View where Content: View {
#Preview {
WizardSheetVStack {
Spacer(minLength: 40)
PlainText("Hello")
Text("Hello")
Spacer()
}
}
2 changes: 1 addition & 1 deletion Nos/Views/DiscoverView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ struct DiscoverView: View {
.searchable(
text: $searchController.query,
placement: .toolbar,
prompt: PlainText(.localizable.searchBar)
prompt: Text(.localizable.searchBar)
)
.autocorrectionDisabled()
.onSubmit(of: .search) {
Expand Down
Loading

0 comments on commit 1590ea4

Please sign in to comment.