Skip to content

Commit

Permalink
[AN] 발자국 삭제, 산책 종료, 산책 타이머 기능 구현 (#522)
Browse files Browse the repository at this point in the history
  • Loading branch information
dpcks0509 authored Aug 22, 2024
1 parent 5b9a574 commit 011bb84
Show file tree
Hide file tree
Showing 84 changed files with 1,906 additions and 781 deletions.
1 change: 1 addition & 0 deletions android/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ dependencies {
implementation(libs.bundles.datastore)
implementation(libs.bundles.animation)
implementation(libs.bundles.stomp)
implementation(libs.bundles.ballon)
implementation(libs.bundles.room)
testImplementation(libs.bundles.test)
androidTestImplementation(libs.androidx.junit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ object Types {
const val REGISTER_MARKER_BTN_CLICKED = "register_marker_btn_clicked"
const val LOCATION_BTN_CLICKED = "location_btn_clicked"
const val MY_FOOTPRINT_BTN_CLICKED = "my_footprint_btn_clicked"
const val REFRESH_BTN_CLICKED = "refresh_btn_clicked"
const val BACK_BTN_CLICKED = "back_btn_clicked"
const val CLOSE_BTN_CLICKED = "close_btn_clicked"
const val FOOTPRINT_CLICKED = "footprint_clicked"
const val FOOTPRINT_MEMBER_NAME_CLICKED = "footprint_member_name_clicked"
const val REGISTER_HELP_CLICKED = "register_help_clicked"
const val WALK_HELP_CLICKED = "walk_help_clicked"
const val FOOTPRINT_PET_IMAGE_CLICKED = "footprint_pet_image_clicked"
const val CLUB_SELECT_PARTICIPATION_FILTER = "club_select_participation_filter"
const val CLUB_SELECT_CLUB_FILTER = "club_select_club_filter"
const val CLUB_ADD_UN_SELECT_FILTER = "club_add_un_select_filter"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ import com.happy.friendogly.domain.usecase.ConnectWebsocketUseCase
import com.happy.friendogly.domain.usecase.DeleteAddressUseCase
import com.happy.friendogly.domain.usecase.DeleteChatAlarmUseCase
import com.happy.friendogly.domain.usecase.DeleteClubMemberUseCase
import com.happy.friendogly.domain.usecase.DeleteFootprintUseCase
import com.happy.friendogly.domain.usecase.DeleteMemberUseCase
import com.happy.friendogly.domain.usecase.DeleteTokenUseCase
import com.happy.friendogly.domain.usecase.DeleteWoofAlarmUseCase
Expand All @@ -73,9 +74,10 @@ import com.happy.friendogly.domain.usecase.GetSearchingClubsUseCase
import com.happy.friendogly.domain.usecase.GetWoofAlarmUseCase
import com.happy.friendogly.domain.usecase.KakaoLoginUseCase
import com.happy.friendogly.domain.usecase.PatchClubUseCase
import com.happy.friendogly.domain.usecase.PatchFootprintRecentWalkStatusAutoUseCase
import com.happy.friendogly.domain.usecase.PatchFootprintRecentWalkStatusManualUseCase
import com.happy.friendogly.domain.usecase.PatchMemberUseCase
import com.happy.friendogly.domain.usecase.PatchPetUseCase
import com.happy.friendogly.domain.usecase.PatchWalkStatusUseCase
import com.happy.friendogly.domain.usecase.PostClubMemberUseCase
import com.happy.friendogly.domain.usecase.PostClubUseCase
import com.happy.friendogly.domain.usecase.PostFootprintUseCase
Expand Down Expand Up @@ -274,12 +276,16 @@ class AppModule(context: Context) {
GetFootprintInfoUseCase(repository = woofRepository)
val postFootprintUseCase: PostFootprintUseCase =
PostFootprintUseCase(repository = woofRepository)
val patchWalkStatusUseCase: PatchWalkStatusUseCase =
PatchWalkStatusUseCase(repository = woofRepository)
val patchFootprintRecentWalkStatusAutoUseCase: PatchFootprintRecentWalkStatusAutoUseCase =
PatchFootprintRecentWalkStatusAutoUseCase(repository = woofRepository)
val patchFootprintRecentWalkStatusManualUseCase: PatchFootprintRecentWalkStatusManualUseCase =
PatchFootprintRecentWalkStatusManualUseCase(repository = woofRepository)
val getNearFootprintsUseCase: GetNearFootprintsUseCase =
GetNearFootprintsUseCase(repository = woofRepository)
val getFootprintMarkBtnInfoUseCase: GetFootprintMarkBtnInfoUseCase =
GetFootprintMarkBtnInfoUseCase(repository = woofRepository)
val deleteFootprintUseCase: DeleteFootprintUseCase =
DeleteFootprintUseCase(repository = woofRepository)
val postMemberUseCase: PostMemberUseCase = PostMemberUseCase(repository = memberRepository)
val getPetsMineUseCase: GetPetsMineUseCase = GetPetsMineUseCase(repository = petRepository)
val getPetsUseCase: GetPetsUseCase = GetPetsUseCase(repository = petRepository)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.happy.friendogly.data.mapper

import com.happy.friendogly.data.model.FootprintRecentWalkStatusDto
import com.happy.friendogly.presentation.ui.woof.model.FootprintRecentWalkStatus

fun FootprintRecentWalkStatusDto.toDomain(): FootprintRecentWalkStatus {
return FootprintRecentWalkStatus(
walkStatus = walkStatus.toDomain(),
changedWalkStatusTime = changedWalkStatusTime,
)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
package com.happy.friendogly.data.mapper

import com.happy.friendogly.data.model.MyFootprintDto
import com.happy.friendogly.presentation.ui.woof.model.Footprint
import com.happy.friendogly.presentation.ui.woof.model.MyFootprint
import com.happy.friendogly.presentation.ui.woof.model.WalkStatus

fun MyFootprintDto.toDomain(): MyFootprint {
return MyFootprint(
Expand All @@ -11,3 +13,14 @@ fun MyFootprintDto.toDomain(): MyFootprint {
createdAt = createdAt,
)
}

fun MyFootprint.toFootprint(): Footprint {
return Footprint(
footprintId = footprintId,
latitude = latitude,
longitude = longitude,
walkStatus = WalkStatus.BEFORE,
createdAt = createdAt,
isMine = true,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.happy.friendogly.data.model

import kotlinx.datetime.LocalDateTime

data class FootprintRecentWalkStatusDto(
val walkStatus: WalkStatusDto,
val changedWalkStatusTime: LocalDateTime,
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import com.happy.friendogly.domain.repository.WoofRepository
import com.happy.friendogly.presentation.ui.woof.model.Footprint
import com.happy.friendogly.presentation.ui.woof.model.FootprintInfo
import com.happy.friendogly.presentation.ui.woof.model.FootprintMarkBtnInfo
import com.happy.friendogly.presentation.ui.woof.model.FootprintRecentWalkStatus
import com.happy.friendogly.presentation.ui.woof.model.MyFootprint
import com.happy.friendogly.presentation.ui.woof.model.WalkStatus
import com.happy.friendogly.remote.model.request.FootprintRecentWalkStatusAutoRequest
import com.happy.friendogly.remote.model.request.FootprintRecentWalkStatusManualRequest
import com.happy.friendogly.remote.model.request.FootprintRequest
import com.happy.friendogly.remote.model.request.WalkStatusRequest

class WoofRepositoryImpl(private val source: WoofDataSource) : WoofRepository {
override suspend fun postFootprint(
Expand All @@ -26,12 +28,12 @@ class WoofRepositoryImpl(private val source: WoofDataSource) : WoofRepository {
}
}

override suspend fun patchWalkStatus(
override suspend fun patchFootprintRecentWalkStatusAuto(
latitude: Double,
longitude: Double,
): Result<WalkStatus> {
return source.patchWalkStatus(
WalkStatusRequest(
): Result<FootprintRecentWalkStatus> {
return source.patchFootprintRecentWalkStatusAuto(
FootprintRecentWalkStatusAutoRequest(
latitude = latitude,
longitude = longitude,
),
Expand All @@ -40,6 +42,14 @@ class WoofRepositoryImpl(private val source: WoofDataSource) : WoofRepository {
}
}

override suspend fun patchFootprintRecentWalkStatusManual(walkStatus: WalkStatus): Result<FootprintRecentWalkStatus> {
return source.patchFootprintRecentWalkStatusManual(
FootprintRecentWalkStatusManualRequest(walkStatus = walkStatus),
).mapCatching { dto ->
dto.toDomain()
}
}

override suspend fun getFootprintMarkBtnInfo(): Result<FootprintMarkBtnInfo> {
return source.getFootprintMarkBtnInfo().mapCatching { dto ->
dto.toDomain()
Expand All @@ -60,4 +70,8 @@ class WoofRepositoryImpl(private val source: WoofDataSource) : WoofRepository {
return source.getFootprintInfo(footprintId)
.mapCatching { dto -> dto.toDomain() }
}

override suspend fun deleteFootprint(footprintId: Long): Result<Unit> {
return source.deleteFootprint(footprintId)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@ package com.happy.friendogly.data.source
import com.happy.friendogly.data.model.FootprintDto
import com.happy.friendogly.data.model.FootprintInfoDto
import com.happy.friendogly.data.model.FootprintMarkBtnInfoDto
import com.happy.friendogly.data.model.FootprintRecentWalkStatusDto
import com.happy.friendogly.data.model.MyFootprintDto
import com.happy.friendogly.data.model.WalkStatusDto
import com.happy.friendogly.remote.model.request.FootprintRecentWalkStatusAutoRequest
import com.happy.friendogly.remote.model.request.FootprintRecentWalkStatusManualRequest
import com.happy.friendogly.remote.model.request.FootprintRequest
import com.happy.friendogly.remote.model.request.WalkStatusRequest

interface WoofDataSource {
suspend fun postFootprint(request: FootprintRequest): Result<MyFootprintDto>

suspend fun patchWalkStatus(request: WalkStatusRequest): Result<WalkStatusDto>
suspend fun patchFootprintRecentWalkStatusAuto(request: FootprintRecentWalkStatusAutoRequest): Result<FootprintRecentWalkStatusDto>

suspend fun patchFootprintRecentWalkStatusManual(request: FootprintRecentWalkStatusManualRequest): Result<FootprintRecentWalkStatusDto>

suspend fun getFootprintMarkBtnInfo(): Result<FootprintMarkBtnInfoDto>

Expand All @@ -21,4 +24,6 @@ interface WoofDataSource {
): Result<List<FootprintDto>>

suspend fun getFootprintInfo(footprintId: Long): Result<FootprintInfoDto>

suspend fun deleteFootprint(footprintId: Long): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.happy.friendogly.domain.repository
import com.happy.friendogly.presentation.ui.woof.model.Footprint
import com.happy.friendogly.presentation.ui.woof.model.FootprintInfo
import com.happy.friendogly.presentation.ui.woof.model.FootprintMarkBtnInfo
import com.happy.friendogly.presentation.ui.woof.model.FootprintRecentWalkStatus
import com.happy.friendogly.presentation.ui.woof.model.MyFootprint
import com.happy.friendogly.presentation.ui.woof.model.WalkStatus

Expand All @@ -12,10 +13,12 @@ interface WoofRepository {
longitude: Double,
): Result<MyFootprint>

suspend fun patchWalkStatus(
suspend fun patchFootprintRecentWalkStatusAuto(
latitude: Double,
longitude: Double,
): Result<WalkStatus>
): Result<FootprintRecentWalkStatus>

suspend fun patchFootprintRecentWalkStatusManual(walkStatus: WalkStatus): Result<FootprintRecentWalkStatus>

suspend fun getFootprintMarkBtnInfo(): Result<FootprintMarkBtnInfo>

Expand All @@ -25,4 +28,6 @@ interface WoofRepository {
): Result<List<Footprint>>

suspend fun getFootprintInfo(footprintId: Long): Result<FootprintInfo>

suspend fun deleteFootprint(footprintId: Long): Result<Unit>
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package com.happy.friendogly.domain.usecase

import com.happy.friendogly.domain.repository.WoofRepository

class DeleteFootprintUseCase(private val repository: WoofRepository) {
suspend operator fun invoke(footprintId: Long): Result<Unit> = repository.deleteFootprint(footprintId = footprintId)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.happy.friendogly.domain.usecase

import com.happy.friendogly.domain.repository.WoofRepository
import com.happy.friendogly.presentation.ui.woof.model.FootprintRecentWalkStatus

class PatchFootprintRecentWalkStatusAutoUseCase(private val repository: WoofRepository) {
suspend operator fun invoke(
latitude: Double,
longitude: Double,
): Result<FootprintRecentWalkStatus> = repository.patchFootprintRecentWalkStatusAuto(latitude = latitude, longitude = longitude)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.happy.friendogly.domain.usecase

import com.happy.friendogly.domain.repository.WoofRepository
import com.happy.friendogly.presentation.ui.woof.model.FootprintRecentWalkStatus
import com.happy.friendogly.presentation.ui.woof.model.WalkStatus

class PatchFootprintRecentWalkStatusManualUseCase(private val repository: WoofRepository) {
suspend operator fun invoke(walkStatus: WalkStatus): Result<FootprintRecentWalkStatus> =
repository.patchFootprintRecentWalkStatusManual(walkStatus = walkStatus)
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,34 @@ interface WoofActionHandler {

fun clickMyFootprintBtn()

fun clickStatusAll()

fun clickStatusBefore()

fun clickStatusOnGoing()

fun clickStatusAfter()

fun clickRefreshBtn()

fun clickDeleteMyFootprintMarkerBtn()

fun clickEndWalkBtn()

fun clickBackBtn()

fun clickCloseBtn()

fun clickFootprint(
fun clickFootprintMarker(
footprintId: Long,
marker: Marker,
)

fun clickFootprintPetImage(petImageUrl: String)

fun clickFootprintMemberName(memberId: Long)

fun clickRegisterHelp()

fun clickWalkHelp()
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package com.happy.friendogly.presentation.ui.woof

sealed interface WoofAlertActions {
data object AlertHasNotPetDialog : WoofAlertActions

data class AlertMarkBtnClickBeforeTimeoutSnackbar(
val remainingTime: Int,
) : WoofAlertActions

data object AlertMarkerRegisteredSnackbar : WoofAlertActions

data object AlertDeleteMyFootprintMarkerSnackbar : WoofAlertActions

data object AlertEndWalkSnackbar : WoofAlertActions

data object AlertFailToLoadFootprintMarkBtnInfoSnackbar : WoofAlertActions

data object AlertFailToLoadNearFootprintsSnackbar : WoofAlertActions

data object AlertFailToRegisterFootprintSnackbar : WoofAlertActions

data object AlertFailToLoadFootprintInfoSnackbar : WoofAlertActions

data object AlertFailToUpdateFootprintWalkStatusSnackbar : WoofAlertActions

data object AlertFailToEndWalkSnackbar : WoofAlertActions

data object AlertFailToDeleteMyFootprintSnackbar : WoofAlertActions
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package com.happy.friendogly.presentation.ui.woof

import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.view.View
import android.view.ViewTreeObserver
import androidx.core.view.isVisible

const val ANIMATE_DURATION_MILLIS = 300L

fun View.showViewAnimation() {
if (height == 0) {
viewTreeObserver.addOnGlobalLayoutListener(
object : ViewTreeObserver.OnGlobalLayoutListener {
override fun onGlobalLayout() {
animateView()
if (height > 0) viewTreeObserver.removeOnGlobalLayoutListener(this)
}
},
)
} else {
animateView()
}
}

private fun View.animateView() {
translationY = height.toFloat()
animate().translationY(0f).setDuration(ANIMATE_DURATION_MILLIS).setListener(
object : AnimatorListenerAdapter() {
override fun onAnimationStart(animation: Animator) {
isVisible = true
bringToFront()
}
},
)
}

fun View.hideViewAnimation() {
animate().translationY(height.toFloat()).setDuration(ANIMATE_DURATION_MILLIS)
.setListener(
object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
super.onAnimationEnd(animation)
isVisible = false
}
},
)
}
Loading

0 comments on commit 011bb84

Please sign in to comment.