Skip to content

Commit

Permalink
Merge pull request #22 from meongmory/feature/3-auth-ui
Browse files Browse the repository at this point in the history
[Feature] 회원가입 중 약관 웹뷰 연결
  • Loading branch information
Nya128 authored Aug 19, 2023
2 parents f6eada1 + fa64113 commit 9a422a4
Showing 1 changed file with 46 additions and 29 deletions.
75 changes: 46 additions & 29 deletions meongmory_iOS/Presentation/View/Auth/AgreeToTermsView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct AgreeToTermsView: View {
var forced: Bool
var content: String
@State var isAgree: Bool
var webUrl: TermType?
}

@Environment(\.presentationMode) var presentationMode: Binding<PresentationMode>
Expand All @@ -23,9 +24,9 @@ struct AgreeToTermsView: View {

@State var isAllAgree: Bool = false
@State var terms: [Term] = [
Term(forced: true, content: "이용 약관 동의", isAgree: false),
Term(forced: true, content: "개인 정보 수집 및 이용 동의", isAgree: false),
Term(forced: false, content: "E-mail 및 SMS 광고성 정보 수신 동의", isAgree: false)
Term(forced: true, content: "이용 약관 동의", isAgree: false, webUrl: .term),
Term(forced: true, content: "개인 정보 수집 및 이용 동의", isAgree: false, webUrl: .privacyTerm),
Term(forced: false, content: "E-mail 및 SMS 광고성 정보 수신 동의", isAgree: false, webUrl: nil)
]

var body: some View {
Expand All @@ -36,12 +37,9 @@ struct AgreeToTermsView: View {
Divider()
.padding(.vertical, 5)

// terms.forEach { term in
// getAgreeOfTermView(term: term)
// }
getAgreeOfTermView(term: terms[0])
getAgreeOfTermView(term: terms[1])
getAgreeOfTermView(term: terms[2])
getTermViewWithWeb(term: terms[0])
getTermViewWithWeb(term: terms[1])
getTermViewWithoutWeb(term: terms[2])


Spacer()
Expand Down Expand Up @@ -109,12 +107,48 @@ struct AgreeToTermsView: View {
.font(Font.system(size: 12))
.foregroundColor(Color(red: 69/255, green: 69/255, blue: 69/255))
.lineSpacing(4)
}
}
})
}

func getAgreeOfTermView(term: Term) -> some View {
var bottomButton: some View {
NavigationLink {
SetNicknameView()
} label: {
Text("동의하고 시작하기")
.fontWeight(.bold)
.foregroundColor(Color.white)
.frame(maxWidth: .infinity)
.padding(.vertical, 10)
}
.navigationBarBackButtonHidden(true)
.background(isAllAgree
? Color(red: 252/255, green: 156/255, blue: 19/255)
: Color(red: 217/255, green: 217/255, blue: 217/255))
.cornerRadius(10)
}

/// methods
func getTermViewWithWeb(term: Term) -> some View {
var agreeOfTerm: some View {
NavigationLink {
TermWebView(type: .term)
} label: {
getTermRowLabel(term: term)
}
.accentColor(.black)
}
return agreeOfTerm
}


func getTermViewWithoutWeb(term: Term) -> some View {
return getTermRowLabel(term: term)
}


func getTermRowLabel(term: Term) -> some View {
var label: some View {
HStack(alignment: .firstTextBaseline, content: {
Button {
term.isAgree.toggle()
Expand Down Expand Up @@ -142,24 +176,7 @@ struct AgreeToTermsView: View {
.font(Font.system(size: 14))
})
}
return agreeOfTerm
}

var bottomButton: some View {
NavigationLink {
SetNicknameView()
} label: {
Text("동의하고 시작하기")
.fontWeight(.bold)
.foregroundColor(Color.white)
.frame(maxWidth: .infinity)
.padding(.vertical, 10)
}
.navigationBarBackButtonHidden(true)
.background(isAllAgree
? Color(red: 252/255, green: 156/255, blue: 19/255)
: Color(red: 217/255, green: 217/255, blue: 217/255))
.cornerRadius(10)
return label
}

}
Expand Down

0 comments on commit 9a422a4

Please sign in to comment.