Skip to content

Commit

Permalink
Merge pull request #99 from Team-Umbba/chore/#98
Browse files Browse the repository at this point in the history
[Chore/#98] String 추출, 로그 정리, 버그 수정
  • Loading branch information
yeoncheong authored Jul 21, 2023
2 parents 128dc39 + 4917c9a commit a5ca566
Show file tree
Hide file tree
Showing 55 changed files with 255 additions and 334 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package com.sopt.umbba_android.application
import android.app.Application
import androidx.appcompat.app.AppCompatDelegate
import com.kakao.sdk.common.KakaoSdk
import com.sopt.umbba_android.BuildConfig
import com.sopt.umbba_android.BuildConfig.KAKAO_NATIVE_APP_KEY
import com.sopt.umbba_android.data.local.SharedPreferences
import timber.log.Timber

class UmbbaApplication: Application() {
override fun onCreate() {
super.onCreate()
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
initKakao()
setupSharedPreferences()
stopDarkMode()
useTimber()
}

private fun initKakao() {
Expand All @@ -21,4 +24,14 @@ class UmbbaApplication: Application() {
private fun setupSharedPreferences() {
SharedPreferences.init(this)
}

private fun stopDarkMode() {
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO)
}

private fun useTimber() {
if (BuildConfig.DEBUG) {
Timber.plant(Timber.DebugTree())
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,18 @@ class AuthInterceptor : Interceptor {

val token = if (SharedPreferences.getString(USER_TOKEN).isNullOrBlank()) {
SharedPreferences.getKakaoString(USER_KAKAO_TOKEN)
// 저장된 서버 액세스 토큰이 없다면 카카오 토큰 전송 -> 회원가입
} else {
"Bearer ${SharedPreferences.getString(USER_TOKEN)}"
// 저장된 서버 액세스 토큰이 있다면 Bearer 붙여서 전송 -> 로그인
}

val originalRequest = chain.request()

val headerRequest = originalRequest.newBuilder() // 헤더를 추가한 req
val headerRequest = originalRequest.newBuilder()
.header(
"Authorization",
"$token"
)
.build()
Log.e("yeonjin", "헤더 $token")
return chain.proceed(headerRequest)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,18 @@ object SharedPreferences {
return preferences.getString(key, null)
}

//토큰 저장
fun setString(key: String, value: String?) {
preferences.edit { putString(key, value) }
}
//토큰 가져오기 - 자동 로그인 확인

fun getString(key: String): String? {
return preferences.getString(key, null)
}
//온보딩 완료 상태 저장

fun setOnboardingBoolean(key: String, value: Boolean) {
preferences.edit { putBoolean(key, value) }
}
//온보딩 완료했는지 가져오기 - 온보딩 완료 확인

fun getOnboardingBoolean(key: String): Boolean {
return preferences.getBoolean(key, false)
}
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class HomeRepositoryImpl(private val homeRemoteDataSource: HomeRemoteDataSource)
runCatching {
homeRemoteDataSource.getHomeData()
}.onSuccess {
Timber.e("get home data 성공~")
Timber.d("get home data 성공")
}.onFailure {
Timber.e("get home data 실패")
}
Expand All @@ -20,7 +20,7 @@ class HomeRepositoryImpl(private val homeRemoteDataSource: HomeRemoteDataSource)
runCatching {
homeRemoteDataSource.getResponseCase()
}.onSuccess {
Timber.e("get response case 성공~")
Timber.d("get response case 성공")
}.onFailure {
Timber.e("get response case 실패")
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class ListRepositoryImpl(private val listRemoteDataSource: ListRemoteDataSource)
runCatching {
listRemoteDataSource.getListData(sectionId)
}.onSuccess {
Timber.e("get list data 성공~")
Timber.d("get list data 성공")
}.onFailure {
Timber.e("get list data 실패 크라잉 . . . ")
Timber.e("get list data 실패")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ class LoginRepositoryImpl(
runCatching {
loginRemoteDataSource.postLogin(loginRequestDto)
}.onSuccess {
Log.e("yeonjin", "Impl login 성공")
Timber.d("Impl login 성공")
}.onFailure {
Log.e("yeonjin", "Impl login 실패")
Timber.e("Impl login 실패")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.sopt.umbba_android.data.model.response.InviteCodeResponseDto
import com.sopt.umbba_android.data.model.response.ReceiveInfoResponseDto
import com.sopt.umbba_android.data.model.response.SendInfoResponseDto
import com.sopt.umbba_android.domain.repository.OnboardingRepository
import timber.log.Timber

class OnboardingRepositoryImpl(
private val onboardingRemoteDataSource: OnboardingRemoteDataSource
Expand All @@ -17,26 +18,26 @@ class OnboardingRepositoryImpl(
runCatching {
onboardingRemoteDataSource.setFamily(inviteCodeRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding setFamily Impl 성공")
Timber.d("onboarding setFamily Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding setFamily Impl 실패")
Timber.e("onboarding setFamily Impl 실패")
}

override suspend fun setSendInfo(sendInfoRequestDto: SendInfoRequestDto): Result<SendInfoResponseDto> =
runCatching {
onboardingRemoteDataSource.setSendInfo(sendInfoRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding setSendInfo Impl 성공")
Timber.d("onboarding setSendInfo Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding setSendInfo Impl 성공")
Timber.e("onboarding setSendInfo Impl 성공")
}

override suspend fun setReceiveInfo(receiveInfoRequestDto: ReceiveInfoRequestDto): Result<ReceiveInfoResponseDto> =
runCatching {
onboardingRemoteDataSource.setReceiveInfo(receiveInfoRequestDto)
}.onSuccess {
Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공")
Timber.d("onboarding setReceiveInfo Impl 성공")
}.onFailure {
Log.e("yeonjin", "onboarding setReceiveInfo Impl 성공")
Timber.e("onboarding setReceiveInfo Impl 성공")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,26 @@ class QuestionAnswerRepositoryImpl(private val questionAnswerRemoteDataSource: Q
runCatching {
questionAnswerRemoteDataSource.getQuestionAnswer()
}.onSuccess {
Timber.e("문답 data get 성공")
Timber.d("문답 data get 성공")
}.onFailure {
Timber.e("문답 data get 실패 크라잉. . . ")
Timber.e("문답 data get 실패")
}

override suspend fun getListQuestionAnswer(qnaId: Long): Result<ListQuestionAnswerResponseDto> =
runCatching {
questionAnswerRemoteDataSource.getListQuestionAnswer(qnaId)
}.onSuccess {
Timber.e("list qna data get 성공")
Timber.d("list qna data get 성공")
}.onFailure {
Timber.e("list qna data get 시이일패")
Timber.e("list qna data get 실패")
}

override suspend fun postAnswer(answerRequestDto: AnswerRequestDto):Result<AnswerResponseDto> =
runCatching {
questionAnswerRemoteDataSource.postAnswer(answerRequestDto)
}.onSuccess {
Timber.e("답변 data post 성공")
Timber.d("답변 data post 성공")
}.onFailure {
Timber.e("답변 data post 실패 크라잉. . . ")
Timber.e("답변 data post 실패")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,25 @@ import com.sopt.umbba_android.data.datasource.SettingRemoteDataSource
import com.sopt.umbba_android.data.model.response.LogOutResponseDto
import com.sopt.umbba_android.data.model.response.SignOutResponseDto
import com.sopt.umbba_android.domain.repository.SettingRepository
import timber.log.Timber

class SettingRepositoryImpl(private val settingRemoteDataSource: SettingRemoteDataSource) :
SettingRepository {
override suspend fun logout(): Result<LogOutResponseDto> =
runCatching {
settingRemoteDataSource.logout()
}.onSuccess {
Log.e("hyeon","Impl 로그아웃 성공")
Timber.d("Impl 로그아웃 성공")
}.onFailure {
Log.e("hyeon","Impl 로그아웃 실패")
Timber.e("Impl 로그아웃 실패")
}

override suspend fun signout(): Result<SignOutResponseDto> =
runCatching {
settingRemoteDataSource.signout()
}.onSuccess {
Log.e("hyeon","Impl 회원탈퇴 성공")
Timber.d("Impl 회원탈퇴 성공")
}.onFailure {
Log.e("hyeon","Impl 회원탈퇴 실패")
Timber.e("Impl 회원탈퇴 실패")
}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.sopt.umbba_android.presentation.home

import android.content.Intent
import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.fragment.app.viewModels
import coil.load
Expand All @@ -14,6 +13,7 @@ import com.sopt.umbba_android.presentation.qna.NoOpponentDialogFragment
import com.sopt.umbba_android.presentation.qna.QuestionAnswerActivity
import com.sopt.umbba_android.util.ViewModelFactory
import com.sopt.umbba_android.util.binding.BindingFragment
import com.sopt.umbba_android.util.setOnSingleClickListener

class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home) {
private val viewModel: HomeViewModel by viewModels { ViewModelFactory(requireActivity()) }
Expand All @@ -23,7 +23,7 @@ class HomeFragment : BindingFragment<FragmentHomeBinding>(R.layout.fragment_home
observeData()
}
private fun setClickEvent(responseCaseDto: HomeCaseResponseDto.HomeCaseData) {
binding.btnAnswer.setOnClickListener {
binding.btnAnswer.setOnSingleClickListener {
viewModel.getResponseCase()
when (responseCaseDto.responseCase) {
1 -> startActivity(Intent(requireActivity(), QuestionAnswerActivity::class.java))
Expand Down
Loading

0 comments on commit a5ca566

Please sign in to comment.