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
16 changes: 9 additions & 7 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:tools="http://schemas.android.com/tools"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Expand All @@ -17,13 +17,14 @@
android:networkSecurityConfig="@xml/network_security_config"
android:roundIcon="@mipmap/ic_falling_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.THT">
android:theme="@style/Theme.THT"
android:usesCleartextTraffic="true">
<activity
android:name=".SplashActivity"
android:screenOrientation="portrait"
android:exported="true"
tools:ignore="LockedOrientationActivity"
android:theme="@style/Theme.App.Starting">
android:screenOrientation="portrait"
android:theme="@style/Theme.App.Starting"
tools:ignore="LockedOrientationActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

Expand All @@ -33,9 +34,10 @@
</intent-filter>
</activity>
<activity
android:screenOrientation="portrait"
android:name=".HomeActivity"
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize"
tools:ignore="LockedOrientationActivity" />
<activity
android:name="com.kakao.sdk.auth.AuthCodeHandlerActivity"
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/java/com/tht/tht/AppModule.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.tht.tht

import android.app.Application
import com.tht.tht.navigation.BottomNavigationProviderImpl
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
import dagger.hilt.android.qualifiers.ApplicationContext
import dagger.hilt.components.SingletonComponent
import tht.core.navigation.BottomNavigationProvider

@Module
@InstallIn(SingletonComponent::class)
Expand All @@ -14,4 +16,7 @@ object AppModule {
@ApplicationContext
@Provides
fun provideApplicationContext(application: Application) = application

@Provides
fun provideApplication(): BottomNavigationProvider = BottomNavigationProviderImpl()
}
14 changes: 14 additions & 0 deletions app/src/main/java/com/tht/tht/HomeActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.activity.viewModels
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
Expand Down Expand Up @@ -53,18 +54,22 @@ class HomeActivity : BaseActivity<HomeViewModel, ActivityHomeBinding>(), Fragmen
)
true
}

R.id.menu_heart -> {
showFragment(LikeFragment.TAG)
true
}

R.id.menu_chat -> {
showFragment(ChatFragment.TAG)
true
}

R.id.menu_my -> {
showFragment(MyPageFragment.TAG)
true
}

else -> false
}
}
Expand Down Expand Up @@ -101,6 +106,15 @@ class HomeActivity : BaseActivity<HomeViewModel, ActivityHomeBinding>(), Fragmen
}
}

fun showBottomNav() {
binding.bnvHome.visibility = View.VISIBLE
}

fun hideBottomNav() {
binding.bnvHome.visibility = View.GONE
}


override fun addFragmentBackStack(tag: String, bundle: Bundle?) {
binding.root.hideSoftInput()
with(supportFragmentManager) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.tht.tht.navigation

import android.content.Context
import com.tht.tht.HomeActivity
import tht.core.navigation.BottomNavigationProvider

class BottomNavigationProviderImpl : BottomNavigationProvider {
override fun show(context: Context) {
(context as HomeActivity).showBottomNav()
}

override fun hide(context: Context) {
(context as HomeActivity).hideBottomNav()
}
}
1 change: 1 addition & 0 deletions app/src/main/res/xml/network_security_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
<network-security-config>
<domain-config cleartextTrafficPermitted="true">
<domain includeSubdomains="true">tht-talk.co.kr</domain>
<domain includeSubdomains="true">3.34.157.62</domain>
</domain-config>
</network-security-config>
8 changes: 8 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ subprojects {
// run use ./gradlew assembleRelease -PcomposeCompilerReports=true --rerun-tasks
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = "17"
if (project.findProperty("composeCompilerReports") == "true") {
val metricsOutputDir = "${rootProject.file(".").absolutePath}/compose-report/compose-metrics"
val reportOutputDir = "${rootProject.file(".").absolutePath}/compose-report/compose-reports"
Expand All @@ -56,3 +57,10 @@ subprojects {
}
}
}

//configurations.all {
// resolutionStrategy {
// force("org.jetbrains.kotlin:kotlin-stdlib:1.9.0")
// force ("org.jetbrains.kotlin:kotlin-reflect:1.9.0")
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@ package com.example.compose_ui.component.image

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.unit.DpSize
import androidx.compose.ui.unit.dp
import coil.compose.AsyncImagePainter
import coil.compose.rememberAsyncImagePainter
import coil.request.ImageRequest
Expand All @@ -32,7 +35,9 @@ fun ThtImage(

else -> {
Image(
modifier = modifier.size(size),
modifier = modifier
.size(size)
.clip(RoundedCornerShape(12.dp)),
painter = painter,
contentDescription = null,
contentScale = ContentScale.Crop,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import androidx.compose.ui.graphics.Shadow
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.TextUnit
import com.example.compose_ui.component.font.rememberPretendardFontStyle
import com.example.compose_ui.extensions.dpTextUnit
Expand Down Expand Up @@ -104,7 +105,9 @@ fun ThtHeadline4(
fontWeight: FontWeight,
color: Color,
textAlign: TextAlign = TextAlign.Center,
shadow: Shadow? = null
shadow: Shadow? = null,
maxLines: Int = 1,
overflow: TextOverflow = TextOverflow.Ellipsis
) {
Text(
modifier = modifier,
Expand All @@ -116,6 +119,8 @@ fun ThtHeadline4(
shadow = shadow
),
color = color,
overflow = overflow,
maxLines = maxLines,
)
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package tht.core.navigation

import android.content.Context

interface BottomNavigationProvider {
fun show(context: Context)
fun hide(context: Context)
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ object THTApiConstant {

object Chat {
const val CHAT_LIST = "/chat/rooms"

const val CHAT_DETAIL_INFORMATION = "/chat/room/{chat-room-idx}"

const val CHAT_DETAIL_HISTORY = "/chat/history"
}

object Setting {
Expand Down
28 changes: 25 additions & 3 deletions data/src/main/java/com/tht/tht/data/di/UseCaseModule.kt
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.tht.tht.data.di

import com.tht.tht.domain.chat.repository.ChatRepository
import com.tht.tht.domain.chat.usecase.GetChatDetailInformationUseCase
import com.tht.tht.domain.chat.usecase.GetChatHistoryUseCase
import com.tht.tht.domain.chat.usecase.GetChatListUseCase
import com.tht.tht.domain.email.repository.EmailRepository
import com.tht.tht.domain.email.usecase.SendInquiryEmailUseCase
Expand Down Expand Up @@ -33,18 +35,19 @@ import com.tht.tht.domain.signup.usecase.RemoveSignupUserUseCase
import com.tht.tht.domain.signup.usecase.RequestAuthenticationUseCase
import com.tht.tht.domain.signup.usecase.RequestPhoneVerifyUseCase
import com.tht.tht.domain.signup.usecase.RequestSignupUseCase
import com.tht.tht.domain.tohot.DailyTopicRepository
import com.tht.tht.domain.tohot.DailyUserCardRepository
import com.tht.tht.domain.tohot.FetchDailyTopicListUseCase
import com.tht.tht.domain.tohot.FetchDailyUserCardUseCase
import com.tht.tht.domain.tohot.FetchToHotStateUseCase
import com.tht.tht.domain.tohot.SelectTopicUseCase
import com.tht.tht.domain.token.repository.TokenRepository
import com.tht.tht.domain.token.token.CheckAndRefreshThtAccessTokenUseCase
import com.tht.tht.domain.token.token.CheckThtAccessTokenExpiredUseCase
import com.tht.tht.domain.token.token.FetchThtAccessTokenUseCase
import com.tht.tht.domain.token.token.FetchThtUserUuidUseCase
import com.tht.tht.domain.token.token.RefreshFcmTokenUseCase
import com.tht.tht.domain.token.token.RefreshThtAccessTokenUseCase
import com.tht.tht.domain.tohot.DailyTopicRepository
import com.tht.tht.domain.tohot.FetchDailyTopicListUseCase
import com.tht.tht.domain.tohot.SelectTopicUseCase
import com.tht.tht.domain.user.BlockUserUseCase
import com.tht.tht.domain.user.LogoutUseCase
import com.tht.tht.domain.user.ReportUserUseCase
Expand Down Expand Up @@ -98,6 +101,13 @@ object UseCaseModule {
dispatcher
)

@Provides
fun provideFetchUserUuidUseCase(
repository: TokenRepository,
): FetchThtUserUuidUseCase = FetchThtUserUuidUseCase(
repository,
)

@Provides
fun provideFetchTermsUseCase(
repository: SignupRepository,
Expand Down Expand Up @@ -246,6 +256,18 @@ object UseCaseModule {
): GetChatListUseCase =
GetChatListUseCase(repository)

@Provides
fun provideGetChatDetailInformationUseCase(
repository: ChatRepository
): GetChatDetailInformationUseCase =
GetChatDetailInformationUseCase(repository)

@Provides
fun provideGetChatHistoryUseCase(
repository: ChatRepository
): GetChatHistoryUseCase =
GetChatHistoryUseCase(repository)

@Provides
fun provideFetchThtAccessTokenUseCase(
repository: TokenRepository
Expand Down
4 changes: 3 additions & 1 deletion data/src/main/java/com/tht/tht/data/local/dao/TokenDao.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ interface TokenDao {

fun updateFcmToken(token: String)

fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String)
fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String, userUuid: String?)

fun fetchThtToken(): AccessTokenEntity

fun fetchPhone(): String?

fun fetchUserUuid(): String?

fun clear()
}
12 changes: 10 additions & 2 deletions data/src/main/java/com/tht/tht/data/local/dao/TokenDaoImpl.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,23 +38,29 @@ class TokenDaoImpl @Inject constructor(
sp.edit { putString(FCM_TOKEN_KEY, token) }
}

override fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String) {
override fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String, userUuid: String?) {
sp.edit { putString(THT_TOKEN_KEY, token) }
sp.edit { putLong(THT_TOKEN_EXPIRES_KEY, accessTokenExpiresIn) }
sp.edit { putString(THT_PHONE_KEY, phone) }
sp.edit { putString(THT_USER_UUID, userUuid) }
}

override fun fetchThtToken(): AccessTokenEntity {
return AccessTokenEntity(
accessToken = sp.getString(THT_TOKEN_KEY, null),
expiredTime = sp.getLong(THT_TOKEN_EXPIRES_KEY, 0L)
expiredTime = sp.getLong(THT_TOKEN_EXPIRES_KEY, 0L),
userUuid = sp.getString(THT_USER_UUID, null),
)
}

override fun fetchPhone(): String? {
return sp.getString(THT_PHONE_KEY, null)
}

override fun fetchUserUuid(): String? {
return sp.getString(THT_USER_UUID, null)
}

override fun clear() {
sp.edit {
remove(FCM_TOKEN_KEY)
Expand All @@ -72,5 +78,7 @@ class TokenDaoImpl @Inject constructor(
private const val THT_TOKEN_EXPIRES_KEY = "tht_token_expires_key"

private const val THT_PHONE_KEY = "tht_phone_key"

private const val THT_USER_UUID = "tht_user_uuid"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ interface TokenDataSource {

suspend fun updateFcmToken(token: String)

suspend fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String)
suspend fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String, userUuid: String?)

suspend fun fetchThtToken(): AccessTokenEntity

suspend fun fetchPhone(): String?

suspend fun fetchUserUuid(): String?

suspend fun clear()
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class TokenDataSourceImpl @Inject constructor(
}
}

override suspend fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String) {
override suspend fun updateThtToken(token: String, accessTokenExpiresIn: Long, phone: String, userUuid: String?) {
withContext(dispatcher) {
tokenDao.updateThtToken(token, accessTokenExpiresIn, phone)
tokenDao.updateThtToken(token, accessTokenExpiresIn, phone, userUuid)
}
}

Expand All @@ -40,6 +40,10 @@ class TokenDataSourceImpl @Inject constructor(
return tokenDao.fetchPhone()
}

override suspend fun fetchUserUuid(): String? {
return tokenDao.fetchUserUuid()
}

override suspend fun clear() {
return withContext(dispatcher) {
tokenDao.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package com.tht.tht.data.local.entity

data class AccessTokenEntity(
val accessToken: String?,
val expiredTime: Long
val expiredTime: Long,
val userUuid: String?,
)
Loading
Loading