From 99e24c23118f1ad88b5624bf817be6e223323a8b Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:16:19 +0900 Subject: [PATCH 01/16] =?UTF-8?q?[feature]=20=EA=B3=B5=EC=9C=A0=ED=95=98?= =?UTF-8?q?=EA=B8=B0=20util=20=ED=95=A8=EC=88=98=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokit/core/feature/utils/shareUrlLink.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt diff --git a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt new file mode 100644 index 0000000..db6d153 --- /dev/null +++ b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt @@ -0,0 +1,12 @@ +package pokitmons.pokit.core.feature.utils + +import android.content.Context +import android.content.Intent + +fun shareText(context: Context, url: String, chooserTitle: String = "Pokit") { + val intent = Intent(Intent.ACTION_SEND).apply { + type = "text/plain" + putExtra(Intent.EXTRA_TEXT, url) + } + context.startActivity(Intent.createChooser(intent, chooserTitle)) +} From 3a2d61dbb0820c04c46ad6c3315f826b0195dbaf Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:16:42 +0900 Subject: [PATCH 02/16] =?UTF-8?q?[chore]=20=EC=A4=80=EB=B9=84=EC=A4=91=20?= =?UTF-8?q?=ED=86=A0=EC=8A=A4=ED=8A=B8=20=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20?= =?UTF-8?q?TODO=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt index a86edfd..bb156ac 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt @@ -59,7 +59,9 @@ fun PokitScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( - onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, + onClickShare = { + // TODO 카카오 공유 구현 + }, onClickModify = remember { { viewModel.hidePokitDetailRemoveBottomSheet() From 7d344c506370b5571734ab5af238b6e2cf3851fe Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:39:51 +0900 Subject: [PATCH 03/16] =?UTF-8?q?[chore]=20=EB=A1=9C=EA=B7=B8=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt index f3173f7..a044957 100644 --- a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt @@ -74,7 +74,6 @@ fun InputNicknameScreen( 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) From e6c66e95ecc327dfb4dc0fd0e149b294330ba574 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:40:52 +0900 Subject: [PATCH 04/16] =?UTF-8?q?[chore]=20=ED=95=A8=EC=88=98=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt index db6d153..08f37e2 100644 --- a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt +++ b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt @@ -3,7 +3,7 @@ package pokitmons.pokit.core.feature.utils import android.content.Context import android.content.Intent -fun shareText(context: Context, url: String, chooserTitle: String = "Pokit") { +fun shareUrlLink(context: Context, url: String, chooserTitle: String = "Pokit") { val intent = Intent(Intent.ACTION_SEND).apply { type = "text/plain" putExtra(Intent.EXTRA_TEXT, url) From 0b97aefbcaf2619204dcf61050f08b008d28e4aa Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:42:09 +0900 Subject: [PATCH 05/16] =?UTF-8?q?[chore]=20=ED=86=A0=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=A0=9C=EA=B1=B0=20=EB=B0=8F=20shoreUrlLink=20=ED=95=A8?= =?UTF-8?q?=EC=88=98=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokit/home/pokit/UnclassifiedScreen.kt | 18 ++++++++----- .../pokit/home/remind/RemindScreen.kt | 9 +++++-- .../pokitdetail/PokitDetailScreen.kt | 26 +++++++++++++------ .../pokitmons/pokit/search/SearchScreen.kt | 10 +++---- 4 files changed, 42 insertions(+), 21 deletions(-) diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt index 0bc8153..91a28cf 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt @@ -2,6 +2,7 @@ package pokitmons.pokit.home.pokit import android.content.Context import android.content.Intent +import android.util.Log import android.widget.Toast import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues @@ -20,6 +21,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.rememberAsyncImagePainter import com.strayalpaca.pokitdetail.R import com.strayalpaca.pokitdetail.model.BottomSheetType +import pokitmons.pokit.core.feature.utils.shareUrlLink import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet import pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet.LinkDetailBottomSheet @@ -52,11 +54,10 @@ fun UnclassifiedScreen( 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")) + shareUrlLink( + context = context, + url = link.url + ) }, onClickModifyLink = { viewModel.hideDetailLinkBottomSheet() @@ -77,7 +78,12 @@ fun UnclassifiedScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( - onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, + onClickShare = { + shareUrlLink( + context = context, + url = currentDetailShowLink?.url ?: "" + ) + }, onClickModify = remember { { viewModel.hideLinkOptionBottomSheet() diff --git a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt index 9395d92..04efd3e 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt @@ -1,7 +1,6 @@ package pokitmons.pokit.home.remind import android.content.Context -import android.widget.Toast import androidx.compose.foundation.background import androidx.compose.foundation.horizontalScroll import androidx.compose.foundation.layout.Arrangement @@ -28,6 +27,7 @@ import coil.compose.rememberAsyncImagePainter import com.strayalpaca.pokitdetail.R import com.strayalpaca.pokitdetail.model.BottomSheetType import pokitmons.pokit.core.feature.model.NetworkState +import pokitmons.pokit.core.feature.utils.shareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet @@ -77,7 +77,12 @@ fun RemindScreen( when (pokitOptionBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( - onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, + onClickShare = { + shareUrlLink( + context = context, + url = viewModel.currentShowingLink.value?.url ?: "" + ) + }, onClickModify = remember { { viewModel.hideLinkOptionBottomSheet() diff --git a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt index 978f0fa..6775a83 100644 --- a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt +++ b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt @@ -34,6 +34,7 @@ import com.strayalpaca.pokitdetail.model.Pokit import com.strayalpaca.pokitdetail.model.PokitDetailScreenState import pokitmons.pokit.core.feature.flow.collectAsEffect import pokitmons.pokit.core.feature.model.paging.PagingState +import pokitmons.pokit.core.feature.utils.shareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.block.pokitlist.PokitList @@ -241,11 +242,10 @@ fun PokitDetailScreen( 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")) + shareUrlLink( + context = context, + url = state.currentLink.url + ) }, onClickModifyLink = { hideLinkDetailBottomSheet() @@ -316,7 +316,12 @@ fun PokitDetailScreen( when (state.linkBottomSheetType) { BottomSheetType.MODIFY -> { ModifyBottomSheetContent( - onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, + onClickShare = { + shareUrlLink( + context = context, + url = state.currentLink?.url ?: "" + ) + }, onClickModify = remember { { state.currentLink?.let { link -> @@ -353,11 +358,16 @@ fun PokitDetailScreen( BottomSheetType.MODIFY -> { val context: Context = LocalContext.current ModifyBottomSheetContent( - onClickShare = { Toast.makeText(context, "준비중입니다.", Toast.LENGTH_SHORT).show() }, + onClickShare = { + shareUrlLink( + context = context, + url = state.currentLink?.url ?: "" + ) + }, onClickModify = remember { { hidePokitModifyBottomSheet() - onClickPokitModify(state.currentPokit!!.id) + onClickPokitModify(state.currentPokit!!.id) // TODO assertion 제거하는 방향으로 } }, onClickRemove = showPokitRemoveBottomSheet diff --git a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt index c7dd4e0..785cb5a 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt @@ -17,6 +17,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import coil.compose.rememberAsyncImagePainter import pokitmons.pokit.core.feature.model.paging.PagingState +import pokitmons.pokit.core.feature.utils.shareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet import pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet.LinkDetailBottomSheet @@ -66,11 +67,10 @@ fun SearchScreenContainer( onHideBottomSheet = viewModel::hideLinkDetailBottomSheet, show = state.showLinkDetailBottomSheet, onClickShareLink = { - val intent = Intent(Intent.ACTION_SEND_MULTIPLE).apply { - type = "text/plain" - putExtra(Intent.EXTRA_TEXT, state.currentDetailLink?.url) - } - context.startActivity(Intent.createChooser(intent, "Pokit")) + shareUrlLink( + context = context, + url = state.currentDetailLink?.url ?: "" + ) }, onClickModifyLink = { viewModel.hideLinkDetailBottomSheet() From bda169142b6c1b95d60dc582d34c850e97b2caa2 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 10 Nov 2024 16:44:20 +0900 Subject: [PATCH 06/16] =?UTF-8?q?[chore]=20=ED=95=A8=EC=88=98=20=EB=93=A4?= =?UTF-8?q?=EC=97=AC=EC=93=B0=EA=B8=B0=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt index 08f37e2..e51a1c0 100644 --- a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt +++ b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt @@ -3,7 +3,11 @@ package pokitmons.pokit.core.feature.utils import android.content.Context import android.content.Intent -fun shareUrlLink(context: Context, url: String, chooserTitle: String = "Pokit") { +fun shareUrlLink( + context: Context, + url: String, + chooserTitle: String = "Pokit" +) { val intent = Intent(Intent.ACTION_SEND).apply { type = "text/plain" putExtra(Intent.EXTRA_TEXT, url) From eeef84eff3047e89e822ef63b5a722f627bfa44c Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Tue, 12 Nov 2024 13:23:21 +0900 Subject: [PATCH 07/16] =?UTF-8?q?[chore]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=20=EC=84=A4=EC=A0=95=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/src/main/AndroidManifest.xml | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index e928a13..13b363f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -2,6 +2,10 @@ + + + + + + - + + + + + + + + + + + From 2d98a35ffc3c85690c04c48a35f4e836cbd356e2 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sat, 16 Nov 2024 15:58:44 +0900 Subject: [PATCH 08/16] =?UTF-8?q?[chore]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20s?= =?UTF-8?q?dk=20maven=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- settings.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index 39e6aa3..72323e7 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,6 +16,7 @@ dependencyResolutionManagement { repositories { google() mavenCentral() + maven { url = java.net.URI("https://devrepo.kakao.com/nexus/content/groups/public/") } } } From a5c1b4ca7ef0f0187a4b34ab7615bad353e0a0bf Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sat, 16 Nov 2024 16:08:44 +0900 Subject: [PATCH 09/16] =?UTF-8?q?[chore]=20=EC=B9=B4=EC=B9=B4=EC=98=A4=20?= =?UTF-8?q?=EA=B3=B5=EC=9C=A0=ED=95=98=EA=B8=B0=20=EB=9D=BC=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- feature/home/build.gradle.kts | 3 +++ gradle/libs.versions.toml | 2 ++ 2 files changed, 5 insertions(+) diff --git a/feature/home/build.gradle.kts b/feature/home/build.gradle.kts index 202d76b..8c2da77 100644 --- a/feature/home/build.gradle.kts +++ b/feature/home/build.gradle.kts @@ -70,6 +70,9 @@ dependencies { // coil implementation(libs.coil.compose) + // kakao share + implementation(libs.kakao.share.v2) + // module implementation(project(":core:ui")) implementation(project(":core:feature")) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 17818e5..b314497 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -31,8 +31,10 @@ firebase-bom = "33.1.2" firebase-auth = "23.0.0" google-services = "4.4.2" mockk = "1.13.12" +kakao-share = "2.20.6" [libraries] +kakao-share-v2 = { group = "com.kakao.sdk", name = "v2-share", version.ref = "kakao-share" } androidx-lifecycle-service = { group = "androidx.lifecycle", name = "lifecycle-service", version.ref = "lifecycle-runtime-ktx"} androidx-core-ktx = { group = "androidx.core", name = "core-ktx", version.ref = "core-ktx" } javax-inject = { module = "javax.inject:javax.inject", version.ref = "javax-inject" } From edaa05b11c1f87603b8328ecab1041d51e005875 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sat, 16 Nov 2024 16:37:49 +0900 Subject: [PATCH 10/16] =?UTF-8?q?[feature]=20=EC=B9=B4=EC=B9=B4=EC=98=A4?= =?UTF-8?q?=20SDK=20=EC=B4=88=EA=B8=B0=ED=99=94=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle.kts | 3 +++ app/src/main/AndroidManifest.xml | 3 +-- app/src/main/java/pokitmons/pokit/PokitApplication.kt | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index d42b021..48e1fc3 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -99,4 +99,7 @@ dependencies { implementation(libs.orbit.compose) implementation(libs.orbit.core) implementation(libs.orbit.viewmodel) + + // kakao + implementation(libs.kakao.share.v2) } diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 13b363f..0de9481 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -44,9 +44,8 @@ - + android:scheme="kakao7890f93caf1d9d5da976da4b4bc6e5e7" /> diff --git a/app/src/main/java/pokitmons/pokit/PokitApplication.kt b/app/src/main/java/pokitmons/pokit/PokitApplication.kt index 77af519..fbb453b 100644 --- a/app/src/main/java/pokitmons/pokit/PokitApplication.kt +++ b/app/src/main/java/pokitmons/pokit/PokitApplication.kt @@ -2,6 +2,7 @@ package pokitmons.pokit import android.app.Application import com.google.firebase.FirebaseApp +import com.kakao.sdk.common.KakaoSdk import dagger.hilt.android.HiltAndroidApp @HiltAndroidApp @@ -9,5 +10,6 @@ class PokitApplication : Application() { override fun onCreate() { super.onCreate() FirebaseApp.initializeApp(this) + KakaoSdk.init(this, "7890f93caf1d9d5da976da4b4bc6e5e7") } } From 15cb59d9ad9034d3b52e14b402b4deca775c8cb9 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 15:29:45 +0900 Subject: [PATCH 11/16] =?UTF-8?q?[chore]=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../data/datasource/local/AuthAuthenticator.kt | 6 +++--- .../local/{TokenManager.kt => AuthManager.kt} | 2 +- .../data/di/network/BearerTokenInterceptor.kt | 6 +++--- .../data/repository/auth/AuthRepositoryImpl.kt | 14 +++++++------- 4 files changed, 14 insertions(+), 14 deletions(-) rename data/src/main/java/pokitmons/pokit/data/datasource/local/{TokenManager.kt => AuthManager.kt} (97%) diff --git a/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthAuthenticator.kt b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthAuthenticator.kt index a882493..be8ab3c 100644 --- a/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthAuthenticator.kt +++ b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthAuthenticator.kt @@ -11,17 +11,17 @@ import pokitmons.pokit.data.model.auth.request.TokenRequest import javax.inject.Inject class AuthAuthenticator @Inject constructor( - private val tokenManager: TokenManager, + private val authManager: AuthManager, private val tokenApi: TokenApi, ) : Authenticator { override fun authenticate(route: Route?, response: Response): Request { val refreshToken = runBlocking { - tokenManager.getRefreshToken().first() + authManager.getRefreshToken().first() } val accessToken = runBlocking { tokenApi.reissue(TokenRequest(refreshToken ?: "")).also { response -> - tokenManager.saveAccessToken(response.accessToken) + authManager.saveAccessToken(response.accessToken) } } return newRequestWithToken(accessToken.accessToken, response.request) diff --git a/data/src/main/java/pokitmons/pokit/data/datasource/local/TokenManager.kt b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt similarity index 97% rename from data/src/main/java/pokitmons/pokit/data/datasource/local/TokenManager.kt rename to data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt index d167f34..f151963 100644 --- a/data/src/main/java/pokitmons/pokit/data/datasource/local/TokenManager.kt +++ b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt @@ -7,7 +7,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map import javax.inject.Inject -class TokenManager @Inject constructor( +class AuthManager @Inject constructor( private val dataStore: DataStore, ) { companion object { diff --git a/data/src/main/java/pokitmons/pokit/data/di/network/BearerTokenInterceptor.kt b/data/src/main/java/pokitmons/pokit/data/di/network/BearerTokenInterceptor.kt index 7110eb9..fe961e9 100644 --- a/data/src/main/java/pokitmons/pokit/data/di/network/BearerTokenInterceptor.kt +++ b/data/src/main/java/pokitmons/pokit/data/di/network/BearerTokenInterceptor.kt @@ -5,14 +5,14 @@ import kotlinx.coroutines.runBlocking import okhttp3.Interceptor import okhttp3.Request import okhttp3.Response -import pokitmons.pokit.data.datasource.local.TokenManager +import pokitmons.pokit.data.datasource.local.AuthManager import javax.inject.Inject // 토큰 api 수정될 때 까지 사용 -class BearerTokenInterceptor @Inject constructor(private val tokenManager: TokenManager) : Interceptor { +class BearerTokenInterceptor @Inject constructor(private val authManager: AuthManager) : Interceptor { override fun intercept(chain: Interceptor.Chain): Response { val token: String = runBlocking { - tokenManager.getAccessToken().first() + authManager.getAccessToken().first() } ?: "" val originalRequest: Request = chain.request() diff --git a/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt b/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt index f8975ea..baffd43 100644 --- a/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt +++ b/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt @@ -2,7 +2,7 @@ package pokitmons.pokit.data.repository.auth import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.first -import pokitmons.pokit.data.datasource.local.TokenManager +import pokitmons.pokit.data.datasource.local.AuthManager import pokitmons.pokit.data.datasource.remote.auth.AuthDataSource import pokitmons.pokit.data.mapper.auth.AuthMapper import pokitmons.pokit.data.model.auth.request.SNSLoginRequest @@ -21,7 +21,7 @@ import javax.inject.Inject class AuthRepositoryImpl @Inject constructor( private val remoteAuthDataSource: AuthDataSource, - private val tokenManager: TokenManager, + private val authManager: AuthManager, ) : AuthRepository { override suspend fun snsLogin( authPlatform: String, @@ -61,7 +61,7 @@ class AuthRepositoryImpl @Inject constructor( remoteAuthDataSource.withdraw( WithdrawRequest( refreshToken = "", - authPlatform = tokenManager.getAuthType().first() + authPlatform = authManager.getAuthType().first() ) ) PokitResult.Success(Unit) @@ -71,18 +71,18 @@ class AuthRepositoryImpl @Inject constructor( } override suspend fun setAccessToken(token: String) { - tokenManager.saveAccessToken(token) + authManager.saveAccessToken(token) } override suspend fun setRefreshToken(token: String) { - tokenManager.saveRefreshToken(token) + authManager.saveRefreshToken(token) } override suspend fun setAuthType(type: String) { - tokenManager.setAuthType(type) + authManager.setAuthType(type) } override suspend fun getAuthType(): Flow { - return tokenManager.getAuthType() + return authManager.getAuthType() } } From 97886fcc6ca2977c099eddba9165ac64ba76a7bd Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 15:31:04 +0900 Subject: [PATCH 12/16] =?UTF-8?q?[chore]=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokit/data/di/network/NetworkModule.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/data/src/main/java/pokitmons/pokit/data/di/network/NetworkModule.kt b/data/src/main/java/pokitmons/pokit/data/di/network/NetworkModule.kt index dc080a1..17321bc 100644 --- a/data/src/main/java/pokitmons/pokit/data/di/network/NetworkModule.kt +++ b/data/src/main/java/pokitmons/pokit/data/di/network/NetworkModule.kt @@ -19,7 +19,7 @@ import pokitmons.pokit.data.api.RemindApi import pokitmons.pokit.data.api.SettingApi import pokitmons.pokit.data.api.TokenApi import pokitmons.pokit.data.datasource.local.AuthAuthenticator -import pokitmons.pokit.data.datasource.local.TokenManager +import pokitmons.pokit.data.datasource.local.AuthManager import retrofit2.Retrofit import java.util.concurrent.TimeUnit import javax.inject.Named @@ -75,23 +75,23 @@ object NetworkModule { @Singleton @Provides - fun provideTokenManager(dataStore: DataStore): TokenManager { - return TokenManager(dataStore) + fun provideTokenManager(dataStore: DataStore): AuthManager { + return AuthManager(dataStore) } @Singleton @Provides fun provideAuthenticator( - tokenManager: TokenManager, + authManager: AuthManager, tokenApi: TokenApi, ): AuthAuthenticator { - return AuthAuthenticator(tokenManager, tokenApi) + return AuthAuthenticator(authManager, tokenApi) } @Singleton @Provides - fun provideInterceptor(tokenManager: TokenManager): BearerTokenInterceptor { - return BearerTokenInterceptor(tokenManager) + fun provideInterceptor(authManager: AuthManager): BearerTokenInterceptor { + return BearerTokenInterceptor(authManager) } @Singleton From b758acb771b318d7d5147c215ac0099c63bc48b6 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 15:43:30 +0900 Subject: [PATCH 13/16] =?UTF-8?q?[chore]=20=ED=81=B4=EB=9E=98=EC=8A=A4=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokitmons/pokit/settings/SettingViewModel.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt index 9569781..cf89570 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt @@ -14,7 +14,7 @@ import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import pokitmons.pokit.domain.commom.PokitResult import pokitmons.pokit.domain.usecase.auth.InputNicknameUseCase -import pokitmons.pokit.domain.usecase.auth.TokenUseCase +import pokitmons.pokit.domain.usecase.auth.AuthUseCase import pokitmons.pokit.domain.usecase.auth.WithdrawUseCase import pokitmons.pokit.domain.usecase.setting.EditNicknameUseCase import pokitmons.pokit.model.DuplicateNicknameState @@ -25,7 +25,7 @@ class SettingViewModel @Inject constructor( private val nicknameUseCase: InputNicknameUseCase, private val editNicknameUseCase: EditNicknameUseCase, private val withdrawUseCase: WithdrawUseCase, - private val tokenUseCase: TokenUseCase, + private val authUseCase: AuthUseCase, ) : ViewModel() { private var duplicateNicknameJob: Job? = null @@ -87,8 +87,8 @@ class SettingViewModel @Inject constructor( viewModelScope.launch { when (val withdraw = withdrawUseCase.withdraw()) { is PokitResult.Success -> { - tokenUseCase.setAuthType("") - tokenUseCase.setAccessToken("") + authUseCase.setAuthType("") + authUseCase.setAccessToken("") _withdrawState.emit(SettingState.Withdraw) } @@ -100,8 +100,8 @@ class SettingViewModel @Inject constructor( fun logout() { viewModelScope.launch { - tokenUseCase.setAuthType("") - tokenUseCase.setAccessToken("") + authUseCase.setAuthType("") + authUseCase.setAccessToken("") _withdrawState.emit(SettingState.Logout) } } From 354e54591adcc4d2a169fd161d458d0b4ff77e45 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 15:43:59 +0900 Subject: [PATCH 14/16] =?UTF-8?q?[feature]=20=ED=9A=8C=EC=9B=90=EA=B0=80?= =?UTF-8?q?=EC=9E=85=EC=8B=9C=20userId=20=EC=A0=80=EC=9E=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokit/data/datasource/local/AuthManager.kt | 16 ++++++++++++++++ .../data/repository/auth/AuthRepositoryImpl.kt | 8 ++++++++ .../domain/repository/auth/AuthRepository.kt | 3 +++ .../auth/{TokenUseCase.kt => AuthUseCase.kt} | 10 +++++++++- .../main/java/pokitmons/pokit/LoginViewModel.kt | 15 +++++++-------- 5 files changed, 43 insertions(+), 9 deletions(-) rename domain/src/main/java/pokitmons/pokit/domain/usecase/auth/{TokenUseCase.kt => AuthUseCase.kt} (68%) diff --git a/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt index f151963..38ed46d 100644 --- a/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt +++ b/data/src/main/java/pokitmons/pokit/data/datasource/local/AuthManager.kt @@ -2,6 +2,7 @@ package pokitmons.pokit.data.datasource.local import androidx.datastore.core.DataStore import androidx.datastore.preferences.core.edit +import androidx.datastore.preferences.core.intPreferencesKey import androidx.datastore.preferences.core.stringPreferencesKey import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.map @@ -14,6 +15,9 @@ class AuthManager @Inject constructor( val ACCESS_TOKEN = stringPreferencesKey("access_token") val REFRESH_TOKEN = stringPreferencesKey("refresh_token") val AUTH_TYPE = stringPreferencesKey("auth_type") + val USER_ID = intPreferencesKey("user_id") + + private const val INVALID_USER_ID = -1 } fun getAccessToken(): Flow { @@ -51,4 +55,16 @@ class AuthManager @Inject constructor( prefs[REFRESH_TOKEN] = token } } + + fun getUserId(): Flow { + return dataStore.data.map { prefs -> + prefs[USER_ID] ?: INVALID_USER_ID + } + } + + suspend fun setUserId(userId: Int) { + dataStore.edit { prefs -> + prefs[USER_ID] = userId + } + } } diff --git a/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt b/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt index baffd43..d0e466d 100644 --- a/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt +++ b/data/src/main/java/pokitmons/pokit/data/repository/auth/AuthRepositoryImpl.kt @@ -85,4 +85,12 @@ class AuthRepositoryImpl @Inject constructor( override suspend fun getAuthType(): Flow { return authManager.getAuthType() } + + override suspend fun setUserId(userId: Int) { + authManager.setUserId(userId) + } + + override suspend fun getUserId(): Flow { + return authManager.getUserId() + } } diff --git a/domain/src/main/java/pokitmons/pokit/domain/repository/auth/AuthRepository.kt b/domain/src/main/java/pokitmons/pokit/domain/repository/auth/AuthRepository.kt index 71944e4..4a782e4 100644 --- a/domain/src/main/java/pokitmons/pokit/domain/repository/auth/AuthRepository.kt +++ b/domain/src/main/java/pokitmons/pokit/domain/repository/auth/AuthRepository.kt @@ -18,4 +18,7 @@ interface AuthRepository { // TODO 리팩토링 suspend fun setAuthType(type: String) suspend fun getAuthType(): Flow + + suspend fun setUserId(userId: Int) + suspend fun getUserId(): Flow } diff --git a/domain/src/main/java/pokitmons/pokit/domain/usecase/auth/TokenUseCase.kt b/domain/src/main/java/pokitmons/pokit/domain/usecase/auth/AuthUseCase.kt similarity index 68% rename from domain/src/main/java/pokitmons/pokit/domain/usecase/auth/TokenUseCase.kt rename to domain/src/main/java/pokitmons/pokit/domain/usecase/auth/AuthUseCase.kt index e64399c..49b026a 100644 --- a/domain/src/main/java/pokitmons/pokit/domain/usecase/auth/TokenUseCase.kt +++ b/domain/src/main/java/pokitmons/pokit/domain/usecase/auth/AuthUseCase.kt @@ -4,7 +4,7 @@ import kotlinx.coroutines.flow.Flow import pokitmons.pokit.domain.repository.auth.AuthRepository import javax.inject.Inject -class TokenUseCase @Inject constructor(private val authRepository: AuthRepository) { +class AuthUseCase @Inject constructor(private val authRepository: AuthRepository) { suspend fun setAccessToken(token: String) { authRepository.setAccessToken(token) } @@ -20,4 +20,12 @@ class TokenUseCase @Inject constructor(private val authRepository: AuthRepositor suspend fun getAuthType(): Flow { return authRepository.getAuthType() } + + suspend fun setUserId(userId: Int) { + authRepository.setUserId(userId) + } + + suspend fun getUserId(): Flow { + return authRepository.getUserId() + } } diff --git a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt index e4168cd..ec7fd21 100644 --- a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt +++ b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt @@ -2,10 +2,8 @@ package pokitmons.pokit import android.content.Context import androidx.compose.runtime.MutableState -import androidx.compose.runtime.getValue import androidx.compose.runtime.mutableStateListOf import androidx.compose.runtime.mutableStateOf -import androidx.compose.runtime.setValue import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel @@ -22,7 +20,7 @@ import pokitmons.pokit.domain.commom.PokitResult import pokitmons.pokit.domain.usecase.auth.InputNicknameUseCase import pokitmons.pokit.domain.usecase.auth.SNSLoginUseCase import pokitmons.pokit.domain.usecase.auth.SignUpUseCase -import pokitmons.pokit.domain.usecase.auth.TokenUseCase +import pokitmons.pokit.domain.usecase.auth.AuthUseCase import pokitmons.pokit.login.R import pokitmons.pokit.model.CategoryState import pokitmons.pokit.model.DuplicateNicknameState @@ -34,11 +32,11 @@ class LoginViewModel @Inject constructor( private val loginUseCase: SNSLoginUseCase, private val nicknameUseCase: InputNicknameUseCase, private val signUpUseCase: SignUpUseCase, - private val tokenUseCase: TokenUseCase, + private val authUseCase: AuthUseCase, ) : ViewModel() { init { viewModelScope.launch { - if (tokenUseCase.getAuthType().first() == "구글") { + if (authUseCase.getAuthType().first() == "구글") { _loginState.emit(LoginState.AutoLogin) } } @@ -89,7 +87,7 @@ class LoginViewModel @Inject constructor( authType = authPlatform when (loginResult.result.isRegistered) { true -> { - tokenUseCase.apply { + authUseCase.apply { setAccessToken(loginResult.result.accessToken) setRefreshToken(loginResult.result.refreshToken) setAuthType(authType) @@ -98,7 +96,7 @@ class LoginViewModel @Inject constructor( } false -> { - tokenUseCase.apply { + authUseCase.apply { setAccessToken(loginResult.result.accessToken) setRefreshToken(loginResult.result.refreshToken) } @@ -123,7 +121,8 @@ class LoginViewModel @Inject constructor( ) ) { is PokitResult.Success -> { - tokenUseCase.setAuthType(authType) + authUseCase.setUserId(signUpResult.result.id) + authUseCase.setAuthType(authType) _signUpState.emit(SignUpState.SignUp) } From 00720ad49354e775d64c8e11bc430b94c7e0e57e Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 18:00:57 +0900 Subject: [PATCH 15/16] =?UTF-8?q?[feature]=20=ED=8F=AC=ED=82=B7=20?= =?UTF-8?q?=EC=B9=B4=EC=B9=B4=EC=98=A4=ED=86=A1=20=EA=B3=B5=EC=9C=A0=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pokitmons/pokit/home/pokit/PokitScreen.kt | 52 ++++++++++++++++++- feature/home/src/main/res/values/strings.xml | 4 ++ 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt index bb156ac..593b884 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt @@ -1,7 +1,6 @@ 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 @@ -21,6 +20,11 @@ import androidx.compose.ui.platform.LocalContext import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import coil.compose.rememberAsyncImagePainter +import com.kakao.sdk.share.ShareClient +import com.kakao.sdk.template.model.Button +import com.kakao.sdk.template.model.Content +import com.kakao.sdk.template.model.FeedTemplate +import com.kakao.sdk.template.model.Link import com.strayalpaca.pokitdetail.R import com.strayalpaca.pokitdetail.model.BottomSheetType import pokitmons.pokit.core.feature.model.paging.PagingState @@ -32,6 +36,7 @@ import pokitmons.pokit.core.ui.components.template.pookiempty.EmptyPooki import pokitmons.pokit.core.ui.components.template.pookierror.ErrorPooki import pokitmons.pokit.core.ui.components.template.removeItemBottomSheet.TwoButtonBottomSheetContent import pokitmons.pokit.core.ui.R.string as coreString +import pokitmons.pokit.home.R.string as homeString @Composable fun PokitScreen( @@ -60,7 +65,42 @@ fun PokitScreen( BottomSheetType.MODIFY -> { ModifyBottomSheetContent( onClickShare = { - // TODO 카카오 공유 구현 + val pokitFeedTemplate = FeedTemplate( + content = Content( + title = currentDetailSelectedCategory?.title + context.getString(homeString.share_pokit_title), + description = context.getString(homeString.share_pokit_description), + imageUrl = currentDetailSelectedCategory?.image?.url, + link = Link( + webUrl = "", + mobileWebUrl = "" + ) + ), + + buttons = listOf( + Button( + context.getString(homeString.share_pokit_button_text), + Link( + androidExecutionParams = mapOf("categoryId" to "${currentDetailSelectedCategory?.id}"), + iosExecutionParams = mapOf("categoryId" to "${currentDetailSelectedCategory?.id}") + ) + ) + ) + ) + val serverCallbackArgs = mapOf("categoryId" to "${currentDetailSelectedCategory?.id}") + + if (ShareClient.instance.isKakaoTalkSharingAvailable(context)) { + ShareClient.instance.shareDefault( + context = context, + defaultTemplate = pokitFeedTemplate, + serverCallbackArgs = serverCallbackArgs + ) { sharingResult, error -> + if (error != null) { + + } else if (sharingResult != null) { + context.startActivity(sharingResult.intent) + } + } + } }, onClickModify = remember { { @@ -71,6 +111,7 @@ fun PokitScreen( onClickRemove = viewModel::showPokitDetailRemoveBottomSheet ) } + BottomSheetType.REMOVE -> { TwoButtonBottomSheetContent( title = stringResource(id = R.string.title_remove_pokit), @@ -84,6 +125,7 @@ fun PokitScreen( } ) } + else -> {} } } @@ -102,6 +144,7 @@ fun PokitScreen( (pokitsState == PagingState.LOADING_INIT) -> { LoadingProgress(modifier = Modifier.fillMaxSize()) } + (pokitsState == PagingState.FAILURE_INIT) -> { ErrorPooki( modifier = Modifier.fillMaxSize(), @@ -110,6 +153,7 @@ fun PokitScreen( onClickRetry = viewModel::loadPokits ) } + (pokits.value.isEmpty()) -> { EmptyPooki( modifier = Modifier.fillMaxSize(), @@ -117,6 +161,7 @@ fun PokitScreen( sub = stringResource(id = coreString.sub_empty_pokits) ) } + else -> { LazyVerticalGrid( modifier = Modifier.fillMaxSize(), @@ -149,6 +194,7 @@ fun PokitScreen( (unCategoryLinksState == PagingState.LOADING_INIT) -> { LoadingProgress(modifier = Modifier.fillMaxSize()) } + (unCategoryLinksState == PagingState.FAILURE_INIT) -> { ErrorPooki( modifier = Modifier.fillMaxSize(), @@ -157,6 +203,7 @@ fun PokitScreen( onClickRetry = viewModel::loadUnCategoryLinks ) } + (unCategoryLinks.value.isEmpty()) -> { EmptyPooki( modifier = Modifier.fillMaxSize(), @@ -164,6 +211,7 @@ fun PokitScreen( sub = stringResource(id = coreString.sub_empty_links) ) } + else -> { UnclassifiedScreen( viewModel = viewModel, diff --git a/feature/home/src/main/res/values/strings.xml b/feature/home/src/main/res/values/strings.xml index 0ddade7..d2fe25c 100644 --- a/feature/home/src/main/res/values/strings.xml +++ b/feature/home/src/main/res/values/strings.xml @@ -3,4 +3,8 @@ 최대 30개의 포킷을 생성할 수 있습니다.\n포킷을 삭제한 뒤에 추가해주세요. 복사한 링크 저장하기\n%s + + 포킷을 공유받았어요! + 소중한 링크들이 담긴 포킷을 Pokit\n앱에서 지금 바로 확인해보세요! + 앱에서 보기 \ No newline at end of file From f17bf794b48f81437cfbad0e68abc37c4bfb2394 Mon Sep 17 00:00:00 2001 From: jiwon2724 Date: Sun, 17 Nov 2024 18:06:17 +0900 Subject: [PATCH 16/16] =?UTF-8?q?[chore]=20=EC=BD=94=EB=94=A9=20=EC=BB=A8?= =?UTF-8?q?=EB=B2=A4=EC=85=98=20=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../feature/utils/{shareUrlLink.kt => ShareUrlLink.kt} | 4 ++-- .../java/pokitmons/pokit/home/pokit/PokitScreen.kt | 1 - .../pokitmons/pokit/home/pokit/UnclassifiedScreen.kt | 9 +++------ .../java/pokitmons/pokit/home/remind/RemindScreen.kt | 4 ++-- .../src/main/java/pokitmons/pokit/LoginViewModel.kt | 2 +- .../pokitmons/pokit/nickname/InputNicknameScreen.kt | 1 - .../com/strayalpaca/pokitdetail/PokitDetailScreen.kt | 10 ++++------ .../main/java/pokitmons/pokit/search/SearchScreen.kt | 4 ++-- .../java/pokitmons/pokit/settings/SettingViewModel.kt | 2 +- 9 files changed, 15 insertions(+), 22 deletions(-) rename core/feature/src/main/java/pokitmons/pokit/core/feature/utils/{shareUrlLink.kt => ShareUrlLink.kt} (86%) diff --git a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/ShareUrlLink.kt similarity index 86% rename from core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt rename to core/feature/src/main/java/pokitmons/pokit/core/feature/utils/ShareUrlLink.kt index e51a1c0..49b4dd9 100644 --- a/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/shareUrlLink.kt +++ b/core/feature/src/main/java/pokitmons/pokit/core/feature/utils/ShareUrlLink.kt @@ -3,10 +3,10 @@ package pokitmons.pokit.core.feature.utils import android.content.Context import android.content.Intent -fun shareUrlLink( +fun ShareUrlLink( context: Context, url: String, - chooserTitle: String = "Pokit" + chooserTitle: String = "Pokit", ) { val intent = Intent(Intent.ACTION_SEND).apply { type = "text/plain" diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt index 593b884..9521da8 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/PokitScreen.kt @@ -95,7 +95,6 @@ fun PokitScreen( serverCallbackArgs = serverCallbackArgs ) { sharingResult, error -> if (error != null) { - } else if (sharingResult != null) { context.startActivity(sharingResult.intent) } diff --git a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt index 91a28cf..35ceb7b 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/pokit/UnclassifiedScreen.kt @@ -1,9 +1,6 @@ package pokitmons.pokit.home.pokit import android.content.Context -import android.content.Intent -import android.util.Log -import android.widget.Toast import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.PaddingValues import androidx.compose.foundation.lazy.LazyColumn @@ -21,7 +18,7 @@ import androidx.hilt.navigation.compose.hiltViewModel import coil.compose.rememberAsyncImagePainter import com.strayalpaca.pokitdetail.R import com.strayalpaca.pokitdetail.model.BottomSheetType -import pokitmons.pokit.core.feature.utils.shareUrlLink +import pokitmons.pokit.core.feature.utils.ShareUrlLink import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet import pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet.LinkDetailBottomSheet @@ -54,7 +51,7 @@ fun UnclassifiedScreen( onHideBottomSheet = viewModel::hideDetailLinkBottomSheet, show = true, onClickShareLink = { - shareUrlLink( + ShareUrlLink( context = context, url = link.url ) @@ -79,7 +76,7 @@ fun UnclassifiedScreen( BottomSheetType.MODIFY -> { ModifyBottomSheetContent( onClickShare = { - shareUrlLink( + ShareUrlLink( context = context, url = currentDetailShowLink?.url ?: "" ) diff --git a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt index 04efd3e..6f92b8e 100644 --- a/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt +++ b/feature/home/src/main/java/pokitmons/pokit/home/remind/RemindScreen.kt @@ -27,7 +27,7 @@ import coil.compose.rememberAsyncImagePainter import com.strayalpaca.pokitdetail.R import com.strayalpaca.pokitdetail.model.BottomSheetType import pokitmons.pokit.core.feature.model.NetworkState -import pokitmons.pokit.core.feature.utils.shareUrlLink +import pokitmons.pokit.core.feature.utils.ShareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet @@ -78,7 +78,7 @@ fun RemindScreen( BottomSheetType.MODIFY -> { ModifyBottomSheetContent( onClickShare = { - shareUrlLink( + ShareUrlLink( context = context, url = viewModel.currentShowingLink.value?.url ?: "" ) diff --git a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt index ec7fd21..8a0b3d1 100644 --- a/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt +++ b/feature/login/src/main/java/pokitmons/pokit/LoginViewModel.kt @@ -17,10 +17,10 @@ import kotlinx.coroutines.flow.first import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import pokitmons.pokit.domain.commom.PokitResult +import pokitmons.pokit.domain.usecase.auth.AuthUseCase import pokitmons.pokit.domain.usecase.auth.InputNicknameUseCase import pokitmons.pokit.domain.usecase.auth.SNSLoginUseCase import pokitmons.pokit.domain.usecase.auth.SignUpUseCase -import pokitmons.pokit.domain.usecase.auth.AuthUseCase import pokitmons.pokit.login.R import pokitmons.pokit.model.CategoryState import pokitmons.pokit.model.DuplicateNicknameState diff --git a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt index a044957..d0d7859 100644 --- a/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt +++ b/feature/login/src/main/java/pokitmons/pokit/nickname/InputNicknameScreen.kt @@ -1,6 +1,5 @@ package pokitmons.pokit.nickname -import android.util.Log import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Spacer diff --git a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt index 6775a83..9de63c3 100644 --- a/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt +++ b/feature/pokitdetail/src/main/java/com/strayalpaca/pokitdetail/PokitDetailScreen.kt @@ -1,8 +1,6 @@ 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 @@ -34,7 +32,7 @@ import com.strayalpaca.pokitdetail.model.Pokit import com.strayalpaca.pokitdetail.model.PokitDetailScreenState import pokitmons.pokit.core.feature.flow.collectAsEffect import pokitmons.pokit.core.feature.model.paging.PagingState -import pokitmons.pokit.core.feature.utils.shareUrlLink +import pokitmons.pokit.core.feature.utils.ShareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.block.linkcard.LinkCard import pokitmons.pokit.core.ui.components.block.pokitlist.PokitList @@ -242,7 +240,7 @@ fun PokitDetailScreen( onHideBottomSheet = hideLinkDetailBottomSheet, show = state.linkDetailBottomSheetVisible, onClickShareLink = { - shareUrlLink( + ShareUrlLink( context = context, url = state.currentLink.url ) @@ -317,7 +315,7 @@ fun PokitDetailScreen( BottomSheetType.MODIFY -> { ModifyBottomSheetContent( onClickShare = { - shareUrlLink( + ShareUrlLink( context = context, url = state.currentLink?.url ?: "" ) @@ -359,7 +357,7 @@ fun PokitDetailScreen( val context: Context = LocalContext.current ModifyBottomSheetContent( onClickShare = { - shareUrlLink( + ShareUrlLink( context = context, url = state.currentLink?.url ?: "" ) diff --git a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt index 785cb5a..44aaf94 100644 --- a/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt +++ b/feature/search/src/main/java/pokitmons/pokit/search/SearchScreen.kt @@ -17,7 +17,7 @@ import androidx.compose.ui.res.stringResource import androidx.compose.ui.unit.dp import coil.compose.rememberAsyncImagePainter import pokitmons.pokit.core.feature.model.paging.PagingState -import pokitmons.pokit.core.feature.utils.shareUrlLink +import pokitmons.pokit.core.feature.utils.ShareUrlLink import pokitmons.pokit.core.ui.components.atom.loading.LoadingProgress import pokitmons.pokit.core.ui.components.template.bottomsheet.PokitBottomSheet import pokitmons.pokit.core.ui.components.template.linkdetailbottomsheet.LinkDetailBottomSheet @@ -67,7 +67,7 @@ fun SearchScreenContainer( onHideBottomSheet = viewModel::hideLinkDetailBottomSheet, show = state.showLinkDetailBottomSheet, onClickShareLink = { - shareUrlLink( + ShareUrlLink( context = context, url = state.currentDetailLink?.url ?: "" ) diff --git a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt index cf89570..b9b91e7 100644 --- a/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt +++ b/feature/settings/src/main/java/pokitmons/pokit/settings/SettingViewModel.kt @@ -13,8 +13,8 @@ import kotlinx.coroutines.flow.asStateFlow import kotlinx.coroutines.flow.update import kotlinx.coroutines.launch import pokitmons.pokit.domain.commom.PokitResult -import pokitmons.pokit.domain.usecase.auth.InputNicknameUseCase import pokitmons.pokit.domain.usecase.auth.AuthUseCase +import pokitmons.pokit.domain.usecase.auth.InputNicknameUseCase import pokitmons.pokit.domain.usecase.auth.WithdrawUseCase import pokitmons.pokit.domain.usecase.setting.EditNicknameUseCase import pokitmons.pokit.model.DuplicateNicknameState