From 6f252ea40f8879c92b203222f5d73006f51acade Mon Sep 17 00:00:00 2001 From: Janokisu <54418395+Janokisu@users.noreply.github.com> Date: Tue, 11 Oct 2022 16:05:37 +0200 Subject: [PATCH] Eingehende Anrufe anzeigen Zeigt eingehenden Anruf an: - Icon blinkt blau - Im Popup wird es wie beim Anrufen angezeigt, allerdings mit einem blauem Telefon --- _locales/de/messages.json | 30 +++++++++++++++++++++++++++--- _locales/en/messages.json | 29 ++++++++++++++++++++++++++--- background.js | 17 ++++++++++++----- help/help.html | 4 ++-- help/help_de.html | 2 +- popup.html | 2 +- popup.js | 34 +++++++++++++++++++++++++++++----- tools.js | 17 +++++++++++++++-- 8 files changed, 113 insertions(+), 22 deletions(-) diff --git a/_locales/de/messages.json b/_locales/de/messages.json index 41dc3f4..ffc50ea 100644 --- a/_locales/de/messages.json +++ b/_locales/de/messages.json @@ -197,7 +197,7 @@ }, "test_CallMon": { - "message": "Teste CallMon", + "message": "Teste CallMonitor", "description": "" }, @@ -360,7 +360,7 @@ } }, - "pop_callingNumberText_Number": { + "pop_callingNumberText_Number_out": { "message": "Nummer $number$ wird angerufen", "description": "", "placeholders": { @@ -370,7 +370,7 @@ } }, - "pop_callingNumberText_Name": { + "pop_callingNumberText_Name_out": { "message": "'$name$' ($number$) wird angerufen", "description": "", "placeholders": { @@ -383,6 +383,30 @@ } }, + "pop_callingNumberText_Number_in": { + "message": "Nummer $number$ ruft dich an", + "description": "", + "placeholders": { + "number" : { + "content" : "$1" + } + } + }, + + "pop_callingNumberText_Name_in": { + "message": "'$name$' ($number$) ruft dich an", + "description": "", + "placeholders": { + "number" : { + "content" : "$1" + }, + "name" : { + "content" : "$2" + } + } + }, + + "pop_connectingNumberText_Number": { "message": "Verbindung zur Nummer $number$ wird aufgebaut", "description": "", diff --git a/_locales/en/messages.json b/_locales/en/messages.json index aa1b930..4cbd026 100644 --- a/_locales/en/messages.json +++ b/_locales/en/messages.json @@ -197,7 +197,7 @@ }, "test_CallMon": { - "message": "Testing CallMon", + "message": "Testing CallMonitor", "description": "" }, @@ -360,7 +360,7 @@ } }, - "pop_callingNumberText_Number": { + "pop_callingNumberText_Number_out": { "message": "Calling number $number$", "description": "", "placeholders": { @@ -370,7 +370,7 @@ } }, - "pop_callingNumberText_Name": { + "pop_callingNumberText_Name_out": { "message": "Calling '$name$' ($number$)", "description": "", "placeholders": { @@ -383,6 +383,29 @@ } }, + "pop_callingNumberText_Number_in": { + "message": "Number $number$ is calling", + "description": "", + "placeholders": { + "number" : { + "content" : "$1" + } + } + }, + + "pop_callingNumberText_Name_in": { + "message": "'$name$' ($number$) is calling", + "description": "", + "placeholders": { + "number" : { + "content" : "$1" + }, + "name" : { + "content" : "$2" + } + } + }, + "pop_connectingNumberText_Number": { "message": "Establishing connection to number $number$", "description": "", diff --git a/background.js b/background.js index a243202..7235bb4 100644 --- a/background.js +++ b/background.js @@ -403,6 +403,8 @@ function work(info){ //note(wer + " ruft" + extra + " an"); note( browser.i18n.getMessage("ring_text", [wer, extra]) ); ruf(true); + Listener_Dial = [2, info[4]]; + blink_connecting("on", 2); } break; @@ -627,7 +629,7 @@ function callNumber(number, sendResponse){ }).then(function(){ console.info("Calling number: " + number); Listener_Dial = [0, number]; - blink_connecting("on"); + blink_connecting("on", 1); if(GL_PythonListen.isRunning() == false){ //console.log("set Time connectingStopped"); @@ -733,10 +735,14 @@ function blink_missed(x){ let blink_connecting_toggle = 0; let blink_connecting_interval = 0; -function blink_connecting(x){ - +function blink_connecting(x, out_in){ + //out_in 1=du rufst an; 2=du wirst angerufen + if(blink_connecting_toggle){ - browser.browserAction.setBadgeBackgroundColor({color: "#00CC00"}); + if(out_in == 1) browser.browserAction.setBadgeBackgroundColor({color: "#00CC00"}); + else if(out_in == 2) browser.browserAction.setBadgeBackgroundColor({color: "#0000CC"}); + console.info("out_in", out_in) + browser.browserAction.setBadgeText({text: "📞"}); blink_connecting_toggle = 0; } @@ -748,9 +754,10 @@ function blink_connecting(x){ if(x != ""){ if(x == "on"){ + clearInterval(blink_connecting_interval); blink_connecting_interval = setInterval(() => { - blink_connecting(); + blink_connecting("", out_in); }, 1000); } else if(x == "off"){ diff --git a/help/help.html b/help/help.html index fd8edf9..f164d57 100644 --- a/help/help.html +++ b/help/help.html @@ -28,8 +28,8 @@