mirror of
https://github.com/kiwix/kiwix-apple.git
synced 2025-08-03 12:37:15 -04:00
Make space for error message when using compact height
This commit is contained in:
parent
78f5f7d12b
commit
43f104ef7f
@ -21,7 +21,7 @@
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="welcomeLogo" adjustsImageSizeForAccessibilityContentSizeCategory="YES" translatesAutoresizingMaskIntoConstraints="NO" id="aq8-ue-tYD" userLabel="Logo">
|
||||
<rect key="frame" x="142" y="61" width="284" height="134"/>
|
||||
<rect key="frame" x="142" y="82" width="284" height="92"/>
|
||||
<constraints>
|
||||
<constraint firstAttribute="width" constant="300" id="zyG-3z-VNV"/>
|
||||
</constraints>
|
||||
@ -45,7 +45,7 @@
|
||||
<constraint firstItem="aq8-ue-tYD" firstAttribute="centerY" secondItem="Ze5-6b-2t3" secondAttribute="centerY" constant="-58" id="tmp-PG-GZz">
|
||||
<variation key="heightClass=compact" constant="-32"/>
|
||||
</constraint>
|
||||
<constraint firstItem="aq8-ue-tYD" firstAttribute="height" secondItem="Ze5-6b-2t3" secondAttribute="height" constant="-186" id="yNt-tV-blG"/>
|
||||
<constraint firstItem="aq8-ue-tYD" firstAttribute="height" secondItem="Ze5-6b-2t3" secondAttribute="height" constant="-228" id="yNt-tV-blG"/>
|
||||
</constraints>
|
||||
<variation key="default">
|
||||
<mask key="constraints">
|
||||
|
@ -43,13 +43,15 @@ struct LogoCalc {
|
||||
/// 50 top bar
|
||||
/// 20 spacing above logo
|
||||
/// Logo itself
|
||||
/// 20 between logo and buttons
|
||||
/// 44 height for the row of buttons
|
||||
/// 20 spacing between logo and buttons
|
||||
/// 44 height for the one row of buttons
|
||||
/// 20 spacing below buttons
|
||||
/// 22 for error message
|
||||
/// 20 spacing below error message
|
||||
/// 32 for bottom navbar
|
||||
/// ---------
|
||||
/// 186 > it's also used on the splash screen
|
||||
static let minNonLogoSpace: CGFloat = barHeights + oneRowOfButtonsHeight + 3 * spacing
|
||||
/// 228 > it's also used on the splash screen
|
||||
static let minNonLogoSpace: CGFloat = barHeights + oneRowOfButtonsHeight + 4 * spacing + errorMsgHeight
|
||||
static let barHeights: CGFloat = 50 + 32
|
||||
static let oneRowOfButtonsHeight: CGFloat = 44
|
||||
static let twoRowsOfButtonsHeight: CGFloat = 96
|
||||
@ -104,11 +106,12 @@ struct LogoCalc {
|
||||
}
|
||||
|
||||
var errorTextCenterY: CGFloat {
|
||||
if isVerticalCompact { // put the error to the top of the screen
|
||||
return logoCenterY - logoSize.height * 0.5 - Const.errorMsgHeight * 0.5 - Const.spacing
|
||||
let buttonsHeight = if isVerticalCompact {
|
||||
Const.oneRowOfButtonsHeight
|
||||
} else {
|
||||
return buttonCenterY + Const.twoRowsOfButtonsHeight * 0.5 + Const.spacing + Const.errorMsgHeight * 0.5
|
||||
Const.twoRowsOfButtonsHeight
|
||||
}
|
||||
return buttonCenterY + buttonsHeight * 0.5 + Const.spacing + Const.errorMsgHeight * 0.5
|
||||
}
|
||||
|
||||
var buttonCenterY: CGFloat {
|
||||
|
@ -108,6 +108,9 @@ struct Welcome: View {
|
||||
.opacity(hasSeenCategories ? 1 : 0)
|
||||
.frame(maxWidth: logoCalc.buttonsWidth)
|
||||
.onChange(of: library.state) { state in
|
||||
if state == .error {
|
||||
hasSeenCategories = true
|
||||
}
|
||||
guard state == .complete else { return }
|
||||
#if os(macOS)
|
||||
navigation.currentItem = .categories
|
||||
|
Loading…
x
Reference in New Issue
Block a user