Skip to content

Commit

Permalink
add callbacks that allow the frontend to query the current user setti…
Browse files Browse the repository at this point in the history
…ngs after initialization
  • Loading branch information
jannickheisch committed Feb 2, 2024
1 parent 71382aa commit 7a4d1f4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions android/tinySSB/app/src/main/assets/web/tremola.js
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,11 @@ function b2f_new_event(e) { // incoming SSB log event: we get map with three ent
}
}

// backend callback method when calling backend("settings:get")
function b2f_get_settings(settings) {
tremola.settings = settings
}

function b2f_new_contact(fid) {
if ((fid in tremola.contacts)) // do not overwrite existing entry
return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ class WebAppInterface(val act: MainActivity, val webView: WebView) {
"settings:set" -> {
act.settings!!.set(args[1], args[2])
}
"settings:get" -> {
val settings = act.settings!!.getSettings()
act.wai.eval("b2f_get_settings('${settings}')")
}
else -> {
Log.d("onFrontendRequest", "unknown")
}
Expand Down

0 comments on commit 7a4d1f4

Please sign in to comment.