4 files changed +34
-8
lines changed Original file line number Diff line number Diff line change @@ -3,10 +3,16 @@ import SwiftUI
3
3
public struct HeaderView : View {
4
4
@Environment ( \. dismiss) var dismiss
5
5
let title : String
6
+ let subtitle : String ?
6
7
let showBack : Bool
7
8
8
- public init ( title: String , showBack: Bool = true ) {
9
+ public init (
10
+ title: String ,
11
+ subtitle: String ? = nil ,
12
+ showBack: Bool = true
13
+ ) {
9
14
self . title = title
15
+ self . subtitle = subtitle
10
16
self . showBack = showBack
11
17
}
12
18
@@ -16,9 +22,18 @@ public struct HeaderView: View {
16
22
Image ( systemName: " chevron.backward " )
17
23
. id ( " back " )
18
24
}
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
+ }
22
37
}
23
38
. onTapGesture {
24
39
dismiss ( )
Original file line number Diff line number Diff line change @@ -3,9 +3,11 @@ import Models
3
3
import PostUI
4
4
import Router
5
5
import SwiftUI
6
+ import Network
6
7
7
8
struct SingleNotificationRow : View {
8
9
@Environment ( Router . self) var router
10
+ @Environment ( BSkyClient . self) var client
9
11
10
12
let notification : AppBskyLexicon . Notification . Notification
11
13
let postItem : PostItem ?
@@ -54,6 +56,7 @@ struct SingleNotificationRow: View {
54
56
. onTapGesture {
55
57
router. navigateTo ( RouterDestination . post ( postItem) )
56
58
}
59
+ . environment ( PostDataController ( post: postItem, client: client) )
57
60
}
58
61
}
59
62
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ public struct CurrentUserView: View {
8
8
9
9
public var body : some View {
10
10
if let profile = currentUser. profile {
11
- ProfileView ( profile: profile. profile)
11
+ ProfileView ( profile: profile. profile, showBack : false )
12
12
} else {
13
13
ProgressView ( )
14
14
}
Original file line number Diff line number Diff line change @@ -4,16 +4,24 @@ import SwiftUI
4
4
5
5
public struct ProfileView : View {
6
6
public let profile : Profile
7
+ public let showBack : Bool
7
8
8
- public init ( profile: Profile ) {
9
+ public init ( profile: Profile , showBack : Bool = true ) {
9
10
self . profile = profile
11
+ self . showBack = showBack
10
12
}
11
13
12
14
public var body : some View {
13
15
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)
16
22
}
17
23
. listStyle ( . plain)
24
+ . navigationBarBackButtonHidden ( )
25
+ . toolbar ( . hidden, for: . navigationBar)
18
26
}
19
27
}
0 commit comments