start method

bool start(
  1. CampaignModel campaign,
  2. CEPTriggerPayload payload
)

Returns true if the guide was started, false if preconditions fail or one is already showing.

Implementation

bool start(CampaignModel campaign, CEPTriggerPayload payload) {
  final config = campaign.config;
  if (campaign.campaignType != 'guide' || config is! GuideCampaignConfig) {
    return false;
  }
  if (config.guideConfig.stepCount == 0) return false;
  if (_state != null) return false;
  _state = ActiveGuideState(
    campaign: campaign,
    payload: payload,
    token: ++_tokenCounter,
  );
  notifyListeners();
  return true;
}