forked from MapComplete/MapComplete
Android: Small fixes to landing page and passthrough
This commit is contained in:
parent
baa7379fbf
commit
77f4bc84aa
12 changed files with 55 additions and 31 deletions
|
|
@ -54,7 +54,6 @@ interface OsmUserInfo {
|
|||
}
|
||||
|
||||
export default interface UserDetails {
|
||||
loggedIn: boolean
|
||||
name: string
|
||||
uid: number
|
||||
csCount: number
|
||||
|
|
@ -165,7 +164,6 @@ export class OsmConnection {
|
|||
const ud = this.userDetails.data
|
||||
ud.csCount = 5678
|
||||
ud.uid = 42
|
||||
ud.loggedIn = true
|
||||
ud.unreadMessages = 0
|
||||
ud.name = "Fake user"
|
||||
ud.totalMessages = 42
|
||||
|
|
@ -236,7 +234,6 @@ export class OsmConnection {
|
|||
|
||||
public LogOut() {
|
||||
this.auth.logout()
|
||||
this.userDetails.data.loggedIn = false
|
||||
this.userDetails.data.csCount = 0
|
||||
this.userDetails.data.name = ""
|
||||
this.userDetails.ping()
|
||||
|
|
@ -296,7 +293,6 @@ export class OsmConnection {
|
|||
name: user.display_name,
|
||||
csCount: user.changesets.count,
|
||||
description: user.description,
|
||||
loggedIn: true,
|
||||
backend: this.Backend(),
|
||||
home: user.home,
|
||||
languages: user.languages,
|
||||
|
|
|
|||
|
|
@ -279,7 +279,7 @@ export class OsmPreferences {
|
|||
* @private
|
||||
*/
|
||||
private deleteKeyDirectly(k: string) {
|
||||
if (!this.osmConnection.userDetails.data.loggedIn) {
|
||||
if (!this.osmConnection.isLoggedIn.data) {
|
||||
console.debug(`Not saving preference ${k}: user not logged in`)
|
||||
return
|
||||
}
|
||||
|
|
@ -312,7 +312,7 @@ export class OsmPreferences {
|
|||
* Deletes it if 'v' is undefined, null or empty
|
||||
*/
|
||||
private async uploadKeyDirectly(k: string, v: string) {
|
||||
if (!this.osmConnection.userDetails.data.loggedIn) {
|
||||
if (!this.osmConnection.isLoggedIn.data) {
|
||||
console.debug(`Not saving preference ${k}: user not logged in`)
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,9 +14,11 @@ const DatabridgePluginSingleton = registerPlugin<DatabridgePlugin>("Databridge",
|
|||
web: () => {
|
||||
return <DatabridgePlugin>{
|
||||
async request(options: { key: string }): Promise<{ value: string | object }> {
|
||||
console.log("Android polyfill got request for", options.key)
|
||||
if (options.key === "meta") {
|
||||
return { value: "web" }
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -65,6 +67,12 @@ export class AndroidPolyfill {
|
|||
console.log("Registering back button callback", callback)
|
||||
DatabridgePluginSingleton.request({ key: "backbutton" }).then(ev => {
|
||||
console.log("AndroidPolyfill: received backbutton: ", ev)
|
||||
if(ev === null){
|
||||
// Probably in web environment
|
||||
return
|
||||
}
|
||||
// We have to re-register every time
|
||||
AndroidPolyfill.onBackButton(callback, options)
|
||||
if (callback()) {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,10 @@ export default class ThemeViewStateHashActor {
|
|||
state.previewedImage.setData(undefined)
|
||||
return true
|
||||
}
|
||||
if(state.searchState.showSearchDrawer.data){
|
||||
state.searchState.showSearchDrawer.set(false)
|
||||
return true
|
||||
}
|
||||
if (state.guistate.closeAll()) {
|
||||
return true
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue