fix: iOS compile errors - protocol mismatches + void return
- ReadingRuntimeAdapter: clearExportedEvents is void, return count separately - ActivityViewModel: FocusItemServicing.list→listAll, add days/type? params - ActivityViewModelTests: update mocks to match new protocol signatures Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
968a78852c
commit
d8125ddf34
@ -154,12 +154,14 @@ final class V1ReadingRuntimeAdapter: ReadingRuntimeAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ackEvents(_ eventIds: [String]) -> UInt32 {
|
func ackEvents(_ eventIds: [String]) -> UInt32 {
|
||||||
return clearExportedEvents(count: UInt32(eventIds.count))
|
clearExportedEvents(count: UInt32(eventIds.count))
|
||||||
|
return UInt32(eventIds.count)
|
||||||
}
|
}
|
||||||
|
|
||||||
func markFailed(_ eventIds: [String]) -> UInt32 {
|
func markFailed(_ eventIds: [String]) -> UInt32 {
|
||||||
// V1 has no mark-failed mechanism — clear them to avoid blocking
|
// V1 has no mark-failed mechanism — clear them to avoid blocking
|
||||||
return clearExportedEvents(count: UInt32(eventIds.count))
|
clearExportedEvents(count: UInt32(eventIds.count))
|
||||||
|
return UInt32(eventIds.count)
|
||||||
}
|
}
|
||||||
|
|
||||||
func reloadStaleEvents() -> UInt32 { return 0 }
|
func reloadStaleEvents() -> UInt32 { return 0 }
|
||||||
|
|||||||
@ -13,9 +13,11 @@ protocol ActivityServicing {
|
|||||||
extension ActivityService: ActivityServicing {}
|
extension ActivityService: ActivityServicing {}
|
||||||
|
|
||||||
protocol FocusItemServicing {
|
protocol FocusItemServicing {
|
||||||
func list() async throws -> [FocusItem]
|
func listAll() async throws -> [FocusItem]
|
||||||
|
}
|
||||||
|
extension FocusItemService: FocusItemServicing {
|
||||||
|
func listAll() async throws -> [FocusItem] { try await list() }
|
||||||
}
|
}
|
||||||
extension FocusItemService: FocusItemServicing {}
|
|
||||||
|
|
||||||
protocol ReadingContinueServicing {
|
protocol ReadingContinueServicing {
|
||||||
func getContinueLearning() async throws -> ContinueLearningResponse
|
func getContinueLearning() async throws -> ContinueLearningResponse
|
||||||
@ -24,8 +26,8 @@ extension ReadingAPIService: ReadingContinueServicing {}
|
|||||||
|
|
||||||
protocol LearningStatusServicing {
|
protocol LearningStatusServicing {
|
||||||
func getLearningSummary() async throws -> LearningSummaryResponse
|
func getLearningSummary() async throws -> LearningSummaryResponse
|
||||||
func getLearningTrend() async throws -> LearningTrendResponse
|
func getLearningTrend(days: Int) async throws -> LearningTrendResponse
|
||||||
func getLearningRecords(limit: Int, type: String) async throws -> LearningRecordsResponse
|
func getLearningRecords(limit: Int, type: String?) async throws -> LearningRecordsResponse
|
||||||
}
|
}
|
||||||
extension ReadingAPIService: LearningStatusServicing {}
|
extension ReadingAPIService: LearningStatusServicing {}
|
||||||
|
|
||||||
@ -65,14 +67,14 @@ class ActivityViewModel: ObservableObject {
|
|||||||
errorMessage = nil
|
errorMessage = nil
|
||||||
|
|
||||||
async let s = try? activityService.summary()
|
async let s = try? activityService.summary()
|
||||||
async let f = try? focusService.list()
|
async let f = try? focusService.listAll()
|
||||||
async let h = try? activityService.heatmap()
|
async let h = try? activityService.heatmap()
|
||||||
async let st = try? activityService.streak()
|
async let st = try? activityService.streak()
|
||||||
async let t = try? activityService.trend()
|
async let t = try? activityService.trend(days: 7)
|
||||||
async let r = try? activityService.recommendations()
|
async let r = try? activityService.recommendations()
|
||||||
async let cr = try? readingService.getContinueLearning()
|
async let cr = try? readingService.getContinueLearning()
|
||||||
async let ls = try? readingService.getLearningSummary()
|
async let ls = try? readingService.getLearningSummary()
|
||||||
async let ltr = try? readingService.getLearningTrend()
|
async let ltr = try? readingService.getLearningTrend(days: 7)
|
||||||
async let recs = try? readingService.getLearningRecords(limit: 10, type: "reading")
|
async let recs = try? readingService.getLearningRecords(limit: 10, type: "reading")
|
||||||
|
|
||||||
let (summaryResult, focusResult, heatmapResult, streakResult, trendResult, recResult, continueResult, lsResult, ltrResult, recordsResult) = await (s, f, h, st, t, r, cr, ls, ltr, recs)
|
let (summaryResult, focusResult, heatmapResult, streakResult, trendResult, recResult, continueResult, lsResult, ltrResult, recordsResult) = await (s, f, h, st, t, r, cr, ls, ltr, recs)
|
||||||
@ -99,14 +101,14 @@ class ActivityViewModel: ObservableObject {
|
|||||||
errorMessage = nil
|
errorMessage = nil
|
||||||
|
|
||||||
async let s = try? activityService.summary()
|
async let s = try? activityService.summary()
|
||||||
async let f = try? focusService.list()
|
async let f = try? focusService.listAll()
|
||||||
async let h = try? activityService.heatmap()
|
async let h = try? activityService.heatmap()
|
||||||
async let st = try? activityService.streak()
|
async let st = try? activityService.streak()
|
||||||
async let t = try? activityService.trend()
|
async let t = try? activityService.trend(days: 7)
|
||||||
async let r = try? activityService.recommendations()
|
async let r = try? activityService.recommendations()
|
||||||
async let cr = try? readingService.getContinueLearning()
|
async let cr = try? readingService.getContinueLearning()
|
||||||
async let ls = try? readingService.getLearningSummary()
|
async let ls = try? readingService.getLearningSummary()
|
||||||
async let ltr = try? readingService.getLearningTrend()
|
async let ltr = try? readingService.getLearningTrend(days: 7)
|
||||||
async let recs = try? readingService.getLearningRecords(limit: 10, type: "reading")
|
async let recs = try? readingService.getLearningRecords(limit: 10, type: "reading")
|
||||||
|
|
||||||
let (summaryResult, focusResult, heatmapResult, streakResult, trendResult, recResult, continueResult, lsResult, ltrResult, recordsResult) = await (s, f, h, st, t, r, cr, ls, ltr, recs)
|
let (summaryResult, focusResult, heatmapResult, streakResult, trendResult, recResult, continueResult, lsResult, ltrResult, recordsResult) = await (s, f, h, st, t, r, cr, ls, ltr, recs)
|
||||||
|
|||||||
@ -19,7 +19,7 @@ private final class MockActivityService: ActivityServicing {
|
|||||||
|
|
||||||
private final class MockFocusItemService: FocusItemServicing {
|
private final class MockFocusItemService: FocusItemServicing {
|
||||||
var items: [FocusItem] = []
|
var items: [FocusItem] = []
|
||||||
func list() async throws -> [FocusItem] { items }
|
func listAll() async throws -> [FocusItem] { items }
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class MockReadingAPIForActivity: ReadingContinueServicing & LearningStatusServicing {
|
private final class MockReadingAPIForActivity: ReadingContinueServicing & LearningStatusServicing {
|
||||||
@ -30,8 +30,8 @@ private final class MockReadingAPIForActivity: ReadingContinueServicing & Learni
|
|||||||
|
|
||||||
func getContinueLearning() async throws -> ContinueLearningResponse { try resultOrThrow(continueLearning) }
|
func getContinueLearning() async throws -> ContinueLearningResponse { try resultOrThrow(continueLearning) }
|
||||||
func getLearningSummary() async throws -> LearningSummaryResponse { try resultOrThrow(learningSummary) }
|
func getLearningSummary() async throws -> LearningSummaryResponse { try resultOrThrow(learningSummary) }
|
||||||
func getLearningTrend() async throws -> LearningTrendResponse { try resultOrThrow(learningTrend) }
|
func getLearningTrend(days: Int) async throws -> LearningTrendResponse { try resultOrThrow(learningTrend) }
|
||||||
func getLearningRecords(limit: Int, type: String) async throws -> LearningRecordsResponse { try resultOrThrow(records) }
|
func getLearningRecords(limit: Int, type: String?) async throws -> LearningRecordsResponse { try resultOrThrow(records) }
|
||||||
}
|
}
|
||||||
|
|
||||||
private func resultOrThrow<T>(_ value: T?) throws -> T {
|
private func resultOrThrow<T>(_ value: T?) throws -> T {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user