Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Configurable Volume for Notifications #6087 #7517

Merged
merged 14 commits into from
Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Solving requested changes by rodrigok and karlprieb at PR #7517
  • Loading branch information
lindoelio committed Jul 27, 2017
commit f269229ab635ada94b12449cd4006bdbbec28c4f
1 change: 0 additions & 1 deletion .meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ email@1.2.3
emojione:emojione@3.0.3
facebook-oauth@1.3.2
fastclick@1.0.13
fourseven:scss@4.5.4
francocatena:status@1.5.3
geojson-utils@1.0.10
github-oauth@1.2.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ Template.pushNotificationsFlexTab.events({
e.preventDefault();

let audio = $(e.currentTarget).data('play');
const user = Meteor.user();

if (!audio || audio === 'none') {
audio = Meteor.user().settings.preferences.newMessageNotification || 'chime';
audio = user && user.settings && user.settings.preferences && user.settings.preferences.newMessageNotification || 'chime';
}

if (audio && audio !== 'none') {

const audioVolume = Meteor.user().settings.preferences.notificationsSoundVolume || 100;
const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
const $audio = $(`audio#${ audio }`);

if ($audio && $audio[0] && $audio[0].play) {
Expand All @@ -278,10 +278,10 @@ Template.pushNotificationsFlexTab.events({
e.preventDefault();

const audio = $(e.currentTarget).val();
const user = Meteor.user();

if (audio && audio !== 'none') {

const audioVolume = Meteor.user().settings.preferences.notificationsSoundVolume || 100;
const audioVolume = user && user.settings && user.settings.preferences && user.settings.preferences.notificationsSoundVolume || 100;
const $audio = $(`audio#${ audio }`);

if ($audio && $audio[0] && $audio[0].play) {
Expand Down
4 changes: 2 additions & 2 deletions packages/rocketchat-slider/rocketchat-slider.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template name="slider">
<div class="range-slider">
<input class="range-slider__range" type="range" id="{{id}}" value="{{value}}" min="{{min}}" max="{{max}}">
<span class="range-slider__value" id="{{id}}__value"></span>
<input class="range-slider-range tertiary-background-color" type="range" id="{{id}}" value="{{value}}" min="{{min}}" max="{{max}}">
<span class="range-slider-value" id="{{id}}_value"></span>
</div>
</template>
2 changes: 1 addition & 1 deletion packages/rocketchat-slider/rocketchat-slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Template.slider.onRendered(function() {
const rangeSlider = function() {

const range = $(`#${ params.id }`);
const labelValue = $(`#${ params.id }__value`);
const labelValue = $(`#${ params.id }_value`);

labelValue.html(params.value);

Expand Down
35 changes: 12 additions & 23 deletions packages/rocketchat-theme/client/imports/slider.css
Original file line number Diff line number Diff line change
@@ -1,45 +1,37 @@
*,
*::before,
*::after {
box-sizing: border-box;
}

.range-slider {
margin: 0 0 0 0%;
margin: 0;
width: 100%;
}

.range-slider__range {
-webkit-appearance: none;
width: calc(100% - (73px));
.range-slider-range {
appearance: none;
width: calc(100% - 73px);
height: 10px;
border-radius: 5px;
outline: none;
padding: 0;
margin: 0;
}

.range-slider__range::-webkit-slider-thumb {
-webkit-appearance: none;
.range-slider-range::-webkit-slider-thumb {
appearance: none;
width: 20px;
height: 20px;
border-radius: 50%;
cursor: pointer;
-webkit-transition: background 0.15s ease-in-out;
transition: background 0.15s ease-in-out;
}

.range-slider__range::-moz-range-thumb {
.range-slider-range::-moz-range-thumb {
width: 20px;
height: 20px;
border: 0;
border-radius: 50%;
cursor: pointer;
-webkit-transition: background 0.15s ease-in-out;
transition: background 0.15s ease-in-out;
}

.range-slider__value {
.range-slider-value {
display: inline-block;
position: relative;
width: 60px;
Expand All @@ -50,7 +42,7 @@
margin-left: 8px;
}

.range-slider__value::after {
.range-slider-value::after {
position: absolute;
top: 8px;
left: -7px;
Expand All @@ -62,11 +54,8 @@
content: '';
}

::-moz-range-track {
border: 0;
}

input::-moz-focus-inner,
input::-moz-focus-outer {
.range-slider-range::-moz-range-track,
.range-slider-range::-moz-focus-inner,
.range-slider-range::-moz-focus-outer {
border: 0;
}
22 changes: 9 additions & 13 deletions packages/rocketchat-theme/server/colors.less
Original file line number Diff line number Diff line change
Expand Up @@ -916,45 +916,41 @@ label.required::after {
* Input Range Slider
*/

.range-slider__range {
background-color: @tertiary-background-color;
}

.range-slider__range::-webkit-slider-thumb {
.range-slider-range::-webkit-slider-thumb {
background-color: @primary-background-color;
}

.range-slider__range::-webkit-slider-thumb:hover {
.range-slider-range::-webkit-slider-thumb:hover {
background-color: darken(@success-color, 30%);
}

.range-slider__range:active::-webkit-slider-thumb {
.range-slider-range:active::-webkit-slider-thumb {
background-color: darken(@success-color, 10%);
}

.range-slider__range::-moz-range-thumb {
.range-slider-range::-moz-range-thumb {
background-color: @primary-background-color;
}

.range-slider__range::-moz-range-thumb:hover {
.range-slider-range::-moz-range-thumb:hover {
background-color: darken(@success-color, 30%);
}

.range-slider__range:active::-moz-range-thumb {
.range-slider-range:active::-moz-range-thumb {
background-color: darken(@success-color, 10%);
}

.range-slider__value {
.range-slider-value {
color: lighten(@tertiary-background-color, 50%);
background-color: @primary-background-color;
}

.range-slider__value::after {
.range-slider-value::after {
border-top-color: transparent;
border-right-color: @primary-background-color;
border-bottom-color: transparent;
}

::-moz-range-track {
.range-slider-range::-moz-range-track {
background-color: @tertiary-background-color;
}
4 changes: 0 additions & 4 deletions packages/rocketchat-ui-account/client/accountPreferences.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/*globals defaultUserLanguage, KonchatNotification */
import toastr from 'toastr';

Template.accountPreferences.helpers({
audioAssets() {
return (RocketChat.CustomSounds && RocketChat.CustomSounds.getList && RocketChat.CustomSounds.getList()) || [];
Expand Down Expand Up @@ -87,19 +86,16 @@ Template.accountPreferences.onCreated(function() {
this.useEmojis = new ReactiveVar(user.settings.preferences.desktopNotificationDuration == null || user.settings.preferences.useEmojis);
}
let instance = this;

this.autorun(() => {
if (instance.useEmojis && instance.useEmojis.get()) {
Tracker.afterFlush(() => $('#convertAsciiEmoji').show());
} else {
Tracker.afterFlush(() => $('#convertAsciiEmoji').hide());
}
});

this.clearForm = function() {
this.find('#language').value = localStorage.getItem('userLanguage');
};

this.save = function() {
instance = this;
const data = {};
Expand Down