updated to use robot image service
This commit is contained in:
parent
09bd1740de
commit
6829e5db6c
@ -3,4 +3,52 @@
|
||||
uuid = "BCD20A5B-B7B0-4775-A851-C44BE1718BD6"
|
||||
type = "1"
|
||||
version = "2.0">
|
||||
<Breakpoints>
|
||||
<BreakpointProxy
|
||||
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
|
||||
<BreakpointContent
|
||||
uuid = "5B504375-F63C-4BB6-A417-2AF4B46C6231"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
filePath = "EmployeeDirectory/Views/ProfileImageView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "17"
|
||||
endingLineNumber = "17"
|
||||
landmarkName = "body"
|
||||
landmarkType = "24">
|
||||
<Locations>
|
||||
<Location
|
||||
uuid = "5B504375-F63C-4BB6-A417-2AF4B46C6231 - 390c6e0a532eeb4c"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "EmployeeDirectory.ProfileImageView.body.getter : some"
|
||||
moduleName = "EmployeeDirectory.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/mattbruce/Documents/Projects/iPhone/_Samples/EmployeeDirectory/SwiftUI-Local/EmployeeDirectory/EmployeeDirectory/Views/ProfileImageView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "17"
|
||||
endingLineNumber = "17">
|
||||
</Location>
|
||||
<Location
|
||||
uuid = "5B504375-F63C-4BB6-A417-2AF4B46C6231 - 128378f9a01d5edf"
|
||||
shouldBeEnabled = "Yes"
|
||||
ignoreCount = "0"
|
||||
continueAfterRunningActions = "No"
|
||||
symbolName = "closure #1 (SwiftUI.AsyncImagePhase) -> SwiftUI._ConditionalContent<SwiftUI._ConditionalContent<SwiftUI.Image, <<opaque return type of SwiftUI.View.foregroundColor(Swift.Optional<SwiftUI.Color>) -> some>>.0>, SwiftUI.ProgressView<SwiftUI.EmptyView, SwiftUI.EmptyView>> in EmployeeDirectory.ProfileImageView.body.getter : some"
|
||||
moduleName = "EmployeeDirectory.debug.dylib"
|
||||
usesParentBreakpointCondition = "Yes"
|
||||
urlString = "file:///Users/mattbruce/Documents/Projects/iPhone/_Samples/EmployeeDirectory/SwiftUI-Local/EmployeeDirectory/EmployeeDirectory/Views/ProfileImageView.swift"
|
||||
startingColumnNumber = "9223372036854775807"
|
||||
endingColumnNumber = "9223372036854775807"
|
||||
startingLineNumber = "17"
|
||||
endingLineNumber = "17">
|
||||
</Location>
|
||||
</Locations>
|
||||
</BreakpointContent>
|
||||
</BreakpointProxy>
|
||||
</Breakpoints>
|
||||
</Bucket>
|
||||
|
||||
@ -43,34 +43,4 @@ public class EmployeeService: EmployeeServiceProtocol {
|
||||
}
|
||||
}
|
||||
|
||||
// Mock Service Implementation for testing & previews.
|
||||
struct MockEmployeeService: EmployeeServiceProtocol {
|
||||
static let sample = createUser(page: 1, index: 1)
|
||||
|
||||
static func createUser(page: Int?, index: Int) -> Employee {
|
||||
Employee(
|
||||
uuid: UUID(),
|
||||
firstName: "First \(index + ((page ?? 1) - 1) * 20)",
|
||||
lastName: "Last \(index + ((page ?? 1) - 1) * 20)",
|
||||
phoneNumber: "555555\(1000 + index)",
|
||||
emailAddress: "user\(index)@example.com",
|
||||
biography: "Biography for employee \(index)",
|
||||
photoURLSmall: "https://example.com/photo_small.jpg",
|
||||
photoURLLarge: "https://example.com/photo_large.jpg"
|
||||
)
|
||||
}
|
||||
func getUsers(page: Int?) async throws -> Employees {
|
||||
// Simulate network delay.
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
|
||||
// Create dummy data (20 employees per page).
|
||||
let dummyEmployees: [Employee] = (0..<20).map { i in
|
||||
Self.createUser(page: page, index: i)
|
||||
}
|
||||
|
||||
// Simulate that there are more pages if page is less than 5.
|
||||
let hasNext = (page ?? 1) < 5
|
||||
|
||||
return Employees(result: dummyEmployees, hasNextPage: hasNext)
|
||||
}
|
||||
}
|
||||
|
||||
40
EmployeeDirectory/Services/MockEmployeeService.swift
Normal file
40
EmployeeDirectory/Services/MockEmployeeService.swift
Normal file
@ -0,0 +1,40 @@
|
||||
//
|
||||
// MockEmployeeService.swift
|
||||
// EmployeeDirectory
|
||||
//
|
||||
// Created by Matt Bruce on 3/4/25.
|
||||
//
|
||||
import Foundation
|
||||
|
||||
// Mock Service Implementation for testing & previews.
|
||||
struct MockEmployeeService: EmployeeServiceProtocol {
|
||||
static let sample = createUser(page: 1, index: 1)
|
||||
|
||||
static func createUser(page: Int?, index: Int) -> Employee {
|
||||
let id = UUID()
|
||||
return Employee(
|
||||
uuid: id,
|
||||
firstName: "First \(index + ((page ?? 1) - 1) * 20)",
|
||||
lastName: "Last \(index + ((page ?? 1) - 1) * 20)",
|
||||
phoneNumber: "555555\(1000 + index)",
|
||||
emailAddress: "user\(index)@example.com",
|
||||
biography: "Biography for employee \(index)",
|
||||
photoURLSmall: "https://robohash.org/\(id.uuidString).png?size=100x100&set=set1",
|
||||
photoURLLarge: "https://robohash.org/\(id.uuidString).png?size=400x400&set=set1"
|
||||
)
|
||||
}
|
||||
func getUsers(page: Int?) async throws -> Employees {
|
||||
// Simulate network delay.
|
||||
try await Task.sleep(nanoseconds: 500_000_000)
|
||||
|
||||
// Create dummy data (20 employees per page).
|
||||
let dummyEmployees: [Employee] = (0..<20).map { i in
|
||||
Self.createUser(page: page, index: i)
|
||||
}
|
||||
|
||||
// Simulate that there are more pages if page is less than 5.
|
||||
let hasNext = (page ?? 1) < 5
|
||||
|
||||
return Employees(result: dummyEmployees, hasNextPage: hasNext)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user