forked from MapComplete/MapComplete
Merge develop
This commit is contained in:
commit
87a061bdd4
4 changed files with 17 additions and 13 deletions
|
@ -135,7 +135,7 @@ export class OsmConnection {
|
|||
oauth_token?: UIEventSource<string>
|
||||
// Used to keep multiple changesets open and to write to the correct changeset
|
||||
singlePage?: boolean
|
||||
attemptLogin?: true | boolean
|
||||
attemptLogin?: boolean
|
||||
/**
|
||||
* If true: automatically check if we're still online every 5 minutes + fetch messages
|
||||
*/
|
||||
|
@ -183,9 +183,9 @@ export class OsmConnection {
|
|||
|
||||
this._dryRun = options.dryRun ?? new UIEventSource<boolean>(false)
|
||||
|
||||
this.createAuthObject()
|
||||
this.updateAuthObject(false)
|
||||
AndroidPolyfill.inAndroid.addCallback(() => {
|
||||
this.createAuthObject()
|
||||
this.updateAuthObject(false)
|
||||
})
|
||||
if (!this.fakeUser) {
|
||||
this.CheckForMessagesContinuously()
|
||||
|
@ -261,8 +261,7 @@ export class OsmConnection {
|
|||
console.log("AttemptLogin called, but ignored as fakeUser is set")
|
||||
return
|
||||
}
|
||||
|
||||
console.log("Trying to log in...")
|
||||
this.updateAuthObject(true)
|
||||
LocalStorageSource.get("location_before_login").setData(
|
||||
Utils.runningFromConsole ? undefined : window.location.href,
|
||||
)
|
||||
|
@ -577,8 +576,7 @@ export class OsmConnection {
|
|||
await this.loadUserInfo()
|
||||
|
||||
}
|
||||
|
||||
private createAuthObject() {
|
||||
private updateAuthObject(autoLogin: boolean) {
|
||||
let redirect_uri = Utils.runningFromConsole
|
||||
? "https://mapcomplete.org/land.html"
|
||||
: window.location.protocol + "//" + window.location.host + "/land.html"
|
||||
|
@ -594,7 +592,7 @@ export class OsmConnection {
|
|||
* However, this breaks in iframes so we open a popup in that case
|
||||
*/
|
||||
singlepage: !this._iframeMode && !AndroidPolyfill.inAndroid.data,
|
||||
auto: false,
|
||||
auto: autoLogin,
|
||||
apiUrl: this._oauth_config.api_url ?? this._oauth_config.url,
|
||||
})
|
||||
if (AndroidPolyfill.inAndroid.data) {
|
||||
|
|
|
@ -209,7 +209,10 @@ export class OsmPreferences {
|
|||
* Bulk-downloads all preferences
|
||||
* @private
|
||||
*/
|
||||
private getPreferencesDictDirectly(): Promise<Record<string, string>> {
|
||||
private async getPreferencesDictDirectly(): Promise<Record<string, string>> {
|
||||
if(!this.osmConnection.isLoggedIn.data){
|
||||
return {}
|
||||
}
|
||||
return new Promise<Record<string, string>>((resolve, reject) => {
|
||||
this.auth.xhr(
|
||||
{
|
||||
|
@ -257,6 +260,9 @@ export class OsmPreferences {
|
|||
*
|
||||
*/
|
||||
private async uploadKvSplit(k: string, v: string) {
|
||||
if(!this.osmConnection.isLoggedIn.data){
|
||||
return
|
||||
}
|
||||
if (v === null || v === undefined || v === "" || v === "undefined" || v === "null") {
|
||||
const keysToDelete = OsmPreferences.keysStartingWith(this.seenKeys, k)
|
||||
await Promise.all(keysToDelete.map((k) => this.deleteKeyDirectly(k)))
|
||||
|
@ -280,7 +286,7 @@ export class OsmPreferences {
|
|||
*/
|
||||
private deleteKeyDirectly(k: string) {
|
||||
if (!this.osmConnection.isLoggedIn.data) {
|
||||
console.debug(`Not saving preference ${k}: user not logged in`)
|
||||
console.debug(`Not deleting preference ${k}: user not logged in`)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import SvelteUIElement from "./Base/SvelteUIElement"
|
||||
import { default as StatisticsSvelte } from "../UI/Statistics/StatisticsGui.svelte"
|
||||
|
||||
new SvelteUIElement(StatisticsSvelte).AttachTo("main")
|
||||
const target = document.getElementById("main")
|
||||
target.innerHTML = ""
|
||||
new StatisticsSvelte({ target })
|
||||
|
|
|
@ -54,7 +54,6 @@ async function main() {
|
|||
DetermineTheme.getTheme(),
|
||||
await getAvailableLayers(),
|
||||
])
|
||||
availableLayers?.delete("cycle_highways") // TODO remove after next cache.mapcomplete.org update
|
||||
console.log("The available layers on server are", Array.from(availableLayers))
|
||||
const state = new ThemeViewState(theme, availableLayers)
|
||||
const target = document.getElementById("maindiv")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue