Skip to content

Commit

Permalink
[Feat/#118] 뒤로가기 버튼 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
HELLOHIDI committed Nov 24, 2024
1 parent b557d04 commit afcebd1
Show file tree
Hide file tree
Showing 20 changed files with 78 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ public extension Project {
"NSAppTransportSecurity": [
"NSAllowsArbitraryLoads": true
],
"UIAppFonts": ["Pretendard-Regular.otf", "Pretendard-SemiBold.otf", "Pretendard-Medium.otf"]
"UIAppFonts": ["Pretendard-Regular.otf", "Pretendard-SemiBold.otf", "Pretendard-Medium.otf"],
"UILaunchStoryboardName": "LaunchScreen"
]


Expand All @@ -42,7 +43,8 @@ public extension Project {
"NSAppTransportSecurity": [
"NSAllowsArbitraryLoads": true
],
"UIAppFonts": ["Pretendard-Regular.otf", "Pretendard-SemiBold.otf", "Pretendard-Medium.otf"]
"UIAppFonts": ["Pretendard-Regular.otf", "Pretendard-SemiBold.otf", "Pretendard-Medium.otf"],
"UILaunchStoryboardName": "LaunchScreen"
]

static let deviceActivityMonitorInfoPlist: [String: Plist.Value] = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct AuthServiceView: View {
VStack {
HStack {
Button {
print("뒤로 가기")
viewModel.send(action: .backButtonDidTap)
} label: {
Image(systemName: "chevron.backward")
.resizable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class AuthServiceViewModel: ObservableObject {
//MARK: Action, State

enum Action {
case backButtonDidTap
case serviceButtonDidTap(Int)
}

Expand Down Expand Up @@ -50,6 +51,8 @@ class AuthServiceViewModel: ObservableObject {
switch index {
case 0:
service.signUp(request: .stub)
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -62,6 +65,8 @@ class AuthServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 1:
service.socialLogin(request: .init(socialPlatform: "KAKAO"))
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -75,6 +80,8 @@ class AuthServiceViewModel: ObservableObject {
default:
break
}
case .backButtonDidTap:
navigationRouter.pop()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct ChallengeServiceView: View {
VStack {
HStack {
Button {
print("뒤로 가기")
viewModel.send(action: .backButtonDidTap)
} label: {
Image(systemName: "chevron.backward")
.resizable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class ChallengeServiceViewModel: ObservableObject {
//MARK: Action, State

enum Action {
case backButtonDidTap
case serviceButtonDidTap(Int)
}

Expand Down Expand Up @@ -53,6 +54,8 @@ class ChallengeServiceViewModel: ObservableObject {
switch index {
case 0:
service.getDailyChallenge()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -65,6 +68,8 @@ class ChallengeServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 1:
service.getSuccesChallenge()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -77,6 +82,8 @@ class ChallengeServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 2:
service.createChallenge(request: .stub)
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -89,6 +96,8 @@ class ChallengeServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 3:
service.postLockChallenge()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -101,6 +110,8 @@ class ChallengeServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 4:
service.deleteApp(request: .stub)
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -114,6 +125,8 @@ class ChallengeServiceViewModel: ObservableObject {

case 5:
service.addApp(request: .stub)
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -127,6 +140,8 @@ class ChallengeServiceViewModel: ObservableObject {

case 6:
service.getChallenge()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -140,6 +155,8 @@ class ChallengeServiceViewModel: ObservableObject {
default:
break
}
case .backButtonDidTap:
navigationRouter.pop()
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct PointServiceView: View {
VStack {
HStack {
Button {
print("뒤로 가기")
viewModel.send(action: .backButtonDidTap)
} label: {
Image(systemName: "chevron.backward")
.resizable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class PointServiceViewModel: ObservableObject {
//MARK: Action, State

enum Action {
case backButtonDidTap
case serviceButtonDidTap(Int)
}

Expand Down Expand Up @@ -50,10 +51,11 @@ class PointServiceViewModel: ObservableObject {
func send(action: Action) {
switch action {
case .serviceButtonDidTap(let index):
let requestPublisher: AnyPublisher<Any, Error>
switch index {
case 0:
service.patchPointUse()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -66,6 +68,8 @@ class PointServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 1:
service.getEarnPoint()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -78,6 +82,8 @@ class PointServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 2:
service.getUsagePoint()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -90,6 +96,8 @@ class PointServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 3:
service.patchEarnPoint(request: .stub)
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -102,6 +110,8 @@ class PointServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 4:
service.getPointList()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -115,6 +125,8 @@ class PointServiceViewModel: ObservableObject {
default:
break
}
case .backButtonDidTap:
navigationRouter.pop()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ struct UserServiceView: View {
VStack {
HStack {
Button {
print("뒤로 가기")
viewModel.send(action: .backButtonDidTap)
} label: {
Image(systemName: "chevron.backward")
.resizable()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class UserServiceViewModel: ObservableObject {
//MARK: Action, State

enum Action {
case backButtonDidTap
case serviceButtonDidTap(Int)
}

Expand Down Expand Up @@ -50,6 +51,8 @@ class UserServiceViewModel: ObservableObject {
switch index {
case 0:
service.logout()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -62,6 +65,8 @@ class UserServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 1:
service.deleteAccount()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -74,6 +79,8 @@ class UserServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 2:
service.getUserData()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -86,6 +93,8 @@ class UserServiceViewModel: ObservableObject {
.store(in: cancelBag)
case 3:
service.getCurrentPoint()
.subscribe(on: DispatchQueue.global())
.receive(on: DispatchQueue.main)
.sink(receiveCompletion: { [weak self] completion in
if case let .failure(error) = completion {
self?.state.networkLoggingText = error.description
Expand All @@ -99,6 +108,8 @@ class UserServiceViewModel: ObservableObject {
default:
break
}
case .backButtonDidTap:
navigationRouter.pop()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
<key>UISceneConfigurations</key>
<dict/>
</dict>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
Expand Down

0 comments on commit afcebd1

Please sign in to comment.