Skip to content

Commit

Permalink
Added task extension, fixed weird window behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
kaulex99 committed Dec 29, 2023
1 parent 9bdec98 commit 05a9143
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions WaiterRobot/LaunchScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import shared
import SwiftUI

struct LaunchScreen: View {
private let minimumOnScreenTime = 3.0 // in seconds
private let minimumOnScreenTimeSeconds = 3.0
private let device = UIDevice.current.userInterfaceIdiom

@State private var startupFinished = false
Expand All @@ -19,6 +19,7 @@ struct LaunchScreen: View {
.scaledToFit()
}
.padding(.horizontal, -2)
.ignoresSafeArea()
} else {
ZStack {
Image(.logoRounded)
Expand Down Expand Up @@ -80,7 +81,7 @@ struct LaunchScreen: View {

private func delay() async {
print("started delay")
try? await Task.sleep(nanoseconds: UInt64(minimumOnScreenTime * 1_000_000_000))
try? await Task.sleep(seconds: minimumOnScreenTimeSeconds)
print("finished delay")
}

Expand Down
8 changes: 8 additions & 0 deletions WaiterRobot/Util/Extensions/Task+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Foundation

extension Task where Success == Never, Failure == Never {
static func sleep(seconds: Double) async throws {
let duration = UInt64(seconds * 1_000_000_000)
try await Task.sleep(nanoseconds: duration)
}
}
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ targetTemplates:
CFBundleName: "${target_name}"
CFBundlePackageType: "$(PRODUCT_BUNDLE_PACKAGE_TYPE)"
ITSAppUsesNonExemptEncryption: false
LSRequiresIPhoneOS: true
UILaunchStoryboardName: ""
NSAppTransportSecurity:
NSAllowsLocalNetworking: true
NSCameraUsageDescription: "Camera is needed to scan QR-Codes"
Expand Down

0 comments on commit 05a9143

Please sign in to comment.