2018-07-07 00:48:14 +00:00
|
|
|
/* global storage, _ */
|
|
|
|
|
|
|
|
// eslint-disable-next-line func-names
|
2018-04-27 21:25:04 +00:00
|
|
|
(function() {
|
|
|
|
'use strict';
|
2018-07-07 00:48:14 +00:00
|
|
|
|
|
|
|
storage.isBlocked = number => {
|
|
|
|
const numbers = storage.get('blocked', []);
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-04-27 21:25:04 +00:00
|
|
|
return _.include(numbers, number);
|
|
|
|
};
|
2018-07-07 00:48:14 +00:00
|
|
|
storage.addBlockedNumber = number => {
|
|
|
|
const numbers = storage.get('blocked', []);
|
2018-04-27 21:25:04 +00:00
|
|
|
if (_.include(numbers, number)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-07-21 19:00:08 +00:00
|
|
|
window.log.info('adding', number, 'to blocked list');
|
2018-04-27 21:25:04 +00:00
|
|
|
storage.put('blocked', numbers.concat(number));
|
|
|
|
};
|
2018-07-07 00:48:14 +00:00
|
|
|
storage.removeBlockedNumber = number => {
|
|
|
|
const numbers = storage.get('blocked', []);
|
2018-04-27 21:25:04 +00:00
|
|
|
if (!_.include(numbers, number)) {
|
|
|
|
return;
|
|
|
|
}
|
2018-01-30 02:14:39 +00:00
|
|
|
|
2018-07-21 19:00:08 +00:00
|
|
|
window.log.info('removing', number, 'from blocked list');
|
2018-04-27 21:25:04 +00:00
|
|
|
storage.put('blocked', _.without(numbers, number));
|
|
|
|
};
|
2016-09-07 00:12:45 +00:00
|
|
|
})();
|