Skip to content

Commit

Permalink
Merge branch 'refs/heads/fix/#65-qa' into fix/#67-qa_bottom_sheet
Browse files Browse the repository at this point in the history
# Conflicts:
#	feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt
#	feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt
#	feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt
#	feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt
  • Loading branch information
l5x5l committed Aug 31, 2024
2 parents 3939b67 + b83d022 commit e61415e
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,17 +273,31 @@ fun AddLinkScreen(
text = memo,
hintText = stringResource(id = R.string.placeholder_memo),
onChangeText = inputMemo,
enable = enable
enable = enable,
isError = memo.length >= 100
)

Spacer(modifier = Modifier.height(4.dp))

Text(
modifier = Modifier.fillMaxWidth(),
text = "${memo.length}/100",
style = PokitTheme.typography.detail1.copy(color = PokitTheme.colors.textTertiary),
textAlign = TextAlign.End
)
Row(verticalAlignment = Alignment.CenterVertically) {
if (memo.length >= 100) {
Text(
color = PokitTheme.colors.error,
text = "최대 100자까지 입력 가능합니다.",
style = PokitTheme.typography.detail1
)
}

Spacer(modifier = Modifier.weight(1f))

Text(
color = if (memo.length >= 100) PokitTheme.colors.error else PokitTheme.colors.textTertiary,
modifier = Modifier.weight(1f),
text = "${memo.length}/100",
style = PokitTheme.typography.detail1,
textAlign = TextAlign.End
)
}

Spacer(modifier = Modifier.height(24.dp))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,9 @@ class AddLinkViewModel @Inject constructor(
}

fun inputMemo(memo: String) {
_memo.update { memo }
if (memo.length <= 100) {
_memo.update { memo }
}
}

fun showSelectPokitBottomSheet() = intent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package pokitmons.pokit.home.pokit

import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -15,6 +17,7 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
Expand Down Expand Up @@ -47,13 +50,16 @@ fun PokitScreen(
val pokitOptionBottomSheetType by viewModel.pokitOptionBottomSheetType.collectAsState()
val currentDetailSelectedCategory by viewModel.currentDetailSelectedCategory.collectAsState()

val context: Context = LocalContext.current

PokitBottomSheet(
onHideBottomSheet = viewModel::hidePokitDetailRemoveBottomSheet,
show = pokitOptionBottomSheetType != null
) {
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hidePokitDetailRemoveBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package pokitmons.pokit.home.pokit

import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.lazy.LazyColumn
Expand All @@ -9,6 +12,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
Expand All @@ -33,6 +37,8 @@ fun UnclassifiedScreen(
val currentSelectedLink by viewModel.currentSelectedLink.collectAsState()
val currentDetailShowLink by viewModel.currentDetailShowLink.collectAsState()

val context: Context = LocalContext.current

currentDetailShowLink?.let { link ->
LinkDetailBottomSheet(
title = link.title,
Expand All @@ -45,6 +51,13 @@ fun UnclassifiedScreen(
dateString = link.dateString,
onHideBottomSheet = viewModel::hideDetailLinkBottomSheet,
show = true,
onClickShareLink = {
val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, link.url)
}
context.startActivity(Intent.createChooser(intent, "Pokit"))
},
onClickBookmark = viewModel::toggleBookmark
)
}
Expand All @@ -56,6 +69,7 @@ fun UnclassifiedScreen(
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hideLinkOptionBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package pokitmons.pokit.home.remind

import android.content.Context
import android.widget.Toast
import androidx.compose.foundation.horizontalScroll
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
Expand All @@ -17,6 +19,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
Expand Down Expand Up @@ -54,6 +57,8 @@ fun RemindScreen(
val pokitOptionBottomSheetType by viewModel.pokitOptionBottomSheetType.collectAsState()
val currentSelectedLink by viewModel.currentSelectedLink.collectAsState()

val context: Context = LocalContext.current

val showTotalEmpty by remember {
derivedStateOf {
todayContentsState == NetworkState.IDLE &&
Expand All @@ -70,6 +75,7 @@ fun RemindScreen(
when (pokitOptionBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
viewModel.hideLinkOptionBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,21 +67,19 @@ fun InputNicknameScreen(
maxLength = NICKNAME_MAX_LENGTH,
sub = when {
inputNicknameState.isDuplicate -> stringResource(id = Login.string.nickname_already_in_use)
inputNicknameState.isRegex -> stringResource(id = Login.string.input_restriction_message)
inputNicknameState.nickname.length < NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_max_length)
!inputNicknameState.isRegex -> stringResource(id = Login.string.input_restriction_message)
inputNicknameState.nickname.length >= NICKNAME_MAX_LENGTH -> stringResource(id = Login.string.input_max_length)
else -> ""
},
isError = inputNicknameState.nickname.length > NICKNAME_MAX_LENGTH || inputNicknameState.isDuplicate || inputNicknameState.isRegex,
isError = inputNicknameState.isRegex || inputNicknameState.isDuplicate || inputNicknameState.nickname.length >= NICKNAME_MAX_LENGTH,
hintText = stringResource(id = Login.string.input_nickname_hint),
onChangeText = { text ->
Log.d("!! : ", text)
if (text.length <= NICKNAME_MAX_LENGTH) {
viewModel.apply {
inputText(text)
if (checkNicknameRegex(text)) {
Log.d("!! : ", "else call")
checkDuplicateNickname(text)
} else {
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package com.strayalpaca.pokitdetail

import android.content.Context
import android.content.Intent
import android.widget.Toast
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -17,6 +20,7 @@ import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
Expand Down Expand Up @@ -215,6 +219,7 @@ fun PokitDetailScreen(
}

if (state.currentLink != null) {
val context: Context = LocalContext.current
LinkDetailBottomSheet(
title = state.currentLink.title,
memo = state.currentLink.memo,
Expand All @@ -226,6 +231,13 @@ fun PokitDetailScreen(
dateString = state.currentLink.dateString,
onHideBottomSheet = hideLinkDetailBottomSheet,
show = state.linkDetailBottomSheetVisible,
onClickShareLink = {
val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, state.currentLink.url)
}
context.startActivity(Intent.createChooser(intent, "Pokit"))
},
onClickBookmark = onClickBookmark
)
}
Expand Down Expand Up @@ -282,9 +294,11 @@ fun PokitDetailScreen(
onHideBottomSheet = hideLinkModifyBottomSheet,
show = state.linkBottomSheetType != null
) {
val context: Context = LocalContext.current
when (state.linkBottomSheetType) {
BottomSheetType.MODIFY -> {
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
state.currentLink?.let { link ->
Expand Down Expand Up @@ -319,7 +333,9 @@ fun PokitDetailScreen(
) {
when (state.pokitBottomSheetType) {
BottomSheetType.MODIFY -> {
val context: Context = LocalContext.current
ModifyBottomSheetContent(
onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() },
onClickModify = remember {
{
hidePokitModifyBottomSheet()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package pokitmons.pokit.search

import android.content.Context
import android.content.Intent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
Expand All @@ -10,6 +12,7 @@ import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import coil.compose.rememberAsyncImagePainter
Expand Down Expand Up @@ -48,6 +51,8 @@ fun SearchScreenContainer(
val pokitList by viewModel.pokitList.collectAsState()
val pokitPagingState by viewModel.pokitPagingState.collectAsState()

val context: Context = LocalContext.current

state.currentLink?.let { link ->
LinkDetailBottomSheet(
title = link.title,
Expand All @@ -60,6 +65,13 @@ fun SearchScreenContainer(
dateString = link.dateString,
onHideBottomSheet = viewModel::hideLinkDetailBottomSheet,
show = state.showLinkDetailBottomSheet,
onClickShareLink = {
val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, state.currentLink?.url)
}
context.startActivity(Intent.createChooser(intent, "Pokit"))
},
onClickModifyLink = {
viewModel.hideLinkDetailBottomSheet()
onNavigateToLinkModify(link.id)
Expand Down

0 comments on commit e61415e

Please sign in to comment.