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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 this.srcUrl, this.hasThumbnail, this.textBody, | 180 this.srcUrl, this.hasThumbnail, this.textBody, |
181 {htmlBody: null, bool unread: true, this.error: false}) | 181 {htmlBody: null, bool unread: true, this.error: false}) |
182 : unread = new ObservableValue<bool>(unread), this._htmlBody = htmlBody; | 182 : unread = new ObservableValue<bool>(unread), this._htmlBody = htmlBody; |
183 | 183 |
184 String get htmlBody { | 184 String get htmlBody { |
185 _ensureLoaded(); | 185 _ensureLoaded(); |
186 return _htmlBody; | 186 return _htmlBody; |
187 } | 187 } |
188 | 188 |
189 String get dataUri { | 189 String get dataUri { |
190 return Uri.encodeComponent(id).replaceAll('%2F', '/'). | 190 return SwarmUri.encodeComponent(id).replaceAll('%2F', '/'). |
191 replaceAll('%253A', '%3A'); | 191 replaceAll('%253A', '%3A'); |
192 } | 192 } |
193 | 193 |
194 String get thumbUrl { | 194 String get thumbUrl { |
195 if (!hasThumbnail) return null; | 195 if (!hasThumbnail) return null; |
196 | 196 |
197 var home; | 197 var home; |
198 if (Sections.runningFromFile) { | 198 if (Sections.runningFromFile) { |
199 home = 'http://dart.googleplex.com'; | 199 home = 'http://dart.googleplex.com'; |
200 } else { | 200 } else { |
(...skipping 30 matching lines...) Expand all Loading... |
231 final hasThumbnail = decoder.readBool(); | 231 final hasThumbnail = decoder.readBool(); |
232 final author = decoder.readString(); | 232 final author = decoder.readString(); |
233 final dateInSeconds = decoder.readInt(); | 233 final dateInSeconds = decoder.readInt(); |
234 final snippet = decoder.readString(); | 234 final snippet = decoder.readString(); |
235 final date = | 235 final date = |
236 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true)
; | 236 new DateTime.fromMillisecondsSinceEpoch(dateInSeconds*1000, isUtc: true)
; |
237 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, | 237 return new Article(source, id, date, title, author, srcUrl, hasThumbnail, |
238 snippet); | 238 snippet); |
239 } | 239 } |
240 } | 240 } |
OLD | NEW |