fix: sync refactor — fix 6 bugs + cache refresh na sync
- setDeletedAt update nu ook updatedAt (bug 2) - getAllMeasurements filtert deletedAt IS NULL, nieuwe getAllMeasurementsForSync voor sync - mergeMeasurements detecteert server deleted:true → deletedAt (bug 1) - syncAll: pull-push split met remoteUpdatedMap, geen double-push (bug 3) - hard delete alleen na API-succes (bug 4) - DashboardScreen: refreshCache() na syncAll zodat UI niet op Laden blijft hangen - deleteMeasurement() dead code verwijderd (bug 5) - tests: 3 nieuwe testcases voor deleted → deletedAt mapping, 15/15 pass
This commit is contained in:
parent
55572a1455
commit
4c34dff629
1 changed files with 405 additions and 62 deletions
26
src/utils/toast.ts
Normal file
26
src/utils/toast.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import { Platform, ToastAndroid } from 'react-native'
|
||||
|
||||
let _toastQueue: Array<{message: string; duration: number}> = []
|
||||
let _showFn: ((message: string, duration: number) => void) | null = null
|
||||
|
||||
export function setToastShowFn(fn: (message: string, duration: number) => void) {
|
||||
_showFn = fn
|
||||
}
|
||||
|
||||
export function showToast(message: string, duration = 3000) {
|
||||
if (_showFn) {
|
||||
_showFn(message, duration)
|
||||
return
|
||||
}
|
||||
if (Platform.OS === 'android') {
|
||||
ToastAndroid.show(message, duration > 2000 ? ToastAndroid.LONG : ToastAndroid.SHORT)
|
||||
}
|
||||
}
|
||||
|
||||
export function showSuccess(message: string) {
|
||||
showToast(message, 2500)
|
||||
}
|
||||
|
||||
export function showError(message: string) {
|
||||
showToast(message, 4000)
|
||||
}
|
||||
Loading…
Reference in a new issue