diff --git a/static/js/controllers/mediastreamcontroller.js b/static/js/controllers/mediastreamcontroller.js
index 113c5eec..6ffcba93 100644
--- a/static/js/controllers/mediastreamcontroller.js
+++ b/static/js/controllers/mediastreamcontroller.js
@@ -20,7 +20,7 @@
*/
define(['underscore', 'bigscreen', 'moment', 'sjcl', 'webrtc.adapter'], function(_, BigScreen, moment, sjcl) {
- return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload) {
+ return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage) {
/*console.log("route", $route, $routeParams, $location);*/
@@ -344,7 +344,6 @@ define(['underscore', 'bigscreen', 'moment', 'sjcl', 'webrtc.adapter'], function
});
// Load stuff from localStorage.
- // TODO(longsleep): Put localStorage into Angular service.
var storedUser = localStorage.getItem("mediastream-user");
console.log("Found stored user data:", storedUser);
if (storedUser) {
diff --git a/static/js/directives/settings.js b/static/js/directives/settings.js
index a05ec15a..7d36757e 100644
--- a/static/js/directives/settings.js
+++ b/static/js/directives/settings.js
@@ -22,7 +22,7 @@ define(['jquery', 'underscore', 'text!partials/settings.html'], function($, _, t
return ["$compile", "mediaStream", function($compile, mediaStream) {
- var controller = ['$scope', 'desktopNotify', 'mediaSources', 'safeApply', 'availableLanguages', 'translation', function($scope, desktopNotify, mediaSources, safeApply, availableLanguages, translation) {
+ var controller = ['$scope', 'desktopNotify', 'mediaSources', 'safeApply', 'availableLanguages', 'translation', 'localStorage', function($scope, desktopNotify, mediaSources, safeApply, availableLanguages, translation, localStorage) {
$scope.layout.settings = false;
$scope.showAdvancedSettings = true;
diff --git a/static/js/directives/usability.js b/static/js/directives/usability.js
index a75aa58a..aace59a3 100644
--- a/static/js/directives/usability.js
+++ b/static/js/directives/usability.js
@@ -24,7 +24,7 @@ define(['jquery', 'underscore', 'text!partials/usability.html'], function($, _,
return ["mediaStream", function(mediaStream) {
- var controller = ['$scope', "mediaStream", "safeApply", "$timeout", function($scope, mediaStream, safeApply, $timeout) {
+ var controller = ['$scope', "mediaStream", "safeApply", "$timeout", "localStorage", function($scope, mediaStream, safeApply, $timeout, localStorage) {
var pending = true;
var complete = false;
diff --git a/static/js/services/localstorage.js b/static/js/services/localstorage.js
new file mode 100644
index 00000000..2d5d75c5
--- /dev/null
+++ b/static/js/services/localstorage.js
@@ -0,0 +1,73 @@
+/*
+ * Spreed WebRTC.
+ * Copyright (C) 2013-2014 struktur AG
+ *
+ * This file is part of Spreed WebRTC.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ *
+ */
+define(["modernizr"], function(Modernizr) {
+
+ // localStorage
+ return ["$window", function($window) {
+
+ // PersistentStorage (c)2014 struktur AG. MIT license.
+ var PersistentStorage = function(prefix) {
+ this.prefix = prefix ? prefix : "ps";
+ this.isPersistentStorage = true;
+ };
+ PersistentStorage.prototype.setItem = function(key, data) {
+ var name = this.prefix+"_"+key;
+ $window.document.cookie = name + "=" + data + "; path=/";
+ };
+ PersistentStorage.prototype.getItem = function(key) {
+ var name = this.prefix+"_"+key+"=";
+ var ca = $window.document.cookie.split(';');
+ for (var i=0; i