Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions DevLog/Presentation/ViewModel/SettingViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -50,6 +48,10 @@ final class SettingViewModel: Store {
private let updateSystemThemeUseCase: UpdateSystemThemeUseCase
private var cancellables = Set<AnyCancellable>()

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
Comment thread
opficdev marked this conversation as resolved.

init(
deleteAuthUseCase: DeleteAuthUseCase,
signOutUseCase: SignOutUseCase,
Expand Down
22 changes: 8 additions & 14 deletions DevLog/UI/Setting/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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("베타 테스트 참여")
Expand Down