handlePresentationTriggerIndex method

void handlePresentationTriggerIndex(
  1. Map data
)

Implementation

void handlePresentationTriggerIndex(Map<dynamic, dynamic> data) {
  var isNew = false;
  var triggeredPath = data['presentationPath'];

  // on Pro6, triggeredPath is just the basename; luckily, we store those :-)
  if (basename2fullpath.containsKey(triggeredPath)) triggeredPath = basename2fullpath[triggeredPath];

  if (triggeredPath != currentPresentationPath) isNew = true;

  state.currentPresentationPath = triggeredPath;
  state.currentSlideIndex = int.tryParse(data['slideIndex'].toString()) ?? 0;

  // we now have enough information to know what the current presentation should be
  // and by this point, we should already have presentation data
  // but we do a doublecheck
  if (isNew || currentPresentation == null || currentPresentation!.slideQuality < SLIDE_HIGHQ) {
    loadPresentation(
      path: triggeredPath,
      quality: SLIDE_HIGHQ,
      doubleLoad: true,
    ).then((_) {
      print('LOADED: presentation $triggeredPath');
      // currentSlide = currentPresentation?.slideAt(currentSlideIndex); // now done with a getter
      // updateController.add(action); // the loadPresentation should trigger updates anyway
    });
  }
  _slideUpdatesStreamController.add(true);
  emit('presentation');
}