diff --git a/app/build.gradle b/app/build.gradle
index 0dff2d4..7b3f4c9 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -14,8 +14,8 @@ android {
applicationId "com.dev.briefing"
minSdk 28
targetSdk 34
- versionCode 3
- versionName "1.1.1"
+ versionCode 4
+ versionName "2.0.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
diff --git a/app/src/main/java/com/dev/briefing/data/datasource/BriefingDataSourceImpl.kt b/app/src/main/java/com/dev/briefing/data/datasource/BriefingDataSourceImpl.kt
index 7cfbb89..d9e5283 100644
--- a/app/src/main/java/com/dev/briefing/data/datasource/BriefingDataSourceImpl.kt
+++ b/app/src/main/java/com/dev/briefing/data/datasource/BriefingDataSourceImpl.kt
@@ -3,8 +3,6 @@ package com.dev.briefing.data.datasource
import com.dev.briefing.data.api.BriefingApi
import com.dev.briefing.data.model.response.BriefingArticleResponse
import com.dev.briefing.data.model.response.BriefingCategoryArticlesResponse
-import com.dev.briefing.data.model.response.BriefingCompactArticleResponse
-import com.dev.briefing.model.BriefingCategoryArticles
import com.dev.briefing.model.enum.BriefingArticleCategory
import com.dev.briefing.model.enum.TimeOfDay
import java.time.LocalDate
@@ -18,7 +16,7 @@ class BriefingDataSourceImpl(private val briefingApi: BriefingApi) : BriefingDat
timeOfDay: TimeOfDay?
): BriefingCategoryArticlesResponse {
return briefingApi.getBriefingCategoryArticles(
- type = type.typeName,
+ type = type.typeId,
date = date?.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")),
timeOfDay = timeOfDay?.value
).result
diff --git a/app/src/main/java/com/dev/briefing/model/enum/BriefingArticleCategory.kt b/app/src/main/java/com/dev/briefing/model/enum/BriefingArticleCategory.kt
index 16abbc0..da362b3 100644
--- a/app/src/main/java/com/dev/briefing/model/enum/BriefingArticleCategory.kt
+++ b/app/src/main/java/com/dev/briefing/model/enum/BriefingArticleCategory.kt
@@ -1,15 +1,17 @@
package com.dev.briefing.model.enum
-enum class BriefingArticleCategory(val typeName: String) {
- KOREA("KOREA"),
- GLOBAL("GLOBAL"),
- SOCIAL("SOCIAL"),
- SCIENCE("SCIENCE"),
- ECONOMY("ECONOMY");
+import com.dev.briefing.R
+
+enum class BriefingArticleCategory(val typeId: String, val typeName: Int) {
+ KOREA("KOREA", R.string.name_category_korea),
+ GLOBAL("GLOBAL", R.string.name_category_global),
+ SOCIAL("SOCIAL", R.string.name_category_society),
+ SCIENCE("SCIENCE", R.string.name_category_science),
+ ECONOMY("ECONOMY", R.string.name_category_economy);
companion object {
fun fromTypeName(typeName: String): BriefingArticleCategory {
- return values().firstOrNull { it.typeName.equals(typeName, ignoreCase = true) }
+ return values().firstOrNull { it.typeId.equals(typeName, ignoreCase = true) }
?: throw IllegalArgumentException("Invalid typeName for ArticleType: $typeName")
}
}
diff --git a/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt b/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
index cd53533..5ee08d0 100644
--- a/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/detail/ArticleDetailScreen.kt
@@ -16,6 +16,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.tooling.preview.datasource.LoremIpsum
@@ -27,7 +28,10 @@ import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.dev.briefing.R
import com.dev.briefing.model.RelatedArticle
+import com.dev.briefing.presentation.login.SignInActivity
import com.dev.briefing.presentation.theme.BriefingTheme
+import com.dev.briefing.presentation.theme.utils.CommonDialog
+import com.dev.briefing.util.preference.AuthPreferenceHelper
import org.koin.androidx.compose.getViewModel
@Composable
@@ -37,6 +41,25 @@ fun ArticleDetailScreen(
onBackClick: () -> Unit = {},
navController: NavController = rememberNavController()
) {
+ val context = LocalContext.current
+ val authPreferenceHelper = AuthPreferenceHelper(context)
+
+ val openSignInDialog = remember { mutableStateOf(false) }
+ if (openSignInDialog.value) {
+ CommonDialog(
+ onDismissRequest = { openSignInDialog.value = false },
+ onConfirmation = {
+ val intent = Intent(context, SignInActivity::class.java)
+ startActivity(context, intent, null)
+ openSignInDialog.value = false
+ },
+ dialogTitle = R.string.dialog_login_title,
+ dialogText = R.string.dialog_login_text,
+ dialogId = R.string.dialog_login_confirm,
+ confirmColor = BriefingTheme.color.PrimaryBlue
+ )
+ }
+
LaunchedEffect(articleId) {
articleDetailViewModel.loadBriefingArticle(articleId)
}
@@ -75,12 +98,16 @@ fun ArticleDetailScreen(
modifier = Modifier.padding(30.dp, 18.dp),
title = article.title,
date = article.createdDate.toString(),
- section = article.category.typeName,
+ section = "${stringResource(id = article.category.typeName)} #${article.ranks}",
generatedEngine = article.gptModel,
scrapCount = article.scrapCount,
isScrapingInProgress = uiState.isScrapingInProgress,
isScrapped = article.isScrap,
onScrapClick = {
+ if (authPreferenceHelper.getMemberId() == -1) {
+ openSignInDialog.value = true
+ return@ArticleDetailHeader
+ }
if (article.isScrap) {
articleDetailViewModel.unScrap(article.id)
} else {
@@ -367,11 +394,12 @@ fun TopBar(onBackPressed: () -> Unit) {
)
}
- IconButton(onClick = onBackPressed, modifier = Modifier.align(Alignment.CenterEnd)) {
+ // TODO : enable when function developed
+ /*IconButton(onClick = onBackPressed, modifier = Modifier.align(Alignment.CenterEnd)) {
Icon(
painter = painterResource(id = R.drawable.baseline_more_horiz_24),
contentDescription = null
)
- }
+ }*/
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt b/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
index c71fa99..7a32dd4 100644
--- a/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/home/HomeScreen.kt
@@ -168,7 +168,7 @@ fun formatBriefingDate(date: Date): String {
val datePart = dateFormat.format(date)
val hourPart = timeFormat.format(date).toInt()
- val briefingPart = if (hourPart < 12) "아침 브리핑" else "저녁 브리핑"
+ val briefingPart = if (hourPart < 16) "아침 브리핑" else "저녁 브리핑"
return "$datePart $briefingPart"
}
diff --git a/app/src/main/java/com/dev/briefing/presentation/home/HomeViewModel.kt b/app/src/main/java/com/dev/briefing/presentation/home/HomeViewModel.kt
index 6814168..f42656a 100644
--- a/app/src/main/java/com/dev/briefing/presentation/home/HomeViewModel.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/home/HomeViewModel.kt
@@ -50,9 +50,7 @@ class HomeViewModel(
runCatching {
briefingRepository.getBriefings(
- briefingArticleCategory,
- LocalDate.of(2023, 11, 30),
- TimeOfDay.MORNING
+ briefingArticleCategory
)
}.onSuccess {
currentLoadingCategories.remove(briefingArticleCategory)
diff --git a/app/src/main/java/com/dev/briefing/presentation/login/SignInActivity.kt b/app/src/main/java/com/dev/briefing/presentation/login/SignInActivity.kt
index ed1e0ee..9f4d1c4 100644
--- a/app/src/main/java/com/dev/briefing/presentation/login/SignInActivity.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/login/SignInActivity.kt
@@ -36,7 +36,7 @@ class SignInActivity : ComponentActivity() {
val token = authPreferenceHelper.getAccessToken()
val memberId = authPreferenceHelper.getMemberId()
if (token != "" && memberId != -1) {
- Toast.makeText(this, "자동 로그인 되었습니다.", Toast.LENGTH_SHORT).show()
+// Toast.makeText(this, "자동 로그인 되었습니다.", Toast.LENGTH_SHORT).show()
val intent = Intent(this@SignInActivity, HomeActivity::class.java)
startActivity(intent, null)
finish()
diff --git a/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt b/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
index b454f2f..4f48daa 100644
--- a/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/setting/SettingScreen.kt
@@ -101,7 +101,7 @@ fun SettingScreen(
val intent = Intent(context, SignInActivity::class.java)
startActivity(context, intent, null)
- val activity = context as? ComponentActivity
+ val activity = context as? Activity
activity?.finish()
},
dialogTitle = R.string.dialog_logout_title,
@@ -138,8 +138,8 @@ fun SettingScreen(
timePickerDialog.show()
},
)
- //구독 정보
- SettingSection(R.string.setting_section_premium)
+ // TODO : enable when starting premium service
+ /*SettingSection(R.string.setting_section_premium)
SettingMenuItem(
type = SettingMenu(
isArrow = true,
@@ -148,7 +148,7 @@ fun SettingScreen(
onClick = {
navController.navigate(HomeScreen.Premium.route)
},
- )
+ )*/
//앱 정보
SettingSection(R.string.setting_section_info)
SettingMenuItem(
diff --git a/app/src/main/java/com/dev/briefing/presentation/theme/component/CommonHeader.kt b/app/src/main/java/com/dev/briefing/presentation/theme/component/CommonHeader.kt
index 654eb49..8c09729 100644
--- a/app/src/main/java/com/dev/briefing/presentation/theme/component/CommonHeader.kt
+++ b/app/src/main/java/com/dev/briefing/presentation/theme/component/CommonHeader.kt
@@ -3,21 +3,27 @@ package com.dev.briefing.presentation.theme.component
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.size
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.dev.briefing.R
import androidx.constraintlayout.compose.ConstraintLayout
import com.dev.briefing.presentation.theme.BriefingTheme
+import java.time.format.TextStyle
@Preview
@Composable
@@ -36,50 +42,32 @@ fun CommonHeader(
onBackClick: () -> Unit = {},
header: String = "",
color: Color = BriefingTheme.color.BackgroundWhite,
- isPadding: Boolean = false
) {
- ConstraintLayout(
- modifier = modifier
- .fillMaxWidth()
- .background(color = color)
- .padding(
- top = 24.dp, bottom = 15.dp, start = if (isPadding) {
- 20.dp
- } else {
- 0.dp
- }, end = if (isPadding) {
- 20.dp
- } else {
- 0.dp
- }
- ),
- )
- {
- val (backKey, title) = createRefs()
- Image(
- modifier = Modifier
- .height(20.dp)
- .clickable(onClick = onBackClick)
- .constrainAs(backKey) {
- start.linkTo(parent.start)
- top.linkTo(parent.top)
- bottom.linkTo(parent.bottom)
- },
- painter = painterResource(
- id = R.drawable.vector
- ),
- contentDescription = "뒤로가기"
- )
+ Box(modifier.fillMaxWidth().background(color).padding(20.dp, 16.dp)) {
+ Box(modifier = Modifier
+ .size(33.dp)
+ .clickable(onClick = onBackClick)
+ .align(Alignment.CenterStart)) {
+ Image(
+ modifier = Modifier
+ .size(8.dp, 16.dp)
+ .align(Alignment.Center),
+ painter = painterResource(
+ id = R.drawable.vector
+ ),
+ contentDescription = "뒤로가기"
+ )
+ }
+
Text(
- modifier = Modifier.constrainAs(title) {
- start.linkTo(parent.start)
- end.linkTo(parent.end)
- },
text = header,
- style = BriefingTheme.typography.SubtitleStyleBold.copy(
- color = BriefingTheme.color.TextBlack,
+ modifier = Modifier
+ .align(Alignment.Center),
+ style = BriefingTheme.typography.TitleStyleRegular.copy(
fontSize = 20.sp,
- fontWeight = FontWeight(400)
+ fontWeight = FontWeight(400),
+ color = Color(0xFF000000),
+ textAlign = TextAlign.Center,
)
)
}
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index a3f902e..47596c2 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -67,4 +67,9 @@
과학
글로벌
경제
+ 한국
+ 세계
+ 사회
+ 과학
+ 경제
\ No newline at end of file