Skip to content

Commit 469d760

Browse files
committed
design: 위치 데이터 이전 UI 수정
1 parent e87679a commit 469d760

1 file changed

Lines changed: 109 additions & 6 deletions

File tree

SpaceWalker/Features/MyPage/View/MyPageViewController.swift

Lines changed: 109 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,46 @@ final class MyPageViewController: UIViewController {
109109
private lazy var policyButton = makeSettingButton(title: "개인정보 처리방침")
110110
private lazy var termsButton = makeSettingButton(title: "서비스 이용약관")
111111
private lazy var ossButton = makeSettingButton(title: "오픈소스 라이센스")
112-
private lazy var exportLocationButton = makeSettingButton(title: "위치 데이터 내보내기")
113-
private lazy var importLocationButton = makeSettingButton(title: "위치 데이터 가져오기")
112+
113+
private let locationTransferCard: UIView = {
114+
let view = UIView()
115+
view.backgroundColor = UIColor.systemBlue.withAlphaComponent(0.08)
116+
view.layer.cornerRadius = 16
117+
view.layer.borderWidth = 1
118+
view.layer.borderColor = UIColor.systemBlue.withAlphaComponent(0.24).cgColor
119+
return view
120+
}()
121+
private let locationTransferIconView: UIImageView = {
122+
let iv = UIImageView(image: UIImage(systemName: "arrow.triangle.2.circlepath.icloud"))
123+
iv.tintColor = .systemBlue
124+
iv.contentMode = .scaleAspectFit
125+
return iv
126+
}()
127+
private let locationTransferTitleLabel: UILabel = {
128+
let lb = UILabel()
129+
lb.text = "위치 데이터 이전"
130+
lb.font = .systemFont(ofSize: 16, weight: .semibold)
131+
lb.textColor = .label
132+
return lb
133+
}()
134+
private let locationTransferDescriptionLabel: UILabel = {
135+
let lb = UILabel()
136+
lb.text = "기기 변경 시 위치 메타데이터를 내보내고 가져올 수 있어요."
137+
lb.font = .systemFont(ofSize: 13, weight: .regular)
138+
lb.textColor = .secondaryLabel
139+
lb.numberOfLines = 2
140+
return lb
141+
}()
142+
private lazy var exportLocationButton = makeTransferActionButton(
143+
title: "내보내기",
144+
image: UIImage(systemName: "square.and.arrow.up"),
145+
filled: true
146+
)
147+
private lazy var importLocationButton = makeTransferActionButton(
148+
title: "가져오기",
149+
image: UIImage(systemName: "square.and.arrow.down"),
150+
filled: false
151+
)
114152

115153
private let withdrawButton: UIButton = {
116154
var config = UIButton.Configuration.bordered()
@@ -292,9 +330,7 @@ final class MyPageViewController: UIViewController {
292330
let settingsStack = UIStackView(arrangedSubviews: [
293331
policyButton,
294332
termsButton,
295-
ossButton,
296-
exportLocationButton,
297-
importLocationButton
333+
ossButton
298334
])
299335
settingsStack.axis = .vertical
300336
settingsStack.spacing = 12
@@ -304,10 +340,54 @@ final class MyPageViewController: UIViewController {
304340
make.top.equalTo(settingsTitle.snp.bottom).offset(12)
305341
make.leading.trailing.equalToSuperview().inset(20)
306342
}
343+
344+
contentView.addSubview(locationTransferCard)
345+
locationTransferCard.snp.makeConstraints { make in
346+
make.top.equalTo(settingsStack.snp.bottom).offset(16)
347+
make.leading.trailing.equalToSuperview().inset(20)
348+
}
349+
350+
locationTransferCard.addSubview(locationTransferIconView)
351+
locationTransferCard.addSubview(locationTransferTitleLabel)
352+
locationTransferCard.addSubview(locationTransferDescriptionLabel)
353+
354+
locationTransferIconView.snp.makeConstraints { make in
355+
make.top.leading.equalToSuperview().inset(16)
356+
make.width.height.equalTo(20)
357+
}
358+
359+
locationTransferTitleLabel.snp.makeConstraints { make in
360+
make.top.equalToSuperview().inset(16)
361+
make.leading.equalTo(locationTransferIconView.snp.trailing).offset(8)
362+
make.trailing.equalToSuperview().inset(16)
363+
}
364+
365+
locationTransferDescriptionLabel.snp.makeConstraints { make in
366+
make.top.equalTo(locationTransferTitleLabel.snp.bottom).offset(6)
367+
make.leading.equalTo(locationTransferTitleLabel)
368+
make.trailing.equalToSuperview().inset(16)
369+
}
370+
371+
let transferButtonsStack = UIStackView(arrangedSubviews: [exportLocationButton, importLocationButton])
372+
transferButtonsStack.axis = .vertical
373+
transferButtonsStack.spacing = 10
374+
locationTransferCard.addSubview(transferButtonsStack)
375+
transferButtonsStack.snp.makeConstraints { make in
376+
make.top.equalTo(locationTransferDescriptionLabel.snp.bottom).offset(14)
377+
make.leading.trailing.bottom.equalToSuperview().inset(16)
378+
}
379+
380+
exportLocationButton.snp.makeConstraints { make in
381+
make.height.equalTo(44)
382+
}
383+
384+
importLocationButton.snp.makeConstraints { make in
385+
make.height.equalTo(44)
386+
}
307387

308388
contentView.addSubview(withdrawButton)
309389
withdrawButton.snp.makeConstraints { make in
310-
make.top.equalTo(settingsStack.snp.bottom).offset(28)
390+
make.top.equalTo(locationTransferCard.snp.bottom).offset(28)
311391
make.leading.trailing.equalToSuperview().inset(20)
312392
make.height.equalTo(52)
313393
make.bottom.equalToSuperview().inset(24)
@@ -327,6 +407,29 @@ final class MyPageViewController: UIViewController {
327407
b.contentHorizontalAlignment = .leading
328408
return b
329409
}
410+
411+
private func makeTransferActionButton(title: String, image: UIImage?, filled: Bool) -> UIButton {
412+
var config = UIButton.Configuration.filled()
413+
config.title = title
414+
config.image = image
415+
config.imagePadding = 8
416+
config.cornerStyle = .medium
417+
config.contentInsets = NSDirectionalEdgeInsets(top: 11, leading: 14, bottom: 11, trailing: 14)
418+
if filled {
419+
config.baseBackgroundColor = .systemBlue
420+
config.baseForegroundColor = .white
421+
} else {
422+
config.baseBackgroundColor = .clear
423+
config.baseForegroundColor = .systemBlue
424+
}
425+
let button = UIButton(configuration: config)
426+
if filled == false {
427+
button.layer.cornerRadius = 11
428+
button.layer.borderWidth = 1
429+
button.layer.borderColor = UIColor.systemBlue.withAlphaComponent(0.45).cgColor
430+
}
431+
return button
432+
}
330433

331434
private func bindActions() {
332435
editButton.addTarget(self, action: #selector(didTapEditNickname), for: .touchUpInside)

0 commit comments

Comments
 (0)