Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 50f6027

Browse files
authored
Open CI links (#1902)
1 parent f3f3d45 commit 50f6027

File tree

5 files changed

+52
-9
lines changed

5 files changed

+52
-9
lines changed

Classes/Issues/Merge/IssueMergeContextModel.swift

+5-1
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,24 @@ final class IssueMergeContextModel: ListDiffable {
1717
let login: String
1818
let avatarURL: URL
1919
let description: String
20+
let targetURL: URL
2021

2122
init(
2223
id: String,
2324
context: String,
2425
state: StatusState,
2526
login: String,
2627
avatarURL: URL,
27-
description: String
28+
description: String,
29+
targetURL: URL
2830
) {
2931
self.id = id
3032
self.context = context
3133
self.state = state
3234
self.login = login
3335
self.avatarURL = avatarURL
3436
self.description = description
37+
self.targetURL = targetURL
3538
}
3639

3740
// MARK: ListDiffable
@@ -48,6 +51,7 @@ final class IssueMergeContextModel: ListDiffable {
4851
&& login == object.login
4952
&& avatarURL == object.avatarURL
5053
&& description == object.description
54+
&& targetURL == object.targetURL
5155
}
5256

5357
}

Classes/Issues/Merge/IssueMergeSectionController.swift

+14-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ import IGListKit
1111

1212
final class IssueMergeSectionController: ListBindingSectionController<IssueMergeModel>,
1313
ListBindingSectionControllerDataSource,
14-
MergeButtonDelegate {
14+
MergeButtonDelegate,
15+
ListBindingSectionControllerSelectionDelegate {
1516

1617
private let model: IssueDetailsModel
1718
private let client: GithubClient
@@ -24,6 +25,7 @@ MergeButtonDelegate {
2425
self.resultID = resultID
2526
super.init()
2627
dataSource = self
28+
selectionDelegate = self
2729
}
2830

2931
// MARK: Private API
@@ -188,4 +190,15 @@ MergeButtonDelegate {
188190
viewController?.present(alert, animated: trueUnlessReduceMotionEnabled)
189191
}
190192

193+
// MARK: ListBindingSectionControllerSelectionDelegate
194+
195+
func sectionController(
196+
_ sectionController: ListBindingSectionController<ListDiffable>,
197+
didSelectItemAt index: Int,
198+
viewModel: Any
199+
) {
200+
guard let viewModel = viewModel as? IssueMergeContextModel else { return }
201+
viewController?.presentSafari(url: viewModel.targetURL)
202+
}
203+
191204
}

Classes/Issues/PullRequest+IssueType.swift

+5-2
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,18 @@ extension IssueOrPullRequestQuery.Data.Repository.IssueOrPullRequest.AsPullReque
5959
var contexts = [IssueMergeContextModel]()
6060
for context in commit.status?.contexts ?? [] {
6161
guard let creator = context.creator,
62-
let avatarURL = URL(string: creator.avatarUrl)
62+
let avatarURL = URL(string: creator.avatarUrl),
63+
let targetUrlString = context.targetUrl,
64+
let targetURL = URL(string: targetUrlString)
6365
else { continue }
6466
contexts.append(IssueMergeContextModel(
6567
id: context.id,
6668
context: context.context,
6769
state: context.state,
6870
login: creator.login,
6971
avatarURL: avatarURL,
70-
description: context.description ?? ""
72+
description: context.description ?? "",
73+
targetURL: targetURL
7174
))
7275
}
7376

gql/API.swift

+27-5
Original file line numberDiff line numberDiff line change
@@ -12887,6 +12887,7 @@ public final class IssueOrPullRequestQuery: GraphQLQuery {
1288712887
GraphQLField("state", type: .nonNull(.scalar(StatusState.self))),
1288812888
GraphQLField("creator", type: .object(Creator.selections)),
1288912889
GraphQLField("description", type: .scalar(String.self)),
12890+
GraphQLField("targetUrl", type: .scalar(String.self)),
1289012891
]
1289112892

1289212893
public var snapshot: Snapshot
@@ -12895,8 +12896,8 @@ public final class IssueOrPullRequestQuery: GraphQLQuery {
1289512896
self.snapshot = snapshot
1289612897
}
1289712898

12898-
public init(id: GraphQLID, context: String, state: StatusState, creator: Creator? = nil, description: String? = nil) {
12899-
self.init(snapshot: ["__typename": "StatusContext", "id": id, "context": context, "state": state, "creator": creator.flatMap { (value: Creator) -> Snapshot in value.snapshot }, "description": description])
12899+
public init(id: GraphQLID, context: String, state: StatusState, creator: Creator? = nil, description: String? = nil, targetUrl: String? = nil) {
12900+
self.init(snapshot: ["__typename": "StatusContext", "id": id, "context": context, "state": state, "creator": creator.flatMap { (value: Creator) -> Snapshot in value.snapshot }, "description": description, "targetUrl": targetUrl])
1290012901
}
1290112902

1290212903
public var __typename: String {
@@ -12957,6 +12958,16 @@ public final class IssueOrPullRequestQuery: GraphQLQuery {
1295712958
}
1295812959
}
1295912960

12961+
/// The URL for this status context.
12962+
public var targetUrl: String? {
12963+
get {
12964+
return snapshot["targetUrl"] as? String
12965+
}
12966+
set {
12967+
snapshot.updateValue(newValue, forKey: "targetUrl")
12968+
}
12969+
}
12970+
1296012971
public struct Creator: GraphQLSelectionSet {
1296112972
public static let possibleTypes = ["Organization", "User", "Bot"]
1296212973

@@ -18488,7 +18499,7 @@ public struct RepoEventFields: GraphQLFragment {
1848818499

1848918500
public struct CommitContext: GraphQLFragment {
1849018501
public static let fragmentString =
18491-
"fragment commitContext on Commit {\n __typename\n id\n status {\n __typename\n contexts {\n __typename\n id\n context\n state\n creator {\n __typename\n login\n avatarUrl\n }\n description\n }\n state\n }\n}"
18502+
"fragment commitContext on Commit {\n __typename\n id\n status {\n __typename\n contexts {\n __typename\n id\n context\n state\n creator {\n __typename\n login\n avatarUrl\n }\n description\n targetUrl\n }\n state\n }\n}"
1849218503

1849318504
public static let possibleTypes = ["Commit"]
1849418505

@@ -18594,6 +18605,7 @@ public struct CommitContext: GraphQLFragment {
1859418605
GraphQLField("state", type: .nonNull(.scalar(StatusState.self))),
1859518606
GraphQLField("creator", type: .object(Creator.selections)),
1859618607
GraphQLField("description", type: .scalar(String.self)),
18608+
GraphQLField("targetUrl", type: .scalar(String.self)),
1859718609
]
1859818610

1859918611
public var snapshot: Snapshot
@@ -18602,8 +18614,8 @@ public struct CommitContext: GraphQLFragment {
1860218614
self.snapshot = snapshot
1860318615
}
1860418616

18605-
public init(id: GraphQLID, context: String, state: StatusState, creator: Creator? = nil, description: String? = nil) {
18606-
self.init(snapshot: ["__typename": "StatusContext", "id": id, "context": context, "state": state, "creator": creator.flatMap { (value: Creator) -> Snapshot in value.snapshot }, "description": description])
18617+
public init(id: GraphQLID, context: String, state: StatusState, creator: Creator? = nil, description: String? = nil, targetUrl: String? = nil) {
18618+
self.init(snapshot: ["__typename": "StatusContext", "id": id, "context": context, "state": state, "creator": creator.flatMap { (value: Creator) -> Snapshot in value.snapshot }, "description": description, "targetUrl": targetUrl])
1860718619
}
1860818620

1860918621
public var __typename: String {
@@ -18664,6 +18676,16 @@ public struct CommitContext: GraphQLFragment {
1866418676
}
1866518677
}
1866618678

18679+
/// The URL for this status context.
18680+
public var targetUrl: String? {
18681+
get {
18682+
return snapshot["targetUrl"] as? String
18683+
}
18684+
set {
18685+
snapshot.updateValue(newValue, forKey: "targetUrl")
18686+
}
18687+
}
18688+
1866718689
public struct Creator: GraphQLSelectionSet {
1866818690
public static let possibleTypes = ["Organization", "User", "Bot"]
1866918691

gql/Fragments.graphql

+1
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ fragment commitContext on Commit {
104104
avatarUrl
105105
}
106106
description
107+
targetUrl
107108
}
108109
state
109110
}

0 commit comments

Comments
 (0)