Skip to content
This repository has been archived by the owner on Mar 8, 2024. It is now read-only.

Commit

Permalink
♻️ :: 링크 옵셔널 처리
Browse files Browse the repository at this point in the history
  • Loading branch information
Tmdhoon2 committed Nov 25, 2023
1 parent ae4f45d commit 851446d
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import com.signal.domain.entity.RecommendDetailsEntity

data class FetchRecommendDetailsResponse(
@SerializedName("title") val title: String,
@SerializedName("image") val image: String,
@SerializedName("image") val image: String?,
@SerializedName("content") val content: String,
@SerializedName("link") val link: String,
@SerializedName("link") val link: String?,
@SerializedName("name") val name: String,
@SerializedName("profile") val profile: String?,
@SerializedName("create_date") val createDate: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ data class FetchRecommendsResponse(
@SerializedName("title") val title: String,
@SerializedName("content") val content: String,
@SerializedName("image") val image: String,
@SerializedName("link") val link: String,
@SerializedName("link") val link: String?,
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package com.signal.domain.entity

data class RecommendDetailsEntity(
val title: String,
val image: String,
val image: String?,
val content: String,
val link: String,
val link: String?,
val name: String,
val profile: String?,
val createDate: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ data class RecommendsEntity(
val title: String,
val content: String,
val image: String,
val link: String,
val link: String?,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ internal fun RecommendDetails(
}

val intentToUrl: () -> Unit = {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(details.link))
context.startActivity(intent)
details.link?.run {
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(this))
context.startActivity(intent)
}
}

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,9 @@ internal fun Recommends(
content = it.content,
imageUrl = it.image,
iconEnabled = true,
onIconClicked = { moveToLink(it.link) },
onIconClicked = {
it.link?.run(moveToLink)
},
)
}
}
Expand Down

0 comments on commit 851446d

Please sign in to comment.