forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
d0ebd0e233
187 changed files with 1201 additions and 22352 deletions
|
@ -137,7 +137,6 @@ export default class GeoLocationHandler {
|
|||
}
|
||||
}
|
||||
|
||||
console.trace("Moving the map to the GPS-location")
|
||||
mapLocation.setData({
|
||||
lon: newLocation.longitude,
|
||||
lat: newLocation.latitude,
|
||||
|
@ -152,7 +151,6 @@ export default class GeoLocationHandler {
|
|||
private CopyGeolocationIntoMapstate() {
|
||||
const features: UIEventSource<Feature[]> = new UIEventSource<Feature[]>([])
|
||||
this.currentUserLocation = new StaticFeatureSource(features)
|
||||
const keysToCopy = ["speed", "accuracy", "altitude", "altitudeAccuracy", "heading"]
|
||||
let i = 0
|
||||
this.geolocationState.currentGPSLocation.addCallbackAndRun((location) => {
|
||||
if (location === undefined) {
|
||||
|
@ -163,19 +161,15 @@ export default class GeoLocationHandler {
|
|||
id: "gps-" + i,
|
||||
"user:location": "yes",
|
||||
date: new Date().toISOString(),
|
||||
// GeolocationObject behaves really weird when indexing, so copying it one by one is the most stable
|
||||
accuracy: location.accuracy,
|
||||
speed: location.speed,
|
||||
altitude: location.altitude,
|
||||
altitudeAccuracy: location.altitudeAccuracy,
|
||||
heading: location.heading,
|
||||
}
|
||||
i++
|
||||
|
||||
for (const k in keysToCopy) {
|
||||
// For some weird reason, the 'Object.keys' method doesn't work for the 'location: GeolocationCoordinates'-object and will thus not copy all the properties when using {...location}
|
||||
// As such, they are copied here
|
||||
if (location[k]) {
|
||||
properties[k] = location[k]
|
||||
}
|
||||
}
|
||||
console.debug("Current location object:", location)
|
||||
properties["_all"] = JSON.stringify(location)
|
||||
|
||||
const feature = <Feature>{
|
||||
type: "Feature",
|
||||
properties,
|
||||
|
@ -184,7 +178,6 @@ export default class GeoLocationHandler {
|
|||
coordinates: [location.longitude, location.latitude],
|
||||
},
|
||||
}
|
||||
|
||||
features.setData([feature])
|
||||
})
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ export default class UserDetails {
|
|||
public account_created: string
|
||||
public tracesCount: number = 0
|
||||
public description: string
|
||||
public languages: string[]
|
||||
|
||||
constructor(backend: string) {
|
||||
this.backend = backend
|
||||
|
@ -89,6 +90,7 @@ export class OsmConnection {
|
|||
ud.unreadMessages = 0
|
||||
ud.name = "Fake user"
|
||||
ud.totalMessages = 42
|
||||
ud.languages = ["en"]
|
||||
}
|
||||
const self = this
|
||||
this.UpdateCapabilities()
|
||||
|
@ -193,7 +195,7 @@ export class OsmConnection {
|
|||
method: "GET",
|
||||
path: "/api/0.6/user/details",
|
||||
},
|
||||
function (err, details) {
|
||||
function (err, details: XMLDocument) {
|
||||
if (err != null) {
|
||||
console.log(err)
|
||||
self.loadingStatus.setData("error")
|
||||
|
@ -222,11 +224,14 @@ export class OsmConnection {
|
|||
data.name = userInfo.getAttribute("display_name")
|
||||
data.account_created = userInfo.getAttribute("account_created")
|
||||
data.uid = Number(userInfo.getAttribute("id"))
|
||||
data.languages = Array.from(
|
||||
userInfo.getElementsByTagName("languages")[0].getElementsByTagName("lang")
|
||||
).map((l) => l.textContent)
|
||||
data.csCount = Number.parseInt(
|
||||
userInfo.getElementsByTagName("changesets")[0].getAttribute("count") ?? 0
|
||||
userInfo.getElementsByTagName("changesets")[0].getAttribute("count") ?? "0"
|
||||
)
|
||||
data.tracesCount = Number.parseInt(
|
||||
userInfo.getElementsByTagName("traces")[0].getAttribute("count") ?? 0
|
||||
userInfo.getElementsByTagName("traces")[0].getAttribute("count") ?? "0"
|
||||
)
|
||||
|
||||
data.img = undefined
|
||||
|
|
|
@ -42,6 +42,10 @@ export default class UserRelatedState {
|
|||
public readonly showCrosshair: UIEventSource<"yes" | undefined>
|
||||
public readonly fixateNorth: UIEventSource<undefined | "yes">
|
||||
public readonly homeLocation: FeatureSource
|
||||
/**
|
||||
* The language as saved into the preferences of the user, if logged in.
|
||||
* Note that this is _different_ from the languages a user can set via the osm.org interface here: https://www.openstreetmap.org/preferences
|
||||
*/
|
||||
public readonly language: UIEventSource<string>
|
||||
public readonly preferredBackgroundLayer: UIEventSource<
|
||||
string | "photo" | "map" | "osmbasedmap" | undefined
|
||||
|
@ -134,7 +138,7 @@ export default class UserRelatedState {
|
|||
return
|
||||
}
|
||||
|
||||
this.language.addCallbackAndRunD((language) => Locale.language.setData(language))
|
||||
this.language.syncWith(Locale.language)
|
||||
}
|
||||
|
||||
private static initUserRelatedState(): LayerConfig {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue