Skip to content

Commit

Permalink
refactor: 코틀린 컨벤션에 맞게 수정
Browse files Browse the repository at this point in the history
- 대문자 패키지명 Information -> info 로 수정
  • Loading branch information
nueijeel committed Jan 8, 2024
1 parent 4149813 commit 34a49e6
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.meongcare.Information.model.data.remote
package com.project.meongcare.info.model.data.remote

import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.home.model.entities.GetDogListResponse
import com.project.meongcare.home.model.entities.GetUserProfileResponse
import okhttp3.MultipartBody
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.model.data.remote
package com.project.meongcare.info.model.data.remote

import okhttp3.ResponseBody
import retrofit2.Converter
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.model.data.repository
package com.project.meongcare.info.model.data.repository

import dagger.Module
import dagger.Provides
Expand All @@ -14,4 +14,4 @@ object ProfileModule {
fun provideProfileRepository(profileRepositoryImpl: ProfileRepositoryImpl): ProfileRepository {
return profileRepositoryImpl
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.project.meongcare.Information.model.data.repository
package com.project.meongcare.info.model.data.repository

import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.home.model.entities.DogProfile
import com.project.meongcare.home.model.entities.GetUserProfileResponse
import okhttp3.MultipartBody
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.project.meongcare.Information.model.data.repository
package com.project.meongcare.info.model.data.repository

import android.util.Log
import com.project.meongcare.Information.model.data.remote.ProfileRetrofitClient
import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.info.model.data.remote.ProfileRetrofitClient
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.home.model.entities.DogProfile
import com.project.meongcare.home.model.entities.GetUserProfileResponse
import okhttp3.MultipartBody
Expand All @@ -11,7 +11,7 @@ import javax.inject.Inject

class ProfileRepositoryImpl
@Inject
constructor(private val profileRetrofitClient: ProfileRetrofitClient): ProfileRepository {
constructor(private val profileRetrofitClient: ProfileRetrofitClient) : ProfileRepository {
override suspend fun getUserProfile(accessToken: String): GetUserProfileResponse? {
try {
val response = profileRetrofitClient.profileApi.getUserProfile(accessToken)
Expand Down Expand Up @@ -86,7 +86,7 @@ class ProfileRepositoryImpl
dogId: Long,
accessToken: String,
file: MultipartBody.Part,
dto: RequestBody
dto: RequestBody,
): Int? {
return try {
val response = profileRetrofitClient.profileApi.putDogInfo(dogId, accessToken, file, dto)
Expand Down Expand Up @@ -135,7 +135,10 @@ class ProfileRepositoryImpl
}
}

override suspend fun patchPushAgreement(pushAgreement: Boolean, accessToken: String): Int? {
override suspend fun patchPushAgreement(
pushAgreement: Boolean,
accessToken: String,
): Int? {
return try {
val response = profileRetrofitClient.profileApi.patchPushAgreement(pushAgreement, accessToken)
if (response.code() == 200) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.model.entities
package com.project.meongcare.info.model.entities

import android.os.Parcelable
import kotlinx.parcelize.Parcelize
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.net.Uri
import android.os.Build
Expand All @@ -16,8 +16,8 @@ import androidx.navigation.fragment.findNavController
import com.bumptech.glide.Glide
import com.google.gson.Gson
import com.project.meongcare.CalendarBottomSheetFragment
import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.Information.viewmodel.ProfileViewModel
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.info.viewmodel.ProfileViewModel
import com.project.meongcare.MainActivity
import com.project.meongcare.R
import com.project.meongcare.databinding.FragmentPetEditBinding
Expand Down Expand Up @@ -156,23 +156,31 @@ class PetEditFragment : Fragment(), PhotoMenuListener, DateSubmitListener {
val requestBody: RequestBody = json.toRequestBody("application/json; charset=utf-8".toMediaTypeOrNull())
val filePart = createMultipartBody(mainActivity, petEditViewModel.dogProfile.value)

val accessToken = "Bearer eyJhbGciOiJIUzI1NiJ9.eyJpZCI6MywiZXhwIjoxNzA0NjI4MzQzfQ._y66Fy6QfznE14qRncC0kPaEVHErorVRwW4zAhoW2hI"
val accessToken = ""
petEditViewModel.putDogInfo(dogInfo.dogId, accessToken, filePart, requestBody)
}
}

return binding.root
}

private fun editTextWatcher(editText: EditText, targetView: View, hint: String) {
private fun editTextWatcher(
editText: EditText,
targetView: View,
hint: String,
) {
editText.addTextChangedListener {
editText.doAfterTextChanged { editable ->
updateEditTextStyle(editText, targetView, hint)
}
}
}

private fun updateEditTextStyle(editText: EditText, targetView: View, hint: String) {
private fun updateEditTextStyle(
editText: EditText,
targetView: View,
hint: String,
) {
if (editText.text.isNullOrEmpty()) {
targetView.setBackgroundResource(R.drawable.all_rect_gray1_r5_outline_sub1)
editText.hint = "필수 입력 값입니다"
Expand Down Expand Up @@ -200,8 +208,8 @@ class PetEditFragment : Fragment(), PhotoMenuListener, DateSubmitListener {
edittextPeteditName.setText(dogInfo.name)
edittextPeteditType.setText(dogInfo.type)
when (dogInfo.sex) {
Gender.FEMALE.english -> chipgroupPeteditGroupGender.check(R.id.chip_petedit_female)
Gender.MALE.english -> chipgroupPeteditGroupGender.check(R.id.chip_petedit_male)
Gender.FEMALE.english -> chipgroupPeteditGroupGender.check(R.id.chip_petedit_female)
Gender.MALE.english -> chipgroupPeteditGroupGender.check(R.id.chip_petedit_male)
}
checkboxPeteditNeuterStatus.isChecked = dogInfo.castrate
isCbxChecked = dogInfo.castrate
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.os.Bundle
import android.view.LayoutInflater
Expand All @@ -8,8 +8,8 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.bumptech.glide.Glide
import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.Information.viewmodel.ProfileViewModel
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.info.viewmodel.ProfileViewModel
import com.project.meongcare.R
import com.project.meongcare.databinding.FragmentPetAddEditBinding
import com.project.meongcare.onboarding.view.Gender
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.content.Context
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.cardview.widget.CardView
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.net.Uri
import android.os.Bundle
Expand All @@ -17,7 +17,7 @@ import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.kakao.sdk.user.UserApiClient
import com.navercorp.nid.NaverIdLoginSDK
import com.project.meongcare.Information.viewmodel.ProfileViewModel
import com.project.meongcare.info.viewmodel.ProfileViewModel
import com.project.meongcare.MainActivity
import com.project.meongcare.R
import com.project.meongcare.databinding.FragmentProfileBinding
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.os.Bundle
import android.view.Gravity
Expand All @@ -12,7 +12,7 @@ import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.google.android.material.snackbar.Snackbar
import com.project.meongcare.Information.viewmodel.ProfileViewModel
import com.project.meongcare.info.viewmodel.ProfileViewModel
import com.project.meongcare.R
import com.project.meongcare.databinding.FragmentSettingBinding
import com.project.meongcare.login.model.data.local.UserPreferences
Expand Down Expand Up @@ -87,6 +87,7 @@ class SettingFragment : Fragment() {

return binding.root
}

fun makeSnackBar(message: String) {
val snackBar = Snackbar.make(binding.root, message, Snackbar.LENGTH_SHORT)
val snackBarLayout = snackBar.view as Snackbar.SnackbarLayout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.project.meongcare.Information.view
package com.project.meongcare.info.view

import android.app.Activity
import android.content.Context
Expand Down Expand Up @@ -62,7 +62,7 @@ class UserProfileSelectBottomSheetFragment : BottomSheetDialogFragment() {
ActivityResultContracts.StartActivityForResult(),
) {
if (it.resultCode == Activity.RESULT_OK) {
it.data?.data?.let { uri ->
it.data?.data?.let { uri ->
if (uri != null) {
sendUri(uri)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package com.project.meongcare.Information.viewmodel
package com.project.meongcare.info.viewmodel

import android.net.Uri
import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.project.meongcare.Information.model.data.repository.ProfileRepository
import com.project.meongcare.Information.model.entities.GetDogInfoResponse
import com.project.meongcare.info.model.data.repository.ProfileRepository
import com.project.meongcare.info.model.entities.GetDogInfoResponse
import com.project.meongcare.home.model.entities.DogProfile
import com.project.meongcare.home.model.entities.GetUserProfileResponse
import dagger.hilt.android.lifecycle.HiltViewModel
Expand Down

0 comments on commit 34a49e6

Please sign in to comment.