-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#40] (1) PetsitterRealtimeLocationRepository.kt 생성
(2) RealtimeLocationModel.kt 생성 (3) build.gradle.kts 에서 겹치는 implement 삭제 (보완사항) 에러남 (펫시터꺼 실행안됨), 위에 쓴 보완사항 그대로 수행하기~
- Loading branch information
cny1213
committed
Apr 12, 2024
1 parent
5056fa7
commit 19a4fb6
Showing
4 changed files
with
45 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
MungNolZa/app/src/main/java/kr/co/lion/mungnolza/model/RealtimeLocationModel.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |
30 changes: 30 additions & 0 deletions
30
.../app/src/main/java/kr/co/lion/mungnolza/repository/PetsitterRealtimeLocationRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters