Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AN] 놀이터 서비스 기능 및 리팩토링 #720

Merged
merged 29 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
fa1aeaf
fix: Service 오류 해결
dpcks0509 Oct 18, 2024
3f85761
fix: 놀이터 등록 화면 갔다가 돌아왔을때 나의 참여 놀이터 pathOverlay 사라지던 오류 수정
dpcks0509 Oct 18, 2024
64946bb
fix: 마커 크기 오류 수정
dpcks0509 Oct 18, 2024
d70e754
refactor: api 주소 수정
dpcks0509 Oct 18, 2024
60d88fa
refactor: PlaygroundSummary 디테일 수정
dpcks0509 Oct 18, 2024
c856c42
refactor: MyPlayground에 pathOverlay 추가
dpcks0509 Oct 19, 2024
1cfb154
refactor: RegisterCircleOverlay를 UiState 안에 넣기
dpcks0509 Oct 19, 2024
caadc87
refactor: ViewModel의 addressLine uiState로 이동, trackingModeAction 삭제
dpcks0509 Oct 19, 2024
f4c97c0
fix: locationBtn visible 오류 해결
dpcks0509 Oct 19, 2024
c18c77c
refactor: refreshBtnVisible uiState안에 넣기
dpcks0509 Oct 20, 2024
3325e57
refactor: RegisterBtnClickable uiState안에 넣기
dpcks0509 Oct 20, 2024
9f07dcd
feat: 최근 본 강아지 저장 기능 연결
dpcks0509 Oct 20, 2024
70fee45
refactor: 최근 본 강아지 동일날짜 업데이트 되게하고, 최근 순서대로 정렬되도록 수정
dpcks0509 Oct 20, 2024
fa5f966
style: woof,walk,footrpint,발자국,산책 단어들 -> playgroud, 놀이터로 수정
dpcks0509 Oct 20, 2024
5dae084
refactor: Message -> StateMessage로 클래스명 변경
dpcks0509 Oct 20, 2024
ec96773
refactor: monitorDistanceAndManagePlayStatus함수 viewModel로 이동
dpcks0509 Oct 20, 2024
7daca68
refactor: viewModel로 함수 이동 및 상수화
dpcks0509 Oct 20, 2024
b07b0a2
refactor: showSnackbar 로직 간소화
dpcks0509 Oct 20, 2024
9b006fa
refactor: Loading 상태 수정
dpcks0509 Oct 20, 2024
8b8877e
refactor: 최근 본 강아지 내 강아지는 저장안되도록 수정
dpcks0509 Oct 21, 2024
030647c
feat: 놀이터 상세 새로고침 기능 구현
dpcks0509 Oct 21, 2024
ee3fd70
refactor: 로딩 및 업데이트 로직 수정
dpcks0509 Oct 21, 2024
0c43992
fix: 위치 권한 없을때 dialog 안뜨던 오류 수정
dpcks0509 Oct 22, 2024
caec9c3
refactor: TrackingMode 변경 로직 수정
dpcks0509 Oct 22, 2024
be4fbae
refactor: MakePlayground 액션 로직 간소화
dpcks0509 Oct 22, 2024
687f1d4
feat: 놀이터 새로 참여 다이얼로그 추가
dpcks0509 Oct 23, 2024
7c64679
fix: 깃 충돌 해결
dpcks0509 Oct 23, 2024
70a1c9f
fix: 놀이터 알림 오류 수정
dpcks0509 Oct 23, 2024
4734f86
style: ktlint 수정
dpcks0509 Oct 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
android:exported="false"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize" />

<activity
android:name=".presentation.ui.register.RegisterActivity"
android:exported="true"
Expand Down Expand Up @@ -119,7 +119,7 @@
</intent-filter>
</activity>
<activity
android:name=".presentation.ui.message.MessageActivity"
android:name=".presentation.ui.statemessage.StateMessageActivity"
android:exported="false"
android:screenOrientation="portrait"
android:theme="@style/TransparentActivityTheme"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ abstract class DataSourceModule {

@Binds
@Singleton
abstract fun bindsWoofDataSource(dataSourceImpl: PlaygroundDataSourceImpl): PlaygroundDataSource
abstract fun bindsPlaygroundDataSource(dataSourceImpl: PlaygroundDataSourceImpl): PlaygroundDataSource

@Binds
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import android.content.Context
import com.happy.friendogly.local.di.AddressModule
import com.happy.friendogly.local.di.AlarmTokenModule
import com.happy.friendogly.local.di.ChatAlarmModule
import com.happy.friendogly.local.di.PlaygroundAlarmModule
import com.happy.friendogly.local.di.TokenManager
import com.happy.friendogly.local.di.WoofAlarmModule
import dagger.Module
import dagger.Provides
import dagger.hilt.InstallIn
Expand Down Expand Up @@ -42,7 +42,7 @@ object DataStoreModule {

@Provides
@Singleton
fun providesWoofAlarmModule(
fun providesPlaygroundAlarmModule(
@ApplicationContext appContext: Context,
): WoofAlarmModule = WoofAlarmModule(appContext)
): PlaygroundAlarmModule = PlaygroundAlarmModule(appContext)
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ abstract class RepositoryModule {

@Binds
@Singleton
abstract fun bindsWoofRepository(repositoryImpl: PlaygroundRepositoryImpl): PlaygroundRepository
abstract fun bindsPlaygroundRepository(repositoryImpl: PlaygroundRepositoryImpl): PlaygroundRepository

@Binds
@Singleton
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ object ServiceModule {

@Provides
@Singleton
fun providesWoofService(retrofit: Retrofit): PlaygroundService = retrofit.create(PlaygroundService::class.java)
fun providesPlaygroundService(retrofit: Retrofit): PlaygroundService = retrofit.create(PlaygroundService::class.java)
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.happy.friendogly.data.mapper

import com.happy.friendogly.data.model.MyPlaygroundDto
import com.happy.friendogly.presentation.ui.playground.model.MyPlayground
import com.happy.friendogly.presentation.ui.playground.model.Playground

fun MyPlaygroundDto.toDomain(): MyPlayground {
return MyPlayground(
Expand All @@ -11,12 +10,3 @@ fun MyPlaygroundDto.toDomain(): MyPlayground {
longitude = longitude,
)
}

fun MyPlayground.toPlayground(): Playground {
return Playground(
id = id,
latitude = latitude,
longitude = longitude,
isParticipating = true,
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import com.happy.friendogly.remote.mapper.toLocal

fun RecentPetDto.toLocal(): RecentPetEntity =
RecentPetEntity(
memberId = id,
memberId = memberId,
petId = petId,
name = name,
imgUrl = imgUrl,
birthday = birthday,
Expand All @@ -18,7 +19,7 @@ fun RecentPetDto.toLocal(): RecentPetEntity =

fun RecentPetDto.toDomain(): RecentPet =
RecentPet(
memberId = id,
memberId = memberId,
name = name,
imgUrl = imgUrl,
birthday = birthday,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import java.time.LocalDateTime
data class RecentPetDto(
val id: Long = 0,
val memberId: Long,
val petId: Long,
val name: String,
val birthday: LocalDate,
val imgUrl: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class AlarmSettingRepositoryImpl

override suspend fun deleteChatSetting(): Result<Unit> = source.deleteChatSetting()

override suspend fun saveWoofSetting(isSet: Boolean): Result<Unit> = source.saveWoofSetting(isSet)
override suspend fun savePlaygroundSetting(isSet: Boolean): Result<Unit> = source.savePlaygroundSetting(isSet)

override suspend fun getWoofSetting(): Result<Boolean> = source.getWoofSetting()
override suspend fun getPlaygroundSetting(): Result<Boolean> = source.getPlaygroundSetting()

override suspend fun deleteWoofSetting(): Result<Unit> = source.deleteWoofSetting()
override suspend fun deletePlaygroundSetting(): Result<Unit> = source.deletePlaygroundSetting()
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ class PlaygroundRepositoryImpl
)
}

override suspend fun getFootprintMarkBtnInfo(): Result<PetExistence> =
source.getFootprintMarkBtnInfo().mapCatching { dto ->
override suspend fun getPetExistence(): Result<PetExistence> =
source.getPetExistence().mapCatching { dto ->
dto.toDomain()
}

override suspend fun getPlaygrounds(): Result<List<Playground>> =
source
.getNearFootprints()
.getNearPlaygrounds()
.mapCatching { dto ->
dto.toDomain()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,17 @@ class RecentPetsRepositoryImpl
)

override suspend fun insertRecentPet(
id: Long,
memberId: Long,
petId: Long,
name: String,
imgUrl: String,
birthday: LocalDate,
gender: Gender,
sizeType: SizeType,
): DomainResult<Unit, DataError.Local> {
return dataSource.insertRecentPet(
id = id,
memberId = memberId,
petId = petId,
name = name,
imgUrl = imgUrl,
birthday = birthday,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface AlarmSettingDataSource {

suspend fun deleteChatSetting(): Result<Unit>

suspend fun saveWoofSetting(isSet: Boolean): Result<Unit>
suspend fun savePlaygroundSetting(isSet: Boolean): Result<Unit>

suspend fun getWoofSetting(): Result<Boolean>
suspend fun getPlaygroundSetting(): Result<Boolean>

suspend fun deleteWoofSetting(): Result<Unit>
suspend fun deletePlaygroundSetting(): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ interface PlaygroundDataSource {

suspend fun patchPlaygroundArrival(request: PatchPlaygroundArrivalRequest): Result<PlaygroundArrivalDto>

suspend fun getFootprintMarkBtnInfo(): Result<PetExistenceDto>
suspend fun getPetExistence(): Result<PetExistenceDto>

suspend fun getNearFootprints(): Result<List<PlaygroundDto>>
suspend fun getNearPlaygrounds(): Result<List<PlaygroundDto>>

suspend fun getPlaygroundInfo(id: Long): Result<PlaygroundInfoDto>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ interface RecentPetsDataSource {
suspend fun getAllRecentPet(): Result<List<RecentPetDto>>

suspend fun insertRecentPet(
id: Long,
memberId: Long,
petId: Long,
name: String,
imgUrl: String,
birthday: LocalDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ interface AlarmSettingRepository {

suspend fun deleteChatSetting(): Result<Unit>

suspend fun saveWoofSetting(isSet: Boolean): Result<Unit>
suspend fun savePlaygroundSetting(isSet: Boolean): Result<Unit>

suspend fun getWoofSetting(): Result<Boolean>
suspend fun getPlaygroundSetting(): Result<Boolean>

suspend fun deleteWoofSetting(): Result<Unit>
suspend fun deletePlaygroundSetting(): Result<Unit>
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface PlaygroundRepository {
longitude: Double,
): DomainResult<PlaygroundArrival, DataError.Network>

suspend fun getFootprintMarkBtnInfo(): Result<PetExistence>
suspend fun getPetExistence(): Result<PetExistence>

suspend fun getPlaygrounds(): Result<List<Playground>>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ interface RecentPetsRepository {
suspend fun getAllRecentPet(): DomainResult<List<RecentPet>, DataError.Local>

suspend fun insertRecentPet(
id: Long,
memberId: Long,
petId: Long,
name: String,
imgUrl: String,
birthday: LocalDate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.happy.friendogly.domain.usecase
import com.happy.friendogly.domain.repository.AlarmSettingRepository
import javax.inject.Inject

class DeleteWoofAlarmUseCase
class DeletePlaygroundAlarmUseCase
@Inject
constructor(
private val repository: AlarmSettingRepository,
) {
suspend operator fun invoke(): Result<Unit> = repository.deleteWoofSetting()
suspend operator fun invoke(): Result<Unit> = repository.deletePlaygroundSetting()
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ import javax.inject.Inject
class GetPetExistenceUseCase
@Inject
constructor(private val repository: PlaygroundRepository) {
suspend operator fun invoke(): Result<PetExistence> = repository.getFootprintMarkBtnInfo()
suspend operator fun invoke(): Result<PetExistence> = repository.getPetExistence()
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.happy.friendogly.domain.usecase
import com.happy.friendogly.domain.repository.AlarmSettingRepository
import javax.inject.Inject

class GetWoofAlarmUseCase
class GetPlaygroundAlarmUseCase
@Inject
constructor(
private val repository: AlarmSettingRepository,
) {
suspend operator fun invoke(): Result<Boolean> = repository.getWoofSetting()
suspend operator fun invoke(): Result<Boolean> = repository.getPlaygroundSetting()
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ class InsertRecentPetUseCase
val repository: RecentPetsRepository,
) {
suspend operator fun invoke(
id: Long,
memberId: Long,
petId: Long,
name: String,
imgUrl: String,
birthday: LocalDate,
gender: Gender,
sizeType: SizeType,
): DomainResult<Unit, DataError.Local> =
repository.insertRecentPet(
memberId = memberId,
petId = petId,
imgUrl = imgUrl,
name = name,
id = id,
birthday = birthday,
gender = gender,
sizeType = sizeType,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package com.happy.friendogly.domain.usecase
import com.happy.friendogly.domain.repository.AlarmSettingRepository
import javax.inject.Inject

class SaveWoofAlarmUseCase
class SavePlaygroundAlarmUseCase
@Inject
constructor(
private val repository: AlarmSettingRepository,
) {
suspend operator fun invoke(isSet: Boolean): Result<Unit> = repository.saveWoofSetting(isSet)
suspend operator fun invoke(isSet: Boolean): Result<Unit> = repository.savePlaygroundSetting(isSet)
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object Types {
const val KAKAO_LOGIN_CLICKED = "kakao_login_clicked"
const val GOOGLE_LOGIN_CLICKED = "google_login_clicked"
const val GROUP_LIST_FRAGMENT = "group_list_fragment"
const val WOOF_FRAGMENT = "woof_fragment"
const val PLAYGROUND_FRAGMENT = "playground_fragment"
const val CHAT_LIST_FRAGMENT = "chat_list_fragment"
const val MY_PAGE_FRAGMENT = "my_page_fragment"
const val CLUB_LIST_FRAGMENT_SWITCHED = "group_list_fragment_switched"
Expand All @@ -41,12 +41,17 @@ object Types {
const val REGISTER_MARKER_BTN_CLICKED = "register_marker_btn_clicked"
const val LOCATION_BTN_CLICKED = "location_btn_clicked"
const val MY_PLAYGROUND_BTN_CLICKED = "my_playground_btn_clicked"
const val REFRESH_BTN_CLICKED = "refresh_btn_clicked"
const val PLAYGROUND_REFRESH_BTN_CLICKED = "playground_refresh_btn_clicked"
const val PLAYGROUND_INFO_REFRESH_BTN_CLICKED = "playground_info_refresh_btn_clicked"
const val BACK_BTN_CLICKED = "back_btn_clicked"
const val CLOSE_BTN_CLICKED = "close_btn_clicked"
const val PLAYGROUND_PET_DETAIL_CLICKED = "playground_pet_detail_clicked"
const val HELP_BTN_CLICKED = "help_btn_clicked"
const val PET_IMAGE_CLICKED = "pet_image_clicked"
const val STATE_MESSAGE_CLICKED = "state_message_clicked"
const val JOIN_PLAYGROUND_CLICKED = "join_playground_clicked"
const val LEAVE_PLAYGROUND_CLICKED = "leave_playground_clicked"
const val CHECK_PET_EXISTENCE_CLICKED = "check_pet_existence_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 @@ -3,16 +3,30 @@ package com.happy.friendogly.local.dao
import androidx.room.Dao
import androidx.room.Insert
import androidx.room.Query
import androidx.room.Transaction
import com.happy.friendogly.local.model.RecentPetEntity
import java.time.LocalDateTime

@Dao
interface RecentPetsDao {
@Query("SELECT * FROM recent_pet WHERE memberId = :id")
suspend fun getRecentPetById(id: Long): RecentPetEntity?

@Query("SELECT * FROM recent_pet")
@Query("SELECT * FROM recent_pet ORDER BY created_at DESC")
suspend fun getAllRecentPet(): List<RecentPetEntity>

@Query("DELETE FROM recent_pet WHERE petId = :petId AND DATE(created_at) = DATE(:createdAt)")
suspend fun deleteByPetIdAndCreatedAt(
petId: Long,
createdAt: LocalDateTime,
)

@Insert
suspend fun insertRecentPet(recentPetEntity: RecentPetEntity)

@Transaction
suspend fun insertOrUpdateRecentPet(recentPetEntity: RecentPetEntity) {
deleteByPetIdAndCreatedAt(recentPetEntity.petId, recentPetEntity.createdAt)
insertRecentPet(recentPetEntity)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import kotlinx.coroutines.flow.catch
import kotlinx.coroutines.flow.map
import java.io.IOException

class WoofAlarmModule(val context: Context) {
class PlaygroundAlarmModule(val context: Context) {
private val Context.dataStore: DataStore<Preferences> by preferencesDataStore(name = DATA_STORE_NAME)

private val key = booleanPreferencesKey(ALARM_SETTING)
Expand Down Expand Up @@ -41,7 +41,7 @@ class WoofAlarmModule(val context: Context) {
}

companion object {
private const val ALARM_SETTING = "WOOF_ALARM_SETTING"
private const val DATA_STORE_NAME = "woofAlarmDataStore"
private const val ALARM_SETTING = "PLAYGROUND_ALARM_SETTING"
private const val DATA_STORE_NAME = "playgroundAlarmDataStore"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import com.happy.friendogly.local.model.RecentPetEntity

fun RecentPetEntity.toData(): RecentPetDto =
RecentPetDto(
memberId = id,
memberId = memberId,
petId = petId,
name = name,
imgUrl = imgUrl,
birthday = birthday,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import java.time.LocalDateTime
data class RecentPetEntity(
@ColumnInfo(name = "memberId")
val memberId: Long,
@ColumnInfo(name = "petId")
val petId: Long,
@ColumnInfo(name = "name")
val name: String,
@ColumnInfo(name = "imgUrl")
Expand Down
Loading
Loading