Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions ios/HackerNews/Auth/LoginRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@

import Foundation
import SwiftUI
import Common

struct LoginRow: View {
let loggedIn: Bool
let tapped: () -> Void

@Environment(Theme.self) private var theme

var body: some View {
HStack(alignment: .center, spacing: 8) {
Circle()
Expand All @@ -20,7 +22,7 @@ struct LoginRow: View {
width: 8
)
Text(loginText())
.font(.ibmPlexMono(.bold, size: 16))
.font(theme.themedFont(size: 16, style: .mono, weight: .bold))
Spacer()
Image(systemName: "message.fill")
.font(.system(size: 12))
Expand Down Expand Up @@ -57,4 +59,5 @@ struct LoginRow: View {

#Preview {
LoginRow(loggedIn: true, tapped: {})
.environment(Theme())
}
1 change: 0 additions & 1 deletion ios/HackerNews/HNApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct HackerNewsApp: App {
SentrySDK.start { options in
options.dsn =
"https://118cff4b239bd3e0ede8fd74aad9bf8f@o497846.ingest.sentry.io/4506027753668608"
options.enableTracing = true
options.configureUserFeedback = { config in
config.onSubmitSuccess = { data in
print("Feedback submitted successfully: \(data)")
Expand Down
9 changes: 6 additions & 3 deletions ios/HackerNews/Hacker-News-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
</array>
<key>UIAppFonts</key>
<array>
<string>Fonts_Fonts.bundle/ibm_plex_sans_regular.ttf</string>
<string>Fonts_Fonts.bundle/ibm_plex_sans_medium.ttf</string>
<string>Fonts_Fonts.bundle/ibm_plex_sans_bold.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexSans-Regular.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexSans-Medium.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexSans-Bold.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexMono-Bold.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexMono-Medium.ttf</string>
<string>Fonts_Fonts.bundle/IBMPlexMono-Regular.ttf</string>
</array>
</dict>
</plist>
5 changes: 4 additions & 1 deletion ios/HackerNews/Settings/SettingsRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@

import Foundation
import SwiftUI
import Common

struct SettingsRow<Leading: View, Trailing: View>: View {
let text: String
@ViewBuilder let leadingIcon: () -> Leading
@ViewBuilder let trailingIcon: () -> Trailing
let action: () -> Void
@Environment(Theme.self) private var theme

var body: some View {
HStack(alignment: .center, spacing: 8) {
leadingIcon()
Text(text)
.font(.ibmPlexMono(.bold, size: 16))
.font(theme.themedFont(size: 16, style: .mono, weight: .bold))
Spacer()
trailingIcon()
}
Expand All @@ -45,4 +47,5 @@ struct SettingsRow<Leading: View, Trailing: View>: View {
},
action: {}
)
.environment(Theme())
}
56 changes: 44 additions & 12 deletions ios/HackerNews/Settings/SettingsScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ struct SettingsScreen: View {
LazyVStack(spacing: 8) {
VStack(alignment: .leading, spacing: 4) {
Text("Profile")
.font(.ibmPlexSans(.medium, size: 12))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
LoginRow(loggedIn: model.authState == AuthState.loggedIn) {
model.gotoLogin()
}
}

VStack(alignment: .leading, spacing: 4) {
Text("About")
.font(.ibmPlexSans(.medium, size: 12))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
SettingsRow(
text: "Follow Emerge",
leadingIcon: {
Expand Down Expand Up @@ -132,31 +132,63 @@ struct SettingsScreen: View {
@Bindable var theme = theme
Text("Appearance")
.font(.ibmPlexSans(.medium, size: 12))

SettingsRow(
text: "Use System Font",
text: "Font Family",
leadingIcon: {
Image(systemName: "textformat")
.font(.system(size: 12))
.foregroundStyle(.purple)
},
trailingIcon: {
Toggle("", isOn: $theme.useSystemFont)
.labelsHidden()
Menu {
Button("System") {
theme.fontFamilyPreference = .system
}
Button("IBM Plex") {
theme.fontFamilyPreference = .ibmPlex
}
} label: {
HStack(spacing: 4) {
Text(
theme.fontFamilyPreference.displayName
)
.font(theme.themedFont(size: 14, style: .mono))
Image(systemName: "chevron.down")
.font(.system(size: 12))
}
.foregroundStyle(.onBackground)
}
},
action: {}
)

SettingsRow(
text: "Use Monospaced Font",
text: "Font Style",
leadingIcon: {
Image(systemName: "textformat.size")
Image(systemName: "textformat")
.font(.system(size: 12))
.foregroundStyle(.orange)
.foregroundStyle(.purple)
},
trailingIcon: {
Toggle("", isOn: $theme.useMonospaced)
.labelsHidden()
Menu {
Button("Sans") {
theme.fontStylePreference = .sans
}
Button("Sans + Mono") {
theme.fontStylePreference = .sansAndMono
}
} label: {
HStack(spacing: 4) {
Text(
theme.fontStylePreference.displayName
)
.font(theme.themedFont(size: 14, style: .mono))
Image(systemName: "chevron.down")
.font(.system(size: 12))
}
.foregroundStyle(.onBackground)
}
},
action: {}
)
Expand Down
18 changes: 9 additions & 9 deletions ios/HackerNews/Stories/StoryRow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ struct StoryRow: View {
let author = content.author!
HStack {
Text("@\(author)")
.font(theme.userMonoFont(size: 12, weight: .bold))
.font(theme.themedFont(size: 12, style: .mono, weight: .bold))
.foregroundColor(.hnOrange)
Spacer()
if content.bookmarked {
Expand All @@ -62,14 +62,14 @@ struct StoryRow: View {
.font(.system(size: 12))
.foregroundColor(.green)
Text("\(content.score)")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}
HStack(spacing: 4) {
Image(systemName: "clock")
.font(.system(size: 12))
.foregroundColor(.purple)
Text(content.relativeDate())
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}
Spacer()
// Comment Button
Expand All @@ -84,7 +84,7 @@ struct StoryRow: View {
Image(systemName: "message.fill")
.font(.system(size: 12))
Text("\(content.commentCount)")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}
.foregroundStyle(.blue)
}
Expand All @@ -104,11 +104,11 @@ struct StoryRowLoadingState: View {
var body: some View {
VStack(alignment: .leading, spacing: 8) {
Text("@humdinger")
.font(theme.userMonoFont(size: 12, weight: .bold))
.font(theme.themedFont(size: 12, style: .mono, weight: .bold))
.foregroundColor(.hnOrange)
.redacted(reason: .placeholder)
Text("Some Short Title")
.font(theme.userMonoFont(size: 16, weight: .bold))
.font(theme.themedFont(size: 16, style: .mono, weight: .bold))
.redacted(reason: .placeholder)
HStack(spacing: 16) {
HStack(spacing: 4) {
Expand All @@ -118,7 +118,7 @@ struct StoryRowLoadingState: View {
.redacted(reason: .placeholder)
Text("99")
.font(
theme.userSansFont(size: 12, weight: .medium)
theme.themedFont(size: 12, style: .sans, weight: .medium)
)
.redacted(reason: .placeholder)
}
Expand All @@ -128,7 +128,7 @@ struct StoryRowLoadingState: View {
.foregroundColor(.purple)
.redacted(reason: .placeholder)
Text("2h ago")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
.redacted(reason: .placeholder)
}
Spacer()
Expand All @@ -138,7 +138,7 @@ struct StoryRowLoadingState: View {
Image(systemName: "message.fill")
.font(.system(size: 12))
Text("45")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}
.foregroundStyle(.blue)
}
Expand Down
12 changes: 6 additions & 6 deletions ios/HackerNewsHomeWidget/HackerNewsHomeWidget.swift
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ struct HackerNewsHomeWidgetEntryView: View {
HStack(spacing: 12) {
HStack(spacing: 4) {
Image(systemName: "arrow.up")
.font(theme.userSansFont(size: 10))
.font(theme.themedFont(size: 10, style: .sans))
.foregroundColor(.green)
Text("\(story.score)")
.font(theme.userSansFont(size: 10, weight: .medium))
.font(theme.themedFont(size: 10, style: .sans, weight: .medium))
}

HStack(spacing: 4) {
Expand Down Expand Up @@ -144,10 +144,10 @@ struct HackerNewsHomeWidgetEntryView: View {
HStack(spacing: 16) {
HStack(spacing: 4) {
Image(systemName: "arrow.up")
.font(theme.userSansFont(size: 12))
.font(theme.themedFont(size: 12, style: .sans))
.foregroundColor(.green)
Text("\(story.score)")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}

HStack(spacing: 4) {
Expand Down Expand Up @@ -190,10 +190,10 @@ struct HackerNewsHomeWidgetEntryView: View {
HStack(spacing: 16) {
HStack(spacing: 4) {
Image(systemName: "arrow.up")
.font(theme.userSansFont(size: 12))
.font(theme.themedFont(size: 12, style: .sans))
.foregroundColor(.green)
Text("\(story.score)")
.font(theme.userSansFont(size: 12, weight: .medium))
.font(theme.themedFont(size: 12, style: .sans, weight: .medium))
}

HStack(spacing: 4) {
Expand Down
Loading
Loading