Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Bug 824788 - Properly handling the case where the active call ends while another call is waiting. #7239

Merged
merged 1 commit into from over 1 year ago

1 participant

Etienne Segonzac
Etienne Segonzac
Collaborator

r=vingtetun

Etienne Segonzac
Collaborator

r+, bb+, merging

Etienne Segonzac etiennesegonzac merged commit 5cb5312 into from December 28, 2012
Etienne Segonzac etiennesegonzac closed this December 28, 2012
Etienne Segonzac etiennesegonzac deleted the branch February 15, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Dec 28, 2012
Etienne Segonzac Bug 824788 - Properly handling the case where the active call ends while
another call is waiting.
r=vingtetun
bdea60a
This page is out of date. Refresh to see the latest.
14  apps/communications/dialer/js/handled_call.js
@@ -183,3 +183,17 @@ HandledCall.prototype.disconnected = function hc_disconnected() {
183 183
   CallScreen.turnSpeakerOff();
184 184
   this.remove();
185 185
 };
  186
+
  187
+HandledCall.prototype.show = function hc_show() {
  188
+  if (!this.node)
  189
+    return;
  190
+
  191
+  this.node.hidden = false;
  192
+};
  193
+
  194
+HandledCall.prototype.hide = function hc_hide() {
  195
+  if (!this.node)
  196
+    return;
  197
+
  198
+  this.node.hidden = true;
  199
+};
25  apps/communications/dialer/js/oncall.js
@@ -234,7 +234,6 @@ var OnCallHandler = (function onCallHandler() {
234 234
 
235 235
       if (!stillHere) {
236 236
         removeCall(index);
237  
-        return;
238 237
       }
239 238
     });
240 239
 
@@ -308,12 +307,32 @@ var OnCallHandler = (function onCallHandler() {
308 307
   }
309 308
 
310 309
   function removeCall(index) {
  310
+    var removedCall = handledCalls[index];
311 311
     handledCalls.splice(index, 1);
312 312
 
313 313
     if (handledCalls.length > 0) {
314  
-      // Resuming the first remaining call
315  
-      handledCalls[0].call.resume();
  314
+      // Only hiding the call if we have another one to display
  315
+      removedCall.hide();
316 316
       CallScreen.hideIncoming();
  317
+
  318
+      var remainingCall = handledCalls[0];
  319
+      if (remainingCall.call.state == 'incoming') {
  320
+        // The active call ended, showing the incoming call
  321
+        remainingCall.show();
  322
+
  323
+        // This is the difference between an endAndAnswer() and
  324
+        // the active call being disconnected while a call is waiting
  325
+        setTimeout(function nextTick() {
  326
+          if (remainingCall.call.state == 'incoming') {
  327
+            CallScreen.render('incoming');
  328
+          };
  329
+        });
  330
+
  331
+        return;
  332
+      }
  333
+
  334
+      // The incoming call was rejected, resuming...
  335
+      remainingCall.call.resume();
317 336
       return;
318 337
     }
319 338
 
4  apps/communications/dialer/style/oncall.css
@@ -184,11 +184,11 @@ body.hidden *[data-l10n-id] {
184 184
 #main-container:before {
185 185
   content: "";
186 186
   position: absolute;
187  
-  top: 9rem;
  187
+  top: 7rem;
188 188
   left: 0;
189 189
   background-color: rgba(0, 0, 0, 0.45);
190 190
   width: 100%;
191  
-  height: calc(100% - 9rem);
  191
+  height: calc(100% - 7rem);
192 192
 }
193 193
 
194 194
 #main-container.transparent:before {
22  apps/communications/dialer/test/unit/handled_call_test.js
@@ -341,6 +341,14 @@ suite('dialer/handled_call', function() {
341 341
       mockCall._disconnect();
342 342
       assert.equal(subject.recentsEntry.type, 'incoming-refused');
343 343
     });
  344
+
  345
+    test('show should do nothing', function() {
  346
+      subject.show(); // will trigger a js error if failing
  347
+    });
  348
+
  349
+    test('hide should do nothing', function() {
  350
+      subject.hide(); // will trigger a js error if failing
  351
+    });
344 352
   });
345 353
 
346 354
   test('should display unknown l10n key', function() {
@@ -367,4 +375,18 @@ suite('dialer/handled_call', function() {
367 375
       assert.equal('', additionalInfoNode.textContent);
368 376
     });
369 377
   });
  378
+
  379
+  suite('explicit visibility', function() {
  380
+    test('calling show should show the node', function() {
  381
+      subject.node.hidden = true;
  382
+      subject.show();
  383
+      assert.isFalse(subject.node.hidden);
  384
+    });
  385
+
  386
+    test('calling hide should hide the node', function() {
  387
+      subject.node.hidden = false;
  388
+      subject.hide();
  389
+      assert.isTrue(subject.node.hidden);
  390
+    });
  391
+  });
370 392
 });
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.