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

	angular
		.module('yapp.services')
		.factory('Dataservice', Dataservice);

	Dataservice.$inject = ['$http', '$q', '$ionicLoading', 'DSCacheFactory'];
	function Dataservice($http, $q, $ionicLoading, DSCacheFactory)
	{
		var hostname = 'http://localhost:8100/api/';

		var service = {
			getNotifications: getNotifications()
		}

		// Caches - Define Offline mode
		var notificationsCache = DSCacheFactory.get('notificationsCache');
		notificationsCache.setOptions({
			onExpire: function(key, value) {
				getNotifications()
					.then(function() {

					}, function() {
						notificationsCache.put(key, value);
					});

			}
		});

		return service;

		function getNotifications() {

			var deferred = $q.defer(),
				notificationsCache = DSCacheFactory.get('notificationsCache'),
				cacheKey = 'notifications',
				notifications = notificationsCache.get(cacheKey);

			if( notifications )
			{
				console.log('Found in Cache');
				deferred.resolve(notifications);	
			}
			else
			{
				$ionicLoading.show({ template: 'Loading...'});

				$http.get(hostname + 'notifications.json')
					.success(function(data, status){
						
						notificationsCache.put(cacheKey, data);
						deferred.resolve(data);

						$ionicLoading.hide();
					})
					.error(function(data, status){
						deferred.reject();

						$ionicLoading.hide();
					});
			}

			return deferred.promise;
		}
	}

})();<commit_msg>Not show Loading when update cache<commit_after>(function(){
	'use strict';

	angular
		.module('yapp.services')
		.factory('Dataservice', Dataservice);

	Dataservice.$inject = ['$http', '$q', '$ionicLoading', 'DSCacheFactory'];
	function Dataservice($http, $q, $ionicLoading, DSCacheFactory)
	{
		var hostname = 'http://localhost:8100/api/';

		var service = {
			getNotifications: getNotifications(false)
		}

		// Caches - Define Offline mode
		var notificationsCache = DSCacheFactory.get('notificationsCache');
		notificationsCache.setOptions({
			onExpire: function(key, value) {
				getNotifications(true)
					.then(function() {

					}, function() {
						notificationsCache.put(key, value);
					});

			}
		});

		return service;

		function getNotifications(loadCache) {

			var deferred = $q.defer(),
				notificationsCache = DSCacheFactory.get('notificationsCache'),
				cacheKey = 'notifications',
				notifications = notificationsCache.get(cacheKey);

			if( notifications )
				deferred.resolve(notifications);
			else
			{
				if( !loadCache )
					$ionicLoading.show({ template: 'Loading...'});

				$http.get(hostname + 'notifications.json')
					.success(function(data, status){
						notificationsCache.put(cacheKey, data);
						deferred.resolve(data);

						if( !loadCache )
							$ionicLoading.hide();
					})
					.error(function(data, status){
						deferred.reject();

						if( !loadCache )
							$ionicLoading.hide();
					});
			}

			return deferred.promise;
		}
	}

})()
{'fraction_non_alphanumeric': 0.150253807106599, 'fraction_numerical': 0.0027072758037225042, 'mean_word_length': 3.3988095238095237, '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': '6121178', 'n_tokens_mistral': 1203, 'n_tokens_neox': 908, 'n_words': 162}