Skip to content

Commit

Permalink
[Feat] #415 - Add Cell in SettingView
Browse files Browse the repository at this point in the history
  • Loading branch information
HanGyeongjun committed Mar 1, 2023
1 parent 9236f7e commit 6671cbf
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 8 deletions.
5 changes: 4 additions & 1 deletion HappyAnding/HappyAnding/TextLiteral.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ enum TextLiteral {

//MARK: - announcementCell
static let announcementTag: String = "새로운 기능"
static let announcementDescription: String = "단축어 작성 등급 살펴보기"

//MARK: - UserGrade
static let UserGradeTitle: String = "단축어 작성 등급"
static let UserGradeDescription: String = "단축어 작성 등급 살펴보기"

// MARK: - RecentRegisteredView
static let recentRegisteredViewTitle: String = "최신 단축어"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ struct ExploreShortcutView: View {
if isAnnouncementShow {
AnnouncementCell(icon: "ShortcutGradeAnnouncement",
tagName: TextLiteral.announcementTag,
discription: TextLiteral.announcementDescription,
discription: TextLiteral.UserGradeTitle,
isAnnouncementShow: $isAnnouncementShow)
}

Expand Down
56 changes: 50 additions & 6 deletions HappyAnding/HappyAnding/Views/MyPageViews/SettingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@ struct SettingView: View {
var body: some View {
VStack(alignment: .leading) {

// MARK: - 버전 정보
if !getAppVersion().isEmpty {
SettingCell(title: TextLiteral.settingViewVersion, version: getAppVersion())
}

divider

//MARK: - 단축어 작성 등급
FunctionCell(title: TextLiteral.UserGradeTitle, tag: TextLiteral.announcementTag)

/*
// TODO: 알림 기능
Text("알림 설정")
Expand All @@ -40,11 +50,7 @@ struct SettingView: View {
}
*/

// MARK: - 버전 정보
if !getAppVersion().isEmpty {
SettingCell(title: TextLiteral.settingViewVersion, version: getAppVersion())
}

divider

// MARK: - 오픈소스 라이선스
SettingCell(title: TextLiteral.settingViewOpensourceLicense)
Expand All @@ -65,6 +71,7 @@ struct SettingView: View {
// SettingCell(title: "개발팀에 관하여")
// }


// MARK: - 개발자에게 연락하기 버튼
Button(action : {
if MFMailComposeViewController.canSendMail() {
Expand All @@ -80,14 +87,15 @@ struct SettingView: View {
}
}

divider

if useWithoutSignIn {
//MARK: - 로그인없이 둘러보기 시 로그인 버튼
Button {
useWithoutSignIn = false
} label: {
SettingCell(title: TextLiteral.settingViewLogin)
}

} else {
// MARK: - 로그아웃 버튼
Button {
Expand All @@ -111,6 +119,7 @@ struct SettingView: View {
Text(TextLiteral.settingViewLogoutMessage)
}


// MARK: - 회원탈퇴 버튼
SettingCell(title: TextLiteral.settingViewWithdrawal)
.navigationLinkRouter(data: NavigationWithdrawal.first)
Expand Down Expand Up @@ -139,6 +148,11 @@ struct SettingView: View {
.navigationBarTitleDisplayMode(.inline)
}

var divider: some View {
Divider()
.background(Color.gray1)
.frame(width: UIScreen.main.bounds.size.width - 32)
}

private func logOut() {
let firebaseAuth = Auth.auth()
Expand Down Expand Up @@ -175,6 +189,36 @@ struct SettingCell: View {
}
}

struct FunctionCell: View {
var title: String
var tag: String?

var body: some View {
HStack {
Text(title)
.Body1()
.foregroundColor(.gray4)
Spacer()
if let tag {
Text(tag)
.Body2()
.foregroundColor(Color.tagText)
.frame(height: 20)
.padding(.horizontal, 8)
.padding(.vertical, 2)
.background(
Capsule()
.fill( Color.tagBackground )
.overlay(
Capsule()
.strokeBorder(Color.shortcutsZipPrimary, lineWidth: 1)) )
}
}
.padding(.horizontal, 12)
.padding(.vertical, 16)
}
}

struct SettingView_Previews: PreviewProvider {
static var previews: some View {
SettingView()
Expand Down

0 comments on commit 6671cbf

Please sign in to comment.