Skip to content

Commit

Permalink
Merge pull request #60 from winebarrel/show_service
Browse files Browse the repository at this point in the history
Show service
  • Loading branch information
winebarrel authored Nov 4, 2024
2 parents 70627fa + 3e061ed commit f2e4a26
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 19 deletions.
8 changes: 4 additions & 4 deletions PagerCall.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@
CODE_SIGN_ENTITLEMENTS = PagerCall/PagerCall.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 97A8B2WE2P;
Expand All @@ -308,7 +308,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = jp.winebarrel.PagerCall;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand All @@ -324,7 +324,7 @@
CODE_SIGN_ENTITLEMENTS = PagerCall/PagerCall.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 3;
CURRENT_PROJECT_VERSION = 0;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "";
DEVELOPMENT_TEAM = 97A8B2WE2P;
Expand All @@ -339,7 +339,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MARKETING_VERSION = 1.0;
MARKETING_VERSION = 1.1;
PRODUCT_BUNDLE_IDENTIFIER = jp.winebarrel.PagerCall;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_EMIT_LOC_STRINGS = YES;
Expand Down
31 changes: 19 additions & 12 deletions PagerCall/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,25 @@ struct ContentView: View {
}
} else {
List(self.pagerDuty.incidents) { incident in
Link(destination: URL(string: incident.htmlUrl)!) {
Text(incident.urgency.rawValue)
.font(.caption)
.padding(.horizontal, 3)
.foregroundColor(.white)
.background(incident.urgency == .high ? .urgencyHigh : .gray, in: RoundedRectangle(cornerRadius: 5))
Text(incident.title)
.multilineTextAlignment(.leading)
.underline(hoverId == incident.id)
.onHover { hovering in
hoverId = hovering ? incident.id : ""
}
VStack(alignment: .leading) {
HStack(spacing: 2) {
Text(incident.urgency.rawValue)
.padding(.horizontal, 3)
.foregroundColor(.white)
.background(incident.urgency == .high ? .urgencyHigh : .gray, in: RoundedRectangle(cornerRadius: 5))
Text("on")
Text(incident.service.summary)
.fontWeight(.bold)
}.font(.caption)

Link(destination: URL(string: incident.htmlUrl)!) {
Text(incident.title)
.multilineTextAlignment(.leading)
.underline(hoverId == incident.id)
.onHover { hovering in
hoverId = hovering ? incident.id : ""
}
}
}
}
}
Expand Down
5 changes: 5 additions & 0 deletions PagerCall/PagerDutyAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ struct Incident: Codable, Identifiable {
let id: String
let title: String
let htmlUrl: String
let service: Service
let urgency: Urgency

struct Service: Codable {
let summary: String
}

enum Urgency: String, Codable {
case high
case low
Expand Down
2 changes: 1 addition & 1 deletion PagerCall/PagerDutyModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class PagerDuty: ObservableObject {

await Notification.notify(
id: inc.id,
title: "\(emoji)PagerCall [\(inc.urgency)]",
title: "\(emoji)PagerCall [\(inc.urgency)] on \(inc.service.summary)",
body: inc.title,
url: inc.htmlUrl
)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ https://github.com/winebarrel/PagerCall/releases/latest

### Show assigned incidents

![](https://github.com/user-attachments/assets/7dc38ed0-70be-453e-ba9f-1ff13f08bfc4)
![](https://github.com/user-attachments/assets/245b1668-c602-4d98-956f-0f24f6e40e37)

### Notifications

![](https://github.com/user-attachments/assets/b039c93e-6df1-4b8a-ac14-676dd15525af)
![](https://github.com/user-attachments/assets/cd37b6fc-7b40-446b-aac0-d51a3cb49e5e)

### Icon indicate PagerDuty status

Expand Down

0 comments on commit f2e4a26

Please sign in to comment.