ExWapp.AppState.Engine.Dispatch (ExWapp v0.1.2)

Copy Markdown View Source

Applies decoded app-state mutations to local contact and chat state.

The decoder turns WhatsApp patch payloads into normalized mutation maps; this module is the bridge that translates those maps into the project's local ExWapp.Contact and ExWapp.Chat updates.

Summary

Functions

Replays the local side effects of an outgoing patch after server ack.

Backwards-compatible helper that treats the mutation as a SET operation.

Dispatches one decoded mutation into the appropriate local store update.

Dispatches one decoded mutation with feature-specific persistence options.

Types

action_value()

@type action_value() :: WAWebProtobufSyncAction.SyncActionValue.t() | nil

patch_info()

@type patch_info() :: %{
  type: String.t(),
  mutations: [map()],
  timestamp: integer() | nil
}

Functions

apply_outgoing_patch(store, patch_info)

@spec apply_outgoing_patch(
  struct(),
  patch_info()
) :: :ok

Replays the local side effects of an outgoing patch after server ack.

apply_outgoing_patch(store, patch_info, opts)

@spec apply_outgoing_patch(struct(), patch_info(), keyword()) :: :ok

dispatch_mutation(store, index, action_value)

@spec dispatch_mutation(struct(), [String.t()], action_value()) :: :ok | :ignored

Backwards-compatible helper that treats the mutation as a SET operation.

dispatch_mutation(store, operation, index, action_value)

@spec dispatch_mutation(struct(), non_neg_integer(), [String.t()], action_value()) ::
  :ok | :ignored

Dispatches one decoded mutation into the appropriate local store update.

dispatch_mutation(store, operation, index, action_value, opts)

@spec dispatch_mutation(
  struct(),
  non_neg_integer(),
  [String.t()],
  action_value(),
  keyword()
) ::
  :ok | :ignored

Dispatches one decoded mutation with feature-specific persistence options.

The :max_records option controls call-log retention when the mutation carries a CallLogRecord; other mutation types ignore it.