@@ -154,8 +154,9 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS
154154 }
155155 } ;
156156
157- // Cache .
157+ // Data voids .
158158 var cache = { } ;
159+ var resurrect = null ;
159160
160161 $scope . update = function ( user , noRefresh ) {
161162 $scope . master = angular . copy ( user ) ;
@@ -171,6 +172,10 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS
171172 $scope . $emit ( "status" , status ) ;
172173 } ;
173174
175+ $scope . getStatus = function ( ) {
176+ return $scope . status ;
177+ } ;
178+
174179 $scope . updateStatus = ( function ( ) {
175180 return function ( ) {
176181 // This is the user status.
@@ -387,9 +392,22 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS
387392 mediaStream . api . sendSelf ( ) ;
388393 } , data . Turn . ttl / 100 * 90 * 1000 ) ;
389394 }
395+ // Support resurrection shrine.
396+ if ( resurrect ) {
397+ var resurrection = resurrect ;
398+ resurrect = null ;
399+ $timeout ( function ( ) {
400+ if ( resurrection . id === $scope . id ) {
401+ console . log ( "Using resurrection shrine" , resurrection ) ;
402+ // Valid resurrection.
403+ $scope . setStatus ( resurrection . status ) ;
404+ }
405+ } , 0 ) ;
406+ }
390407 } ) ;
391408
392409 mediaStream . webrtc . e . on ( "peercall" , function ( event , peercall ) {
410+
393411 // Kill timeout.
394412 $timeout . cancel ( pickupTimeout ) ;
395413 pickupTimeout = null ;
@@ -466,6 +484,14 @@ define(['underscore', 'bigscreen', 'moment', 'webrtc.adapter'], function(_, BigS
466484
467485 var reconnect = function ( ) {
468486 if ( connected && autoreconnect ) {
487+ if ( resurrect == null ) {
488+ // Storage data at the resurrection shrine.
489+ resurrect = {
490+ status : $scope . getStatus ( ) ,
491+ id : $scope . id
492+ }
493+ console . log ( "Stored data at the resurrection shrine" , resurrect ) ;
494+ }
469495 reconnecting = false ;
470496 _ . delay ( function ( ) {
471497 if ( autoreconnect && ! reconnecting ) {
0 commit comments