fix: AuthManager has no currentUserId, use KeychainHelper.getUserId()
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
0cf727899a
commit
d28dba29fc
Binary file not shown.
@ -48,7 +48,7 @@ final class ReadingEventUploadQueue {
|
|||||||
// MARK: - Public API
|
// MARK: - Public API
|
||||||
|
|
||||||
/// Enqueue a batch of upload items. Deduplicates by eventId.
|
/// Enqueue a batch of upload items. Deduplicates by eventId.
|
||||||
func enqueue(_ uploadItems: [ReadingEventUploadItem], userId: String = AuthManager.shared.currentUserId ?? "unknown") {
|
func enqueue(_ uploadItems: [ReadingEventUploadItem], userId: String = (KeychainHelper.getUserId() ?? "unknown") ?? "unknown") {
|
||||||
let existingIds = Set(items.map(\.eventId))
|
let existingIds = Set(items.map(\.eventId))
|
||||||
let now = Date()
|
let now = Date()
|
||||||
let newItems = uploadItems
|
let newItems = uploadItems
|
||||||
@ -73,7 +73,7 @@ final class ReadingEventUploadQueue {
|
|||||||
|
|
||||||
/// Fetch a batch of pending items (max `limit`).
|
/// Fetch a batch of pending items (max `limit`).
|
||||||
func fetchPendingBatch(limit: Int = 100, userId: String? = nil) -> [ReadingEventQueueItem] {
|
func fetchPendingBatch(limit: Int = 100, userId: String? = nil) -> [ReadingEventQueueItem] {
|
||||||
let uid = userId ?? AuthManager.shared.currentUserId ?? "unknown"
|
let uid = userId ?? (KeychainHelper.getUserId() ?? "unknown") ?? "unknown"
|
||||||
return Array(
|
return Array(
|
||||||
items
|
items
|
||||||
.filter { $0.status == .pending && $0.userId == uid }
|
.filter { $0.status == .pending && $0.userId == uid }
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user