| 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; |
| 11 | 11 |
| 12 Sections(this._sections); | 12 Sections(this._sections); |
| 13 | 13 |
| 14 operator [](int i) => _sections[i]; | 14 operator [](int i) => _sections[i]; |
| 15 | 15 |
| 16 int get length => _sections.length; | 16 int get length => _sections.length; |
| 17 | 17 |
| 18 List<String> get sectionTitles => | 18 List<String> get sectionTitles => |
| 19 _sections.mappedBy((s) => s.title).toList(); | 19 _sections.map((s) => s.title).toList(); |
| 20 | 20 |
| 21 void refresh() { | 21 void refresh() { |
| 22 // TODO(jimhug): http://b/issue?id=5351067 | 22 // TODO(jimhug): http://b/issue?id=5351067 |
| 23 } | 23 } |
| 24 | 24 |
| 25 /** | 25 /** |
| 26 * Find the Section object that has a given title. | 26 * Find the Section object that has a given title. |
| 27 * This is used to integrate well with [ConveyorView]. | 27 * This is used to integrate well with [ConveyorView]. |
| 28 */ | 28 */ |
| 29 Section findSection(String name) { | 29 Section findSection(String name) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 final hasThumbnail = decoder.readBool(); | 235 final hasThumbnail = decoder.readBool(); |
| 236 final author = decoder.readString(); | 236 final author = decoder.readString(); |
| 237 final dateInSeconds = decoder.readInt(); | 237 final dateInSeconds = decoder.readInt(); |
| 238 final snippet = decoder.readString(); | 238 final snippet = decoder.readString(); |
| 239 final date = | 239 final date = |
| 240 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true)
; | 240 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true)
; |
| 241 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, | 241 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, |
| 242 snippet); | 242 snippet); |
| 243 } | 243 } |
| 244 } | 244 } |
| OLD | NEW |