trigger method

  1. @override
Future<void> trigger({
  1. required BuildContext context,
  2. required String userStatId,
  3. String position = "FULL_SCREEN",
  4. required String event,
  5. Map<String, dynamic>? gameSettingDetails,
  6. int? storyIndex,
  7. int? slideIndex,
  8. bool? deepLinkMode,
  9. String? deepLinkType,
})
override

Implementation

@override
Future<void> trigger({
  required BuildContext context,
  required String userStatId,
  String position = "FULL_SCREEN",
  required String event,
  Map<String, dynamic>? gameSettingDetails,
  int? storyIndex,
  int? slideIndex,
  bool? deepLinkMode,
  String? deepLinkType,
  // slideIndex, storyIndex, deepLinkMode, type
}) async {
  storiesRepo = StoriesRepo(
    nudgeId: id,
    token: token,
    baseUrl: nudgeUrl,
  );

  final fetchedStories = await storiesRepo.getStories();

  _streamController.add(
    StoriesData(
      storiesRepo: storiesRepo,
      data: fetchedStories,
      token: token,
      nudgeId: id,
    ),
  );

  // TODO: DO NOT DELETE THIS CODE, trust me you will need it
  // deepLinkMode = true;
  // storyIndex = 1;
  // slideIndex = 2;
  // deepLinkType = "SINGLE_SLIDE";

  // if (deepLinkMode != null && deepLinkMode) {
  //   log("Deep Link Mode: $deepLinkMode", name: "NudgeStoriesUi");
  //   if (deepLinkType == "SINGLE_STORY") {
  //     storyIndex = storyIndex ?? 0;
  //     slideIndex = 0;
  //   } else if (deepLinkType == "SINGLE_SLIDE") {
  //     storyIndex = storyIndex ?? 0;
  //     slideIndex = slideIndex ?? 0;
  //   } else if (deepLinkType == "ALL_STORIES") {
  //     storyIndex = 0;
  //     slideIndex = 0;
  //   }
  //
  //   _streamController.add(
  //     StoriesData(
  //       data: fetchedStories,
  //       token: token,
  //       nudgeId: id,
  //       storyIndex: 0,
  //       slideIndex: 1,
  //       deepLinkMode: true,
  //       deepLinkType: "SINGLE_SLIDE",
  //     ),
  //   );
  // } else {
  //   _streamController.add(
  //     StoriesData(
  //       storiesRepo: storiesRepo,
  //       data: fetchedStories,
  //       token: token,
  //       nudgeId: id,
  //     ),
  //   );
  // }
}