Skip to content

Commit

Permalink
Merge pull request #1688 from HedvigInsurance/fix/form-update-home-mo…
Browse files Browse the repository at this point in the history
…ve-profile

Form update for home,moving flow and profile
  • Loading branch information
sladan-hedvig authored Jan 23, 2025
2 parents 22cec4b + 5ff845c commit f817886
Show file tree
Hide file tree
Showing 14 changed files with 43 additions and 54 deletions.
3 changes: 2 additions & 1 deletion Projects/App/Sources/Journeys/LoggedInNavigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ struct LoggedInNavigation: View {
}
}
)
.embededInNavigation(tracking: ProfileRedirectType.deleteRequestLoading)
}
}
.tabItem {
Expand Down Expand Up @@ -400,7 +401,7 @@ struct HomeTab: View {
}
.detent(
presented: $homeNavigationVm.navBarItems.isFirstVetPresented,
style: [.height]
style: [.large]
) {
let store: HomeStore = globalPresentableStoreContainer.get()
FirstVetView(partners: store.state.quickActions.getFirstVetPartners ?? [])
Expand Down
4 changes: 2 additions & 2 deletions Projects/Home/Sources/CommonClaims/FirstVetView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public struct FirstVetView: View {
}

public var body: some View {
hForm {
hUpdatedForm {
VStack(spacing: 8) {
ForEach(partners, id: \.id) { partner in
hSection {
Expand Down Expand Up @@ -46,7 +46,7 @@ public struct FirstVetView: View {
.hWithoutDivider
}
}
.hFormAttachToBottom {
.hFormAlwaysAttachToBottom {
hButton.LargeButton(type: .ghost) {
store.send(.dismissOtherServices)
} content: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ struct HelpCenterQuestionView: View {
}

var body: some View {
hForm {
hUpdatedForm {
VStack(alignment: .leading, spacing: 32) {
hSection {
VStack(alignment: .leading, spacing: 32) {
Expand Down Expand Up @@ -52,7 +52,7 @@ struct HelpCenterQuestionView: View {
}
}

#Preview{
#Preview {
HelpCenterQuestionView(
question: Question(
question: "When do you charge for my insurance?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct HelpCenterStartView: View {
}

public var body: some View {
hForm {
hUpdatedForm {
VStack(spacing: 0) {
hSection {
VStack(alignment: .leading, spacing: 40) {
Expand Down Expand Up @@ -74,7 +74,6 @@ public struct HelpCenterStartView: View {
vm.searchInProgress
? .transparent : .gradient(from: hBackgroundColor.primary, to: hSurfaceColor.Opaque.primary)
)
.hFormObserveKeyboard
.edgesIgnoringSafeArea(.bottom)
.dismissKeyboard()
.introspect(.viewController, on: .iOS(.v13...)) { [weak vm] vc in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct HelpCenterTopicView: View {
}

var body: some View {
hForm {
hUpdatedForm {
VStack(spacing: 40) {
hSection {
VStack(spacing: 40) {
Expand All @@ -41,7 +41,7 @@ struct HelpCenterTopicView: View {
}
}

#Preview{
#Preview {
let questions: [Question] = [
.init(
question: "When do you charge for my insurance?",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ struct MovingFlowAddExtraBuildingScreen: View {
}

var body: some View {
hForm {
hUpdatedForm {
VStack(spacing: 8) {
hSection {
typeOfBuilding
Expand Down Expand Up @@ -53,7 +53,7 @@ struct MovingFlowAddExtraBuildingScreen: View {
.sectionContainerStyle(.transparent)
}
}
.hDisableScroll
.hFormContentPosition(.compact)
}
@ViewBuilder
private var typeOfBuilding: some View {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct AppInfoView: View {
public init() {}

public var body: some View {
hForm {
hUpdatedForm {
hSection {
memberId
profileVersion
Expand All @@ -23,9 +23,8 @@ public struct AppInfoView: View {
.hWithoutHorizontalPadding
.hWithoutDividerPadding
.sectionContainerStyle(.transparent)
.hFormAttachToBottom {
.hFormAlwaysAttachToBottom {
submitBugButton
.padding(.vertical, .padding16)
.sectionContainerStyle(.transparent)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ public struct DeleteAccountView: View {

public var body: some View {
RouterHost(router: router, tracking: DeleteDetentType.deleteAccountView) {
hForm {
Spacing(height: vm.topSpacing)
hUpdatedForm {
hSection {
VStack(alignment: vm.alignment, spacing: vm.titleAndDescriptionSpacing) {
if let topIcon = vm.topIcon {
Expand All @@ -47,6 +46,7 @@ public struct DeleteAccountView: View {
}
.sectionContainerStyle(.transparent)
}
.hFormContentPosition(.compact)
.hFormAttachToBottom {
hSection {
VStack(spacing: 8) {
Expand All @@ -68,7 +68,6 @@ public struct DeleteAccountView: View {
}
.sectionContainerStyle(.transparent)
}
.hDisableScroll
}
}
}
Expand Down Expand Up @@ -124,15 +123,6 @@ extension DeleteAccountViewModel {
return .leading
}
}
var topSpacing: Float {
if self.hasActiveContracts {
return 64
} else if self.hasActiveClaims {
return 64
} else {
return 32
}
}

var titleAndDescriptionSpacing: CGFloat {
if self.hasActiveContracts {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import hGraphQL
public struct DeleteRequestLoadingView: View {
@PresentableStore var store: ProfileStore
var profileService = ProfileService()

@EnvironmentObject var router: Router
private var dismissAction: (ProfileNavigationDismissAction) -> Void

public init(
Expand All @@ -34,7 +34,7 @@ public struct DeleteRequestLoadingView: View {
}

@ViewBuilder private var successState: some View {
hForm {
hUpdatedForm {
VStack(spacing: 0) {
Image(uiImage: hCoreUIAssets.checkmark.image)
.resizable()
Expand All @@ -47,12 +47,13 @@ public struct DeleteRequestLoadingView: View {
.foregroundColor(hTextColor.Translucent.secondary)
.multilineTextAlignment(.center)
}
.padding(.top, UIScreen.main.bounds.size.height / 3.5)
.padding(.horizontal, .padding32)
}
.hFormContentPosition(.center)
.hFormAttachToBottom {
hSection {
hButton.LargeButton(type: .ghost) {
router.dismiss()
dismissAction(.makeHomeTabActive)
} content: {
hText(L10n.generalCloseButton, style: .body1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public struct EuroBonusView: View {
return L10n.SasIntegration.notConnected
}()

hForm {
hUpdatedForm {
hSection {
VStack(spacing: 16) {
hFloatingField(value: fieldValue, placeholder: L10n.SasIntegration.title) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public struct MyInfoView: View {
public init() {}

public var body: some View {
hForm {
hUpdatedForm {
hSection {
VStack(spacing: 4) {
hFloatingTextField(
Expand Down
4 changes: 2 additions & 2 deletions Projects/Profile/Sources/Views/Screens/Profile/Profile.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public struct ProfileView: View {
}

public var body: some View {
hForm {
hUpdatedForm {
PresentableStoreLens(
ProfileStore.self,
getter: { state in
Expand Down Expand Up @@ -52,7 +52,6 @@ public struct ProfileView: View {
.hWithoutDividerPadding
}
}
.hFormMergeBottomViewWithContentIfNeeded
.hFormAttachToBottom {
hSection {
VStack(spacing: 8) {
Expand All @@ -75,6 +74,7 @@ public struct ProfileView: View {
.onAppear {
store.send(.fetchProfileState)
}
.hSetScrollBounce(to: true)
.onPullToRefresh {
await store.sendAsync(.fetchProfileState)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ struct SettingsView: View {
}

var body: some View {
hForm {
hUpdatedForm {
hSection {
VStack(spacing: 4) {
hFloatingField(
Expand Down
39 changes: 19 additions & 20 deletions Projects/hCoreUI/Sources/ToggleStyles/CheckboxToggleStyle.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,26 @@ public struct CheckboxToggleStyle: ToggleStyle {
}

public func makeBody(configuration: Configuration) -> some View {
ZStack {
RoundedRectangle(cornerRadius: .cornerRadiusL).fill(getBackgroundColor)
.padding(.horizontal, 16)
hSection {
hRow {
configuration.label
}
.verticalPadding(0)
.hWithoutHorizontalPadding
.padding(.top, getTopPadding)
.padding(.bottom, getBottomPadding)
.padding(.horizontal, getHorizontalPadding)
hSection {
hRow {
configuration.label
}
.sectionContainerStyle(.transparent)
.onUpdate(of: configuration.isOn) { newValue in
withAnimation {
animate = true
}
withAnimation(.default.delay(0.4)) {
animate = false
}
.verticalPadding(0)
.hWithoutHorizontalPadding
.padding(.top, getTopPadding)
.padding(.bottom, getBottomPadding)
.padding(.horizontal, getHorizontalPadding)
.background {
RoundedRectangle(cornerRadius: .cornerRadiusL).fill(getBackgroundColor)
}
}
.sectionContainerStyle(.transparent)
.onUpdate(of: configuration.isOn) { newValue in
withAnimation {
animate = true
}
withAnimation(.default.delay(0.4)) {
animate = false
}
}
}
Expand Down

0 comments on commit f817886

Please sign in to comment.