-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from shinonome-inc/feature/status-item-actions
StatusItemクラスの引数関連のリファクタ
- Loading branch information
Showing
11 changed files
with
175 additions
and
186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import 'package:pg_mobile/models/mastodon/account.dart'; | ||
import 'package:pg_mobile/util/mastodon_content_parser.dart'; | ||
|
||
extension AccountExtension on Account { | ||
String get noteText => MastodonContentParser.convertHtmlToPlainText(note); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,29 @@ | ||
import 'package:pg_mobile/models/mastodon/status.dart'; | ||
import 'package:pg_mobile/util/date_formatter.dart'; | ||
import 'package:pg_mobile/util/status_util.dart'; | ||
import 'package:pg_mobile/util/mastodon_content_parser.dart'; | ||
|
||
extension StatusExtension on Status { | ||
DateTime get _createdAt => DateTime.parse(createdAt).toLocal(); | ||
String get createdAtText => DateFormatter.formatStatusDetail(_createdAt); | ||
String get createdAtTimeAgoText => | ||
DateFormatter.formatTimeAgoDate(_createdAt); | ||
|
||
String get contentText => StatusUtil.convertHtmlToPlainText(content); | ||
List<String> get urls => StatusUtil.extractUrls(contentText); | ||
String get mentionsText => StatusUtil.extractMentionsText(mentions); | ||
String get contentText => | ||
MastodonContentParser.convertHtmlToPlainText(content); | ||
List<String> get urls => MastodonContentParser.extractUrls(contentText); | ||
String get mentionsText => | ||
MastodonContentParser.extractMentionsText(mentions); | ||
|
||
bool get containsUrl => urls.isNotEmpty; | ||
bool get showLinkPreview => containsUrl && mediaAttachments.isEmpty; | ||
|
||
bool get isPinnedToProfile => pinned ?? false; | ||
|
||
Uri get _uri => Uri.parse(url ?? ''); | ||
String get uriText => _uri.toString(); | ||
} | ||
|
||
extension StatusListExtension on List<Status> { | ||
Status findStatusFromId(String id) => | ||
firstWhere((element) => element.id == id); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.