2018-07-05 16:08:19 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2019-02-02 17:28:51 +01:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2019-12-12 07:02:48 +01:00
|
|
|
import 'package:git_touch/models/github.dart';
|
2019-11-03 16:33:24 +01:00
|
|
|
import 'package:git_touch/models/theme.dart';
|
2019-11-02 16:36:49 +01:00
|
|
|
import 'package:git_touch/widgets/action_button.dart';
|
2019-12-20 15:41:38 +01:00
|
|
|
import 'package:git_touch/widgets/issue_icon.dart';
|
2019-11-03 16:33:24 +01:00
|
|
|
import 'package:provider/provider.dart';
|
2019-08-31 15:37:29 +02:00
|
|
|
import 'package:timeago/timeago.dart' as timeago;
|
2019-02-07 07:35:19 +01:00
|
|
|
import 'avatar.dart';
|
2019-03-13 15:51:48 +01:00
|
|
|
import '../widgets/link.dart';
|
2019-02-07 12:17:29 +01:00
|
|
|
import '../utils/utils.dart';
|
2018-07-05 16:08:19 +02:00
|
|
|
|
|
|
|
class EventItem extends StatelessWidget {
|
2019-12-20 15:41:38 +01:00
|
|
|
final GithubEvent e;
|
2019-02-09 06:29:44 +01:00
|
|
|
|
2019-12-20 15:41:38 +01:00
|
|
|
EventItem(this.e);
|
2018-07-05 16:08:19 +02:00
|
|
|
|
2019-11-05 14:22:41 +01:00
|
|
|
TextSpan _buildLinkSpan(ThemeModel theme, String text) {
|
|
|
|
return TextSpan(
|
|
|
|
text: text,
|
2019-12-21 09:16:17 +01:00
|
|
|
style: TextStyle(color: theme.palette.primary),
|
2019-11-05 14:22:41 +01:00
|
|
|
);
|
|
|
|
}
|
2018-07-05 16:08:19 +02:00
|
|
|
|
2019-12-20 15:41:38 +01:00
|
|
|
TextSpan _buildRepo(ThemeModel theme) => _buildLinkSpan(theme, e.repo.name);
|
2019-01-26 15:10:18 +01:00
|
|
|
|
2019-11-03 16:23:05 +01:00
|
|
|
Iterable<ActionItem> _getUserActions(List<String> users) {
|
|
|
|
// Remove duplicates
|
|
|
|
return users.toSet().map((user) {
|
|
|
|
return ActionItem.user(user);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-02-07 10:19:08 +01:00
|
|
|
Widget _buildItem({
|
|
|
|
@required BuildContext context,
|
2019-09-25 07:34:13 +02:00
|
|
|
@required List<InlineSpan> spans,
|
2019-02-07 10:19:08 +01:00
|
|
|
String detail,
|
2019-12-20 15:41:38 +01:00
|
|
|
Widget card,
|
2019-09-08 14:33:04 +02:00
|
|
|
String url,
|
2019-11-02 16:36:49 +01:00
|
|
|
List<ActionItem> actionItems,
|
2019-02-07 10:19:08 +01:00
|
|
|
}) {
|
2019-11-05 14:22:41 +01:00
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
|
|
|
|
2019-12-20 15:41:38 +01:00
|
|
|
if (card == null && detail != null) {
|
|
|
|
card = Text(detail.trim(), overflow: TextOverflow.ellipsis, maxLines: 5);
|
2019-08-31 15:37:29 +02:00
|
|
|
}
|
|
|
|
|
2019-12-20 13:52:49 +01:00
|
|
|
return Container(
|
|
|
|
padding: CommonStyle.padding,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Link(
|
2019-12-20 15:41:38 +01:00
|
|
|
url: '/' + e.actor.login,
|
2019-12-20 16:19:41 +01:00
|
|
|
child: Avatar.medium(url: e.actor.avatarUrl),
|
2019-12-20 13:52:49 +01:00
|
|
|
),
|
|
|
|
SizedBox(width: 10),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: join(SizedBox(height: 8), [
|
|
|
|
RichText(
|
|
|
|
text: TextSpan(
|
|
|
|
style: TextStyle(
|
2019-12-20 16:19:41 +01:00
|
|
|
fontSize: 17,
|
2019-12-20 13:52:49 +01:00
|
|
|
color: theme.palette.text,
|
2019-08-31 15:37:29 +02:00
|
|
|
),
|
2019-12-20 13:52:49 +01:00
|
|
|
children: [
|
2019-12-20 15:41:38 +01:00
|
|
|
_buildLinkSpan(theme, e.actor.login),
|
2019-12-20 13:52:49 +01:00
|
|
|
...spans,
|
|
|
|
],
|
2019-09-07 11:08:24 +02:00
|
|
|
),
|
2019-12-20 13:52:49 +01:00
|
|
|
),
|
|
|
|
Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
2019-12-20 15:41:38 +01:00
|
|
|
Text(timeago.format(e.createdAt),
|
2019-12-20 13:52:49 +01:00
|
|
|
style: TextStyle(
|
2019-12-20 16:19:41 +01:00
|
|
|
fontSize: 14,
|
2019-12-20 13:52:49 +01:00
|
|
|
color: theme.palette.tertiaryText,
|
|
|
|
)),
|
|
|
|
// Expanded(child: Container()),
|
|
|
|
// GestureDetector(
|
|
|
|
// child: Icon(Icons.more_horiz),
|
|
|
|
// onTap: () {
|
|
|
|
// theme.showActions(context, actionItems);
|
|
|
|
// },
|
|
|
|
// ),
|
|
|
|
],
|
|
|
|
),
|
2019-12-20 15:41:38 +01:00
|
|
|
if (card != null) card
|
2019-12-20 13:52:49 +01:00
|
|
|
]),
|
2019-01-31 07:37:25 +01:00
|
|
|
),
|
2019-12-20 13:52:49 +01:00
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
],
|
2018-07-05 16:08:19 +02:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
2019-02-07 10:19:08 +01:00
|
|
|
|
2019-12-12 07:02:48 +01:00
|
|
|
Widget _buildDefaultItem(BuildContext context) {
|
2019-11-05 14:22:41 +01:00
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildItem(
|
2019-02-07 10:39:27 +01:00
|
|
|
context: context,
|
2019-02-10 05:54:48 +01:00
|
|
|
spans: [
|
|
|
|
TextSpan(
|
2019-12-20 15:41:38 +01:00
|
|
|
text: ' ' + e.type,
|
2019-11-05 14:22:41 +01:00
|
|
|
style: TextStyle(color: theme.palette.primary),
|
2019-02-10 05:54:48 +01:00
|
|
|
)
|
|
|
|
],
|
2019-12-20 15:41:38 +01:00
|
|
|
detail: 'Woops, ${e.type} not implemented yet',
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Widget _buildCommitsCard(BuildContext context) {
|
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
|
|
|
return Link(
|
|
|
|
url:
|
|
|
|
'https://github.com/${e.repoOwner}/${e.repoName}/compare/${e.payload.before}...${e.payload.head}',
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: theme.palette.grayBackground,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(4))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
RichText(
|
|
|
|
text: TextSpan(
|
2019-12-20 16:19:41 +01:00
|
|
|
style: TextStyle(color: theme.palette.text, fontSize: 15),
|
2019-12-20 15:41:38 +01:00
|
|
|
children: [
|
|
|
|
TextSpan(
|
|
|
|
text:
|
|
|
|
e.payload.commits.length.toString() + ' commits to '),
|
|
|
|
WidgetSpan(
|
|
|
|
child: PrimerBranchName(
|
|
|
|
e.payload.ref.replaceFirst('refs/heads/', '')),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2019-12-20 16:19:41 +01:00
|
|
|
SizedBox(height: 8),
|
2019-12-20 15:41:38 +01:00
|
|
|
...e.payload.commits.map((commit) {
|
|
|
|
return Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Text(
|
|
|
|
commit.sha.substring(0, 7),
|
|
|
|
style: TextStyle(
|
|
|
|
color: theme.palette.primary,
|
2019-12-20 16:19:41 +01:00
|
|
|
fontSize: 15,
|
2019-12-20 15:41:38 +01:00
|
|
|
fontFamily: CommonStyle.monospace,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
SizedBox(width: 6),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
commit.message,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 1,
|
2019-12-20 16:19:41 +01:00
|
|
|
style: TextStyle(color: theme.palette.text, fontSize: 15),
|
2019-12-20 15:41:38 +01:00
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
);
|
|
|
|
}).toList()
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
2019-02-07 10:39:27 +01:00
|
|
|
);
|
2019-12-12 07:02:48 +01:00
|
|
|
}
|
|
|
|
|
2019-12-20 15:41:38 +01:00
|
|
|
Widget _buildIssueCard(
|
|
|
|
BuildContext context, GithubEventIssue issue, String body,
|
|
|
|
{isPullRequest = false}) {
|
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
|
|
|
IssueIconState state;
|
|
|
|
if (isPullRequest) {
|
|
|
|
if (issue.merged == true) {
|
|
|
|
state = IssueIconState.prMerged;
|
|
|
|
} else if (issue.state == 'open') {
|
|
|
|
state = IssueIconState.prOpen;
|
|
|
|
} else {
|
|
|
|
state = IssueIconState.prClosed;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (issue.state == 'open') {
|
|
|
|
state = IssueIconState.open;
|
|
|
|
} else {
|
|
|
|
state = IssueIconState.closed;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return Link(
|
|
|
|
url:
|
|
|
|
'/${e.repoOwner}/${e.repoName}/${isPullRequest ? 'pulls' : 'issues'}/${issue.number}',
|
|
|
|
child: Container(
|
|
|
|
padding: EdgeInsets.all(12),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: theme.palette.grayBackground,
|
|
|
|
borderRadius: BorderRadius.all(Radius.circular(4))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
2019-12-20 16:19:41 +01:00
|
|
|
children: join(SizedBox(height: 8), [
|
2019-12-20 15:41:38 +01:00
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
|
|
|
IssueIcon(state, size: 20),
|
|
|
|
SizedBox(width: 4),
|
|
|
|
Expanded(
|
|
|
|
child: Text(
|
|
|
|
'#' + issue.number.toString() + ' ' + issue.title,
|
|
|
|
style: TextStyle(
|
|
|
|
fontWeight: FontWeight.w500,
|
2019-12-20 16:19:41 +01:00
|
|
|
fontSize: 17,
|
2019-12-20 15:41:38 +01:00
|
|
|
color: theme.palette.text,
|
|
|
|
),
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
2019-12-20 16:19:41 +01:00
|
|
|
if (body != null && body.isNotEmpty)
|
2019-12-20 15:41:38 +01:00
|
|
|
Text(
|
|
|
|
body,
|
|
|
|
overflow: TextOverflow.ellipsis,
|
|
|
|
maxLines: 3,
|
2019-12-20 16:19:41 +01:00
|
|
|
style:
|
|
|
|
TextStyle(color: theme.palette.secondaryText, fontSize: 15),
|
2019-12-20 15:41:38 +01:00
|
|
|
),
|
2019-12-20 16:19:41 +01:00
|
|
|
Row(
|
|
|
|
children: <Widget>[
|
|
|
|
Avatar.extraSmall(url: issue.user.avatarUrl),
|
|
|
|
SizedBox(width: 8),
|
|
|
|
Text(issue.user.login,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: theme.palette.tertiaryText,
|
|
|
|
)),
|
|
|
|
Expanded(child: Container()),
|
|
|
|
Icon(
|
|
|
|
Octicons.comment,
|
|
|
|
size: 14,
|
|
|
|
color: theme.palette.tertiaryText,
|
|
|
|
),
|
|
|
|
SizedBox(width: 4),
|
|
|
|
Text(issue.comments.toString(),
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 14,
|
|
|
|
color: theme.palette.tertiaryText,
|
|
|
|
)),
|
|
|
|
],
|
|
|
|
)
|
|
|
|
]),
|
2019-12-20 13:52:49 +01:00
|
|
|
),
|
2019-12-20 15:41:38 +01:00
|
|
|
),
|
2019-12-20 13:52:49 +01:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-12-12 07:02:48 +01:00
|
|
|
@override
|
|
|
|
build(BuildContext context) {
|
|
|
|
final theme = Provider.of<ThemeModel>(context);
|
2019-02-07 10:39:27 +01:00
|
|
|
|
|
|
|
// all events types here:
|
|
|
|
// https://developer.github.com/v3/activity/events/types/#event-types--payloads
|
2019-12-20 15:41:38 +01:00
|
|
|
switch (e.type) {
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'CheckRunEvent':
|
|
|
|
case 'CheckSuiteEvent':
|
|
|
|
case 'CommitCommentEvent':
|
|
|
|
case 'ContentReferenceEvent':
|
|
|
|
case 'CreateEvent':
|
|
|
|
case 'DeleteEvent':
|
|
|
|
case 'DeploymentEvent':
|
|
|
|
case 'DeploymentStatusEvent':
|
|
|
|
case 'DownloadEvent':
|
|
|
|
case 'FollowEvent':
|
|
|
|
// TODO:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'ForkEvent':
|
2019-12-20 15:41:38 +01:00
|
|
|
final forkeeOwner = e.payload.forkee['owner']['login'] as String;
|
|
|
|
final forkeeName = e.payload.forkee['name'] as String;
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
|
|
|
spans: [
|
2019-02-07 10:39:27 +01:00
|
|
|
TextSpan(text: ' forked '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildLinkSpan(theme, '$forkeeOwner/$forkeeName'),
|
2019-02-07 10:39:27 +01:00
|
|
|
TextSpan(text: ' from '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildRepo(theme),
|
2019-02-07 10:39:27 +01:00
|
|
|
],
|
2019-12-12 13:29:56 +01:00
|
|
|
url: '/$forkeeOwner/$forkeeName',
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, forkeeOwner]),
|
2019-11-02 16:36:49 +01:00
|
|
|
ActionItem.repository(forkeeOwner, forkeeName),
|
2019-12-20 15:41:38 +01:00
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:39:27 +01:00
|
|
|
);
|
|
|
|
case 'ForkApplyEvent':
|
|
|
|
case 'GitHubAppAuthorizationEvent':
|
|
|
|
case 'GistEvent':
|
|
|
|
case 'GollumEvent':
|
|
|
|
case 'InstallationEvent':
|
|
|
|
case 'InstallationRepositoriesEvent':
|
|
|
|
// TODO:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'IssueCommentEvent':
|
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
|
|
|
spans: [
|
2019-12-20 13:52:49 +01:00
|
|
|
TextSpan(
|
|
|
|
text:
|
2019-12-20 15:41:38 +01:00
|
|
|
' commented on ${e.payload.issue.isPullRequestComment ? 'pull request' : 'issue'} '),
|
|
|
|
_buildLinkSpan(theme, '#${e.payload.issue.number}'),
|
2019-02-07 10:19:08 +01:00
|
|
|
TextSpan(text: ' at '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildRepo(theme),
|
2019-02-07 10:19:08 +01:00
|
|
|
],
|
2019-12-20 15:41:38 +01:00
|
|
|
card: _buildIssueCard(
|
|
|
|
context,
|
|
|
|
e.payload.issue,
|
|
|
|
e.payload.comment.body,
|
|
|
|
isPullRequest: e.payload.issue.isPullRequestComment,
|
|
|
|
),
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
2019-12-20 13:52:49 +01:00
|
|
|
ActionItem.pullRequest(
|
2019-12-20 15:41:38 +01:00
|
|
|
e.repoOwner, e.repoName, e.payload.issue.number),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'IssuesEvent':
|
2019-12-20 15:41:38 +01:00
|
|
|
final issue = e.payload.issue;
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
|
|
|
spans: [
|
2019-12-20 15:41:38 +01:00
|
|
|
TextSpan(text: ' ${e.payload.action} issue '),
|
2019-12-20 13:52:49 +01:00
|
|
|
_buildLinkSpan(theme, '#${issue.number}'),
|
2019-02-07 10:19:08 +01:00
|
|
|
TextSpan(text: ' at '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildRepo(theme),
|
2019-02-07 10:19:08 +01:00
|
|
|
],
|
2019-12-20 15:41:38 +01:00
|
|
|
card: _buildIssueCard(context, issue, issue.body),
|
|
|
|
url: '/${e.repoOwner}/${e.repoName}/issues/${issue.number}',
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
|
|
|
ActionItem.issue(e.repoOwner, e.repoName, issue.number),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'LabelEvent':
|
|
|
|
case 'MarketplacePurchaseEvent':
|
|
|
|
case 'MemberEvent':
|
|
|
|
case 'MembershipEvent':
|
|
|
|
case 'MilestoneEvent':
|
|
|
|
case 'OrganizationEvent':
|
|
|
|
case 'OrgBlockEvent':
|
|
|
|
case 'PageBuildEvent':
|
|
|
|
case 'ProjectCardEvent':
|
|
|
|
case 'ProjectColumnEvent':
|
|
|
|
case 'ProjectEvent':
|
|
|
|
case 'PublicEvent':
|
|
|
|
// TODO:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:19:08 +01:00
|
|
|
case 'PullRequestEvent':
|
2019-12-20 15:41:38 +01:00
|
|
|
final pr = e.payload.pullRequest;
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
|
|
|
spans: [
|
2019-12-20 15:41:38 +01:00
|
|
|
TextSpan(text: ' ${e.payload.action} pull request '),
|
2019-12-20 13:52:49 +01:00
|
|
|
_buildLinkSpan(theme, '#${pr.number}'),
|
2019-02-07 10:19:08 +01:00
|
|
|
TextSpan(text: ' at '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildRepo(theme),
|
2019-02-07 10:19:08 +01:00
|
|
|
],
|
2019-12-20 15:41:38 +01:00
|
|
|
card: _buildIssueCard(context, pr, pr.body, isPullRequest: true),
|
|
|
|
url: '/${e.repoOwner}/${e.repoName}/pulls/${pr.number}',
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
|
|
|
ActionItem.pullRequest(e.repoOwner, e.repoName, pr.number),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'PullRequestReviewEvent':
|
|
|
|
// TODO:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:19:08 +01:00
|
|
|
case 'PullRequestReviewCommentEvent':
|
2019-12-20 15:41:38 +01:00
|
|
|
final pr = e.payload.pullRequest;
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
|
|
|
spans: [
|
|
|
|
TextSpan(text: ' reviewed pull request '),
|
2019-12-20 13:52:49 +01:00
|
|
|
_buildLinkSpan(theme, '#${pr.number}'),
|
2019-02-07 10:19:08 +01:00
|
|
|
TextSpan(text: ' at '),
|
2019-11-05 14:22:41 +01:00
|
|
|
_buildRepo(theme),
|
2019-02-07 10:19:08 +01:00
|
|
|
],
|
2019-12-20 15:41:38 +01:00
|
|
|
card: _buildIssueCard(context, pr, pr.body),
|
|
|
|
url: '/${e.repoOwner}/${e.repoName}/pulls/${pr.number}',
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
|
|
|
ActionItem.pullRequest(e.repoOwner, e.repoName, pr.number),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'PushEvent':
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
2019-12-20 13:52:49 +01:00
|
|
|
spans: [TextSpan(text: ' pushed to '), _buildRepo(theme)],
|
2019-12-20 15:41:38 +01:00
|
|
|
card: _buildCommitsCard(context),
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'ReleaseEvent':
|
|
|
|
case 'RepositoryEvent':
|
|
|
|
case 'RepositoryImportEvent':
|
|
|
|
case 'RepositoryVulnerabilityAlertEvent':
|
|
|
|
case 'SecurityAdvisoryEvent':
|
|
|
|
case 'StatusEvent':
|
|
|
|
case 'TeamEvent':
|
|
|
|
case 'TeamAddEvent':
|
|
|
|
// TODO:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:39:27 +01:00
|
|
|
case 'WatchEvent':
|
2019-02-07 10:19:08 +01:00
|
|
|
return _buildItem(
|
|
|
|
context: context,
|
2019-11-05 14:22:41 +01:00
|
|
|
spans: [TextSpan(text: ' starred '), _buildRepo(theme)],
|
2019-12-20 15:41:38 +01:00
|
|
|
url: '/${e.repoOwner}/${e.repoName}',
|
2019-11-02 16:36:49 +01:00
|
|
|
actionItems: [
|
2019-12-20 15:41:38 +01:00
|
|
|
..._getUserActions([e.actor.login, e.repoOwner]),
|
|
|
|
ActionItem.repository(e.repoOwner, e.repoName),
|
2019-11-02 16:36:49 +01:00
|
|
|
],
|
2019-02-07 10:19:08 +01:00
|
|
|
);
|
|
|
|
default:
|
2019-12-12 07:02:48 +01:00
|
|
|
return _buildDefaultItem(context);
|
2019-02-07 10:19:08 +01:00
|
|
|
}
|
|
|
|
}
|
2018-07-05 16:08:19 +02:00
|
|
|
}
|