Add detection for reshared

This commit is contained in:
Hank Grabowski 2022-01-20 10:52:35 -05:00
parent 8a5636ab54
commit f582e30360
2 changed files with 11 additions and 2 deletions

View file

@ -39,7 +39,7 @@ class TreeEntryCard extends StatelessWidget {
final title = entry.title.isNotEmpty
? entry.title
: entry.parentId.isEmpty
? 'Post'
? (entry.isReshare ? 'Reshare' : 'Post')
: 'Comment on post by ${entry.parentAuthor}';
final dateStamp = ' At ' +
formatter.format(

View file

@ -28,6 +28,8 @@ class FriendicaTimelineEntry {
final String title;
final bool isReshare;
final String author;
final String authorId;
@ -50,6 +52,7 @@ class FriendicaTimelineEntry {
this.creationTimestamp = 0,
this.backdatedTimestamp = 0,
this.modificationTimestamp = 0,
this.isReshare = false,
this.body = '',
this.title = '',
this.author = '',
@ -69,6 +72,7 @@ class FriendicaTimelineEntry {
backdatedTimestamp = DateTime.now().millisecondsSinceEpoch,
modificationTimestamp = DateTime.now().millisecondsSinceEpoch,
id = randomId(),
isReshare = false,
parentId = randomId(),
externalLink = 'Random external link ${randomId()}',
body = 'Random post text ${randomId()}',
@ -92,6 +96,7 @@ class FriendicaTimelineEntry {
{int? creationTimestamp,
int? backdatedTimestamp,
int? modificationTimestamp,
bool? isReshare,
String? id,
String? parentId,
String? externalLink,
@ -111,6 +116,7 @@ class FriendicaTimelineEntry {
modificationTimestamp:
modificationTimestamp ?? this.modificationTimestamp,
id: id ?? this.id,
isReshare: isReshare ?? this.isReshare,
parentId: parentId ?? this.parentId,
externalLink: externalLink ?? this.externalLink,
body: body ?? this.body,
@ -127,7 +133,7 @@ class FriendicaTimelineEntry {
@override
String toString() {
return 'FriendicaTimelineEntry{id: $id, parentId: $parentId, creationTimestamp: $creationTimestamp, modificationTimestamp: $modificationTimestamp, backdatedTimeStamp: $backdatedTimestamp, post: $body, title: $title, author: $author, parentAuthor: $parentAuthor mediaAttachments: $mediaAttachments, links: $links}';
return 'FriendicaTimelineEntry{id: $id, isReshare: $isReshare, parentId: $parentId, creationTimestamp: $creationTimestamp, modificationTimestamp: $modificationTimestamp, backdatedTimeStamp: $backdatedTimestamp, post: $body, title: $title, author: $author, parentAuthor: $parentAuthor mediaAttachments: $mediaAttachments, links: $links}';
}
String toHumanString(PathMappingService mapper, DateFormat formatter) {
@ -139,6 +145,7 @@ class FriendicaTimelineEntry {
'Creation At: $creationDateString',
'Text:',
'Author: $author',
'Reshare: $isReshare',
if (externalLink.isNotEmpty) 'External Link: $externalLink',
body,
'',
@ -176,6 +183,7 @@ class FriendicaTimelineEntry {
})
: 0;
final id = json['id_str'] ?? '';
final isReshare = json.containsKey('retweeted_status');
final parentId = json['in_reply_to_status_id_str'] ?? '';
final parentAuthor = json['in_reply_to_screen_name'] ?? '';
final post = json['friendica_html'] ?? '';
@ -214,6 +222,7 @@ class FriendicaTimelineEntry {
locationData: actualLocationData,
externalLink: externalLink,
body: post,
isReshare: isReshare,
id: id,
parentId: parentId,
author: author,