Skip to content

Commit

Permalink
[#40] (1) PetsitterRealtimeLocationRepository.kt 생성
Browse files Browse the repository at this point in the history
(2) RealtimeLocationModel.kt 생성
(3) build.gradle.kts 에서 겹치는 implement 삭제

(보완사항)
에러남 (펫시터꺼 실행안됨), 위에 쓴 보완사항 그대로 수행하기~
  • Loading branch information
cny1213 committed Apr 12, 2024
1 parent 5056fa7 commit 19a4fb6
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 2 deletions.
1 change: 0 additions & 1 deletion MungNolZa/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ dependencies {
implementation("com.google.firebase:firebase-storage:20.3.0")
implementation("com.google.firebase:firebase-storage-ktx:20.3.0")

implementation("com.google.android.gms:play-services-maps:18.2.0")
implementation("com.google.android.gms:play-services-location:21.2.0")

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package kr.co.lion.mungnolza.model

data class RealtimeLocationModel(

// 예약번호 → ReservationNumber
// 위도 → Latitude
// 경도 → Longtitude
// 날짜 → Date

var reservationNumber : Int,
var latitude : Float,
var longtitude : Float,
var date : String
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package kr.co.lion.mungnolza.repository

import com.google.firebase.Firebase
import com.google.firebase.firestore.firestore
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kr.co.lion.mungnolza.model.RealtimeLocationModel

class PetsitterRealtimeLocationRepository {

companion object{

// ReservationModel에서 예약번호(진행중인)를 가져온다.

// 실시간위치 정보를 저장한다. RealtimeLocationModel
suspend fun insertRealtimeLocationData(realtimeLocationModel: RealtimeLocationModel){
val job1 = CoroutineScope(Dispatchers.IO).launch {
val collectionReference = Firebase.firestore.collection("RealtimeLocationModel")
// 컬렉션에 문서를 추가한다.
// 문서를 추가할 때 객체나 맵을 지정한다.
// 추가된 문서 내부의 필드는 객체가 가진 프로퍼티의 이름이나 맵에 있는 데이터의 이름과 동일하게 결정된다.
collectionReference.add(realtimeLocationModel)
}
job1.join()
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class PetSitterReviewWriteFragment : Fragment() {
}
}

// 데잍
// 데이터를 저장한다
fun savePetsitterReviewData() {
CoroutineScope(Dispatchers.Main).launch {
// 펫시터 후기 번호 시퀀스 값을 가져온다.
Expand Down

0 comments on commit 19a4fb6

Please sign in to comment.