Skip to content

Commit

Permalink
Revert "Feature/invitemember (#81)" (#92)
Browse files Browse the repository at this point in the history
This reverts commit 7731444.
  • Loading branch information
wjdwns authored Jun 26, 2022
1 parent 7731444 commit 288496e
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 28 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ object Repository : RemoteDataSource {
emit(apiService.buildTeam(buildTeam))
}


override suspend fun getTeam(): Flow<Groups> = flow {
emit(apiService.getTeamData())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ object RetrofitBuilder {
@Throws(IOException::class)
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()

return try {
chain.proceed(
request.newBuilder()
.addHeader("Authorization", PrefsManager.refreshToken.ifEmpty { PrefsManager.authCode })
.build()
)

} catch (e: Exception) {
Response.Builder()
.request(request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class InviteFragment : Fragment() {
viewModel.viewType.collect {
if (it == InviteViewType.SIGN) {
viewModel.setCode(viewModel.groupName.value)
viewModel.getInviteCodeResponse()
viewModel.setInviteCodeValidPeriod()
} else {
viewModel.getInviteCodeResponse()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.depromeet.housekeeper.local.PrefsManager
import com.depromeet.housekeeper.model.BuildTeam
import com.depromeet.housekeeper.model.InviteFailedResponse
import com.depromeet.housekeeper.model.enums.InviteViewType
import com.depromeet.housekeeper.network.remote.repository.Repository
import kotlinx.coroutines.flow.MutableStateFlow
import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.collect
import kotlinx.coroutines.launch
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter


class InviteViewModel : ViewModel() {
Expand All @@ -32,11 +33,6 @@ class InviteViewModel : ViewModel() {
_groupName.value = groupName
}

private val _errorBody: MutableStateFlow<InviteFailedResponse?> =
MutableStateFlow(null)
val errorBody: StateFlow<InviteFailedResponse?>
get() = _errorBody

private val _inviteCode: MutableStateFlow<String> =
MutableStateFlow("")
val inviteCode: StateFlow<String>
Expand All @@ -51,6 +47,10 @@ class InviteViewModel : ViewModel() {
val networkError: StateFlow<Boolean>
get() = _networkError

fun setInviteCodeValidPeriod() {
_inviteCodeValidPeriod.value = LocalDateTime.now()
.format(DateTimeFormatter.ofPattern("yyyy년 MM월 dd일 HH시 mm분")) + 3600000
}

fun setCode(teamName: String) {
viewModelScope.launch {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ class LoginFragment : Fragment() {
if (navArgs.code != "null") {
navigateDynamicLink()
} else if (account != null) {
//navigateOnStart()
findNavController().navigate(LoginFragmentDirections.actionLoginFragmentToSignNameFragment(SignViewType.InviteCode,null))
navigateOnStart()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,16 @@ class SignNameFragment : Fragment() {
}
lifecycleScope.launchWhenCreated {
viewModel.responseJoinTeam.collect {
if (it != null) {
if(it!=null){
findNavController().navigate(SignNameFragmentDirections.actionSignNameFragmentToGroupInfoFragment())
}
}
}
lifecycleScope.launchWhenCreated {
viewModel.responseTeamUpdate.collect {
if (it != null) {
if(it!=null){
findNavController().navigateUp()
Toast.makeText(context, R.string.modify_group_toast_massage, Toast.LENGTH_SHORT)
.show()
Toast.makeText(context, R.string.modify_group_toast_massage, Toast.LENGTH_SHORT).show()
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class SignNameViewModel : ViewModel() {
_hasTeam.value = hasTeam
}

fun teamNameUpdate(teamName: String) {
fun teamNameUpdate(teamName : String){
viewModelScope.launch {
Repository.updateTeam(BuildTeam(teamName)).runCatching {
collect {
Expand All @@ -68,7 +68,7 @@ class SignNameViewModel : ViewModel() {
}
}

fun joinTeam(inviteCode: String) {
fun joinTeam(inviteCode : String){
viewModelScope.launch {
Repository.joinTeam(JoinTeam(inviteCode)).runCatching {
collect {
Expand Down

0 comments on commit 288496e

Please sign in to comment.