mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-03-17 21:31:57 +01:00
Moves GeohashPrecision class to Quartz
This commit is contained in:
parent
4b91cfe809
commit
1a001e7bb3
@ -34,6 +34,7 @@ import com.fonfon.kgeohash.GeoHash
|
||||
import com.fonfon.kgeohash.toGeoHash
|
||||
import com.vitorpamplona.amethyst.service.LocationState.Companion.MIN_DISTANCE
|
||||
import com.vitorpamplona.amethyst.service.LocationState.Companion.MIN_TIME
|
||||
import com.vitorpamplona.quartz.nip01Core.tags.geohash.GeohashPrecision
|
||||
import kotlinx.coroutines.CancellationException
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.ExperimentalCoroutinesApi
|
||||
@ -125,7 +126,7 @@ class LocationState(
|
||||
(context)
|
||||
.get(MIN_TIME, MIN_DISTANCE)
|
||||
.map {
|
||||
LocationResult.Success(it.toGeoHash(com.vitorpamplona.amethyst.ui.actions.GeohashPrecision.KM_5_X_5.digits)) as LocationResult
|
||||
LocationResult.Success(it.toGeoHash(GeohashPrecision.KM_5_X_5.digits)) as LocationResult
|
||||
}.onEach {
|
||||
latestLocation = it
|
||||
}.catch { e ->
|
||||
|
@ -1680,20 +1680,3 @@ open class NewPostViewModel : ViewModel() {
|
||||
saveDraft()
|
||||
}
|
||||
}
|
||||
|
||||
enum class GeohashPrecision(
|
||||
val digits: Int,
|
||||
) {
|
||||
KM_5000_X_5000(1), // 5,000km × 5,000km
|
||||
KM_1250_X_625(2), // 1,250km × 625km
|
||||
KM_156_X_156(3), // 156km × 156km
|
||||
KM_39_X_19(4), // 39.1km × 19.5km
|
||||
KM_5_X_5(5), // 4.89km × 4.89km
|
||||
M_1000_X_600(6), // 1.22km × 0.61km
|
||||
M_153_X_153(7), // 153m × 153m
|
||||
M_38_X_19(8), // 38.2m × 19.1m
|
||||
M_5_X_5(9), // 4.77m × 4.77m
|
||||
MM_1000_X_1000(10), // 1.19m × 0.596m
|
||||
MM_149_X_149(11), // 149mm × 149mm
|
||||
MM_37_X_18(12), // 37.2mm × 18.6mm
|
||||
}
|
||||
|
@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Copyright (c) 2024 Vitor Pamplona
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
* this software and associated documentation files (the "Software"), to deal in
|
||||
* the Software without restriction, including without limitation the rights to use,
|
||||
* copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the
|
||||
* Software, and to permit persons to whom the Software is furnished to do so,
|
||||
* subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
* FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
* COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
package com.vitorpamplona.quartz.nip01Core.tags.geohash
|
||||
|
||||
enum class GeohashPrecision(
|
||||
val digits: Int,
|
||||
) {
|
||||
KM_5000_X_5000(1), // 5,000km × 5,000km
|
||||
KM_1250_X_625(2), // 1,250km × 625km
|
||||
KM_156_X_156(3), // 156km × 156km
|
||||
KM_39_X_19(4), // 39.1km × 19.5km
|
||||
KM_5_X_5(5), // 4.89km × 4.89km
|
||||
M_1000_X_600(6), // 1.22km × 0.61km
|
||||
M_153_X_153(7), // 153m × 153m
|
||||
M_38_X_19(8), // 38.2m × 19.1m
|
||||
M_5_X_5(9), // 4.77m × 4.77m
|
||||
MM_1000_X_1000(10), // 1.19m × 0.596m
|
||||
MM_149_X_149(11), // 149mm × 149mm
|
||||
MM_37_X_18(12), // 37.2mm × 18.6mm
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user