Skip to content
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
9 changes: 6 additions & 3 deletions .github/workflows/xcodebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,15 @@ jobs:
run: swiftlint lint --config .swiftlint.yml
# iOS build (default)
- name: Build iOS
run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=iOS"
run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=iOS"
# macOS build (if the PR has the label of 'os:macOS' applied)
- name: Build macOS
if: ${{ contains(github.event.pull_request.labels.*.name, 'macOS') }}
run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=macOS"
run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=macOS"
# visionOS build (if the PR has the label of 'os:visionOS' applied)
- name: Build visionOS
if: ${{ contains(github.event.pull_request.labels.*.name, 'visionOS') }}
run: xcodebuild -scheme VimViewer -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=visionOS"
run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=visionOS"
- name: Build tvOS
if: ${{ contains(github.event.pull_request.labels.*.name, 'tvOS') }}
run: xcodebuild -scheme OAuthSample -configuration Debug CODE_SIGNING_ALLOWED=NO -destination "generic/platform=tvOS"
24 changes: 24 additions & 0 deletions .swiftlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
only_rules:
- closing_brace
- colon
- comma
- duplicate_imports
- explicit_init
- file_header
- function_body_length
- legacy_constructor
- legacy_nsgeometry_functions
- legacy_constant
- modifier_order
- private_subject
- redundant_self_in_closure
- sorted_imports
- toggle_bool
- trailing_whitespace
- unneeded_break_in_switch
- unused_import
- weak_delegate

# rule parameters
function_body_length:
- 225 # warning
16 changes: 7 additions & 9 deletions OAuthSample/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ import OAuthKit
import SwiftUI

struct ContentView: View {

#if !os(tvOS)
@Environment(\.openWindow)
var openWindow

@Environment(\.dismissWindow)
private var dismissWindow
#endif

@Environment(\.oauth)
var oauth: OAuth

Expand Down Expand Up @@ -50,7 +50,7 @@ struct ContentView: View {
handle(state: state)
}
}

/// Displays a list of oauth providers.
var providerList: some View {
List(oauth.providers) { provider in
Expand All @@ -60,23 +60,21 @@ struct ContentView: View {
}
}
}

/// Reacts to oauth state changes by opening or closing authorization windows.
/// - Parameter state: the published state change
private func handle(state: OAuth.State) {
switch state {
case .empty, .requestingAccessToken, .requestingDeviceCode:
break
case .authorizing, .receivedDeviceCode:
case .authorizing, .receivedDeviceCode:
#if !os(tvOS)
openWindow(id: "oauth")
#endif
break
case .authorized(_):
case .authorized:
#if !os(tvOS)
dismissWindow(id: "oauth")
#endif
break
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions OAuthSample/OAuthSampleApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by Kevin McKee on 5/16/24.
//

import SwiftUI
import OAuthKit
import SwiftUI

@main
struct OAuthSampleApp: App {

@Environment(\.oauth)
var oauth: OAuth

Expand All @@ -19,7 +19,7 @@ struct OAuthSampleApp: App {
WindowGroup {
ContentView()
}

#if !os(tvOS)
WindowGroup(id: "oauth") {
OAWebView()
Expand Down
4 changes: 2 additions & 2 deletions SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ with the [details usually included with bug reports][issue-template].

#### When to report a vulnerability

* You think you have discovered a potential security vulnerability in VimViewer.
* You are unsure how a vulnerability affects VimViewer.
* You think you have discovered a potential security vulnerability in OAuthSample.
* You are unsure how a vulnerability affects OAuthSample.

[issue-template]: https://github.com/codefiesta/OAuthSample/blob/main/.github/ISSUE_TEMPLATE/bug_report.md