Skip to content

Commit 8d1dd78

Browse files
committed
refactor: 번들 url을 state에서 제외
1 parent 9845f87 commit 8d1dd78

2 files changed

Lines changed: 12 additions & 16 deletions

File tree

DevLog/Presentation/ViewModel/SettingViewModel.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ final class SettingViewModel: Store {
1818
var alertTitle: String = ""
1919
var alertType: AlertType?
2020
var alertMessage: String = ""
21-
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
22-
let policyURL = Bundle.main.object(forInfoDictionaryKey: "PRIVACY_POLICY_URL") as? String
2321
}
2422

2523
enum Action {
@@ -50,6 +48,10 @@ final class SettingViewModel: Store {
5048
private let updateSystemThemeUseCase: UpdateSystemThemeUseCase
5149
private var cancellables = Set<AnyCancellable>()
5250

51+
let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String
52+
let appstoreUrl = Bundle.main.object(forInfoDictionaryKey: "APPSTORE_URL") as? String
53+
let policyURL = Bundle.main.object(forInfoDictionaryKey: "PRIVACY_POLICY_URL") as? String
54+
5355
init(
5456
deleteAuthUseCase: DeleteAuthUseCase,
5557
signOutUseCase: SignOutUseCase,

DevLog/UI/Setting/SettingView.swift

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,25 @@ struct SettingView: View {
5050
}
5151

5252
Section {
53-
if let appVersion = viewModel.state.appVersion {
53+
if let appVersion = viewModel.appVersion {
5454
HStack {
5555
Text("버전 정보")
5656
Spacer()
5757
Text(appVersion)
5858
}
5959
}
60-
if let ppurl = viewModel.state.policyURL {
61-
Link(destination: URL(string: ppurl)!) {
60+
if let policyString = viewModel.policyURL,
61+
let url = URL(string: policyString) {
62+
Link(destination: url) {
6263
Text("개인정보 처리방침")
6364
.foregroundColor(Color.blue)
6465
}
6566
}
6667
Button(action: {
67-
if let url = URL(string: "itms-beta://") {
68-
UIApplication.shared.open(url, options: [:]) { success in
69-
if !success {
70-
if let urlString = Bundle.main.object(
71-
forInfoDictionaryKey: "APPSTORE_URL") as? String,
72-
let appStoreURL = URL(string: urlString) {
73-
UIApplication.shared.open(appStoreURL)
74-
}
75-
}
76-
}
77-
}
68+
if let appStoreString = viewModel.appstoreUrl,
69+
let url = URL(string: appStoreString) {
70+
UIApplication.shared.open(url)
71+
}
7872
}) {
7973
VStack(alignment: .leading) {
8074
Text("베타 테스트 참여")

0 commit comments

Comments
 (0)