<commit_before>﻿/// <reference path="../../foundation.core.htmlclient/foundation.core.d.ts" />
module Foundation.ViewModel.Implementations {

    let dependencyManager = Foundation.Core.DependencyManager.getCurrent();

    export class DefaultAngularAppInitialization implements Core.Contracts.IAppEvents {

        public constructor(public pathProvider = dependencyManager.resolveObject<Contracts.IPathProvider>("PathProvider"), public dateTimeService = dependencyManager.resolveObject<Contracts.IDateTimeService>("DateTimeService"), public angularConfigs = dependencyManager.resolveAllObjects<Contracts.IAngularConfiguration>("AngularConfiguration"), public securityService = dependencyManager.resolveObject<Core.Contracts.ISecurityService>("SecurityService"), public logger = dependencyManager.resolveObject<Core.Contracts.ILogger>("Logger"), public clientAppProfileManager = dependencyManager.resolveObject<Core.ClientAppProfileManager>("ClientAppProfileManager")) {
            this.clientAppProfile = clientAppProfileManager.getClientAppProfile();
        }

        private clientAppProfile: Core.Contracts.IClientAppProfile;

        protected getBaseModuleDependencies(): Array<string> {
            return [];
        }

        protected async onAppRun(app: angular.IModule): Promise<void> {

        }

        protected async registerValues(app: angular.IModule): Promise<void> {
            app.value("$routerRootComponent", "app");
        }

        protected async registerComponents(app: any): Promise<void> {

            const dependencyManager = Core.DependencyManager.getCurrent();

            const formViewModelDependencies = dependencyManager.getAllFormViewModelsDependencies();

            formViewModelDependencies.forEach(vm => {

                let original$routerOnActivate = vm.class.prototype.$routerOnActivate;

                let original$routerCanActivate = vm.class.prototype.$routerCanActivate;

                vm.class.prototype.$routerOnActivate = async function () {

                    let canActivate = original$routerCanActivate == null || await original$routerCanActivate.apply(this, arguments);

                    if (canActivate == false)
                        throw new Error("Can't activate view model");

                    if (original$routerOnActivate != null) {
                        return await original$routerOnActivate.apply(this, arguments);
                    }<commit_msg>Remove usages of argumens in overrided async method because of typescript 2.1 breaking changes<commit_after>﻿/// <reference path="../../foundation.core.htmlclient/foundation.core.d.ts" />
module Foundation.ViewModel.Implementations {

    let dependencyManager = Foundation.Core.DependencyManager.getCurrent();

    export class DefaultAngularAppInitialization implements Core.Contracts.IAppEvents {

        public constructor(public pathProvider = dependencyManager.resolveObject<Contracts.IPathProvider>("PathProvider"), public dateTimeService = dependencyManager.resolveObject<Contracts.IDateTimeService>("DateTimeService"), public angularConfigs = dependencyManager.resolveAllObjects<Contracts.IAngularConfiguration>("AngularConfiguration"), public securityService = dependencyManager.resolveObject<Core.Contracts.ISecurityService>("SecurityService"), public logger = dependencyManager.resolveObject<Core.Contracts.ILogger>("Logger"), public clientAppProfileManager = dependencyManager.resolveObject<Core.ClientAppProfileManager>("ClientAppProfileManager")) {
            this.clientAppProfile = clientAppProfileManager.getClientAppProfile();
        }

        private clientAppProfile: Core.Contracts.IClientAppProfile;

        protected getBaseModuleDependencies(): Array<string> {
            return [];
        }

        protected async onAppRun(app: angular.IModule): Promise<void> {

        }

        protected async registerValues(app: angular.IModule): Promise<void> {
            app.value("$routerRootComponent", "app");
        }

        protected async registerComponents(app: any): Promise<void> {

            const dependencyManager = Core.DependencyManager.getCurrent();

            const formViewModelDependencies = dependencyManager.getAllFormViewModelsDependencies();

            formViewModelDependencies.forEach(vm => {

                let original$routerOnActivate = vm.class.prototype.$routerOnActivate;

                let original$routerCanActivate = vm.class.prototype.$routerCanActivate;

                vm.class.prototype.$routerOnActivate = async function (prev, next) {

                    let canActivate = original$routerCanActivate == null || await original$routerCanActivate.call(this, [next, prev])

                    if (canActivate == false)
                        throw new Error("Can't activate view model");

                    if (original$routerOnActivate != null) {
                        return await original$routerOnActivate.call(this, [next, prev]);
                    }
{'fraction_non_alphanumeric': 0.09406337745687926, 'fraction_numerical': 0.00040112314480545525, 'mean_word_length': 3.492792792792793, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 27, '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': '3234287', 'n_tokens_mistral': 1171, 'n_tokens_neox': 1121, 'n_words': 211}