Skip to content

Commit

Permalink
adde drawing constants
Browse files Browse the repository at this point in the history
  • Loading branch information
wkaisertexas committed Mar 25, 2024
1 parent 79bec4c commit e5d9259
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 15 deletions.
Binary file not shown.
16 changes: 8 additions & 8 deletions TimeLapze/Camera.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Camera: NSObject, Recordable {
input.expectsMediaDataInRealTime = true

guard writer.canAdd(input) else {
print("Can't add input")
logger.error("Can't add input")
return (writer, input)
}
writer.add(input)
Expand Down Expand Up @@ -109,7 +109,7 @@ class Camera: NSObject, Recordable {

if let recorder = recordVideo, recorder.isRecording() {
recorder.stopSession()
print("Stopped running")
logger.error("Stopped running")
}

guard let input = input, let writer = writer else {
Expand All @@ -119,7 +119,7 @@ class Camera: NSObject, Recordable {

// Same as screen
while !input.isReadyForMoreMediaData {
logger.log("Not able to mark the stream as finished")
logger.error("Not able to mark the stream as finished")
sleep(1) // sleeping for a second
}

Expand Down Expand Up @@ -150,17 +150,17 @@ class Camera: NSObject, Recordable {
// MARK: Streaming
func handleVideo(buffer: CMSampleBuffer) {
guard let input = self.input, let writer = self.writer else {
print("Not video writer present")
logger.error("Not video writer present")
return
}

guard writer.status != .failed else {
print("Writer has failed")
logger.error("Writer has failed")
return
}

guard buffer.isValid else {
logger.log("Invalid Camera Buffer")
logger.error("Invalid Camera Buffer")
return
}

Expand All @@ -175,12 +175,12 @@ class Camera: NSObject, Recordable {
}

guard writer.status == .writing else {
print("The writer has failed \(String(describing: writer.error!))")
logger.error("The writer has failed \(String(describing: writer.error!))")
return
}

guard input.isReadyForMoreMediaData else {
print("Is not ready for more data")
logger.error("Is not ready for more data")
return
}

Expand Down
29 changes: 22 additions & 7 deletions TimeLapze/OnboardingView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ struct OnboardingView: View {
card(title: "Get started creating TimeLapzes", subtitle: "Recording are always color-accurate and crazy performant", image: "OnboardingGetStarted", index: 5)
}
}
}.frame(width: 466, height: 483, alignment: .leading)
}.frame(width: DrawingConstants.width, height: DrawingConstants.height, alignment: .leading)
}

// MARK: Intents
Expand All @@ -123,7 +123,7 @@ struct OnboardingView: View {
.transition(.push(from: .leading))
.accessibilityIdentifier("feature_background")
VStack (alignment: .leading){
VStack(alignment: .leading, spacing: 8){
VStack(alignment: .leading, spacing: DrawingConstants.spacing){
Text(title)
.fontWeight(.bold)
.fontWidth(.condensed)
Expand All @@ -134,24 +134,32 @@ struct OnboardingView: View {
.fontWeight(.medium)
.fontWidth(.expanded)
.font(.subheadline)
.frame(maxWidth: (466 - 80) / 3 * 2, alignment: .leading)
.frame(maxWidth: (DrawingConstants.width - 2 * DrawingConstants.padding) * DrawingConstants.two_thirds, alignment: .leading)
.accessibilityIdentifier("feature_subtitle")
}.transition(.move(edge: .leading))

Spacer()

let baseCircle = Circle().stroke(lineWidth: 2).fill(.gray).frame(width: 9, height: 9).opacity(0.2)
HStack{
ForEach(0..<6, id: \.self) { id in
if id == index {
baseCircle.background(Circle().fill(.blue))
Circle()
.stroke(lineWidth: 2)
.fill(.blue)
.frame(width: 9, height: 9)
.opacity(0.5)
.background(Circle().fill(.blue).opacity(1))
} else {
baseCircle
Circle()
.stroke(lineWidth: 2)
.fill(.gray)
.frame(width: 9, height: 9)
.opacity(0.5)
}
}
}
bottomNav(viewModel.onWindow)
}.padding(40)
}.padding(DrawingConstants.padding)
.transition(.slide)
}
}
Expand Down Expand Up @@ -190,6 +198,13 @@ struct OnboardingView: View {
struct DrawingConstants{
static let overlayGradient = LinearGradient(gradient: Gradient(colors: [Color.black.opacity(0.8), Color.clear]),
startPoint: .top, endPoint: .bottom)

static let width = 466.0
static let height = 483.0
static let padding = 40.0
static let spacing = 8.0

static let two_thirds = 2.0 / 3.0
}
}

Expand Down

0 comments on commit e5d9259

Please sign in to comment.