Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch to Swift 5.9 #61

Merged
merged 2 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## [Unreleased]
* [#61](https://github.com/blackjacx/assist/pull/61): Switch to Swift 5.9 - [@Blackjacx](https://github.com/blackjacx).

## [0.4.1] - 2023-08-24Z
* Add log to show which tester is processed - [@Blackjacx](https://github.com/blackjacx).
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.8
// swift-tools-version:5.9
import PackageDescription

let package = Package(
Expand Down
12 changes: 6 additions & 6 deletions Sources/Core/Logger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,17 @@ public extension Logger {

var name: String {
switch self {
case .warn: return "Warn"
case .info: return "Info"
case .error: return "Error"
case .warn: "Warn"
case .info: "Info"
case .error: "Error"
}
}

var emoji: String {
switch self {
case .warn: return "🟡"
case .info: return "🟢"
case .error: return "🔴"
case .warn: "🟡"
case .info: "🟢"
case .error: "🔴"
}
}
}
Expand Down
5 changes: 2 additions & 3 deletions Sources/Core/Networking/JSONWebToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ public struct JSONWebToken {
}

public static func token(for service: Service) async throws -> String {

switch service {
case .apns(let credentials): return try token(credentials: credentials)
case .fcm(let credentials): return try await token(credentials: credentials)
case .apns(let credentials): try token(credentials: credentials)
case .fcm(let credentials): try await token(credentials: credentials)
}
}

Expand Down
4 changes: 2 additions & 2 deletions Sources/Core/Shell/Xcodebuild.swift
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ public struct Xcodebuild {

var name: String {
switch self {
case .buildForTesting: return "build-for-testing"
case .testWithoutBuilding: return "test-without-building"
case .buildForTesting: "build-for-testing"
case .testWithoutBuilding: "test-without-building"
}
}
}
Expand Down
29 changes: 16 additions & 13 deletions Sources/Push/PushEndpoint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,36 +22,35 @@ extension PushEndpoint: Endpoint {

var host: String {
switch self {
case .pushViaApns(_, let endpoint, _, _, _): return endpoint.host
case .pushViaFcm: return "fcm.googleapis.com"
case .pushViaApns(_, let endpoint, _, _, _): endpoint.host
case .pushViaFcm: "fcm.googleapis.com"
}
}

var port: Int? {
switch self {
case .pushViaApns: return 443
case .pushViaFcm: return nil
case .pushViaApns: 443
case .pushViaFcm: nil
}
}

var path: String {
switch self {
case let .pushViaApns(_, _, deviceToken, _, _): return "/3/device/\(deviceToken)"
case let .pushViaFcm(_, _, credentials): return "/v1/projects/\(credentials.projectId)/messages:send"
case let .pushViaApns(_, _, deviceToken, _, _): "/3/device/\(deviceToken)"
case let .pushViaFcm(_, _, credentials): "/v1/projects/\(credentials.projectId)/messages:send"
}
}

var queryItems: [URLQueryItem] {
switch self {
case .pushViaApns: return []
case .pushViaFcm: return []
case .pushViaApns: []
case .pushViaFcm: []
}
}

var method: HTTPMethod {
switch self {
case .pushViaApns, .pushViaFcm:
return .post
case .pushViaApns, .pushViaFcm: .post
}
}

Expand Down Expand Up @@ -100,16 +99,20 @@ extension PushEndpoint: Endpoint {
var parameters: [String : Any]? {
switch self {
case let .pushViaApns(_, _, _, _, message):
return ["aps": ["alert": message]]
[
"aps": [
"alert": message
]
]
case let .pushViaFcm(deviceToken, message, _):
return [
[
"message": [
"notification": [
"title": "Hello FCM",
"body": message
],
"token": deviceToken
] as [String: Any]
]
]
}
}
Expand Down
4 changes: 2 additions & 2 deletions Sources/Push/commands/sub/Apns.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ extension Push {

var host: String {
switch self {
case .sandbox: return "api.sandbox.push.apple.com"
case .production: return "api.push.apple.com"
case .sandbox: "api.sandbox.push.apple.com"
case .production: "api.push.apple.com"
}
}
}
Expand Down