Skip to content

Commit

Permalink
Use get() to handle a non-null variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarvis Lin committed May 24, 2024
1 parent d04ef21 commit 1b18034
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ import org.wordpress.android.util.WPAvatarUtils
* It'd be better to have multiple fragments for different sources for different purposes
*/
class SiteCommentDetailFragment : CommentDetailFragment() {
private val comment: CommentModel
get() = mComment!!

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
if (savedInstanceState != null) {
Expand All @@ -34,12 +37,12 @@ class SiteCommentDetailFragment : CommentDetailFragment() {
override fun getUserProfileUiState(): BottomSheetUiState.UserProfileUiState {
return BottomSheetUiState.UserProfileUiState(
userAvatarUrl = CommentExtension.getAvatarUrl(
mComment!!,
comment,
resources.getDimensionPixelSize(R.dimen.avatar_sz_large)
),
blavatarUrl = "",
userName = mComment!!.authorName ?: getString(R.string.anonymous),
userLogin = mComment!!.authorEmail.orEmpty(),
userName = comment.authorName ?: getString(R.string.anonymous),
userLogin = comment.authorEmail.orEmpty(),
// keep them empty because there's no data for displaying on UI
userBio = "",
siteTitle = "",
Expand All @@ -50,7 +53,7 @@ class SiteCommentDetailFragment : CommentDetailFragment() {
}

override fun getCommentIdentifier(): CommentIdentifier =
CommentIdentifier.SiteCommentIdentifier(mComment!!.id, mComment!!.remoteCommentId)
CommentIdentifier.SiteCommentIdentifier(comment.id, comment.remoteCommentId)


override fun handleHeaderVisibility() {
Expand Down

0 comments on commit 1b18034

Please sign in to comment.