ActivityFeed.fromNewBlogPost constructor

ActivityFeed.fromNewBlogPost({
  1. required Post blogPost,
  2. required AppProfile authorProfile,
  3. required String followerId,
})

Factory for new blog post notifications to followers

Implementation

ActivityFeed.fromNewBlogPost({
  required Post blogPost,
  required AppProfile authorProfile,
  required String followerId,
}) :
      id = '',
      ownerId = followerId, // Follower receives the notification
      activityReferenceId = blogPost.id,
      profileId = authorProfile.id,
      profileName = authorProfile.name,
      profileImgUrl = authorProfile.photoUrl,
      mediaUrl = blogPost.thumbnailUrl.isNotEmpty
          ? blogPost.thumbnailUrl
          : blogPost.mediaUrl,
      activityFeedType = ActivityFeedType.newBlogPost,
      createdTime = DateTime.now().millisecondsSinceEpoch,
      message = _extractBlogTitle(blogPost.caption),
      unread = true;