2018-04-27 21:25:04 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
|
|
|
storage.isBlocked = function(number) {
|
|
|
|
var numbers = storage.get('blocked', []);
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
return _.include(numbers, number);
|
|
|
|
};
|
|
|
|
storage.addBlockedNumber = function(number) {
|
|
|
|
var numbers = storage.get('blocked', []);
|
|
|
|
if (_.include(numbers, number)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
console.log('adding', number, 'to blocked list');
|
|
|
|
storage.put('blocked', numbers.concat(number));
|
|
|
|
};
|
|
|
|
storage.removeBlockedNumber = function(number) {
|
|
|
|
var numbers = storage.get('blocked', []);
|
|
|
|
if (!_.include(numbers, number)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
console.log('removing', number, 'from blocked list');
|
|
|
|
storage.put('blocked', _.without(numbers, number));
|
|
|
|
};
|
2016-09-07 00:12:45 +00:00
|
|
|
})();
|