mirror of
https://github.com/git-touch/git-touch
synced 2025-03-07 20:57:44 +01:00
chore: upgrade deprecated query
This commit is contained in:
parent
9669492203
commit
27a5026abf
@ -91,15 +91,6 @@ __typename
|
|||||||
...CommentParts
|
...CommentParts
|
||||||
...ReactableParts
|
...ReactableParts
|
||||||
}
|
}
|
||||||
... on Commit {
|
|
||||||
committedDate
|
|
||||||
oid
|
|
||||||
author {
|
|
||||||
user {
|
|
||||||
login
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on ReferencedEvent {
|
... on ReferencedEvent {
|
||||||
createdAt
|
createdAt
|
||||||
isCrossRepository
|
isCrossRepository
|
||||||
@ -217,6 +208,17 @@ __typename
|
|||||||
|
|
||||||
if (isPullRequest) {
|
if (isPullRequest) {
|
||||||
base += '''
|
base += '''
|
||||||
|
... on PullRequestCommit {
|
||||||
|
prCommit: commit {
|
||||||
|
committedDate
|
||||||
|
oid
|
||||||
|
author {
|
||||||
|
user {
|
||||||
|
login
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
... on HeadRefForcePushedEvent {
|
... on HeadRefForcePushedEvent {
|
||||||
createdAt
|
createdAt
|
||||||
actor {
|
actor {
|
||||||
@ -312,7 +314,7 @@ fragment ReactableParts on Reactable {
|
|||||||
repository(owner: "$owner", name: "$name") {
|
repository(owner: "$owner", name: "$name") {
|
||||||
$resource(number: $number) {
|
$resource(number: $number) {
|
||||||
$issueChunk
|
$issueChunk
|
||||||
timeline($timelineParams) {
|
timelineItems($timelineParams) {
|
||||||
totalCount
|
totalCount
|
||||||
pageInfo {
|
pageInfo {
|
||||||
hasNextPage
|
hasNextPage
|
||||||
@ -511,9 +513,9 @@ mutation {
|
|||||||
TimelineItem(itemPayload, onReaction: _handleReaction(itemPayload)),
|
TimelineItem(itemPayload, onReaction: _handleReaction(itemPayload)),
|
||||||
onRefresh: () async {
|
onRefresh: () async {
|
||||||
var res = await _queryIssue();
|
var res = await _queryIssue();
|
||||||
int totalCount = res['timeline']['totalCount'];
|
int totalCount = res['timelineItems']['totalCount'];
|
||||||
String cursor = res['timeline']['pageInfo']['endCursor'];
|
String cursor = res['timelineItems']['pageInfo']['endCursor'];
|
||||||
List leadingItems = res['timeline']['nodes'];
|
List leadingItems = res['timelineItems']['nodes'];
|
||||||
|
|
||||||
var payload = LongListPayload(
|
var payload = LongListPayload(
|
||||||
header: res,
|
header: res,
|
||||||
@ -525,16 +527,16 @@ mutation {
|
|||||||
|
|
||||||
if (totalCount > 2 * pageSize) {
|
if (totalCount > 2 * pageSize) {
|
||||||
var res = await _queryIssue(trailing: true);
|
var res = await _queryIssue(trailing: true);
|
||||||
payload.trailingItems = res['timeline']['nodes'];
|
payload.trailingItems = res['timelineItems']['nodes'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return payload;
|
return payload;
|
||||||
},
|
},
|
||||||
onLoadMore: (String _cursor) async {
|
onLoadMore: (String _cursor) async {
|
||||||
var res = await _queryIssue(cursor: _cursor);
|
var res = await _queryIssue(cursor: _cursor);
|
||||||
int totalCount = res['timeline']['totalCount'];
|
int totalCount = res['timelineItems']['totalCount'];
|
||||||
String cursor = res['timeline']['pageInfo']['endCursor'];
|
String cursor = res['timelineItems']['pageInfo']['endCursor'];
|
||||||
List leadingItems = res['timeline']['nodes'];
|
List leadingItems = res['timelineItems']['nodes'];
|
||||||
|
|
||||||
var payload = LongListPayload(
|
var payload = LongListPayload(
|
||||||
totalCount: totalCount,
|
totalCount: totalCount,
|
||||||
|
@ -12,14 +12,14 @@ class TimelineEventItem extends StatelessWidget {
|
|||||||
final IconData iconData;
|
final IconData iconData;
|
||||||
final Color iconColor;
|
final Color iconColor;
|
||||||
final TextSpan textSpan;
|
final TextSpan textSpan;
|
||||||
final item;
|
final p;
|
||||||
|
|
||||||
TimelineEventItem({
|
TimelineEventItem({
|
||||||
this.actor,
|
this.actor,
|
||||||
this.iconData = Octicons.octoface,
|
this.iconData = Octicons.octoface,
|
||||||
this.iconColor = Colors.grey,
|
this.iconColor = Colors.grey,
|
||||||
this.textSpan,
|
this.textSpan,
|
||||||
this.item,
|
this.p,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -50,10 +50,10 @@ class TimelineEventItem extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class TimelineItem extends StatelessWidget {
|
class TimelineItem extends StatelessWidget {
|
||||||
final Map<String, dynamic> payload;
|
final Map<String, dynamic> p;
|
||||||
final Function(String emojiKey, bool isRemove) onReaction;
|
final Function(String emojiKey, bool isRemove) onReaction;
|
||||||
|
|
||||||
TimelineItem(this.payload, {@required this.onReaction});
|
TimelineItem(this.p, {@required this.onReaction});
|
||||||
|
|
||||||
TextSpan _buildReviewText(BuildContext context, item) {
|
TextSpan _buildReviewText(BuildContext context, item) {
|
||||||
switch (item['state']) {
|
switch (item['state']) {
|
||||||
@ -84,150 +84,149 @@ class TimelineItem extends StatelessWidget {
|
|||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: 'Woops, $type type not implemented yet'),
|
TextSpan(text: 'Woops, $type type not implemented yet'),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
// common types
|
// common types
|
||||||
case 'Commit':
|
case 'PullRequestCommit':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['author']['user'] == null
|
actor: p['prCommit']['author']['user'] == null
|
||||||
? null
|
? null
|
||||||
: payload['author']['user']['login'],
|
: p['prCommit']['author']['user']['login'],
|
||||||
iconData: Octicons.git_commit,
|
iconData: Octicons.git_commit,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' added commit '),
|
TextSpan(text: ' added commit '),
|
||||||
TextSpan(text: payload['oid'].substring(0, 8))
|
TextSpan(text: p['prCommit']['oid'].substring(0, 8))
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'IssueComment':
|
case 'IssueComment':
|
||||||
return CommentItem(payload, onReaction: onReaction);
|
return CommentItem(p, onReaction: onReaction);
|
||||||
case 'CrossReferencedEvent':
|
case 'CrossReferencedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.primitive_dot,
|
iconData: Octicons.primitive_dot,
|
||||||
iconColor: GithubPalette.open,
|
iconColor: GithubPalette.open,
|
||||||
textSpan: TextSpan(
|
textSpan: TextSpan(
|
||||||
text: ' referenced this on #' +
|
text: ' referenced this on #' + p['source']['number'].toString()),
|
||||||
payload['source']['number'].toString()),
|
p: p,
|
||||||
item: payload,
|
|
||||||
);
|
);
|
||||||
case 'ClosedEvent':
|
case 'ClosedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.circle_slash,
|
iconData: Octicons.circle_slash,
|
||||||
iconColor: GithubPalette.closed,
|
iconColor: GithubPalette.closed,
|
||||||
textSpan: TextSpan(text: ' closed this '),
|
textSpan: TextSpan(text: ' closed this '),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
|
|
||||||
case 'ReopenedEvent':
|
case 'ReopenedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.primitive_dot,
|
iconData: Octicons.primitive_dot,
|
||||||
iconColor: GithubPalette.open,
|
iconColor: GithubPalette.open,
|
||||||
textSpan: TextSpan(text: ' reopened this '),
|
textSpan: TextSpan(text: ' reopened this '),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'SubscribedEvent':
|
case 'SubscribedEvent':
|
||||||
case 'UnsubscribedEvent':
|
case 'UnsubscribedEvent':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'ReferencedEvent':
|
case 'ReferencedEvent':
|
||||||
// TODO: isCrossRepository
|
// TODO: isCrossRepository
|
||||||
if (payload['commit'] == null) {
|
if (p['commit'] == null) {
|
||||||
return Container();
|
return Container();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.bookmark,
|
iconData: Octicons.bookmark,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' referenced this pull request from commit '),
|
TextSpan(text: ' referenced this pull request from commit '),
|
||||||
TextSpan(text: payload['commit']['oid'].substring(0, 8)),
|
TextSpan(text: p['commit']['oid'].substring(0, 8)),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'AssignedEvent':
|
case 'AssignedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.key,
|
iconData: Octicons.key,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' assigned this to '),
|
TextSpan(text: ' assigned this to '),
|
||||||
TextSpan(text: payload['user']['login'])
|
TextSpan(text: p['user']['login'])
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'UnassignedEvent':
|
case 'UnassignedEvent':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'LabeledEvent':
|
case 'LabeledEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.tag,
|
iconData: Octicons.tag,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' added '),
|
TextSpan(text: ' added '),
|
||||||
_buildLabel(payload),
|
_buildLabel(p),
|
||||||
TextSpan(text: ' label'),
|
TextSpan(text: ' label'),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'UnlabeledEvent':
|
case 'UnlabeledEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.tag,
|
iconData: Octicons.tag,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' removed '),
|
TextSpan(text: ' removed '),
|
||||||
_buildLabel(payload),
|
_buildLabel(p),
|
||||||
TextSpan(text: ' label'),
|
TextSpan(text: ' label'),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
|
|
||||||
case 'MilestonedEvent':
|
case 'MilestonedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.milestone,
|
iconData: Octicons.milestone,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' added this to '),
|
TextSpan(text: ' added this to '),
|
||||||
TextSpan(text: payload['milestoneTitle']),
|
TextSpan(text: p['milestoneTitle']),
|
||||||
TextSpan(text: ' milestone'),
|
TextSpan(text: ' milestone'),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'DemilestonedEvent':
|
case 'DemilestonedEvent':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'RenamedTitleEvent':
|
case 'RenamedTitleEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.pencil,
|
iconData: Octicons.pencil,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' changed the title '),
|
TextSpan(text: ' changed the title '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: payload['previousTitle'],
|
text: p['previousTitle'],
|
||||||
style: TextStyle(decoration: TextDecoration.lineThrough),
|
style: TextStyle(decoration: TextDecoration.lineThrough),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' to '),
|
TextSpan(text: ' to '),
|
||||||
TextSpan(text: payload['currentTitle'])
|
TextSpan(text: p['currentTitle'])
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'LockedEvent':
|
case 'LockedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.lock,
|
iconData: Octicons.lock,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' locked this conversation '),
|
TextSpan(text: ' locked this conversation '),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'UnlockedEvent':
|
case 'UnlockedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.key,
|
iconData: Octicons.key,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' unlocked this conversation '),
|
TextSpan(text: ' unlocked this conversation '),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
|
|
||||||
// issue only types
|
// issue only types
|
||||||
@ -239,79 +238,77 @@ class TimelineItem extends StatelessWidget {
|
|||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'PullRequestReview':
|
case 'PullRequestReview':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['author']['login'],
|
actor: p['author']['login'],
|
||||||
iconColor: GithubPalette.open,
|
iconColor: GithubPalette.open,
|
||||||
iconData: Octicons.check,
|
iconData: Octicons.check,
|
||||||
textSpan: _buildReviewText(context, payload),
|
textSpan: _buildReviewText(context, p),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'PullRequestReviewThread':
|
case 'PullRequestReviewThread':
|
||||||
case 'PullRequestReviewComment':
|
case 'PullRequestReviewComment':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'MergedEvent':
|
case 'MergedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.git_merge,
|
iconData: Octicons.git_merge,
|
||||||
iconColor: GithubPalette.merged,
|
iconColor: GithubPalette.merged,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' merged commit '),
|
TextSpan(text: ' merged commit '),
|
||||||
TextSpan(text: payload['commit']['oid'].substring(0, 8)),
|
TextSpan(text: p['commit']['oid'].substring(0, 8)),
|
||||||
TextSpan(text: ' into '),
|
TextSpan(text: ' into '),
|
||||||
TextSpan(text: payload['mergeRefName']),
|
TextSpan(text: p['mergeRefName']),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'DeployedEvent':
|
case 'DeployedEvent':
|
||||||
case 'DeploymentEnvironmentChangedEvent':
|
case 'DeploymentEnvironmentChangedEvent':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'HeadRefDeletedEvent':
|
case 'HeadRefDeletedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
iconData: Octicons.git_branch,
|
iconData: Octicons.git_branch,
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' deleted the '),
|
TextSpan(text: ' deleted the '),
|
||||||
TextSpan(text: payload['headRefName']),
|
TextSpan(text: p['headRefName']),
|
||||||
TextSpan(text: ' branch'),
|
TextSpan(text: ' branch'),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'HeadRefRestoredEvent':
|
case 'HeadRefRestoredEvent':
|
||||||
case 'HeadRefForcePushedEvent':
|
case 'HeadRefForcePushedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
iconData: Octicons.repo_force_push,
|
iconData: Octicons.repo_force_push,
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
textSpan: TextSpan(
|
textSpan: TextSpan(
|
||||||
children: [
|
children: [
|
||||||
TextSpan(text: ' force-pushed the '),
|
TextSpan(text: ' force-pushed the '),
|
||||||
WidgetSpan(
|
WidgetSpan(
|
||||||
child: PrimerBranchName(
|
child: PrimerBranchName(p['pullRequest']['headRef']['name'])),
|
||||||
payload['pullRequest']['headRef']['name'])),
|
|
||||||
TextSpan(text: ' branch from '),
|
TextSpan(text: ' branch from '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text:
|
text: (p['beforeCommit']['oid'] as String).substring(0, 7),
|
||||||
(payload['beforeCommit']['oid'] as String).substring(0, 7),
|
|
||||||
style: TextStyle(color: theme.palette.primary),
|
style: TextStyle(color: theme.palette.primary),
|
||||||
),
|
),
|
||||||
TextSpan(text: ' to '),
|
TextSpan(text: ' to '),
|
||||||
TextSpan(
|
TextSpan(
|
||||||
text: (payload['afterCommit']['oid'] as String).substring(0, 7),
|
text: (p['afterCommit']['oid'] as String).substring(0, 7),
|
||||||
style: TextStyle(color: theme.palette.primary),
|
style: TextStyle(color: theme.palette.primary),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'BaseRefForcePushedEvent':
|
case 'BaseRefForcePushedEvent':
|
||||||
return defaultItem; // TODO:
|
return defaultItem; // TODO:
|
||||||
case 'ReviewRequestedEvent':
|
case 'ReviewRequestedEvent':
|
||||||
return TimelineEventItem(
|
return TimelineEventItem(
|
||||||
iconData: Octicons.eye,
|
iconData: Octicons.eye,
|
||||||
actor: payload['actor']['login'],
|
actor: p['actor']['login'],
|
||||||
textSpan: TextSpan(children: [
|
textSpan: TextSpan(children: [
|
||||||
TextSpan(text: ' requested a review from '),
|
TextSpan(text: ' requested a review from '),
|
||||||
createUserSpan(context, payload['requestedReviewer']['login']),
|
createUserSpan(context, p['requestedReviewer']['login']),
|
||||||
]),
|
]),
|
||||||
item: payload,
|
p: p,
|
||||||
);
|
);
|
||||||
case 'ReviewRequestRemovedEvent':
|
case 'ReviewRequestRemovedEvent':
|
||||||
case 'ReviewDismissedEvent':
|
case 'ReviewDismissedEvent':
|
||||||
@ -323,7 +320,7 @@ class TimelineItem extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final type = payload['__typename'] as String;
|
final type = p['__typename'] as String;
|
||||||
|
|
||||||
Widget widget = Container(
|
Widget widget = Container(
|
||||||
padding: CommonStyle.padding,
|
padding: CommonStyle.padding,
|
||||||
@ -331,7 +328,7 @@ class TimelineItem extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (type == 'PullRequestReview') {
|
if (type == 'PullRequestReview') {
|
||||||
final comments = payload['comments']['nodes'] as List;
|
final comments = p['comments']['nodes'] as List;
|
||||||
if (comments.isNotEmpty) {
|
if (comments.isNotEmpty) {
|
||||||
widget = Column(
|
widget = Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
Loading…
x
Reference in New Issue
Block a user