Display notification message when don't have rez permissions

This commit is contained in:
David Rowe 2017-09-06 12:44:57 +12:00
parent 61fc32714a
commit 6838461b07
2 changed files with 22 additions and 0 deletions

View file

@ -85,6 +85,7 @@
var PLAY_NOTIFICATION_SOUNDS_SETTING = "play_notification_sounds";
var PLAY_NOTIFICATION_SOUNDS_TYPE_SETTING_PRE = "play_notification_sounds_type_";
var lodTextID = false;
var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications"
var NotificationType = {
UNKNOWN: 0,
@ -531,6 +532,13 @@
createNotification(wordWrap(msg), NotificationType.UNKNOWN); // Needs a generic notification system for user feedback, thus using this
}
function onMessageReceived(channel, message) {
if (channel === NOTIFICATIONS_MESSAGE_CHANNEL) {
message = JSON.parse(message);
createNotification(wordWrap(message.message), message.notificationType);
}
}
function onSnapshotTaken(pathStillSnapshot, notify) {
if (notify) {
var imageProperties = {
@ -623,6 +631,7 @@
Overlays.deleteOverlay(buttons[notificationIndex]);
}
Menu.removeMenu(MENU_NAME);
Messages.unsubscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
}
function menuItemEvent(menuItem) {
@ -665,6 +674,10 @@
Window.notifyEditError = onEditError;
Window.notify = onNotify;
Tablet.tabletNotification.connect(tabletNotification);
Messages.subscribe(NOTIFICATIONS_MESSAGE_CHANNEL);
Messages.messageReceived.connect(onMessageReceived);
setup();
}()); // END LOCAL_SCOPE

View file

@ -1590,9 +1590,18 @@
function onAppButtonClicked() {
var NOTIFICATIONS_MESSAGE_CHANNEL = "Hifi-Notifications",
EDIT_ERROR = 4, // Per notifications.js.
INSUFFICIENT_PERMISSIONS_ERROR_MSG =
"You do not have the necessary permissions to edit on this domain."; // Same as edit.js.
// Application tablet/toolbar button clicked.
if (!isAppActive && !(Entities.canRez() || Entities.canRezTmp())) {
Feedback.play(dominantHand, Feedback.GENERAL_ERROR);
Messages.sendLocalMessage(NOTIFICATIONS_MESSAGE_CHANNEL, JSON.stringify({
message: INSUFFICIENT_PERMISSIONS_ERROR_MSG,
notificationType: EDIT_ERROR
}));
return;
}