Skip to content

Commit

Permalink
Merge pull request #42 from nocap-stone-design/feature/#40-user-info
Browse files Browse the repository at this point in the history
Feature/#40 user info
  • Loading branch information
KDW03 authored Apr 11, 2023
2 parents a327f3d + 5a10bcc commit b0861e7
Show file tree
Hide file tree
Showing 24 changed files with 237 additions and 368 deletions.
17 changes: 17 additions & 0 deletions .idea/deploymentTargetDropDown.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@ class InputBuddyTypeFragment : Fragment() {
// Inflate the layout for this fragment
_binding = FragmentInputBuddyTypeBinding.inflate(inflater, container, false)


(activity as MainActivityUtil).run {
setToolbarTitle("버디 추가")
setVisibilityBottomAppbar(View.GONE)
if (activity is MainActivityUtil){
(activity as MainActivityUtil).run {
setToolbarTitle("버디 추가")
setVisibilityBottomAppbar(View.GONE)
}
}


return binding.root

}
Expand Down
27 changes: 27 additions & 0 deletions buddy/src/main/res/navigation/nav_addbuddy.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/nav_addbuddy"
app:startDestination="@id/inputBuddyTypeFragment">

<fragment
android:id="@+id/inputBuddyInfoFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.InputBuddyInfoFragment"
android:label="InputBuddyInfoFragment">
<action
android:id="@+id/next"
app:destination="@id/completeRegistrationFragment" />
</fragment>
<fragment
android:id="@+id/inputBuddyTypeFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.InputBuddyTypeFragment"
android:label="InputBuddyTypeFragment">
<action
android:id="@+id/next"
app:destination="@id/inputBuddyInfoFragment" />
</fragment>
<fragment
android:id="@+id/completeRegistrationFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.CompleteRegistrationFragment"
android:label="CompleteRegistrationFragment" />
</navigation>
27 changes: 4 additions & 23 deletions buddy/src/main/res/navigation/nav_buddy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,36 +4,16 @@
android:id="@+id/nav_buddy"
app:startDestination="@id/myBuddyFragment">

<fragment
android:id="@+id/completeRegistrationFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.CompleteRegistrationFragment"
android:label="CompleteRegistrationFragment" />
<fragment
android:id="@+id/inputBuddyTypeFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.InputBuddyTypeFragment"
android:label="InputBuddyTypeFragment" >
<action
android:id="@+id/next"
app:destination="@id/inputBuddyInfoFragment" />
</fragment>
<fragment
android:id="@+id/inputBuddyInfoFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.InputBuddyInfoFragment"
android:label="InputBuddyInfoFragment" >
<action
android:id="@+id/next"
app:destination="@id/completeRegistrationFragment" />
</fragment>
<fragment
android:id="@+id/myBuddyFragment"
android:name="com.nocapstone.buddyvet.buddy.ui.MyBuddyFragment"
android:label="MyBuddyFragment" >
<action
android:id="@+id/next"
app:destination="@id/inputBuddyTypeFragment" />
<action
android:id="@+id/putFragment"
app:destination="@id/putBuddyFragment" />
<action
android:id="@+id/next"
app:destination="@id/nav_addbuddy" />
</fragment>
<fragment
android:id="@+id/putBuddyFragment"
Expand All @@ -43,4 +23,5 @@
android:name="buddyId"
app:argType="long" />
</fragment>
<include app:graph="@navigation/nav_addbuddy" />
</navigation>
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.nocapstone.common_ui

import androidx.fragment.app.Fragment

interface MainActivityUtil{
fun setToolbarTitle(newTitle: String)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,28 @@ import com.nocapstone.common.data.dto.CommonResponse
import com.nocapstone.common.data.dto.LoginResponse
import com.nocapstone.common.domain.entity.LoginRequest
import com.nocapstone.common.data.entity.Jwt
import com.nocapstone.common.domain.entity.UserNameRequest
import okhttp3.MultipartBody
import org.apache.commons.lang3.ObjectUtils.Null
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.*

interface AuthService {
@POST("oauth/login")
suspend fun postToken(@Body loginRequest: LoginRequest): Response<LoginResponse>

@POST("user/nickname")
@POST("users/nickname")
suspend fun postUserInfo(
@Header("Authorization") token: String,
@Body nickname: String
@Body nickname: UserNameRequest
): CommonResponse<String?>

@Multipart
@POST("users/image")
suspend fun uploadUserImg(
@Header("Authorization") token: String,
@Part image: MultipartBody.Part
): CommonResponse<String?>


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.nocapstone.common.domain.entity

data class UserNameRequest(
val nickname : String
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import com.nocapstone.common.data.dto.LoginResponse
import com.nocapstone.common.data.entity.Jwt
import com.nocapstone.common.domain.entity.LoginRequest
import com.nocapstone.common.data.source.AuthService
import com.nocapstone.common.domain.entity.UserNameRequest
import okhttp3.MultipartBody
import retrofit2.Response
import javax.inject.Inject

Expand All @@ -15,7 +17,12 @@ class AuthUseCase @Inject constructor(
return authService.postToken(LoginRequest(token, providerType))
}

suspend fun inputUserInfo(token:String , nickname: String){
suspend fun inputUserInfo(token:String , nickname: UserNameRequest){
authService.postUserInfo(token,nickname)
}

suspend fun uploadUserImg(token: String,image: MultipartBody.Part) {
authService.uploadUserImg(token, image)
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,4 @@ enum class PermissionType(val permissionArray: Array<String>) {
)
),
CAMERA(arrayOf(Manifest.permission.CAMERA, Manifest.permission.READ_EXTERNAL_STORAGE)),
NOTIFICATION(arrayOf(Manifest.permission.POST_NOTIFICATIONS))
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.nocapstone.onboarding.ui

import android.net.Uri
import android.os.Bundle
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
Expand All @@ -10,6 +11,9 @@ import androidx.navigation.fragment.findNavController
import com.nocapstone.onboarding.R
import com.nocapstone.onboarding.databinding.FragmentInputUserInfoBinding
import dagger.hilt.android.AndroidEntryPoint
import gun0912.tedimagepicker.builder.TedImagePicker
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow

@AndroidEntryPoint
class InputUserInfoFragment : Fragment() {
Expand All @@ -19,21 +23,33 @@ class InputUserInfoFragment : Fragment() {

private val splashViewModel: SplashViewModel by viewModels()


override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?

): View? {
// Inflate the layout for this fragment
_binding = FragmentInputUserInfoBinding.inflate(inflater, container, false)
return binding.root
}

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.apply {
viewModel = splashViewModel
lifecycleOwner = viewLifecycleOwner
}
binding.next.setOnClickListener {
splashViewModel.postUserInfo(binding.nameEt.toString())
findNavController().navigate(R.id.next)
splashViewModel.postUserInfo(binding.nameEt.text.toString()){
findNavController().navigate(R.id.next)
}
}

binding.imgSelect.setOnClickListener {
TedImagePicker.with(requireContext())
.start {
splashViewModel.setSelectImgUri(it)
}
}
}
override fun onDestroyView() {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,22 @@ import dagger.hilt.android.AndroidEntryPoint
//todo companion?
private val messageArray = arrayOf(
"주위 동물병원 찾기 및 산책 지수 제공을 위한 GPS접근 동의가 필요해요.",
"진달을 위해서 갤러리 및 카메라 접근 동의가 필요해요." ,
"버디들의 진단 정보 나 상태 정보 제공을 위한 알림 권한 동의가 필요해요"
"진단을 위해서 갤러리 및 카메라 접근 동의가 필요해요."
)

private val imageArray = arrayOf(R.drawable.img_gps, R.drawable.img_gps, R.drawable.img_gps)



@AndroidEntryPoint
class OnBoardingViewPagerFragment : Fragment(), PermissionCallback {


companion object{
var viewpagerNum = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) 3 else 2
}


var viewpagerNum = 2
private var _binding: FragmentOnBoardingViewPagerBinding? = null
private val binding
get() = _binding!!
private val requestPermissionLauncher = PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })
get() = _binding!!
private val requestPermissionLauncher =
PermissionObject.checkPermission(this, { onSuccess() }, { onFail() })


override fun onCreateView(
Expand Down Expand Up @@ -80,26 +75,28 @@ class OnBoardingViewPagerFragment : Fragment(), PermissionCallback {
}



private inner class OnBoardingViewPagerAdapter(fragment: Fragment) :
FragmentStateAdapter(fragment) {

override fun getItemCount(): Int = viewpagerNum
override fun createFragment(position: Int): Fragment {
return when (position) {
0 -> OnBoarding1Fragment.newInstance()
1 -> OnBoarding2Fragment.newInstance()
else -> OnBoarding3Fragment.newInstance()
0 -> {
binding.onboardingBack.setBackgroundResource(R.drawable.img_onboarding1)
OnBoarding1Fragment.newInstance()
}
else -> {
binding.onboardingBack.setBackgroundResource(R.drawable.img_onboarding2)
OnBoarding2Fragment.newInstance()
}
}
}


}

override fun onSuccess() {
if (binding.viewpager2.currentItem == viewpagerNum - 1) {
findNavController().navigate(R.id.next)
}else{
} else {
binding.viewpager2.currentItem++
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class SplashActivity : AppCompatActivity() {
splashViewModel.withJsonWebToken { JWT ->
if (JWT != null) {
Log.d("buddyTest","$JWT")
LoginUtil.startMainActivity(this, mainActivityClass)
initNav()

//LoginUtil.startMainActivity(this, mainActivityClass)
} else {
Log.d("buddyTest","JWT널")
initNav()
Expand Down
Loading

0 comments on commit b0861e7

Please sign in to comment.