This commit is contained in:
lunaticbum 2024-10-23 17:14:29 +09:00
parent aa9a0a7b24
commit f0cbf1c4fd

View File

@ -53,11 +53,16 @@ class LocationUpdateService : Service(), LocationListener {
WorkersDb.getRealm()?.apply { WorkersDb.getRealm()?.apply {
LocationLog().let { loc -> LocationLog().let { loc ->
loc.fillData(it) loc.fillData(it)
var list = query<LocationLog>().sort("time", Sort.DESCENDING).find()
var list = query<LocationLog>().query("userId == $0", PrefString.telegramMyId.get("")).sort("time", Sort.DESCENDING).find()
val post = (list.size == 0 || (list.size > 0 && list.first().time < (System.currentTimeMillis() - (1000L * 60L * 5L))) && inRangeLocation(lat,long,50) == false)
writeBlocking { writeBlocking {
copyToRealm(loc) if (post) {
loc.userId = PrefString.telegramMyId.get("")
copyToRealm(loc)
}
} }
(list.size == 0 || (list.size > 0 && list.first().time < (System.currentTimeMillis() - (1000L * 60L * 5L))) && inRangeLocation(lat,long,50) == false).letTrue { post.letTrue {
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
try { try {
//////-1002450229641 //////-1002450229641