Skip to content

Commit

Permalink
#40: Self review for PR
Browse files Browse the repository at this point in the history
  • Loading branch information
pixlwave committed Jun 14, 2022
1 parent f3ac347 commit 66f4955
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 113 deletions.
184 changes: 88 additions & 96 deletions ElementX.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
import SwiftUI

extension String {
/// Returns the string as an `AttributedString` with the specified character tinted in a different color.
/// - Parameters:
/// - character: The character to be tinted.
/// - color: The color to tint the character. Defaults to the accent color.
/// - Returns: An `AttributedString`.
func tinting(_ character: Character, color: Color = .accentColor) -> AttributedString {
var string = AttributedString(self)
let characterView = string.characters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,12 @@
import SwiftUI

/// Metrics used across the entire onboarding flow.
struct OnboardingMetrics {
struct AuthenticationMetrics {
static let maxContentWidth: CGFloat = 600
static let maxContentHeight: CGFloat = 750

/// The padding used between the top of the main content and the navigation bar.
static let topPaddingToNavigationBar: CGFloat = 16
/// The padding used between the footer and the bottom of the view.
static let actionButtonBottomPadding: CGFloat = 24
/// The width/height used for the main icon shown in most of the screens.
static let iconSize: CGFloat = 90

/// The padding used to the top of the view for breaker screens that don't have a navigation bar.
static let breakerScreenTopPadding: CGFloat = 80
static let breakerScreenIconBottomPadding: CGFloat = 42

/// The height to use for top/bottom spacers to pad the views to fit the `maxContentHeight`.
static func spacerHeight(in geometry: GeometryProxy) -> CGFloat {
max(0, (geometry.size.height - maxContentHeight) / 2)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ struct SplashScreen: View {

buttons
.padding(.horizontal, 16)
.frame(maxWidth: OnboardingMetrics.maxContentWidth)
.frame(maxWidth: AuthenticationMetrics.maxContentWidth)
Spacer()
}
.background(ViewFrameReader(frame: $overlayFrame))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ struct SplashScreenPage: View {
Spacer().frame(maxHeight: overlayHeight)
}
.padding(.horizontal, 16)
.frame(maxWidth: OnboardingMetrics.maxContentWidth,
maxHeight: OnboardingMetrics.maxContentHeight)
.frame(maxWidth: AuthenticationMetrics.maxContentWidth,
maxHeight: AuthenticationMetrics.maxContentHeight)
}
.frame(maxWidth: .infinity, maxHeight: .infinity)
.background(backgroundGradient.ignoresSafeArea())
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@
//

import XCTest
import Combine

@testable import ElementX

class SplashScreenViewModelTests: XCTestCase {

// Nothing to test, the view model has no mutable state.
}
1 change: 1 addition & 0 deletions changelog.d/40.change
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a UserSessionStore and the splash screen from Element iOS.

0 comments on commit 66f4955

Please sign in to comment.