Skip to content

Commit c2250dd

Browse files
committed
chore(format): run swift formatter
1 parent a5c7856 commit c2250dd

134 files changed

Lines changed: 49208 additions & 46757 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dayflow/Dayflow/App/AppDeepLinkRouter.swift

Lines changed: 72 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -2,96 +2,98 @@ import Foundation
22

33
@MainActor
44
protocol AppDeepLinkRouterDelegate: AnyObject {
5-
func prepareForRecordingToggle(reason: String)
5+
func prepareForRecordingToggle(reason: String)
66
}
77

88
@MainActor
99
final class AppDeepLinkRouter {
10-
enum Action: String {
11-
case startRecording = "start-recording"
12-
case stopRecording = "stop-recording"
13-
14-
init?(identifier: String) {
15-
switch identifier.lowercased() {
16-
case Self.startRecording.rawValue, "start", "resume":
17-
self = .startRecording
18-
case Self.stopRecording.rawValue, "stop", "pause":
19-
self = .stopRecording
20-
default:
21-
return nil
22-
}
23-
}
10+
enum Action: String {
11+
case startRecording = "start-recording"
12+
case stopRecording = "stop-recording"
13+
14+
init?(identifier: String) {
15+
switch identifier.lowercased() {
16+
case Self.startRecording.rawValue, "start", "resume":
17+
self = .startRecording
18+
case Self.stopRecording.rawValue, "stop", "pause":
19+
self = .stopRecording
20+
default:
21+
return nil
22+
}
2423
}
24+
}
2525

26-
private weak var delegate: AppDeepLinkRouterDelegate?
26+
private weak var delegate: AppDeepLinkRouterDelegate?
2727

28-
init(delegate: AppDeepLinkRouterDelegate?) {
29-
self.delegate = delegate
30-
}
31-
32-
@discardableResult
33-
func handle(_ url: URL) -> Bool {
34-
guard let action = resolveAction(from: url) else {
35-
print("[DeepLink] Unsupported URL: \(url.absoluteString)")
36-
return false
37-
}
28+
init(delegate: AppDeepLinkRouterDelegate?) {
29+
self.delegate = delegate
30+
}
3831

39-
perform(action)
40-
return true
32+
@discardableResult
33+
func handle(_ url: URL) -> Bool {
34+
guard let action = resolveAction(from: url) else {
35+
print("[DeepLink] Unsupported URL: \(url.absoluteString)")
36+
return false
4137
}
4238

43-
private func resolveAction(from url: URL) -> Action? {
44-
guard let scheme = url.scheme, scheme.caseInsensitiveCompare("dayflow") == .orderedSame else {
45-
return nil
46-
}
39+
perform(action)
40+
return true
41+
}
4742

48-
var candidates: [String] = []
49-
if let host = url.host, !host.isEmpty {
50-
candidates.append(host)
51-
}
43+
private func resolveAction(from url: URL) -> Action? {
44+
guard let scheme = url.scheme, scheme.caseInsensitiveCompare("dayflow") == .orderedSame else {
45+
return nil
46+
}
5247

53-
let pathComponents = url.path
54-
.split(separator: "/")
55-
.map { String($0) }
48+
var candidates: [String] = []
49+
if let host = url.host, !host.isEmpty {
50+
candidates.append(host)
51+
}
5652

57-
candidates.append(contentsOf: pathComponents)
53+
let pathComponents = url.path
54+
.split(separator: "/")
55+
.map { String($0) }
5856

59-
if candidates.isEmpty {
60-
if let actionItem = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?.first(where: { $0.name.lowercased() == "action" }),
61-
let value = actionItem.value, !value.isEmpty {
62-
candidates.append(value)
63-
}
64-
}
57+
candidates.append(contentsOf: pathComponents)
6558

66-
guard let identifier = candidates.first else { return nil }
67-
return Action(identifier: identifier)
59+
if candidates.isEmpty {
60+
if let actionItem = URLComponents(url: url, resolvingAgainstBaseURL: false)?.queryItems?
61+
.first(where: { $0.name.lowercased() == "action" }),
62+
let value = actionItem.value, !value.isEmpty
63+
{
64+
candidates.append(value)
65+
}
6866
}
6967

70-
private func perform(_ action: Action) {
71-
switch action {
72-
case .startRecording:
73-
startRecording()
74-
case .stopRecording:
75-
stopRecording()
76-
}
77-
}
68+
guard let identifier = candidates.first else { return nil }
69+
return Action(identifier: identifier)
70+
}
7871

79-
private func startRecording() {
80-
guard !AppState.shared.isRecording else {
81-
print("[DeepLink] Recording already active; ignoring start request")
82-
return
83-
}
84-
delegate?.prepareForRecordingToggle(reason: "deeplink")
85-
AppState.shared.isRecording = true
72+
private func perform(_ action: Action) {
73+
switch action {
74+
case .startRecording:
75+
startRecording()
76+
case .stopRecording:
77+
stopRecording()
8678
}
79+
}
8780

88-
private func stopRecording() {
89-
guard AppState.shared.isRecording else {
90-
print("[DeepLink] Recording already stopped; ignoring stop request")
91-
return
92-
}
93-
delegate?.prepareForRecordingToggle(reason: "deeplink")
94-
AppState.shared.isRecording = false
81+
private func startRecording() {
82+
guard !AppState.shared.isRecording else {
83+
print("[DeepLink] Recording already active; ignoring start request")
84+
return
85+
}
86+
delegate?.prepareForRecordingToggle(reason: "deeplink")
87+
AppState.shared.isRecording = true
88+
}
89+
90+
private func stopRecording() {
91+
guard AppState.shared.isRecording else {
92+
print("[DeepLink] Recording already stopped; ignoring stop request")
93+
return
9594
}
95+
delegate?.prepareForRecordingToggle(reason: "deeplink")
96+
AppState.shared.isRecording = false
97+
}
9698

9799
}

0 commit comments

Comments
 (0)