chore: add untranslated strings, fix: caps (#244)

This commit is contained in:
Shreyas Thirumalai
2021-06-17 08:32:41 +05:30
committed by GitHub
parent 64178db3db
commit ddfa9e469e
14 changed files with 812 additions and 222 deletions

View File

@@ -9,6 +9,7 @@ import 'package:timeago/timeago.dart' as timeago;
import 'avatar.dart';
import '../widgets/link.dart';
import '../utils/utils.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
class EventItem extends StatelessWidget {
final GithubEvent e;
@@ -104,7 +105,8 @@ class EventItem extends StatelessWidget {
style: TextStyle(color: theme.palette.primary),
)
],
card: Text('Woops, ${e.type} not implemented yet'),
card: Text(
'${e.type} ${AppLocalizations.of(context)!.timelineTypeNotImplemented}'),
);
}
@@ -126,8 +128,8 @@ class EventItem extends StatelessWidget {
style: TextStyle(color: theme.palette.text, fontSize: 15),
children: [
TextSpan(
text: e.payload!.commits!.length.toString() +
' commits to '),
text:
'${AppLocalizations.of(context)!.nCommitsTo(e.payload!.commits!.length)} '),
WidgetSpan(
child: PrimerBranchName(
e.payload!.ref!.replaceFirst('refs/heads/', '')),
@@ -302,7 +304,7 @@ class EventItem extends StatelessWidget {
return _buildItem(context: context, spans: [
TextSpan(
text:
' ${e.payload!.action} a check run for ${e.payload!.checkRun!.name} '),
'${AppLocalizations.of(context)!.checkRunEventMessage(e.payload!.action!, e.payload!.checkRun!.name!)} '),
]);
case 'CheckSuiteEvent':
// Needs checks permission
@@ -310,16 +312,19 @@ class EventItem extends StatelessWidget {
switch (e.payload!.checkSuite!.conclusion) {
case 'success':
case 'failure':
conclusion = 'it is a ' + e.payload!.checkSuite!.conclusion!;
conclusion =
'${AppLocalizations.of(context)!.checkSuiteEventConclusionMessage(e.payload!.checkSuite!.conclusion!)} ';
break;
case 'neutral':
case 'cancelled':
case 'timed_out':
case 'stale':
conclusion = 'it is ' + e.payload!.checkSuite!.conclusion!;
conclusion =
'${AppLocalizations.of(context)!.checkSuiteEventConclusionMessage(e.payload!.checkSuite!.conclusion!)} ';
break;
case 'action_required':
conclusion = ' it requires more action';
conclusion =
' ${AppLocalizations.of(context)!.actionRequiredConclusion}';
break;
}
return _buildItem(
@@ -327,22 +332,25 @@ class EventItem extends StatelessWidget {
spans: [
TextSpan(
text:
' ${e.payload!.action} the check suite and the conclusion is that $conclusion'),
' ${AppLocalizations.of(context)!.checkSuiteEventMessage(e.payload!.action!)} $conclusion'),
],
);
case 'CommitCommentEvent':
return _buildItem(
context: context,
spans: [
TextSpan(text: ' commented on a commit '),
TextSpan(text: ' at '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.commitCommentEventMessage} '),
_buildRepo(context),
],
card: _buildCommitCommentCard(context),
);
case 'ContentReferenceEvent':
return _buildItem(context: context, spans: [
TextSpan(text: ' ${e.payload!.action} a content reference at '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.contentReferenceEventMessage(e.payload!.action!)} '),
_buildLinkSpan(context, e.payload!.contentReference!.reference,
e.payload!.contentReference!.reference),
]);
@@ -350,10 +358,9 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: <InlineSpan>[
TextSpan(text: ' created a ${e.payload!.refType}'),
TextSpan(
text:
'${e.payload!.ref == null ? '' : ' ' + e.payload!.ref! + ' at'} '),
' ${AppLocalizations.of(context)!.createdEventMessage(e.payload!.refType!, e.payload!.ref ?? '')}'),
_buildRepo(context),
],
);
@@ -361,10 +368,9 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: <InlineSpan>[
TextSpan(text: ' deleted the ${e.payload!.refType}'),
TextSpan(
text:
'${e.payload!.ref == null ? '' : ' ' + e.payload!.ref! + ' at'} '),
' ${AppLocalizations.of(context)!.deletedEventMessage(e.payload!.refType!, e.payload!.ref ?? '')}'),
_buildRepo(context),
],
);
@@ -374,9 +380,9 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: [
TextSpan(text: ' forked '),
TextSpan(text: ' ${AppLocalizations.of(context)!.forked} '),
_buildRepo(context, '$forkeeOwner/$forkeeName'),
TextSpan(text: ' from '),
TextSpan(text: ' ${AppLocalizations.of(context)!.from} '),
_buildRepo(context),
],
);
@@ -391,10 +397,12 @@ class EventItem extends StatelessWidget {
}
}
if (pageNamesCreated.length > 0) {
pageNamesCreated = " created the pages: \n" + pageNamesCreated + "\n";
pageNamesCreated =
" ${AppLocalizations.of(context)!.createdPages(pageNamesCreated)}";
}
if (pageNamesEdited.length > 0) {
pageNamesEdited = " edited the pages: \n" + pageNamesEdited + "\n";
pageNamesEdited =
" ${AppLocalizations.of(context)!.editedPages(pageNamesEdited)}";
}
return _buildItem(
@@ -403,14 +411,14 @@ class EventItem extends StatelessWidget {
case 'InstallationEvent':
String? action = e.payload!.action;
if (action == 'new_permissions_accepted') {
action = "new permission were accepted for";
action = "${AppLocalizations.of(context)!.newPermissionsAccepted}";
}
return _buildItem(
context: context,
spans: [
TextSpan(
text:
' $action for the Github App with id ${e.payload!.installation!.id}'),
' $action ${AppLocalizations.of(context)!.forGithubAppWithId(e.payload!.installation!.id.toString())}'),
],
);
case 'InstallationRepositoriesEvent':
@@ -428,17 +436,17 @@ class EventItem extends StatelessWidget {
}
String finalListOfRepos = "";
if (addedRepos != "") {
finalListOfRepos += addedRepos + " were added to\n ";
finalListOfRepos +=
"${AppLocalizations.of(context)!.wereAddedTo(addedRepos, e.payload!.installation!.id.toString())}\n ";
}
if (removedRepos != "") {
finalListOfRepos += removedRepos + " were removed from";
finalListOfRepos += removedRepos +
" ${AppLocalizations.of(context)!.wereRemovedFrom(removedRepos, e.payload!.installation!.id.toString())}";
}
return _buildItem(
context: context,
spans: [
TextSpan(
text:
' $finalListOfRepos the installation id ${e.payload!.installation!.id} '),
TextSpan(text: '$finalListOfRepos'),
],
);
case 'IssueCommentEvent':
@@ -447,13 +455,13 @@ class EventItem extends StatelessWidget {
spans: [
TextSpan(
text:
' commented on ${e.payload!.issue!.isPullRequestComment ? 'pull request' : 'issue'} '),
' ${AppLocalizations.of(context)!.commentedOn} ${e.payload!.issue!.isPullRequestComment ? 'pull request' : 'issue'} '),
_buildIssue(
context,
e.payload!.issue!.number,
isPullRequest: e.payload!.issue!.isPullRequestComment,
),
TextSpan(text: ' at '),
TextSpan(text: ' ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
],
card: _buildIssueCard(
@@ -468,9 +476,11 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: [
TextSpan(text: ' ${e.payload!.action} issue '),
TextSpan(
text:
' ${e.payload!.action} ${AppLocalizations.of(context)!.issue} '),
_buildIssue(context, issue.number),
TextSpan(text: ' at '),
TextSpan(text: ' ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
],
card: _buildIssueCard(context, issue, issue.body),
@@ -480,19 +490,24 @@ class EventItem extends StatelessWidget {
var messageToDisplay;
switch (action) {
case "purchased":
messageToDisplay = "purchased a Marketplace Plan";
messageToDisplay =
AppLocalizations.of(context)!.purchasedMarketplacePlan;
break;
case "cancelled":
messageToDisplay = "cancelled their Marketplace Plan";
messageToDisplay =
AppLocalizations.of(context)!.cancelledMarketplacePlan;
break;
case "pending_change":
messageToDisplay = " Marketplace Plan is pending change";
messageToDisplay =
AppLocalizations.of(context)!.pendingMarketplacePlan;
break;
case "pending_change_cancelled":
messageToDisplay = " Pending Marketplace Plan was cancelled";
messageToDisplay =
AppLocalizations.of(context)!.pendingChangeCancelled;
break;
case "changed":
messageToDisplay = " changed their Marketplace Plan";
messageToDisplay =
AppLocalizations.of(context)!.changedMarketplacePlan;
break;
}
return _buildItem(
@@ -511,21 +526,22 @@ class EventItem extends StatelessWidget {
spans: [
TextSpan(
text:
' was ${e.payload!.action} ${action == 'added' ? 'to' : 'from'} '),
' ${AppLocalizations.of(context)!.was} ${e.payload!.action} ${action == 'added' ? AppLocalizations.of(context)!.to : AppLocalizations.of(context)!.from} '),
_buildRepo(context),
],
);
case 'ProjectCardEvent':
String? action = e.payload!.action;
if (action == 'converted') {
action = ' converted the project card into an issue ';
action = ' ${AppLocalizations.of(context)!.convertProjectCard} ';
} else {
action = action! + ' the project card ';
action =
action! + ' ${AppLocalizations.of(context)!.theProjectCard} ';
}
return _buildItem(
context: context,
spans: [
TextSpan(text: ' $action at '),
TextSpan(text: ' $action ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
],
);
@@ -533,22 +549,22 @@ class EventItem extends StatelessWidget {
return _buildItem(context: context, spans: [
TextSpan(
text:
' ${e.payload!.action} the project column ${e.payload!.projectColumn!.name} at '),
' ${AppLocalizations.of(context)!.projectColumnEventMessage(e.payload!.action!, e.payload!.projectColumn!.name!)} '),
_buildRepo(context),
]);
case 'ProjectEvent':
return _buildItem(context: context, spans: [
TextSpan(
text:
' ${e.payload!.action} the project ${e.payload!.project!.name} '),
' ${AppLocalizations.of(context)!.projectEventMessage(e.payload!.action!, e.payload!.project!.name!)}} '),
]);
case 'PublicEvent':
return _buildItem(
context: context,
spans: [
TextSpan(text: ' made '),
TextSpan(text: ' ${AppLocalizations.of(context)!.made} '),
_buildRepo(context),
TextSpan(text: ' public'),
TextSpan(text: ' ${AppLocalizations.of(context)!.public}'),
],
);
case 'PullRequestEvent':
@@ -556,9 +572,11 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: [
TextSpan(text: ' ${e.payload!.action} pull request '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.pullRequestEventMessage(e.payload!.action!)} '),
_buildIssue(context, pr.number, isPullRequest: true),
TextSpan(text: ' at '),
TextSpan(text: ' ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
],
card: _buildIssueCard(context, pr, pr.body, isPullRequest: true),
@@ -566,9 +584,11 @@ class EventItem extends StatelessWidget {
case 'PullRequestReviewEvent':
final pr = e.payload!.pullRequest!;
return _buildItem(context: context, spans: [
TextSpan(text: ' ${e.payload!.action} the pull request review '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.pullRequestReviewEventMessage(e.payload!.action!)} '),
_buildIssue(context, pr.number, isPullRequest: true),
TextSpan(text: ' at '),
TextSpan(text: ' ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
]);
case 'PullRequestReviewCommentEvent':
@@ -576,9 +596,11 @@ class EventItem extends StatelessWidget {
return _buildItem(
context: context,
spans: [
TextSpan(text: ' reviewed pull request '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.pullRequestReviewCommentEventMessage} '),
_buildIssue(context, pr.number, isPullRequest: true),
TextSpan(text: ' at '),
TextSpan(text: ' ${AppLocalizations.of(context)!.at} '),
_buildRepo(context),
],
card: _buildIssueCard(context, pr, e.payload!.comment!.body,
@@ -587,14 +609,17 @@ class EventItem extends StatelessWidget {
case 'PushEvent':
return _buildItem(
context: context,
spans: [TextSpan(text: ' pushed to '), _buildRepo(context)],
spans: [
TextSpan(text: ' ${AppLocalizations.of(context)!.pushedTo} '),
_buildRepo(context)
],
card: _buildCommitsCard(context),
);
case 'ReleaseEvent':
return _buildItem(
context: context,
spans: [
TextSpan(text: ' released '),
TextSpan(text: '${AppLocalizations.of(context)!.released} '),
_buildLinkSpan(context, e.payload!.release!.tagName,
e.payload!.release!.htmlUrl),
TextSpan(text: ' at '),
@@ -607,20 +632,23 @@ class EventItem extends StatelessWidget {
return _buildItem(context: context, spans: [
TextSpan(
text:
' Security alert involving the package ${e.payload!.alert!.affectedPackageName} between versions ${e.payload!.alert!.affectedRange} was {e.payload.action}ed',
' ${AppLocalizations.of(context)!.securityAlertInvolvingPackage(e.payload!.alert!.affectedPackageName!, e.payload!.alert!.affectedRange!, e.payload!.action!)}',
)
]);
case 'SecurityAdvisoryEvent':
return _buildItem(context: context, spans: [
TextSpan(
text:
' Security advisory regarding ${e.payload!.securityAdvisory!.summary} was ${e.payload!.action} ',
' ${AppLocalizations.of(context)!.securityAdvisory(e.payload!.securityAdvisory!.summary!, e.payload!.action!)} ',
)
]);
case 'WatchEvent':
return _buildItem(
context: context,
spans: [TextSpan(text: ' starred '), _buildRepo(context)],
spans: [
TextSpan(text: ' ${AppLocalizations.of(context)!.starred} '),
_buildRepo(context)
],
);
default:
return _buildDefaultItem(context);

View File

@@ -8,6 +8,7 @@ import 'package:git_touch/widgets/markdown_view.dart';
import 'package:git_touch/widgets/table_view.dart';
import 'package:provider/provider.dart';
import 'package:timeago/timeago.dart' as timeago;
import 'package:flutter_gen/gen_l10n/S.dart';
class ReleaseItem extends StatelessWidget {
final String? login;
@@ -61,8 +62,9 @@ class ReleaseItem extends StatelessWidget {
color: theme.palette.secondaryText,
fontSize: 16,
),
child: Text(
login! + " released " + timeago.format(publishedAt!)),
child: Text(login! +
" ${AppLocalizations.of(context)!.released} " +
timeago.format(publishedAt!)),
),
],
),

View File

@@ -8,6 +8,7 @@ import 'package:git_touch/widgets/label.dart';
import 'package:provider/provider.dart';
import '../utils/utils.dart';
import 'comment_item.dart';
import 'package:flutter_gen/gen_l10n/S.dart';
TextSpan createUserSpan(BuildContext context, String? login) {
return createLinkSpan(context, login, '/github/$login');
@@ -57,12 +58,14 @@ class TimelineItem extends StatelessWidget {
final dynamic node;
TimelineItem(this.node);
Widget _buildFallback(String? type) {
Widget _buildFallback(String? type, BuildContext context) {
return TimelineEventItem(
actor: '',
iconData: Octicons.octoface,
textSpan: TextSpan(children: [
TextSpan(text: 'Woops, $type type not implemented yet'),
TextSpan(
text:
'$type ${AppLocalizations.of(context)!.timelineTypeNotImplemented}'),
]),
);
}
@@ -78,8 +81,9 @@ class TimelineItem extends StatelessWidget {
actor: p.commit.author!.user?.login,
iconData: Octicons.git_commit,
textSpan: TextSpan(children: [
TextSpan(text: ' added commit '),
TextSpan(text: p.commit.oid.substring(0, 8))
TextSpan(
text:
' ${AppLocalizations.of(context)!.pullRequestCommitMessage(p.commit.oid.substring(0, 8))} '),
]),
);
case 'IssueComment':
@@ -97,7 +101,9 @@ class TimelineItem extends StatelessWidget {
iconData: Octicons.primitive_dot,
iconColor: GithubPalette.open,
textSpan: TextSpan(children: [
TextSpan(text: ' referenced this on '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.crossReferencedEventMessage} '),
createLinkSpan(context, '$owner/$name#$number',
'/github/$owner/$name/$prefix/$number'),
]),
@@ -108,7 +114,8 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.circle_slash,
iconColor: GithubPalette.closed,
textSpan: TextSpan(text: ' closed this '),
textSpan: TextSpan(
text: ' ${AppLocalizations.of(context)!.closedEventMessage} '),
);
case 'ReopenedEvent':
@@ -117,19 +124,24 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.primitive_dot,
iconColor: GithubPalette.open,
textSpan: TextSpan(text: ' reopened this '),
textSpan: TextSpan(
text: ' ${AppLocalizations.of(context)!.reopenedEventMessage} '),
);
case 'SubscribedEvent':
final p = node as GSubscribedEventParts;
return TimelineEventItem(
actor: p.actor!.login,
textSpan: TextSpan(text: ' subscribed to this issue '),
textSpan: TextSpan(
text:
' ${AppLocalizations.of(context)!.subscribedEventMessage} '),
);
case 'UnsubscribedEvent':
final p = node as GUnsubscribedEventParts;
return TimelineEventItem(
actor: p.actor!.login,
textSpan: TextSpan(text: ' unsubscribed from this issue '),
textSpan: TextSpan(
text:
' ${AppLocalizations.of(context)!.unsubscribedEventMessage} '),
);
case 'ReferencedEvent':
final p = node as GReferencedEventParts;
@@ -142,9 +154,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.bookmark,
textSpan: TextSpan(children: [
TextSpan(text: ' referenced this pull request from commit '),
TextSpan(text: p.commit!.oid.substring(0, 8)),
TextSpan(text: ' from ' + p.commitRepository.name),
TextSpan(
text:
' ${AppLocalizations.of(context)!.referencedEventMessage(p.commit!.oid.substring(0, 8), p.commitRepository.name)} '),
]),
);
}
@@ -152,8 +164,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.bookmark,
textSpan: TextSpan(children: [
TextSpan(text: ' referenced this pull request from commit '),
TextSpan(text: p.commit!.oid.substring(0, 8)),
TextSpan(
text:
' ${AppLocalizations.of(context)!.referencedEventMessage(p.commit!.oid.substring(0, 8), '')} '),
]),
);
case 'AssignedEvent':
@@ -163,7 +176,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.key,
textSpan: TextSpan(children: [
TextSpan(text: ' assigned this to '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.assignedEventMessage} '),
createLinkSpan(context, assignee, '/github/$assignee'),
]),
);
@@ -174,7 +189,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.key,
textSpan: TextSpan(children: [
TextSpan(text: ' unassigned this from '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.unassignedEventMessage} '),
createLinkSpan(context, assignee, '/github/$assignee')
]),
);
@@ -184,10 +201,10 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.tag,
textSpan: TextSpan(children: [
TextSpan(text: ' added '),
TextSpan(text: ' ${AppLocalizations.of(context)!.added} '),
WidgetSpan(
child: MyLabel(name: p.label.name, cssColor: p.label.color)),
TextSpan(text: ' label'),
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
]),
);
case 'UnlabeledEvent':
@@ -196,10 +213,10 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.tag,
textSpan: TextSpan(children: [
TextSpan(text: ' removed '),
TextSpan(text: ' ${AppLocalizations.of(context)!.removed} '),
WidgetSpan(
child: MyLabel(name: p.label.name, cssColor: p.label.color)),
TextSpan(text: ' label'),
TextSpan(text: ' ${AppLocalizations.of(context)!.label}'),
]),
);
case 'MilestonedEvent':
@@ -208,9 +225,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.milestone,
textSpan: TextSpan(children: [
TextSpan(text: ' added this to '),
TextSpan(text: p.milestoneTitle),
TextSpan(text: ' milestone'),
TextSpan(
text:
' ${AppLocalizations.of(context)!.milestonedEventMessage(p.milestoneTitle)} '),
]),
);
case 'DemilestonedEvent':
@@ -219,9 +236,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.milestone,
textSpan: TextSpan(children: [
TextSpan(text: ' removed this from '),
TextSpan(text: p.milestoneTitle),
TextSpan(text: ' milestone'),
TextSpan(
text:
' ${AppLocalizations.of(context)!.demilestonedEventMessage(p.milestoneTitle)} '),
]),
);
case 'RenamedTitleEvent':
@@ -230,13 +247,13 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.pencil,
textSpan: TextSpan(children: [
TextSpan(text: ' changed the title '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.renamedTitleEventMessage(p.currentTitle)} '),
TextSpan(
text: p.previousTitle,
style: TextStyle(decoration: TextDecoration.lineThrough),
),
TextSpan(text: ' to '),
TextSpan(text: p.currentTitle)
]),
);
case 'LockedEvent':
@@ -245,7 +262,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.lock,
textSpan: TextSpan(children: [
TextSpan(text: ' locked this conversation '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.lockedConversationEventMessage} '),
]),
);
case 'UnlockedEvent':
@@ -254,7 +273,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.key,
textSpan: TextSpan(children: [
TextSpan(text: ' unlocked this conversation '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.unlockedConversationEventMessage} '),
]),
);
case 'TransferredEvent':
@@ -265,14 +286,14 @@ class TimelineItem extends StatelessWidget {
children: [
TextSpan(
text:
' transferred this issue from ' + p.fromRepository!.name)
' ${AppLocalizations.of(context)!.transferredEventMessage(p.fromRepository!.name)} ')
],
),
);
// pull request only types
case 'CommitCommentThread':
return _buildFallback(type); // TODO:
return _buildFallback(type, context); // TODO:
case 'PullRequestReview':
final p = node as GPullRequestReviewParts;
return Column(
@@ -282,9 +303,12 @@ class TimelineItem extends StatelessWidget {
iconColor: GithubPalette.open,
iconData: Octicons.check,
textSpan: p.state == GPullRequestReviewState.APPROVED
? TextSpan(text: ' approved these changes')
? TextSpan(
text:
' ${AppLocalizations.of(context)!.approvedChanges}')
: p.state == GPullRequestReviewState.COMMENTED
? TextSpan(text: ' reviewed ')
? TextSpan(
text: ' ${AppLocalizations.of(context)!.reviewed} ')
: warningSpan),
Container(
padding: CommonStyle.padding.copyWith(left: 50),
@@ -299,7 +323,7 @@ class TimelineItem extends StatelessWidget {
);
case 'PullRequestReviewThread':
case 'PullRequestReviewComment':
return _buildFallback(type); // TODO:
return _buildFallback(type, context); // TODO:
case 'MergedEvent':
final p = node as GMergedEventParts;
return TimelineEventItem(
@@ -307,10 +331,9 @@ class TimelineItem extends StatelessWidget {
iconData: Octicons.git_merge,
iconColor: GithubPalette.merged,
textSpan: TextSpan(children: [
TextSpan(text: ' merged commit '),
TextSpan(text: p.commit!.oid.substring(0, 8)),
TextSpan(text: ' into '),
TextSpan(text: p.mergeRefName),
TextSpan(
text:
' ${AppLocalizations.of(context)!.mergedEventMessage(p.commit!.oid.substring(0, 8), p.mergeRefName)} '),
]),
);
case 'MentionedEvent':
@@ -318,14 +341,16 @@ class TimelineItem extends StatelessWidget {
return TimelineEventItem(
actor: p.actor!.login,
iconData: Octicons.bookmark,
textSpan: TextSpan(text: ' was mentioned '),
textSpan: TextSpan(
text: ' ${AppLocalizations.of(context)!.mentionedEventMessage} '),
);
case 'PinnedEvent':
final p = node as GPinnedEventParts;
return TimelineEventItem(
actor: p.actor!.login,
iconData: Octicons.pin,
textSpan: TextSpan(text: ' pinned this issue '),
textSpan: TextSpan(
text: ' ${AppLocalizations.of(context)!.pinnedEventMessage} '),
);
case 'DeployedEvent':
final p = node as GDeployedEventParts;
@@ -333,15 +358,15 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
textSpan: TextSpan(
text:
' deployed the pull request ' + p.pullRequest.headRef!.name),
' ${AppLocalizations.of(context)!.deployedPR(p.pullRequest.headRef!.name)} '),
);
case 'DeploymentEnvironmentChangedEvent':
final p = node as GDeploymentEnvironmentChangedEventParts;
return TimelineEventItem(
actor: p.actor!.login,
textSpan: TextSpan(
text: ' changed the deployment environment to ' +
p.deploymentStatus.deployment.environment!),
text:
' ${AppLocalizations.of(context)!.deploymentEnvironmentChangedEventMessage(p.deploymentStatus.deployment.environment!)} '),
);
case 'HeadRefDeletedEvent':
final p = node as GHeadRefDeletedEventParts;
@@ -349,9 +374,9 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
iconData: Octicons.git_branch,
textSpan: TextSpan(children: [
TextSpan(text: ' deleted the '),
TextSpan(text: p.headRefName),
TextSpan(text: ' branch'),
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefDeletedEventMessage(p.headRefName)} '),
]),
);
case 'HeadRefRestoredEvent':
@@ -359,9 +384,9 @@ class TimelineItem extends StatelessWidget {
return TimelineEventItem(
actor: p.actor!.login,
textSpan: TextSpan(children: [
TextSpan(text: ' restored the '),
WidgetSpan(child: PrimerBranchName(p.pullRequest.headRefName)),
TextSpan(text: ' branch')
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefRestoredEventMessage(p.pullRequest.headRefName)} '),
]),
);
case 'HeadRefForcePushedEvent':
@@ -371,14 +396,18 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
textSpan: TextSpan(
children: [
TextSpan(text: ' force-pushed the '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefForcedPushedEventFirstMessage} '),
WidgetSpan(child: PrimerBranchName(p.pullRequest.headRefName)),
TextSpan(text: ' branch from '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefForcedPushedEventSecondMessage} '),
TextSpan(
text: p.beforeCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
),
TextSpan(text: ' to '),
TextSpan(text: ' ${AppLocalizations.of(context)!.to} '),
TextSpan(
text: p.afterCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
@@ -393,14 +422,18 @@ class TimelineItem extends StatelessWidget {
actor: p.actor!.login,
textSpan: TextSpan(
children: [
TextSpan(text: ' force-pushed the '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefForcedPushedEventFirstMessage} '),
WidgetSpan(child: PrimerBranchName(p.pullRequest.baseRef!.name)),
TextSpan(text: ' branch from '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.headRefForcedPushedEventSecondMessage} '),
TextSpan(
text: p.beforeCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
),
TextSpan(text: ' to '),
TextSpan(text: ' ${AppLocalizations.of(context)!.to} '),
TextSpan(
text: p.afterCommit!.oid.substring(0, 7),
style: TextStyle(color: theme.palette.primary),
@@ -414,7 +447,9 @@ class TimelineItem extends StatelessWidget {
iconData: Octicons.eye,
actor: p.actor!.login,
textSpan: TextSpan(children: [
TextSpan(text: ' requested a review from '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.reviewRequestEventMessage} '),
createUserSpan(
context,
(p.requestedReviewer
@@ -434,7 +469,8 @@ class TimelineItem extends StatelessWidget {
(p.requestedReviewer
as GReviewRequestRemovedEventParts_requestedReviewer__asUser)
.login),
TextSpan(text: ' from the review request '),
TextSpan(
text: ' ${AppLocalizations.of(context)!.fromReviewRequest} '),
]),
);
case 'ReviewDismissedEvent':
@@ -443,12 +479,14 @@ class TimelineItem extends StatelessWidget {
iconData: Octicons.eye,
actor: p.actor!.login,
textSpan: TextSpan(children: [
TextSpan(text: ' dismissed the pull request review requested by '),
TextSpan(
text:
' ${AppLocalizations.of(context)!.reviewDismissedEventMessage} '),
createUserSpan(context, p.pullRequest.author!.login),
]),
);
default:
return _buildFallback(type);
return _buildFallback(type, context);
}
}