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

Commit f1882b8

Browse files
akarataevBasThomas
authored andcommitted
Add haptics for merge results (#2668) (#2690)
1 parent f8efbc5 commit f1882b8

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Classes/Issues/Merge/GithubClient+Merge.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extension GithubClient {
1818
repo: String,
1919
number: Int,
2020
type: IssueMergeType,
21-
error: @escaping () -> Void
21+
completionHandler: @escaping (_ success: Bool) -> Void
2222
) {
2323
let newLabels = IssueLabelsModel(
2424
status: IssueLabelStatusModel(
@@ -54,9 +54,10 @@ extension GithubClient {
5454
switch result {
5555
case .success:
5656
cache.set(value: optimisticResult)
57+
completionHandler(true)
5758
case .failure(let err):
5859
Squawk.show(error: err)
59-
error()
60+
completionHandler(false)
6061
}
6162
}
6263
}

Classes/Issues/Merge/IssueMergeSectionController.swift

+8-3
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,14 @@ ListBindingSectionControllerSelectionDelegate {
7474
repo: model.repo,
7575
number: model.number,
7676
type: preferredMergeType,
77-
error: { [weak self] in
78-
self?.loading = false
79-
self?.update(animated: true)
77+
completionHandler: { [weak self] isSuccessfulMerge in
78+
if isSuccessfulMerge {
79+
Haptic.triggerNotification(.success)
80+
} else {
81+
self?.loading = false
82+
self?.update(animated: true)
83+
Haptic.triggerNotification(.error)
84+
}
8085
})
8186
}
8287

0 commit comments

Comments
 (0)