Skip to content

Commit

Permalink
🧹 Cleanup Project (#115)
Browse files Browse the repository at this point in the history
* [clenup] 주석 제거

* [cleanup] build.gradle 수정

* [cleanup] remove unused import
  • Loading branch information
HamBeomJoon authored Aug 19, 2024
1 parent f2c4dfc commit 3be1a06
Show file tree
Hide file tree
Showing 15 changed files with 24 additions and 47 deletions.
4 changes: 2 additions & 2 deletions Nabi/data/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ dependencies {
implementation(libs.v2.user)

// RoomDB
implementation("androidx.room:room-ktx:2.6.1")
kapt("androidx.room:room-compiler:2.6.1")
implementation(libs.androidx.room.ktx)
kapt(libs.androidx.room.compiler)

// naver Login
implementation(libs.oauth)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ class NaverAuthService @Inject constructor(

val oauthLoginCallback = object : OAuthLoginCallback {
override fun onSuccess() {
// 네이버 로그인 인증이 성공했을 때 수행할 코드 추가
val accessToken = NaverIdLoginSDK.getAccessToken()
signInListener(accessToken ?: "", AuthProvider.NAVER)

Expand Down

This file was deleted.

7 changes: 5 additions & 2 deletions Nabi/gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ material = "1.12.0"
activity = "1.8.0"
constraintlayout = "2.1.4"
jetbrainsKotlinJvm = "1.9.0"
mpandroidchart = "v3.1.0"
readmoreview = "v1.0.4"
retrofit = "2.11.0"
roomKtx = "2.6.1"
v2User = "2.20.1"
googleGmsGoogleServices = "4.4.2"
firebaseMessaging = "24.0.0"
Expand All @@ -34,6 +35,8 @@ androidx-datastore-preferences = { module = "androidx.datastore:datastore-prefer
androidx-fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" }
androidx-lifecycle-livedata-ktx = { module = "androidx.lifecycle:lifecycle-livedata-ktx", version.ref = "lifecycleViewmodelKtx" }
androidx-lifecycle-viewmodel-ktx = { module = "androidx.lifecycle:lifecycle-viewmodel-ktx", version.ref = "lifecycleViewmodelKtx" }
androidx-room-compiler = { module = "androidx.room:room-compiler", version.ref = "roomKtx" }
androidx-room-ktx = { module = "androidx.room:room-ktx", version.ref = "roomKtx" }
androidx-viewpager2 = { module = "androidx.viewpager2:viewpager2", version.ref = "viewpager2" }
balloon = { module = "com.github.skydoves:balloon", version.ref = "balloon" }
dagger-hilt-compiler = { module = "com.google.dagger:hilt-compiler", version.ref = "hiltAndroid" }
Expand All @@ -49,8 +52,8 @@ logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", ver
material = { group = "com.google.android.material", name = "material", version.ref = "material" }
androidx-activity = { group = "androidx.activity", name = "activity", version.ref = "activity" }
androidx-constraintlayout = { group = "androidx.constraintlayout", name = "constraintlayout", version.ref = "constraintlayout" }
mpandroidchart = { module = "com.github.PhilJay:MPAndroidChart", version.ref = "mpandroidchart" }
okhttp = { module = "com.squareup.okhttp3:okhttp", version.ref = "loggingInterceptor" }
readmoreview = { module = "com.github.jeonjungin:ReadMoreView", version.ref = "readmoreview" }
retrofit = { module = "com.squareup.retrofit2:retrofit", version.ref = "retrofit" }
v2-user = { module = "com.kakao.sdk:v2-user", version.ref = "v2User" }
firebase-messaging = { group = "com.google.firebase", name = "firebase-messaging", version.ref = "firebaseMessaging" }
Expand Down
8 changes: 4 additions & 4 deletions Nabi/presentation/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ dependencies {
implementation(libs.androidx.viewpager2)

// Tooltip - Balloon
implementation("com.github.skydoves:balloon:1.4.6")
implementation(libs.balloon)

// LoggerUtils
implementation(libs.logger)

// ReadMoreView
implementation("com.github.jeonjungin:ReadMoreView:v1.0.4")
implementation(libs.readmoreview)

// RoomDB
implementation("androidx.room:room-ktx:2.6.1")
kapt("androidx.room:room-compiler:2.6.1")
implementation(libs.androidx.room.ktx)
kapt(libs.androidx.room.compiler)

// naver Login
implementation(libs.oauth)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nabi.nabi.views

import androidx.activity.OnBackPressedCallback
import androidx.fragment.app.Fragment
import com.nabi.nabi.R
import com.nabi.nabi.base.BaseActivity
Expand All @@ -17,6 +18,7 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
}

replaceFragment(HomeFragment(), false)
addOnBackPressedCallback()
}

fun replaceFragment(fragment: Fragment, isAddToBackStack: Boolean){
Expand All @@ -25,4 +27,13 @@ class MainActivity : BaseActivity<ActivityMainBinding>(R.layout.activity_main) {
if(isAddToBackStack) ft.addToBackStack(null)
ft.commit()
}

private fun addOnBackPressedCallback() {
val callback = object : OnBackPressedCallback(true) {
override fun handleOnBackPressed() {

}
}
this.onBackPressedDispatcher.addCallback(this, callback)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class AddDiaryCalendarAdapter :
}
}


override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): DateViewHolder {
val binding =
ItemDayBinding.inflate(LayoutInflater.from(parent.context), parent, false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ class AddDiaryFragment(
}
} else {
requireActivity().supportFragmentManager.popBackStack()
// if (isEdit){ requireActivity().supportFragmentManager.popBackStack() }
// else {(requireActivity() as MainActivity).replaceFragment(AddDiarySelectDateFragment(), false) }
}
}

Expand Down Expand Up @@ -146,7 +144,6 @@ class AddDiaryFragment(
viewModel.addDiary(content, diaryDate)
}
} else {
// content가 empty일 때
showToast("일기 내용을 입력해주세요")
}
}
Expand All @@ -165,10 +162,6 @@ class AddDiaryFragment(
is UiState.Success -> {
currentDiaryId = it.data.id
LoggerUtils.d("일기 추가 성공")
// (requireActivity() as MainActivity).replaceFragment(
// EmotionLoadingDialog(isEdit, currentDiaryId!!),
// false
// )

EmotionLoadingDialog(isEdit, currentDiaryId!!).show(
requireActivity().supportFragmentManager, "emotion loading"
Expand All @@ -187,10 +180,6 @@ class AddDiaryFragment(
is UiState.Success -> {
currentDiaryId = it.data.diaryId
LoggerUtils.d("일기 수정 성공")
// (requireActivity() as MainActivity).replaceFragment(
// EmotionLoadingDialog(isEdit, currentDiaryId!!),
// false
// )

EmotionLoadingDialog(isEdit, currentDiaryId!!).show(
requireActivity().supportFragmentManager, "emotion loading"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.WindowManager
import android.widget.Toast
import androidx.core.content.ContextCompat
import androidx.core.view.WindowCompat
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.viewModels
import com.nabi.nabi.R
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class DetailDiaryFragment(

override fun initView() {
(requireActivity() as MainActivity).setStatusBarColor(R.color.white, false)

viewModel.fetchData(diaryId)
}

Expand Down Expand Up @@ -198,7 +197,6 @@ class DetailDiaryFragment(

private fun popBackStack() {
val bundle = Bundle()
LoggerUtils.d(entryPoint.toString())

when (entryPoint) {
"SelectDiaryMonthFragment" -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class UpdateEmotionDialog(

var activeBalloon: Balloon? = null

// Initially check the toggle button based on the emotion value
val initialToggleButton = when (emotion) {
"화남" -> binding.tbAnger
"행복" -> binding.tbHappiness
Expand All @@ -111,7 +110,7 @@ class UpdateEmotionDialog(

initialToggleButton?.let { toggleButton ->
toggleButton.isChecked = true
lastCheckedButton = toggleButton // Save the initial button as the last checked button
lastCheckedButton = toggleButton
val initialMessage = when (toggleButton) {
binding.tbAnger -> "화나"
binding.tbHappiness -> "행복해"
Expand Down Expand Up @@ -150,9 +149,8 @@ class UpdateEmotionDialog(
it.isChecked = false
}

lastCheckedButton = toggleButton // Update the last checked button
lastCheckedButton = toggleButton
} else {
// Prevent unchecking the last active button
if (toggleButtons.none { it.isChecked }) {
toggleButton.isChecked = true
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class MyPageFragment : BaseFragment<FragmentMypageBinding>(R.layout.fragment_myp
}

private fun getRealPathFromPdfUri(context: Context, uri: Uri): String? {
// ContentProvider를 통해 파일 정보 가져오기
context.contentResolver.query(uri, null, null, null, null)?.use { cursor ->
if (cursor.moveToFirst()) {
val displayNameIndex = cursor.getColumnIndex(OpenableColumns.DISPLAY_NAME)
Expand All @@ -175,11 +174,8 @@ class MyPageFragment : BaseFragment<FragmentMypageBinding>(R.layout.fragment_myp
val file = File(context.cacheDir, displayName)

try {
// URI에서 입력 스트림 열기
context.contentResolver.openInputStream(uri)?.use { input ->
// 파일에 출력 스트림 열기
FileOutputStream(file).use { output ->
// 입력 스트림에서 출력 스트림으로 데이터 복사
input.copyTo(output)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.nabi.nabi.utils.UiState
import com.nabi.nabi.views.MainActivity
import com.nabi.nabi.views.sign.SignActivity
import dagger.hilt.android.AndroidEntryPoint
import kotlinx.coroutines.DelicateCoroutinesApi
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import javax.inject.Inject
Expand Down
3 changes: 0 additions & 3 deletions Nabi/presentation/src/main/res/values/font_style.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
500 : Medium
600 : Semi Bold
700 : Bold
Line Height 계산 방법
ex.
-->

<!-- Heading -->
Expand Down
1 change: 0 additions & 1 deletion Nabi/presentation/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<item name="android:textColorPrimary">@color/black</item>
</style>

<!-- Define a custom style for the buttons -->
<style name="DialogButtonStyle">
<item name="fontFamily">@font/pretendard_bold</item>
<item name="android:textColor">@color/primary</item>
Expand Down

0 comments on commit 3be1a06

Please sign in to comment.