RecoverOrDiscardUnsyncedChangesHandler constructor
- BeforeResetCallback? onBeforeReset,
- AfterResetCallback? onAfterRecovery,
- AfterResetCallback? onAfterDiscard,
- ClientResetCallback? onManualResetFallback,
Creates an instance of RecoverOrDiscardUnsyncedChangesHandler
.
This strategy will recover automatically any unsynchronized changes. If the recovery fails this strategy fallsback to the discard unsynced one.
The automatic recovery mechanism creates write transactions meaning that all the changes that take place
are properly propagated through the standard Realm's change notifications.
This strategy supplies four callbacks: onBeforeReset
, onAfterRecovery
, onAfterDiscard
and onManualResetFallback
.
onBeforeReset
is invoked just before the client reset happens.
onAfterRecovery
is invoke if and only if an automatic client reset succeeded. The callback is never called
if the automatic client reset fails.
onAfterDiscard
is invoked if and only if an automatic client reset failed and instead the discard unsynced one succeded.
The callback is never called if the discard unsynced client reset fails.
onManualResetFallback
is invoked whenever an error occurs in either of the recovery stragegies and the system needs to fallback to a manual mode.
Implementation
const RecoverOrDiscardUnsyncedChangesHandler(
{BeforeResetCallback? onBeforeReset, AfterResetCallback? onAfterRecovery, AfterResetCallback? onAfterDiscard, ClientResetCallback? onManualResetFallback})
: super._(ClientResyncModeInternal.recoverOrDiscard, onManualResetFallback,
onBeforeReset: onBeforeReset, onAfterDiscard: onAfterDiscard, onAfterRecovery: onAfterRecovery);