File tree Expand file tree Collapse file tree 6 files changed +24
-3
lines changed
CoreKit/Sources/Data/Client/UserDefaults Expand file tree Collapse file tree 6 files changed +24
-3
lines changed Original file line number Diff line number Diff line change @@ -78,6 +78,12 @@ public struct AppDelegateFeature {
7878 catch: { _, _ in }
7979 case let . userNotifications( . willPresentNotification( _, completionHandler) ) :
8080 return . run { _ in completionHandler ( . banner) }
81+
82+ case let . userNotifications( . didReceiveResponse( _, completionHandler) ) :
83+ return . run { send in
84+ await userDefaults. setBool ( true , . fromBanner)
85+ completionHandler ( )
86+ }
8187 case . userNotifications:
8288 return . none
8389
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ import FeatureLogin
1111@Reducer
1212public struct IntroFeature {
1313 /// - Dependency
14-
14+ @ Dependency ( \ . userDefaults ) var userDefaults
1515 /// - State
1616 @ObservableState
1717 public enum State {
@@ -68,6 +68,9 @@ private extension IntroFeature {
6868
6969 case . delegate( . loginNeeded) :
7070 return . run { send in
71+ /// 알람을 통해 앱을 들어왔으나 자동 로그인을 실패했다면 배너로 이동하지 못하게 flag 삭제
72+ await userDefaults. removeBool ( . fromBanner)
73+ /// Todo: 원하는 애니메이션 넣어줘~
7174 await send ( . _sceneChange( . login( ) ) , animation: . smooth)
7275 }
7376
Original file line number Diff line number Diff line change @@ -21,6 +21,8 @@ public struct MainTabFeature {
2121 private var pasteBoard
2222 @Dependency ( \. categoryClient)
2323 private var categoryClient
24+ @Dependency ( \. userDefaults)
25+ private var userDefaults
2426 /// - State
2527 @ObservableState
2628 public struct State : Equatable {
@@ -80,6 +82,7 @@ public struct MainTabFeature {
8082 case 포킷추가하기
8183 case 로그아웃
8284 case 회원탈퇴
85+ case 알림함이동
8386 }
8487 }
8588 /// initiallizer
@@ -150,6 +153,12 @@ private extension MainTabFeature {
150153
151154 case . onAppear:
152155 return . run { send in
156+ let fromBanner = userDefaults. boolKey ( . fromBanner)
157+ if fromBanner {
158+ await userDefaults. removeBool ( . fromBanner)
159+ await send ( . delegate( . 알림함이동) )
160+ }
161+
153162 for await _ in self . pasteBoard. changes ( ) {
154163 let url = try await pasteBoard. probableWebURL ( )
155164 await send ( . inner( . linkCopySuccess( url) ) , animation: . pokitSpring)
Original file line number Diff line number Diff line change @@ -60,7 +60,8 @@ public extension MainTabFeature {
6060 switch action {
6161 /// - 네비게이션 바 `알림`버튼 눌렀을 때
6262 case . pokit( . delegate( . alertButtonTapped) ) ,
63- . remind( . delegate( . alertButtonTapped) ) :
63+ . remind( . delegate( . alertButtonTapped) ) ,
64+ . delegate( . 알림함이동) :
6465 state. path. append ( . 알림함( PokitAlertBoxFeature . State ( ) ) )
6566 return . none
6667
Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ public struct RootFeature {
5555 }
5656
5757 case . mainTab( . delegate( . 로그아웃) ) ,
58- . mainTab( . delegate( . 회원탈퇴) ) :
58+ . mainTab( . delegate( . 회원탈퇴) ) :
5959 return . run { send in await send ( . _sceneChange( . intro( . login( ) ) ) ) }
6060
6161 case . intro, . mainTab:
Original file line number Diff line number Diff line change @@ -10,6 +10,8 @@ import Foundation
1010public enum UserDefaultsKey {
1111 public enum BoolKey : String {
1212 case autoSaveSearch
13+ /// - 배너를 클릭해서 들어왔을 때
14+ case fromBanner
1315 }
1416 public enum StringKey : String {
1517 /// `구글` or `애플`
You can’t perform that action at this time.
0 commit comments