- 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
26 lines
701 B
TypeScript
26 lines
701 B
TypeScript
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)
|
|
}
|