Browse Source

Merge branch 'release-0.24'

pull/230/head v0.24.6
Simon Eisenmann 11 years ago
parent
commit
3bc5e45191
  1. 1
      .travis.yml
  2. 7
      debian/changelog
  3. 39
      static/js/services/desktopnotify.js

1
.travis.yml

@ -35,5 +35,6 @@ script: @@ -35,5 +35,6 @@ script:
- make styles
- make jshint
- make javascript
- make test
- make binary
- make build-i18n

7
debian/changelog vendored

@ -1,3 +1,10 @@ @@ -1,3 +1,10 @@
spreed-webrtc-server (0.24.6) trusty; urgency=medium
* Make travis run 'make test'.
* Disable notifications on Android Chrome (see https://code.google.com/p/chromium/issues/detail?id=481856).
-- Simon Eisenmann <simon@struktur.de> Mon, 10 Aug 2015 17:33:46 +0200
spreed-webrtc-server (0.24.5) trusty; urgency=medium
* Updated ua-parser to 0.7.9.

39
static/js/services/desktopnotify.js

@ -20,7 +20,7 @@ @@ -20,7 +20,7 @@
*/
"use strict";
define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
define(['jquery', 'underscore', 'desktop-notify', 'webrtc.adapter'], function($, _, notify) {
return ["$window", function($window) {
@ -29,8 +29,8 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { @@ -29,8 +29,8 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
var iconElement = $("<span>").addClass("desktopnotify-icon hidden");
iconElement.appendTo("body");
var url = iconElement.css('background-image');
url = /^url\((['"]?)(.*)\1\)$/.exec(url);
url = url ? url[2] : "";
url = /^url\((['"]?)(.*)\1\)$/.exec(url);
url = url ? url[2] : "";
iconElement.remove();
return url;
}());
@ -55,18 +55,43 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) { @@ -55,18 +55,43 @@ define(['jquery', 'underscore', 'desktop-notify'], function($, _, notify) {
DesktopNotify.prototype.enabled = function() {
if (this.level === "default") {
if (this.supported && this.level === "default") {
this.asked = true;
this.requestPermission();
}
return (this.supported && this.level === "granted") ? true : false;
return this.supported && this.level === "granted";
};
DesktopNotify.prototype.refresh = function() {
this.supported = helper.isSupported;
this.level = helper.permissionLevel();
var level = this.level = helper.permissionLevel();
this.supported = (function() {
if (helper.isSupported) {
if ($window.Notification && $window.Notification.requestPermission) {
if (level !== "granted") {
// Aditional check to verify Notification really works. This fails
// on Android, where Notifications raise an exception.
// See https://code.google.com/p/chromium/issues/detail?id=481856
try {
/*jshint nonew: false */
new $window.Notification('');
} catch(e) {
if (e.name == 'TypeError') {
return false;
}
}
} else {
// Disable notifications even if granted and on Android Chrome.
if ($window.webrtcDetectedAndroid) {
return false;
}
}
}
return true;
}
return false;
}());
};

Loading…
Cancel
Save