<commit_before>// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'pascalprecht.translate'])

.run(function($ionicPlatform, $rootScope) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }

    if(ionic.Platform.device().platform == undefined){
       $rootScope.apiUrl = "/api";
    } else {
       $rootScope.apiUrl = "http://medievales.visitapp.ch/API";
    }
/*
    // Schedule notification for tomorrow to remember about the meeting
    cordova.plugins.notification.local.schedule({
        text: "Wake up!",
        sound: "file://data/seb.mp3",
        every: 2 // every 30 minutes
    });
*/

  });
})

.config(function($stateProvider, $urlRouterProvider, $translateProvider) {
  $stateProvider

    .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html',
    controller: 'AppCtrl'
  })

  .state('app.accueil', {
    url: '/accueil',
    views: {<commit_msg>Notifications automatique 1h avant un événement<commit_after>// Ionic Starter App

// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.controllers' is found in controllers.js
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'pascalprecht.translate'])

.run(function($ionicPlatform, $rootScope, programmesService) {
  $ionicPlatform.ready(function() {
    // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
    // for form inputs)
    if (window.cordova && window.cordova.plugins.Keyboard) {
      cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
      cordova.plugins.Keyboard.disableScroll(true);

    }
    if (window.StatusBar) {
      // org.apache.cordova.statusbar required
      StatusBar.styleDefault();
    }

    if(ionic.Platform.device().platform == undefined){
       $rootScope.apiUrl = "/api";
    } else {
       $rootScope.apiUrl = "http://medievales.visitapp.ch/API";
    }

    /*
    cordova.plugins.notification.local.schedule({
          id: i,
          title: "Evenement dans 1 heure",
          text: data[i].name,
          at: data[i].start,
          icon: "res://icon.png"
        });
        */

    if (window.cordova){

      cordova.plugins.notification.local.cancelAll(function() {}, this);

      programmesService.get(function (data) {
        var events = [];
        for (var i = 0; i < data.length; i++) {
          
           // Split timestamp into [ Y, M, D, h, m, s ]
          var t = data[i].start.split(/[- :]/);
          // Apply each element to the Date function
          var d = new Date(t[0], t[1]-1, t[2], t[3], t[4], t[5]);

          var now = new Date().getTime();
          if(d > now){
            events.push({
              id: i,
              title: "Événement dans 1 heure",
              text: data[i].name,
              at: d - (60*60*1000),
              icon: "res://icon.png"
            });
          }
        }

        cordova.plugins.notification.local.schedule(events);
      });
           
    }
    
  


  });
})

.config(function($stateProvider, $urlRouterProvider, $translateProvider) {
  $stateProvider
  .state('app', {
    url: '/app',
    abstract: true,
    templateUrl: 'templates/menu.html',
    controller: 'AppCtrl'
  })

  .state('app.accueil', {
    url: '/accueil',
    views: {
{'fraction_non_alphanumeric': 0.14014251781472684, 'fraction_numerical': 0.0059382422802850355, 'mean_word_length': 2.5595942519019443, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, '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': '565887', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1244, 'n_words': 319}