Skip to content

Commit

Permalink
Fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
aromanov91 committed Feb 26, 2022
1 parent 943815d commit c83b649
Showing 1 changed file with 46 additions and 36 deletions.
82 changes: 46 additions & 36 deletions Sources/OversizeUI/Controls/HUD/HUD.swift
Original file line number Diff line number Diff line change
Expand Up @@ -99,42 +99,52 @@ public struct HUDSurfaceView<Content: View>: View {
}

public var body: some View {
// if #available(iOS 15.0, *) {
// content
// .padding(.top, topPadding)
// .padding(.horizontal, horizontalPadding)
// .padding(.bottom, bottomPadding)
// .background(backgroundMaterial(type: type),
// in: backgroundShape(type: type))
// .shadowElevaton(type == .hud ? .z2 : .z0)
// } else {
content
.padding(.top, topPadding)
.padding(.horizontal, horizontalPadding)
.padding(.bottom, bottomPadding)
.background(background(type: type))
// }
}

// @available(iOS 15.0, *)
// private func backgroundMaterial(type: HUDType) -> Material {
// switch type {
// case .hud:
// return .regular
// case .alert:
// return .ultraThinMaterial
// }
// }
//
// private func backgroundShape(type: HUDType) -> AnyShape {
// switch type {
// case .hud:
// return AnyShape(Capsule())
//
// case .alert:
// return AnyShape(RoundedRectangle(cornerRadius: Radius.medium.rawValue, style: .continuous))
// }
// }
#if os(iOS)
if #available(iOS 15.0, *) {
content
.padding(.top, topPadding)
.padding(.horizontal, horizontalPadding)
.padding(.bottom, bottomPadding)
.background(backgroundMaterial(type: type),
in: backgroundShape(type: type))
.shadowElevaton(type == .hud ? .z2 : .z0)
} else {
content
.padding(.top, topPadding)
.padding(.horizontal, horizontalPadding)
.padding(.bottom, bottomPadding)
.background(background(type: type))
}
#else
content
.padding(.top, topPadding)
.padding(.horizontal, horizontalPadding)
.padding(.bottom, bottomPadding)
.background(background(type: type))
#endif
}

#if os(iOS)
@available(iOS 15.0, *)
private func backgroundMaterial(type: HUDType) -> Material {
switch type {
case .hud:
return .regular
case .alert:
return .ultraThinMaterial
}
}
#endif

private func backgroundShape(type: HUDType) -> AnyShape {
switch type {
case .hud:
return AnyShape(Capsule())

case .alert:
return AnyShape(RoundedRectangle(cornerRadius: Radius.medium.rawValue, style: .continuous))
}
}

@ViewBuilder
private func background(type: HUDType) -> some View {
Expand Down

0 comments on commit c83b649

Please sign in to comment.