uploadPhotoWithThumbnail method

Future<T> uploadPhotoWithThumbnail(
  1. String memberMediumDocumentID,
  2. PhotoWithThumbnail photoWithThumbnail, {
  3. FeedbackProgress? feedbackProgress,
})

Implementation

Future<T> uploadPhotoWithThumbnail(
    String memberMediumDocumentID, PhotoWithThumbnail photoWithThumbnail,
    {FeedbackProgress? feedbackProgress}) async {
  var fileInfo = await UploadInfo.uploadData(
      photoWithThumbnail.photoData.baseName,
      photoWithThumbnail.photoData.data,
      app.documentID,
      ownerId,
      packageName,
      readAccessCustomMetaData(),
      feedbackProgress: (progress) => _feedBackAggregatedProgress(
          1, 3, progress,
          feedbackProgress: feedbackProgress));

  var thumbnailInfo = await UploadInfo.uploadData(
      photoWithThumbnail.thumbNailData.baseName,
      photoWithThumbnail.thumbNailData.data,
      app.documentID,
      ownerId,
      packageName,
      readAccessCustomMetaData(),
      feedbackProgress: (progress) => _feedBackAggregatedProgress(
          2, 3, progress,
          feedbackProgress: feedbackProgress));

  if (fileInfo == null) {
    throw Exception(
        'Unable to upload photo with thumbnail with baseName = $basename. fileInfo is null ');
  }

  if (thumbnailInfo == null) {
    throw Exception(
        'Unable to upload photo with thumbnail with baseName = $basename. thumbnailInfo is null ');
  }

  var returnMe = await photoWithThumbnailToMediumModel(
      memberMediumDocumentID,
      photoWithThumbnail.photoData.baseName,
      fileInfo,
      thumbnailInfo,
      photoWithThumbnail);
  _feedBackAggregatedProgress(3, 3, 1, feedbackProgress: feedbackProgress);
  return returnMe;
}