File tree Expand file tree Collapse file tree 3 files changed +17
-4
lines changed
SourceCode/Feature/2.QuestionTab/2-2.TodayQuestion Expand file tree Collapse file tree 3 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -17,5 +17,6 @@ enum Constant {
1717
1818extension Constant {
1919 static let isSignIn = " isSignIn "
20+ static let recentQuestionID = " recentQuestionID "
2021 static let userRandomID = " userRandomID "
2122}
Original file line number Diff line number Diff line change @@ -19,8 +19,10 @@ struct TodayQuestionFeature {
1919 var timeRemainingForQuestion : TimeInterval = 0
2020 var isLoading = true
2121 var isFirstLaunch = true
22+ var isNewQuestion = false
2223 @Presents var sheet : Sheet . State ?
2324 @Presents var alert : AlertState < Action . Alert > ?
25+ @Shared ( . appStorage( Constant . recentQuestionID) ) var recentQuestionID = 0
2426 }
2527
2628 enum Action {
@@ -79,6 +81,14 @@ struct TodayQuestionFeature {
7981 case let . mainQuestionResponse( mainQuestion) :
8082 state. isFirstLaunch = false
8183 state. todayQuestion = mainQuestion
84+
85+ if mainQuestion. id != state. recentQuestionID {
86+ state. isNewQuestion = true
87+ state. $recentQuestionID. withLock { $0 = mainQuestion. id }
88+ } else {
89+ state. isNewQuestion = false
90+ }
91+
8292 if isQuestionLiveTime {
8393 state. questionState = mainQuestion. isAnswered ? . complete : . ready
8494 return . none
Original file line number Diff line number Diff line change @@ -15,12 +15,14 @@ struct TodayQuestionView: View {
1515 var body : some View {
1616 ScrollView {
1717 VStack ( spacing: 0 ) {
18- LargeHeaderView ( store: store)
19- LargeQuestionButton ( store: store)
20- // SmallHeaderView(store: store)
18+ if store. isNewQuestion {
19+ LargeHeaderView ( store: store)
20+ LargeQuestionButton ( store: store)
21+ } else {
22+ SmallHeaderView ( store: store)
23+ }
2124 AnswerPreviewList ( store: store)
2225 }
23-
2426 }
2527 . background ( . second)
2628 . scrollIndicators ( . hidden)
You can’t perform that action at this time.
0 commit comments