Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,23 @@ import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.graphics.painter.Painter
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
import com.umcspot.spot.designsystem.theme.*
import com.umcspot.spot.designsystem.R
import com.umcspot.spot.model.ImageRef
import com.umcspot.spot.ui.extension.screenWidthDp

object SpotShapes {

Expand Down Expand Up @@ -69,8 +74,7 @@ object SpotShapes {

@Composable
fun ShapeImageWithBadge(
painter: Painter = painterResource(R.drawable.spot_logo),
contentDescription: String? = null,
imageRef: ImageRef = ImageRef.None,
shape: Shape,
size: Dp = 40.dp,
modifier: Modifier = Modifier,
Expand All @@ -81,13 +85,12 @@ fun ShapeImageWithBadge(
badgeSize: Dp = 16.dp,
) {
Box(
modifier = modifier.size(size),
modifier = modifier.size(screenWidthDp(size)),
contentAlignment = Alignment.Center
) {
ShapeImageBox(
modifier = Modifier.size(size),
painter = painter,
contentDescription = contentDescription,
modifier = Modifier.size(screenWidthDp(size)),
imageRef = imageRef,
shape = shape,
borderWidth = borderWidth,
padding = padding,
Expand All @@ -100,7 +103,7 @@ fun ShapeImageWithBadge(
tint = Color.Unspecified,
modifier = Modifier
.align(Alignment.BottomEnd)
.size(badgeSize),
.size(screenWidthDp(badgeSize)),
contentDescription = null
)
}
Expand All @@ -109,42 +112,66 @@ fun ShapeImageWithBadge(

@Composable
fun ShapeImageBox(
painter: Painter,
contentDescription: String? = null,
shape: Shape,
imageRef: ImageRef,
modifier: Modifier = Modifier,
shape: Shape,
borderWidth: Dp = 0.dp,
padding: Dp = 5.dp,
borderColor: Color? = Color.Transparent,
contentScale: ContentScale = ContentScale.Fit,
backgroundColor : Color = Color.Transparent,
content: @Composable BoxScope.() -> Unit = {} // ✅ 추가
backgroundColor: Color = Color.Transparent,
fallback: Int = R.drawable.spot_logo,
content: @Composable BoxScope.() -> Unit = {}
) {
val context = LocalContext.current

val painter: Painter? = when (imageRef) {
ImageRef.None -> painterResource(fallback)

is ImageRef.Name -> {
val resId = remember(imageRef.name) {
context.resources.getIdentifier(
imageRef.name,
"drawable",
context.packageName
)
}
if (resId != 0) painterResource(resId) else painterResource(fallback)
}

is ImageRef.Url ->
rememberAsyncImagePainter(model = imageRef.url)

is ImageRef.LocalUri ->
rememberAsyncImagePainter(model = imageRef.uri)
}

Box(
modifier = modifier
.clip(shape)
.background(backgroundColor)
.then(
if (borderColor != null && borderWidth > 0.dp) {
Modifier.border(borderWidth, borderColor, shape)
} else {
Modifier
}
} else Modifier
),
contentAlignment = Alignment.Center
) {
Image(
painter = painter,
contentDescription = contentDescription,
contentScale = contentScale,
modifier = Modifier
.wrapContentSize()
.padding(padding)
)
if (painter != null) {
Image(
painter = painter,
contentDescription = null,
contentScale = contentScale,
modifier = Modifier
.wrapContentSize()
.padding(padding)
)
}
content()
}
}


@Composable
fun ShapeBox(
shape: Shape = SpotShapes.Hard,
Expand Down
12 changes: 6 additions & 6 deletions core/designsystem/src/main/res/drawable/announce.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="48dp"
android:height="48dp"
android:viewportWidth="48"
android:viewportHeight="48">
android:width="16dp"
android:height="16dp"
android:viewportWidth="16"
android:viewportHeight="16">
<path
android:pathData="M0,24C0,10.745 10.745,0 24,0C37.255,0 48,10.745 48,24C48,37.255 37.255,48 24,48C10.745,48 0,37.255 0,24Z"
android:pathData="M0,8C0,6.14 0,5.21 0.204,4.447C0.759,2.377 2.377,0.759 4.447,0.204C5.21,0 6.14,0 8,0C9.86,0 10.79,0 11.553,0.204C13.623,0.759 15.241,2.377 15.796,4.447C16,5.21 16,6.14 16,8C16,9.86 16,10.79 15.796,11.553C15.241,13.623 13.623,15.241 11.553,15.796C10.79,16 9.86,16 8,16C6.14,16 5.21,16 4.447,15.796C2.377,15.241 0.759,13.623 0.204,11.553C0,10.79 0,9.86 0,8Z"
android:fillColor="#337BFF"/>
<path
android:pathData="M28,13.667V34.328C28,35.767 26.302,36.529 25.227,35.574L19.238,30.248C19.055,30.086 18.818,29.996 18.574,29.996H13.667C13.273,29.996 12.883,29.919 12.519,29.768C12.155,29.617 11.824,29.396 11.546,29.117C11.267,28.839 11.046,28.508 10.895,28.144C10.745,27.78 10.667,27.39 10.667,26.996V20.999C10.667,20.203 10.984,19.441 11.546,18.878C12.109,18.316 12.872,18 13.667,18H18.574C18.819,18 19.055,17.91 19.238,17.747L25.226,12.423C26.302,11.467 28,12.229 28,13.667ZM33.323,15.864C33.536,15.706 33.803,15.639 34.065,15.679C34.328,15.717 34.564,15.859 34.722,16.072C36.422,18.366 37.338,21.146 37.334,24.001C37.337,26.856 36.421,29.636 34.72,31.929C34.561,32.138 34.326,32.275 34.066,32.312C33.806,32.349 33.542,32.282 33.331,32.125C33.12,31.969 32.979,31.736 32.938,31.476C32.897,31.217 32.961,30.952 33.114,30.739C34.559,28.79 35.337,26.427 35.334,24.001C35.338,21.575 34.559,19.212 33.114,17.263C33.035,17.157 32.979,17.037 32.947,16.91C32.915,16.782 32.909,16.649 32.928,16.519C32.947,16.389 32.992,16.264 33.06,16.152C33.128,16.039 33.217,15.942 33.323,15.864ZM30.858,19.16C30.973,19.097 31.1,19.058 31.23,19.045C31.361,19.031 31.493,19.043 31.619,19.08C31.745,19.118 31.862,19.18 31.964,19.263C32.066,19.345 32.151,19.447 32.214,19.563C32.928,20.883 33.334,22.396 33.334,24.001C33.334,25.551 32.95,27.076 32.214,28.439C32.151,28.554 32.067,28.656 31.965,28.739C31.862,28.822 31.745,28.884 31.619,28.922C31.493,28.959 31.361,28.972 31.231,28.958C31.1,28.944 30.973,28.905 30.858,28.843C30.742,28.78 30.64,28.696 30.557,28.594C30.474,28.492 30.412,28.374 30.375,28.249C30.337,28.122 30.325,27.99 30.338,27.86C30.352,27.729 30.391,27.602 30.454,27.487C31.032,26.416 31.334,25.218 31.334,24.001C31.334,22.737 31.014,21.551 30.454,20.515C30.328,20.281 30.299,20.008 30.375,19.754C30.451,19.5 30.625,19.286 30.858,19.16Z"
android:pathData="M9.249,4.771V11.227C9.249,11.677 8.718,11.915 8.382,11.616L6.51,9.952C6.453,9.901 6.379,9.873 6.303,9.873H4.77C4.646,9.873 4.525,9.849 4.411,9.802C4.297,9.755 4.194,9.686 4.107,9.599C4.02,9.512 3.951,9.408 3.903,9.295C3.856,9.181 3.832,9.059 3.832,8.936V7.062C3.832,6.813 3.931,6.575 4.107,6.399C4.283,6.223 4.521,6.125 4.77,6.125H6.303C6.379,6.125 6.453,6.096 6.51,6.045L8.382,4.382C8.718,4.083 9.249,4.321 9.249,4.771ZM10.912,5.457C10.979,5.408 11.062,5.387 11.144,5.399C11.226,5.411 11.3,5.456 11.349,5.522C11.88,6.239 12.167,7.108 12.165,8C12.167,8.892 11.88,9.761 11.349,10.478C11.299,10.543 11.225,10.586 11.144,10.597C11.063,10.609 10.98,10.588 10.914,10.539C10.849,10.49 10.804,10.417 10.792,10.336C10.779,10.255 10.799,10.172 10.847,10.106C11.298,9.497 11.542,8.758 11.54,8C11.542,7.242 11.298,6.503 10.847,5.894C10.822,5.861 10.804,5.824 10.795,5.784C10.785,5.744 10.783,5.703 10.789,5.662C10.795,5.621 10.809,5.582 10.83,5.547C10.851,5.512 10.879,5.482 10.912,5.457ZM10.142,6.487C10.178,6.468 10.217,6.455 10.258,6.451C10.299,6.447 10.34,6.451 10.38,6.462C10.419,6.474 10.456,6.493 10.488,6.519C10.519,6.545 10.546,6.577 10.565,6.613C10.789,7.025 10.915,7.498 10.915,8C10.916,8.484 10.795,8.961 10.565,9.387C10.546,9.423 10.519,9.455 10.488,9.481C10.456,9.507 10.419,9.526 10.38,9.538C10.34,9.549 10.299,9.553 10.258,9.549C10.217,9.545 10.178,9.533 10.142,9.513C10.106,9.493 10.074,9.467 10.048,9.435C10.022,9.403 10.002,9.367 9.991,9.327C9.979,9.288 9.975,9.247 9.979,9.206C9.984,9.165 9.996,9.125 10.015,9.089C10.196,8.755 10.29,8.38 10.29,8C10.29,7.605 10.19,7.234 10.015,6.911C9.976,6.838 9.967,6.752 9.991,6.673C10.014,6.593 10.069,6.527 10.142,6.487Z"
android:fillColor="#FCFCFF"/>
</vector>
4 changes: 0 additions & 4 deletions core/model/src/main/java/com/umcspot/spot/model/Global.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ enum class RecruitingStudySort(val label: String) {
HITS("조회수 높은 순"),
LIKES("관심 많은 순")
}


enum class AlertKind { POPULAR_POST, STUDY_NOTICE, STUDY_SCHEDULE, TODO_DONE }

enum class ActivityType(
val label: String
) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package com.umcspot.spot.alert.datasource

import com.umcspot.spot.alert.dto.response.AlertResponseDto
import com.umcspot.spot.alert.dto.response.AppliedAlertResponseDto
import com.umcspot.spot.network.model.BaseResponse

interface AlertDataSource {
suspend fun getAlerts(): BaseResponse<AlertResponseDto>

suspend fun getAppliedAlerts(): BaseResponse<AppliedAlertResponseDto>

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.umcspot.spot.alert.datasourceimpl

import com.umcspot.spot.alert.datasource.AlertDataSource
import com.umcspot.spot.alert.dto.response.AlertResponseDto
import com.umcspot.spot.alert.dto.response.AppliedAlertResponseDto
import com.umcspot.spot.alert.service.AlertService
import com.umcspot.spot.network.model.BaseResponse
import javax.inject.Inject
Expand All @@ -13,10 +12,4 @@ class AlertDataSourceImpl @Inject constructor(
override suspend fun getAlerts(
): BaseResponse<AlertResponseDto> =
alertService.getAlerts()

override suspend fun getAppliedAlerts(

): BaseResponse<AppliedAlertResponseDto> =
alertService.getAppliedAlerts()

}
Original file line number Diff line number Diff line change
@@ -1,59 +1,29 @@
package com.umcspot.spot.alert.dto.response

import android.annotation.SuppressLint
import com.umcspot.spot.model.AlertKind
import com.umcspot.spot.model.ImageRef
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class AlertResponseDto(
@SerialName("alerts")
val alerts : List<AlertItem>
@SerialName("studies")
val studies : List<AlertItem>
)

@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class AlertItem(
@SerialName("id")
val id: Int,
@SerialName("applicationId")
val applicationId: String,

@SerialName("kind")
val kind: AlertKind,
@SerialName("studyId")
val studyId: String,

@SerialName("title")
val title: String,

@SerialName("subtitle")
val subtitle: String,

@SerialName("studyImageRes")
val studyImageRes: ImageRef,

@SerialName("isRead")
val isRead: Boolean = false
)

@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class AppliedAlertResponseDto(
@SerialName("alerts")
val alerts : List<AppliedAlertItem>
)

@SuppressLint("UnsafeOptInUsageError")
@Serializable
data class AppliedAlertItem(
@SerialName("id")
val id: Int,

@SerialName("title")
val title: String,

@SerialName("subtitle")
val subtitle: String,

@SerialName("studyImageRes")
val studyImageRes: ImageRef,
@SerialName("profileImageRef")
val profileImageRef: ImageRef,
)
Loading