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 IterableBase<Section> { | 9 class Sections extends IterableBase<Section> { |
10 final List<Section> _sections; | 10 final List<Section> _sections; |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 void refresh() {} | 159 void refresh() {} |
160 } | 160 } |
161 | 161 |
162 /** A single article or posting to display. */ | 162 /** A single article or posting to display. */ |
163 class Article { | 163 class Article { |
164 final String id; | 164 final String id; |
165 DateTime date; | 165 DateTime date; |
166 final String title; | 166 final String title; |
167 final String author; | 167 final String author; |
168 final bool hasThumbnail; | 168 final bool hasThumbnail; |
169 String textBody; // TODO(jimhug): rename to snipppet. | 169 String textBody; // TODO(jimhug): rename to snippet. |
170 final Feed dataSource; // TODO(jimhug): rename to feed. | 170 final Feed dataSource; // TODO(jimhug): rename to feed. |
171 String _htmlBody; | 171 String _htmlBody; |
172 String srcUrl; | 172 String srcUrl; |
173 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. | 173 final ObservableValue<bool> unread; // TODO(jimhug): persist to server. |
174 | 174 |
175 bool error; // TODO(jimhug): Check if this is dead and remove. | 175 bool error; // TODO(jimhug): Check if this is dead and remove. |
176 | 176 |
177 Article(this.dataSource, this.id, this.date, this.title, this.author, | 177 Article(this.dataSource, this.id, this.date, this.title, this.author, |
178 this.srcUrl, this.hasThumbnail, this.textBody, | 178 this.srcUrl, this.hasThumbnail, this.textBody, |
179 {htmlBody: null, bool unread: true, this.error: false}) | 179 {htmlBody: null, bool unread: true, this.error: false}) |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
232 final hasThumbnail = decoder.readBool(); | 232 final hasThumbnail = decoder.readBool(); |
233 final author = decoder.readString(); | 233 final author = decoder.readString(); |
234 final dateInSeconds = decoder.readInt(); | 234 final dateInSeconds = decoder.readInt(); |
235 final snippet = decoder.readString(); | 235 final snippet = decoder.readString(); |
236 final date = new DateTime.fromMillisecondsSinceEpoch(dateInSeconds * 1000, | 236 final date = new DateTime.fromMillisecondsSinceEpoch(dateInSeconds * 1000, |
237 isUtc: true); | 237 isUtc: true); |
238 return new Article( | 238 return new Article( |
239 source, id, date, title, author, srcUrl, hasThumbnail, snippet); | 239 source, id, date, title, author, srcUrl, hasThumbnail, snippet); |
240 } | 240 } |
241 } | 241 } |
OLD | NEW |