Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] 회원가입 중 약관 웹뷰 연결 #22

Merged
merged 1 commit into from
Aug 19, 2023
Merged
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
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