Rewrites notification service

- showNotification takes a song as parameter and picks the information it needs itself. That way we avoid player-directive.js having utils as a dependency.
- shortened the names of the methods a bit. Had to rename them in settings.js
- Used $interval rather than window.setInterval in player-directive.js and in notification-service.js. It's easier to unit test them that way !
This commit is contained in:
Hyzual 2015-01-10 17:36:37 +01:00
parent 33f1a88d6b
commit 392ef74eba
5 changed files with 146 additions and 61 deletions

View file

@ -36,13 +36,13 @@
if ($scope.settings.Server.indexOf('http://') != 0 && $scope.settings.Server.indexOf('https://') != 0) { $scope.settings.Server = 'http://' + $scope.settings.Server; }
if ($scope.settings.NotificationSong) {
notifications.requestPermissionIfRequired();
if (!notifications.hasNotificationSupport()) {
if (!notifications.isSupported()) {
alert('HTML5 Notifications are not available for your current browser, Sorry :(');
}
}
if ($scope.settings.NotificationNowPlaying) {
notifications.requestPermissionIfRequired();
if (!notifications.hasNotificationSupport()) {
if (!notifications.isSupported()) {
alert('HTML5 Notifications are not available for your current browser, Sorry :(');
}
}