blob: e6a8e1d2d14ebdb8df1ef07487a5492d99449095 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
/**
* ownCloud - News
*
* This file is licensed under the Affero General Public License version 3 or
* later. See the COPYING file.
*
* @author Bernhard Posselt <dev@bernhard-posselt.com>
* @copyright Bernhard Posselt 2014
*/
app.factory('ItemResource', (Resource, $http, BASE_URL) => {
'use strict';
class ItemResource extends Resource {
constructor ($http, BASE_URL) {
super($http, BASE_URL);
}
receive (value, channel) {
switch (channel) {
case 'newestItemId':
this.newestItemId = value;
break;
case 'starred':
this.starredCount = value;
break;
default:
super.receive(value, channel);
}
}
getNewestItemId () {
return this.newestItemId;
}
getStarredCount () {
return this.starredCount;
}
markRead (itemId, read=true) {
this.get(itemId).unread = !read;
//http.get();
}
markFeedRead (feedId) {
for (let item in this.values.filter(i => i.feedId === feedId)) {
this.markRead(item);
}
}
}
return new ItemResource($http, BASE_URL);
});
|