import Auth = require('./authentication/auth.mod'); import Core = require('./core/core.mod'); import FlightList = require('./flight-list/flight-list.mod'); import FlightDetail from './flight-detail/flight-detail.mod'; import SiteSelection = require('./site-selection/site-selection.mod'); import {Mod as WindowList} from './window-list/window-list.mod'; export class App { static appName: string = 'chroma.app'; dep: Array = ['ui.router', 'ionic', 'ngCookies', 'ngIOS9UIWebViewPatch', 'chroma.templates', 'chroma.configuration', 'chroma.framework']; mods: Array = [ Core.Mod.$componentName, Auth.Mod.$componentName, FlightList.Mod.$componentName, FlightDetail.$componentName, SiteSelection.Mod.$componentName, WindowList.$componentName ]; auth: Auth.Mod; core: Core.Mod; flightList: FlightList.Mod; flightDetail: FlightDetail; SiteSelection: SiteSelection.Mod; windowList: WindowList; constructor(angular: ng.IAngularStatic) { this.auth = new Auth.Mod(angular); this.core = new Core.Mod(angular); this.flightList = new FlightList.Mod(angular); this.flightDetail = new FlightDetail(angular); this.SiteSelection = new SiteSelection.Mod(angular); this.windowList = new WindowList(angular); angular.module(App.appName, this.dep.concat(this.mods)).config(( $ionicConfigProvider: ionic.utility.IonicConfigProvider, $compileProvider: ng.ICompileProvider, $httpProvider: ng.IHttpProvider, $provide: any) => { $ionicConfigProvider.navBar.alignTitle('center'); $ionicConfigProvider.views.maxCache(0); $httpProvider.defaults.withCredentials = true; $compileProvider.debugInfoEnabled(false); $provide.decorator('$exceptionHandler', ['$delegate', '$injector', ($delegate, $injector) => (exception, cause) => { $delegate(exception, cause); let alertBox: ionic.popup.IonicPopupService = $injector.get('$ionicPopup'); let instance: ionic.popup.IonicPopupPromise = alertBox.show({ template: `
${exception}
Restarting the AODB is recommended.
`, title: 'Unexpected Error', buttons: [ { text: 'Continue', onTap: (e) => { instance.close(); } }, { text: 'Close App', type: 'button-assertive', onTap: function(e) { let ionicInstance: any = ionic; ionicInstance.Platform.exitApp(); } } ] }); }]); }).run(function($ionicPlatform) { $ionicPlatform.registerBackButtonAction(function(e) { e.preventDefault(); return false; }, 101); }); angular.bootstrap(document, [App.appName]); if (typeof hockeyapp !== 'undefined') { hockeyapp.start(null, null, '8ca6b61ff4374109b416a476ceb29688'); } } }