Fix SwiftLint errors
This commit is contained in:
parent
fa1ef6fcda
commit
3fbb520a10
5 changed files with 33 additions and 25 deletions
2
.github/actions/build-for-testing/action.yml
vendored
2
.github/actions/build-for-testing/action.yml
vendored
|
|
@ -27,7 +27,9 @@ runs:
|
|||
Apple/DerivedData
|
||||
key: ${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-${{ inputs.scheme }}-${{ hashFiles('**/Package.resolved') }}
|
||||
${{ runner.os }}-${{ inputs.scheme }}-
|
||||
${{ runner.os }}-
|
||||
- name: Build
|
||||
shell: bash
|
||||
working-directory: Apple
|
||||
|
|
|
|||
6
.github/workflows/build-rust.yml
vendored
6
.github/workflows/build-rust.yml
vendored
|
|
@ -21,14 +21,16 @@ jobs:
|
|||
- x86_64-unknown-linux-gnu
|
||||
targets:
|
||||
- aarch64-unknown-linux-gnu
|
||||
- os: macos-12
|
||||
- os: macos-13
|
||||
platform: macOS (Intel)
|
||||
xcode: /Applications/Xcode_15.2.app
|
||||
test-targets:
|
||||
- x86_64-apple-darwin
|
||||
targets:
|
||||
- x86_64-apple-ios
|
||||
- os: macos-14
|
||||
platform: macOS
|
||||
xcode: /Applications/Xcode_16.0.app
|
||||
test-targets:
|
||||
- aarch64-apple-darwin
|
||||
targets:
|
||||
|
|
@ -42,7 +44,7 @@ jobs:
|
|||
- aarch64-pc-windows-msvc
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
DEVELOPER_DIR: /Applications/Xcode_16.0.app/Contents/Developer
|
||||
DEVELOPER_DIR: ${{ matrix.xcode }}/Contents/Developer
|
||||
CARGO_INCREMENTAL: 0
|
||||
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
|
||||
RUST_BACKTRACE: short
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
import AppKit
|
||||
import SwiftUI
|
||||
|
||||
@MainActor @main
|
||||
@main
|
||||
@MainActor
|
||||
class AppDelegate: NSObject, NSApplicationDelegate {
|
||||
private let quitItem: NSMenuItem = {
|
||||
let quitItem = NSMenuItem(
|
||||
|
|
|
|||
|
|
@ -42,7 +42,6 @@ struct BurrowView: View {
|
|||
}
|
||||
|
||||
private func addWireGuardNetwork() {
|
||||
|
||||
}
|
||||
|
||||
private func authenticateWithSlack() async throws {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import AuthenticationServices
|
||||
import SwiftUI
|
||||
import Foundation
|
||||
import SwiftUI
|
||||
|
||||
enum OAuth2 {
|
||||
enum Error: Swift.Error {
|
||||
|
|
@ -35,7 +35,7 @@ enum OAuth2 {
|
|||
}
|
||||
}
|
||||
|
||||
public init(
|
||||
init(
|
||||
authorizationEndpoint: URL,
|
||||
tokenEndpoint: URL,
|
||||
redirectURI: URL,
|
||||
|
|
@ -125,7 +125,11 @@ enum OAuth2 {
|
|||
var refreshToken: String?
|
||||
|
||||
var credential: Credential {
|
||||
.init(accessToken: accessToken, refreshToken: refreshToken, expirationDate: expiresIn.map { Date.init(timeIntervalSinceNow: $0) })
|
||||
.init(
|
||||
accessToken: accessToken,
|
||||
refreshToken: refreshToken,
|
||||
expirationDate: expiresIn.map { Date(timeIntervalSinceNow: $0) }
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -203,7 +207,24 @@ enum OAuth2 {
|
|||
}
|
||||
|
||||
extension WebAuthenticationSession {
|
||||
func start(url: URL, redirectURI: URL) async throws -> URL {
|
||||
#if canImport(BrowserEngineKit)
|
||||
@available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *)
|
||||
fileprivate static func callback(for redirectURI: URL) throws -> ASWebAuthenticationSession.Callback {
|
||||
switch redirectURI.scheme {
|
||||
case "https":
|
||||
guard let host = redirectURI.host else { throw OAuth2.Error.invalidRedirectURI }
|
||||
return .https(host: host, path: redirectURI.path)
|
||||
case "http":
|
||||
throw OAuth2.Error.invalidRedirectURI
|
||||
case .some(let scheme):
|
||||
return .customScheme(scheme)
|
||||
case .none:
|
||||
throw OAuth2.Error.invalidRedirectURI
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
fileprivate func start(url: URL, redirectURI: URL) async throws -> URL {
|
||||
#if canImport(BrowserEngineKit)
|
||||
if #available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *) {
|
||||
return try await authenticate(
|
||||
|
|
@ -231,23 +252,6 @@ extension WebAuthenticationSession {
|
|||
return url
|
||||
}
|
||||
}
|
||||
|
||||
#if canImport(BrowserEngineKit)
|
||||
@available(iOS 17.4, macOS 14.4, tvOS 17.4, watchOS 10.4, *)
|
||||
fileprivate static func callback(for redirectURI: URL) throws -> ASWebAuthenticationSession.Callback {
|
||||
switch redirectURI.scheme {
|
||||
case "https":
|
||||
guard let host = redirectURI.host else { throw OAuth2.Error.invalidRedirectURI }
|
||||
return .https(host: host, path: redirectURI.path)
|
||||
case "http":
|
||||
throw OAuth2.Error.invalidRedirectURI
|
||||
case .some(let scheme):
|
||||
return .customScheme(scheme)
|
||||
case .none:
|
||||
throw OAuth2.Error.invalidRedirectURI
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
extension View {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue