<commit_before>'use strict';

/*
 * Controller which handles the actual video call part of the app
 * Sets up the canvases, and sets up the correct data callbacks and such...
 */

angular.module('call', ['peerhandler', 'drawinghandler'])

.controller('CallCtrl', function($scope, $sce, $stateParams, peerFactory, drawingFactory) {
            if ($stateParams && $stateParams.user) {
                    $scope.user = $stateParams.user;
            } else {
                    $scope.user = { displayName: '?????'};
            }

            //TODO: Refactor this into something more elegant
            $scope.toggleFullscreen = function (canvasId) {
                if ($scope.currentFullscreenCanvas === canvasId) {
                    $scope.currentFullscreenCanvas = null;
                    drawingFactory.zoomOutCanvasByTag(canvasId);
                    switch (canvasId) {
                        case 'local':
                            document.querySelector('#local-wrapper').classList.remove('fullscreen');
                            document.querySelector('#remote-wrapper').style.display = '';
                        break;
                        case 'remote':
                            document.querySelector('#remote-wrapper').classList.remove('fullscreen');
                            document.querySelector('#local-wrapper').style.display = '';
                        break;
                    }
                } else {
                    drawingFactory.zoomInCanvasByTag(canvasId);
                    $scope.currentFullscreenCanvas = canvasId;
                    switch (canvasId) {
                        case 'local':
                            document.querySelector('#local-wrapper').classList.add('fullscreen');
                            document.querySelector('#remote-wrapper').style.display = 'none';
                        break;
                        case 'remote':
                            document.querySelector('#remote-wrapper').classList.add('fullscreen');
                            document.querySelector('#local-wrapper').style.display = 'none';
                        break;
                    }
                }

            }

            var localStreamSrc = peerFactory.getLocalStreamSrc();
            var remoteStreamSrc = peerFactory.getRemoteStreamSrc();

            // Sweet hack for browser if you can't be bothered to make a call
            if (localStreamSrc === null) {localStreamSrc = 'res/img/SampleVideo_1080x720_10mb.mp4'}
            if (remoteStreamSrc === null) {remoteStreamSrc = 'res/img/SampleVideo_1080x720_10mb.mp4'}
<commit_msg>Don't requery call wrappers every time they're used<commit_after>'use strict';

/*
 * Controller which handles the actual video call part of the app
 * Sets up the canvases, and sets up the correct data callbacks and such...
 */

angular.module('call', ['peerhandler', 'drawinghandler'])

.controller('CallCtrl', function($scope, $sce, $stateParams, peerFactory, drawingFactory) {
            if ($stateParams && $stateParams.user) {
                    $scope.user = $stateParams.user;
            } else {
                    $scope.user = { displayName: '?????'};
            }

            var localWrapper  = document.querySelector('#local-wrapper');
            var remoteWrapper = document.querySelector('#remote-wrapper');

            //TODO: Refactor this into something more elegant
            $scope.toggleFullscreen = function (canvasId) {
                if ($scope.currentFullscreenCanvas === canvasId) {

                    $scope.currentFullscreenCanvas = null;
                    drawingFactory.zoomOutCanvasByTag(canvasId);

                    switch (canvasId) {
                        case 'local':
                            localWrapper.classList.remove('fullscreen');
                            remoteWrapper.style.display = '';
                        break;
                        case 'remote':
                            remoteWrapper.classList.remove('fullscreen');
                            localWrapper.style.display = '';
                        break;
                    }
                } else {

                    drawingFactory.zoomInCanvasByTag(canvasId);
                    $scope.currentFullscreenCanvas = canvasId;

                    switch (canvasId) {
                        case 'local':
                           localWrapper.classList.add('fullscreen');
                            remoteWrapper.style.display = 'none';
                        break;
                        case 'remote':
                            remoteWrapper.classList.add('fullscreen');
                            localWrapper.style.display = 'none';
                        break;
                    }
                }

            }

            var localStreamSrc = peerFactory.getLocalStreamSrc();
            var remoteStreamSrc = peerFactory.getRemoteStreamSrc();

            // Sweet hack for browser if you can't be bothered to make a call
            if (localStreamSrc === null) {localStreamSrc = 'res/img/SampleVideo_1080x720_10mb.mp4'}
            if (remoteStreamSrc === null) {remoteStreamSrc = 'res/img/SampleVideo_1080x720_10mb.mp4'}

{'fraction_non_alphanumeric': 0.10155202146004982, 'fraction_numerical': 0.007664303506418854, 'mean_word_length': 1.5035971223021583, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1248713', 'n_tokens_mistral': 1218, 'n_tokens_neox': 1154, 'n_words': 249}