OLD | NEW |
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of swarmlib; | 5 part of swarmlib; |
6 | 6 |
7 /** The top-level collection of all sections for a user. */ | 7 /** The top-level collection of all sections for a user. */ |
8 // TODO(jimhug): This is known as UserData in the server model. | 8 // TODO(jimhug): This is known as UserData in the server model. |
9 class Sections extends Collection<Section> { | 9 class Sections extends Collection<Section> { |
10 final List<Section> _sections; | 10 final List<Section> _sections; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 return CollectionUtils.find(articles, (article) => article.id == id_); | 160 return CollectionUtils.find(articles, (article) => article.id == id_); |
161 } | 161 } |
162 | 162 |
163 void refresh() {} | 163 void refresh() {} |
164 } | 164 } |
165 | 165 |
166 | 166 |
167 /** A single article or posting to display. */ | 167 /** A single article or posting to display. */ |
168 class Article { | 168 class Article { |
169 final String id; | 169 final String id; |
170 Date date; | 170 DateTime date; |
171 final String title; | 171 final String title; |
172 final String author; | 172 final String author; |
173 final bool hasThumbnail; | 173 final bool hasThumbnail; |
174 String textBody; // TODO(jimhug): rename to snipppet. | 174 String textBody; // TODO(jimhug): rename to snipppet. |
175 final Feed dataSource; // TODO(jimhug): rename to feed. | 175 final Feed dataSource; // TODO(jimhug): rename to feed. |
176 String _htmlBody; | 176 String _htmlBody; |
177 String srcUrl; | 177 String srcUrl; |
178 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. | 178 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. |
179 | 179 |
180 bool error; // TODO(jimhug): Check if this is dead and remove. | 180 bool error; // TODO(jimhug): Check if this is dead and remove. |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 static Article decodeHeader(Feed source, Decoder decoder) { | 230 static Article decodeHeader(Feed source, Decoder decoder) { |
231 final id = decoder.readString(); | 231 final id = decoder.readString(); |
232 final title = decoder.readString(); | 232 final title = decoder.readString(); |
233 final srcUrl = decoder.readString(); | 233 final srcUrl = decoder.readString(); |
234 final hasThumbnail = decoder.readBool(); | 234 final hasThumbnail = decoder.readBool(); |
235 final author = decoder.readString(); | 235 final author = decoder.readString(); |
236 final dateInSeconds = decoder.readInt(); | 236 final dateInSeconds = decoder.readInt(); |
237 final snippet = decoder.readString(); | 237 final snippet = decoder.readString(); |
238 final date = | 238 final date = |
239 new Date.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true); | 239 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true)
; |
240 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, | 240 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, |
241 snippet); | 241 snippet); |
242 } | 242 } |
243 } | 243 } |
OLD | NEW |