forked from MapComplete/MapComplete
UX: don't check for messages and being online every 5m in studio, fix #1830
This commit is contained in:
parent
040e0fd8bf
commit
45f7043131
2 changed files with 11 additions and 1 deletions
|
@ -52,6 +52,7 @@ export class OsmConnection {
|
||||||
private readonly _iframeMode: Boolean | boolean
|
private readonly _iframeMode: Boolean | boolean
|
||||||
private readonly _singlePage: boolean
|
private readonly _singlePage: boolean
|
||||||
private isChecking = false
|
private isChecking = false
|
||||||
|
private readonly _doCheckRegularly
|
||||||
|
|
||||||
constructor(options?: {
|
constructor(options?: {
|
||||||
dryRun?: Store<boolean>
|
dryRun?: Store<boolean>
|
||||||
|
@ -59,12 +60,17 @@ export class OsmConnection {
|
||||||
oauth_token?: UIEventSource<string>
|
oauth_token?: UIEventSource<string>
|
||||||
// Used to keep multiple changesets open and to write to the correct changeset
|
// Used to keep multiple changesets open and to write to the correct changeset
|
||||||
singlePage?: boolean
|
singlePage?: boolean
|
||||||
attemptLogin?: true | boolean
|
attemptLogin?: true | boolean,
|
||||||
|
/**
|
||||||
|
* If true: automatically check if we're still online every 5 minutes + fetch messages
|
||||||
|
*/
|
||||||
|
checkOnlineRegularly?: true | boolean
|
||||||
}) {
|
}) {
|
||||||
options ??= {}
|
options ??= {}
|
||||||
this.fakeUser = options?.fakeUser ?? false
|
this.fakeUser = options?.fakeUser ?? false
|
||||||
this._singlePage = options?.singlePage ?? true
|
this._singlePage = options?.singlePage ?? true
|
||||||
this._oauth_config = Constants.osmAuthConfig
|
this._oauth_config = Constants.osmAuthConfig
|
||||||
|
this._doCheckRegularly = options?.checkOnlineRegularly ?? true
|
||||||
console.debug("Using backend", this._oauth_config.url)
|
console.debug("Using backend", this._oauth_config.url)
|
||||||
this._iframeMode = Utils.runningFromConsole ? false : window !== window.top
|
this._iframeMode = Utils.runningFromConsole ? false : window !== window.top
|
||||||
|
|
||||||
|
@ -544,6 +550,9 @@ export class OsmConnection {
|
||||||
if (this.isChecking) {
|
if (this.isChecking) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if(!this._doCheckRegularly){
|
||||||
|
return
|
||||||
|
}
|
||||||
this.isChecking = true
|
this.isChecking = true
|
||||||
Stores.Chronic(5 * 60 * 1000).addCallback((_) => {
|
Stores.Chronic(5 * 60 * 1000).addCallback((_) => {
|
||||||
if (self.isLoggedIn.data) {
|
if (self.isLoggedIn.data) {
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
)
|
)
|
||||||
let osmConnection = new OsmConnection({
|
let osmConnection = new OsmConnection({
|
||||||
oauth_token,
|
oauth_token,
|
||||||
|
checkOnlineRegularly: false
|
||||||
})
|
})
|
||||||
const expertMode = UIEventSource.asBoolean(
|
const expertMode = UIEventSource.asBoolean(
|
||||||
osmConnection.GetPreference("studio-expert-mode", "false", {
|
osmConnection.GetPreference("studio-expert-mode", "false", {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue