diff --git a/app/js/controllers.js b/app/js/controllers.js index 32228de1..3766c140 100644 --- a/app/js/controllers.js +++ b/app/js/controllers.js @@ -2549,7 +2549,7 @@ angular.module('myApp.controllers', ['myApp.i18n']) }); }; - Storage.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter', 'notify_volume', 'notify_novibrate').then(function (settings) { + Storage.get('notify_nodesktop', 'notify_nosound', 'send_ctrlenter', 'notify_volume', 'notify_novibrate', 'notify_nopreview').then(function (settings) { $scope.notify.desktop = !settings[0]; $scope.send.enter = settings[2] ? '' : '1'; @@ -2564,6 +2564,8 @@ angular.module('myApp.controllers', ['myApp.i18n']) $scope.notify.canVibrate = NotificationsManager.getVibrateSupport(); $scope.notify.vibrate = !settings[4]; + $scope.notify.preview = !settings[5]; + $scope.notify.volumeOf4 = function () { return 1 + Math.ceil(($scope.notify.volume - 0.1) / 0.33); }; @@ -2602,6 +2604,16 @@ angular.module('myApp.controllers', ['myApp.i18n']) } } + $scope.togglePreview = function () { + $scope.notify.preview = !$scope.notify.preview; + + if ($scope.notify.preview) { + Storage.remove('notify_nopreview'); + } else { + Storage.set({notify_nopreview: true}); + } + } + $scope.toggleVibrate = function () { $scope.notify.vibrate = !$scope.notify.vibrate; diff --git a/app/js/locales/en-us.json b/app/js/locales/en-us.json index 9dd0fdae..6ce39497 100644 --- a/app/js/locales/en-us.json +++ b/app/js/locales/en-us.json @@ -43,6 +43,7 @@ "settings_modal_sounds": "Sounds", "settings_modal_language": "Language", "settings_modal_notifications": "Desktop notifications", + "settings_modal_message_preview": "Message Preview", "settings_modal_sound": "Sound", "settings_modal_enter_send_description_md": "**Enter** - send message, **Shift + Enter** - new line", "settings_modal_ctrl_enter_send_description_md": "**Ctrl + Enter** - send message, **Enter** - new line", @@ -206,6 +207,7 @@ "conversation_kicked_user": "removed {user}", "conversation_invited_user_message": "invited user", "conversation_kicked_user_message": "removed user", + "conversation_message_sent": "sent you a message", "conversation_unknown_user": "Somebody", "conversation_unknown_chat": "Unknown chat", diff --git a/app/js/services.js b/app/js/services.js index f947c8af..0ffd3f94 100755 --- a/app/js/services.js +++ b/app/js/services.js @@ -889,7 +889,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) if (message.unread && !message.out) { NotificationsManager.getPeerMuted(peerID).then(function (muted) { if (!muted) { - notifyAboutMessage(message); + Storage.get('notify_nopreview').then(function (no_preview) { + notifyAboutMessage(message, no_preview); + }); } }); } @@ -2040,7 +2042,7 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) } } - function notifyAboutMessage (message) { + function notifyAboutMessage (message, no_preview) { var peerID = getMessagePeer(message); var fromUser = AppUsersManager.getUser(message.from_id); var fromPhoto = AppUsersManager.getUserPhoto(message.from_id, 'User'); @@ -2050,7 +2052,11 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) notificationPhoto; if (message.message) { - notificationMessage = RichTextProcessor.wrapPlainText(message.message); + if (no_preview) { + notificationMessage = _('conversation_message_sent'); + } else { + notificationMessage = RichTextProcessor.wrapPlainText(message.message); + } } else if (message.media) { switch (message.media._) { case 'messageMediaPhoto': notificationMessage = _('conversation_media_photo_raw'); break; @@ -2239,7 +2245,9 @@ angular.module('myApp.services', ['myApp.i18n', 'izhukov.utils']) setTimeout(function () { isMutedPromise.then(function (muted) { if (message.unread && !muted) { - notifyAboutMessage(message); + Storage.get('notify_nopreview').then(function (no_preview) { + notifyAboutMessage(message, no_preview); + }); } }) }, timeout); diff --git a/app/partials/desktop/settings_modal.html b/app/partials/desktop/settings_modal.html index 866c8f49..21977275 100644 --- a/app/partials/desktop/settings_modal.html +++ b/app/partials/desktop/settings_modal.html @@ -61,6 +61,11 @@ + + + + + diff --git a/app/partials/mobile/settings_modal.html b/app/partials/mobile/settings_modal.html index 764fba76..9bf66b1a 100644 --- a/app/partials/mobile/settings_modal.html +++ b/app/partials/mobile/settings_modal.html @@ -83,6 +83,13 @@ +
+ + + + +
+