<commit_before>(function () {
    'use strict';

    angular
        .module('app')
        .controller('ComicDetailController', ComicDetailController);

    function ComicDetailController($log, $stateParams, $scope, utils) {

        var vm = this;
        vm.title = 'ComicDetailController';
        vm.comic = $stateParams.comic;
        vm.openDetailPage = openDetailPage;
        vm.remove = remove;
        vm.toggleContent = toggleContent;
        vm.showViewer = showViewer;

        activate();

        ////////////////

        function activate() {
            $log.debug(vm.title + ' instantiated');
        }

        // Open comic page on marvel.com in default browser.
        function openDetailPage() {
            var open = _.get(window, 'cordova.InAppBrowser.open') || window.open;
            open(vm.comic.detailUrl, '_system');
        }

        function remove(){
            // Little subtlety.
            // For simplicity sake, the modal load a template which define its own controller in the template (this one).
            // As ionicModal create a scope automatically if not provided, it is automatically the parent of the one created for this controller.
            // You should know too that ionicModal will register the created instance as a property of the scope.
            // Thus our parent scope possessing a reference to our modal instance.
            $scope.$parent.modal.remove();
        }

        function toggleContent(){
            vm.hideContent = !vm.hideContent;
        }

        // Show a native viewer with zoom and sharing capabilities.
        function showViewer() {
            // Unfortunately, this plugin doesn't handle cdvfile: url.
            // So I'm converting it to a normal file system url to avoid to download again that image.
            // Plus the plugin doesn't have any error callback, so using the cached file avoid us issues with network.
            utils.cacheFile(vm.comic.thumbnailUrl)
                .then(utils.convertLocalFileSystemURL)
                .then(showNativeViewer)
                .catch(showNativeViewer);
            //////////
            function showNativeViewer(url) {
                PhotoViewer.show(url, vm.comic.title);
            }
        }

    }

})();

<commit_msg>feature/comic-detail — Unnecessary cache processing (already done).<commit_after>(function () {
    'use strict';

    angular
        .module('app')
        .controller('ComicDetailController', ComicDetailController);

    function ComicDetailController($log, $stateParams, $scope) {

        var vm = this;
        vm.title = 'ComicDetailController';
        vm.comic = $stateParams.comic;
        vm.openDetailPage = openDetailPage;
        vm.remove = remove;
        vm.toggleContent = toggleContent;
        vm.showViewer = showViewer;

        activate();

        ////////////////

        function activate() {
            $log.debug(vm.title + ' instantiated');
        }

        // Open comic page on marvel.com in default browser.
        function openDetailPage() {
            var open = _.get(window, 'cordova.InAppBrowser.open') || window.open;
            open(vm.comic.detailUrl, '_system');
        }

        function remove() {
            // Little subtlety.
            // For simplicity sake, the modal load a template which define its own controller in the template (this one).
            // As ionicModal create a scope automatically if not provided, it is automatically the parent of the one created for this controller.
            // You should know too that ionicModal will register the created instance as a property of the scope.
            // Thus our parent scope possessing a reference to our modal instance.
            $scope.$parent.modal.remove();
        }

        function toggleContent() {
            vm.hideContent = !vm.hideContent;
        }

        // Show a native viewer with zoom and sharing capabilities.
        function showViewer() {
            PhotoViewer.show(vm.comic.thumbnailUrlInCache, vm.comic.title);
        }

    }

})();


{'fraction_non_alphanumeric': 0.09899534427836315, 'fraction_numerical': 0.0, 'mean_word_length': 1.943042537851478, '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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4658562', 'n_tokens_mistral': 1031, 'n_tokens_neox': 985, 'n_words': 329}