Download the PHP package alfred-nutile-inc/notifications without Composer
On this page you can find all versions of the php package alfred-nutile-inc/notifications. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Please rate this library. Is it a good library?
Informations about the package notifications
Notification API
video here
Install
Composer
composer require alfred-nutile-inc/notifications:dev-master
Add the provider
Publish Migrations
Publish Assets
Then use as needed and seen in video
I also have a main angular config file that sets these constants
#config.js
function constants() {
return {
'pusher_public_key': window.pusher_public_key,
'sauce_key': window.sauce_key,
'sauce_user': window.sauce_user,
'profile': window.profile,
'js_root': '/assets/js/',
'debug': window.debug,
'messages': window.messages
};
}
Add if you want the public notifications javascript to your angular area and include the js files into your app.
Then update your nav so people can get to the main ui and the drop down
#Main ui nav
And load it in the main angular controller so on page load we listen for pusher notifications
controller.js
/**
* @NOTE Noty is better than toaster for this one thing
*/
function MainCtrl($window, PusherService, Noty, ProjectsService, localStorageService, ENV) {
var vm = this;
vm.localStorageService = localStorageService;
vm.Noty = Noty;
vm.ENV = ENV;
vm.messages = [];
vm.PusherService = PusherService;
vm.ProjectsService = ProjectsService;
vm.loadProjects = loadProjects;
vm.setOriginalMessages = setOriginalMessages;
vm.maintenanceNotification = maintenanceNotification;
vm.noticeMessage = noticeMessage;
vm.ringBell = ringBell;
vm.profile = {};
vm.projects = [];
vm.activate = activate;
vm.activate();
///////
activate();
function activate() {
vm.profile = $window.profile;
vm.PusherService.setPusher('maintenance', 'behat', vm.maintenanceNotification);
vm.loadProjects();
if(vm.localStorageService.isSupported) {
console.log('supported');
console.log(vm.localStorageService.keys());
}
vm.setOriginalMessages();
vm.PusherService.setPusher('notifications', ENV.profile.id, vm.noticeMessage);
}
function setOriginalMessages()
{
angular.forEach(vm.ENV.messages, function(v,i){
vm.messages.push( { "id": v.id, "message": v.notification_message.message } );
});
}
function noticeMessage(data)
{
if(!angular.isUndefined(data))
{
vm.messages.push(data[0]);
vm.toaster.pop("info", "Message", data[0].message, 5000, 'trustedHtml');
vm.ringBell();
$rootScope.$apply();
}
}
function ringBell()
{
var audio = $('#notificationAudio');
if (audio.length == 0) {
$('<audio id="notificationAudio"><source src="/js/lib/notifications/notify.mp3" type="audio/mpeg"></audio>').appendTo('body');
audio = $('#notificationAudio');
}
audio[0].play();
}
function loadProjects()
{
if(vm.projects.length < 1)
{
vm.ProjectsService.index().then(function(results) {
vm.projects = results.data;
});
}
}
function maintenanceNotification(data)
{
if(!angular.isUndefined(data))
{
vm.Noty(data, "information", true, false, false);
}
}
}
/**
*
* Pass all functions into module
*/
angular
.module('app')
.controller('MainCtrl ', MainCtrl);
~~
All versions of notifications with dependencies
PHP Build Version
Package Version
The package alfred-nutile-inc/notifications contains the following files
Loading the files please wait ....