Skip to content

Commit

Permalink
show notification for incoming calls
Browse files Browse the repository at this point in the history
  • Loading branch information
liamcottle committed Jul 31, 2024
1 parent 73b9639 commit cac6803
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions meshchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ async def announce_loop(self):
# handle receiving a new audio call
def on_incoming_audio_call(self, audio_call: AudioCall):
print("on_incoming_audio_call: {}".format(audio_call.link.hash.hex()))
asyncio.run(self.websocket_broadcast(json.dumps({
"type": "incoming_audio_call",
})))

# web server has shutdown, likely ctrl+c, but if we don't do the following, the script never exits
async def shutdown(self, app):
Expand Down
11 changes: 11 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,17 @@
this.getConfig();
break;
}
case 'incoming_audio_call': {
Notification.requestPermission().then((result) => {
if(result === "granted"){
new window.Notification("Incoming Call", {
body: "Someone is calling you.",
tag: "new_audio_call", // only ever show one notification at a time
});
}
});
break;
}
case 'lxmf.delivery': {

// add inbound message to ui
Expand Down

0 comments on commit cac6803

Please sign in to comment.