diff --git a/DevLog/Presentation/ViewModel/SettingViewModel.swift b/DevLog/Presentation/ViewModel/SettingViewModel.swift index d2f724be..3b4d6297 100644 --- a/DevLog/Presentation/ViewModel/SettingViewModel.swift +++ b/DevLog/Presentation/ViewModel/SettingViewModel.swift @@ -18,8 +18,6 @@ final class SettingViewModel: Store { var alertTitle: String = "" var alertType: AlertType? var alertMessage: String = "" - let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String - let policyURL = Bundle.main.object(forInfoDictionaryKey: "PRIVACY_POLICY_URL") as? String } enum Action { @@ -50,6 +48,10 @@ final class SettingViewModel: Store { private let updateSystemThemeUseCase: UpdateSystemThemeUseCase private var cancellables = Set() + let appVersion = Bundle.main.infoDictionary?["CFBundleShortVersionString"] as? String + let appstoreUrl = Bundle.main.object(forInfoDictionaryKey: "APPSTORE_URL") as? String + let policyURL = Bundle.main.object(forInfoDictionaryKey: "PRIVACY_POLICY_URL") as? String + init( deleteAuthUseCase: DeleteAuthUseCase, signOutUseCase: SignOutUseCase, diff --git a/DevLog/UI/Setting/SettingView.swift b/DevLog/UI/Setting/SettingView.swift index ca688978..0ba42d69 100644 --- a/DevLog/UI/Setting/SettingView.swift +++ b/DevLog/UI/Setting/SettingView.swift @@ -50,31 +50,25 @@ struct SettingView: View { } Section { - if let appVersion = viewModel.state.appVersion { + if let appVersion = viewModel.appVersion { HStack { Text("버전 정보") Spacer() Text(appVersion) } } - if let ppurl = viewModel.state.policyURL { - Link(destination: URL(string: ppurl)!) { + if let policyString = viewModel.policyURL, + let url = URL(string: policyString) { + Link(destination: url) { Text("개인정보 처리방침") .foregroundColor(Color.blue) } } Button(action: { - if let url = URL(string: "itms-beta://") { - UIApplication.shared.open(url, options: [:]) { success in - if !success { - if let urlString = Bundle.main.object( - forInfoDictionaryKey: "APPSTORE_URL") as? String, - let appStoreURL = URL(string: urlString) { - UIApplication.shared.open(appStoreURL) - } - } - } - } + if let appStoreString = viewModel.appstoreUrl, + let url = URL(string: appStoreString) { + UIApplication.shared.open(url) + } }) { VStack(alignment: .leading) { Text("베타 테스트 참여")