ActivityFeed.fromNewBlogEntry constructor

ActivityFeed.fromNewBlogEntry({
  1. required BlogEntry blogEntry,
  2. required AppProfile authorProfile,
  3. required String followerId,
})

Factory for new BlogEntry notifications to followers (new model).

Implementation

ActivityFeed.fromNewBlogEntry({
  required BlogEntry blogEntry,
  required AppProfile authorProfile,
  required String followerId,
}) :
      id = '',
      ownerId = followerId, // Follower receives the notification
      activityReferenceId = blogEntry.id,
      profileId = authorProfile.id,
      profileName = authorProfile.name,
      profileImgUrl = authorProfile.photoUrl,
      mediaUrl = blogEntry.thumbnailUrl,
      activityFeedType = ActivityFeedType.newBlogPost,
      createdTime = DateTime.now().millisecondsSinceEpoch,
      message = blogEntry.title.length > 80
          ? '${blogEntry.title.substring(0, 80)}...'
          : blogEntry.title,
      unread = true;