Skip to content

Commit 78cc0a8

Browse files
Version 0.0.18
1 parent 43f1da1 commit 78cc0a8

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Siperb-Web-Phone.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ const Siperb = {
167167
// Resolve but don't return.
168168
resolve(cachedProvisioning);
169169
isResolved = true;
170-
console.log(`GetProvisioning: %cUsing cached Provisioning`, "color: green;");
170+
console.log(`GetProvisioning: %cUsing cached Provisioning`, "color: orange;");
171171
}
172172
catch (error) {
173173
console.log(`GetProvisioning: %cError parsing cached Provisioning: ${error.message}`, "color: red;");
@@ -254,7 +254,15 @@ const Siperb = {
254254
const PhoneWindow = iframeElement.contentWindow;
255255
const phoneDoc = PhoneWindow.document;
256256
// Load the Browser Phone Layer
257-
let phoneVersionTree = await Siperb.LoadVersionTree("https://y3amulnpc5icrmmnmvtfn44zba0ckjuq.lambda-url.eu-west-1.on.aws/", "BROWSER_PHONE_VERSION_TREE");
257+
let treeUrl = "https://y3amulnpc5icrmmnmvtfn44zba0ckjuq.lambda-url.eu-west-1.on.aws/";
258+
if(typeof window !== 'undefined' && typeof window.localStorage !== "undefined"){
259+
if(localStorage.getItem("DEV_MODE") == "yes"){
260+
window.SiperbAPI.DevMode = true;
261+
treeUrl = "https://vgf6bcf26w6wime5enpyflps640yhqmb.lambda-url.eu-west-1.on.aws/";
262+
console.log("LoadBrowserPhone: %cDEV_MODE enabled, using local version tree", "color: green; font-weight: bold;");
263+
}
264+
}
265+
let phoneVersionTree = await Siperb.LoadVersionTree(treeUrl, "BROWSER_PHONE_VERSION_TREE");
258266
if (!phoneVersionTree) {
259267
console.log(`LoadBrowserPhone: %cPhone Version tree could not be loaded`, "color: red;");
260268
return reject("Phone Version tree could not be loaded");
@@ -291,7 +299,7 @@ const Siperb = {
291299
// Check if the version tree is already in localStorage
292300
let isResolved = false;
293301
let versionTree = localStorage.getItem(cacheKey);
294-
if (versionTree) {
302+
if (versionTree && window.SiperbAPI.DevMode !== true) {
295303
// Parse the JSON string to an object
296304
versionTree = JSON.parse(versionTree);
297305
// Resolve the Promise but don't return the function
@@ -309,6 +317,7 @@ const Siperb = {
309317
versionTree = await response.json();
310318
// Save the json data to the localStorage
311319
localStorage.setItem(cacheKey, JSON.stringify(versionTree));
320+
console.log(`LoadVersionTree - ${cacheKey}: %cTree loaded from network`, "color: green;");
312321
if (!isResolved) resolve(versionTree);
313322
}
314323
else {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.17
1+
0.0.18

test-Browser-Phone.html

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<head>
55
<title>Browser Phone Test</title>
66
<!-- Siperb Provisioning UMD build -->
7-
<script src="./dist/Siperb-Provisioning.umd.min.js"></script>
7+
<script src="./dist/Siperb-Web-Phone.umd.min.js"></script>
88
<!-- Include your test script -->
99
<script>
1010
async function main() {
@@ -60,12 +60,13 @@
6060
// Optional Settings
6161
EnableAvatar : true, // Show user avatar/profile picture
6262
EnabledSettings : false, // Show settings button
63-
EnableDialPad : false, // Show dial pad button
63+
EnableDialPad : true, // Show dial pad button
6464
EnableDisplayCallDetailRecords : true, // Show call detail records button
6565
EnableCallTransfer : true, // Enable call transfer feature
6666
EnableCallHold : true, // Enable call hold feature
6767
EnableCallMute : true, // Enable call mute feature
6868
EnableCallRecording : true, // Enable call recording feature
69+
EnableDeviceSelector : true, // Enable media device selection
6970
// Settings normally in settings window
7071
EnableAutoAnswer : false, // Auto answer incoming calls
7172
EnableDoNotDisturb : false, // Do not disturb mode

0 commit comments

Comments
 (0)