Skip to content

Commit 98bb4be

Browse files
committedDec 4, 2024
Fix notifications + profile base
1 parent a6aaa70 commit 98bb4be

File tree

4 files changed

+34
-8
lines changed

4 files changed

+34
-8
lines changed
 

‎Packages/Features/Sources/DesignSystem/Header/HeaderVIew.swift

+19-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@ import SwiftUI
33
public struct HeaderView: View {
44
@Environment(\.dismiss) var dismiss
55
let title: String
6+
let subtitle: String?
67
let showBack: Bool
78

8-
public init(title: String, showBack: Bool = true) {
9+
public init(
10+
title: String,
11+
subtitle: String? = nil,
12+
showBack: Bool = true
13+
) {
914
self.title = title
15+
self.subtitle = subtitle
1016
self.showBack = showBack
1117
}
1218

@@ -16,9 +22,18 @@ public struct HeaderView: View {
1622
Image(systemName: "chevron.backward")
1723
.id("back")
1824
}
19-
Text(title)
20-
.lineLimit(1)
21-
.minimumScaleFactor(0.5)
25+
VStack(alignment: .leading, spacing: 4) {
26+
Text(title)
27+
.lineLimit(1)
28+
.minimumScaleFactor(0.5)
29+
if let subtitle {
30+
Text(subtitle)
31+
.foregroundStyle(.secondary)
32+
.font(.callout)
33+
.lineLimit(1)
34+
.minimumScaleFactor(0.5)
35+
}
36+
}
2237
}
2338
.onTapGesture {
2439
dismiss()

‎Packages/Features/Sources/NotificationsUI/Rows/SingleNotificationRow.swift

+3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import Models
33
import PostUI
44
import Router
55
import SwiftUI
6+
import Network
67

78
struct SingleNotificationRow: View {
89
@Environment(Router.self) var router
10+
@Environment(BSkyClient.self) var client
911

1012
let notification: AppBskyLexicon.Notification.Notification
1113
let postItem: PostItem?
@@ -54,6 +56,7 @@ struct SingleNotificationRow: View {
5456
.onTapGesture {
5557
router.navigateTo(RouterDestination.post(postItem))
5658
}
59+
.environment(PostDataController(post: postItem, client: client))
5760
}
5861
}
5962

‎Packages/Features/Sources/ProfileUI/CurrentUserView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public struct CurrentUserView: View {
88

99
public var body: some View {
1010
if let profile = currentUser.profile {
11-
ProfileView(profile: profile.profile)
11+
ProfileView(profile: profile.profile, showBack: false)
1212
} else {
1313
ProgressView()
1414
}

‎Packages/Features/Sources/ProfileUI/ProfileView.swift

+11-3
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,24 @@ import SwiftUI
44

55
public struct ProfileView: View {
66
public let profile: Profile
7+
public let showBack: Bool
78

8-
public init(profile: Profile) {
9+
public init(profile: Profile, showBack: Bool = true) {
910
self.profile = profile
11+
self.showBack = showBack
1012
}
1113

1214
public var body: some View {
1315
List {
14-
HeaderView(title: profile.displayName ?? profile.handle)
15-
.padding(.bottom)
16+
HeaderView(
17+
title: profile.displayName ?? profile.handle,
18+
subtitle: "@\(profile.handle)",
19+
showBack: showBack
20+
)
21+
.padding(.bottom)
1622
}
1723
.listStyle(.plain)
24+
.navigationBarBackButtonHidden()
25+
.toolbar(.hidden, for: .navigationBar)
1826
}
1927
}

0 commit comments

Comments
 (0)
Failed to load comments.