Skip to content
Open
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
1 change: 1 addition & 0 deletions TidepoolOnboarding/View Modifiers/ModalPresentation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import SwiftUI
extension View {
func presentation(isModal: Bool, onDismissalAttempt: (() -> Void)? = nil) -> some View {
ModalPresentationView(view: self, isModal: isModal, onDismissalAttempt: onDismissalAttempt)
.ignoresSafeArea()
}
}

Expand Down
39 changes: 24 additions & 15 deletions TidepoolOnboarding/Views/OnboardingSectionPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ struct OnboardingSectionPageView<Destination: View, Content: View, Footer: View>

@State private var isDestinationActiveFromNextButton = false
@State private var isCloseAlertPresented = false
@State private var scrollViewHeight: CGFloat = 0

private let section: OnboardingSection
private let editMode: Bool
Expand Down Expand Up @@ -90,24 +91,32 @@ struct OnboardingSectionPageView<Destination: View, Content: View, Footer: View>

var body: some View {
OnboardingSectionWrapperView(section: section) {
GeometryReader { geometry in
ScrollView {
VStack(spacing: 10) {
Segment {
content
}
Spacer()
if let footer = footer {
footer
}
if !nextButtonHidden {
nextButton
}
ScrollView {
VStack(spacing: 10) {
Segment {
content
}
Spacer()
if let footer = footer {
footer
}
if !nextButtonHidden {
nextButton
}
.padding()
.frame(minHeight: geometry.size.height)
}
.padding()
.frame(minHeight: scrollViewHeight)
}
.background(
GeometryReader { geometry in
let visibleHeight = geometry.size.height - (geometry.frame(in: .global).maxY > UIScreen.main.bounds.height - geometry.safeAreaInsets.bottom + 0.5 ? geometry.safeAreaInsets.bottom : 0)
Color.clear
.onAppear { scrollViewHeight = visibleHeight }
.onChange(of: visibleHeight) { _, height in
scrollViewHeight = height
}
}
)
}
.editMode(editMode)
.backButtonHidden(backButtonHidden)
Expand Down
10 changes: 2 additions & 8 deletions TidepoolOnboarding/Views/OnboardingSectionWrapperView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,8 @@ struct OnboardingSectionWrapperView<Content: View>: View {

private var backButton: some View {
Button(action: { presentationMode.wrappedValue.dismiss() }) {
HStack {
Image(systemName: "chevron.left")
.resizable()
.frame(width: 12, height: 20)
Text(backButtonTitle)
.fontWeight(.regular)
}
.offset(x: -6, y: 0)
Image(systemName: "chevron.left")
.fontWeight(.semibold)
}
.accessibilityElement()
.accessibilityAddTraits(.isButton)
Expand Down
39 changes: 24 additions & 15 deletions TidepoolOnboarding/Views/Sections/WelcomeViews.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,39 @@ struct WelcomeTabView: View {
@EnvironmentObject var onboardingViewModel: OnboardingViewModel

@State private var selectedIndex = 0
@State private var pageHeight: CGFloat = 0

var body: some View {
ZStack {
Color(.systemBackground)
.edgesIgnoringSafeArea(.all)
GeometryReader { geometry in
TabView(selection: $selectedIndex) {
ForEach(welcomeData.indices, id: \.self) { viewIndex in
ScrollView {
VStack {
welcome(for: viewIndex)
Spacer()
pager(for: viewIndex)
.padding(.vertical)
button(for: viewIndex)
}
.padding()
.frame(minHeight: geometry.size.height)
TabView(selection: $selectedIndex) {
ForEach(welcomeData.indices, id: \.self) { viewIndex in
ScrollView {
VStack {
welcome(for: viewIndex)
Spacer()
pager(for: viewIndex)
.padding(.vertical)
button(for: viewIndex)
}
.tag(viewIndex)
.padding()
.frame(minHeight: pageHeight)
}
.tag(viewIndex)
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
}
.tabViewStyle(PageTabViewStyle(indexDisplayMode: .never))
.background(
GeometryReader { geometry in
let visibleHeight = geometry.size.height - (geometry.frame(in: .global).maxY > UIScreen.main.bounds.height - geometry.safeAreaInsets.bottom + 0.5 ? geometry.safeAreaInsets.bottom : 0)
Color.clear
.onAppear { pageHeight = visibleHeight }
.onChange(of: visibleHeight) { _, height in
pageHeight = height
}
}
)
}
.onAppear { onboardingViewModel.sectionProgression.startSection(.welcome) }
}
Expand Down