Skip to content

Commit

Permalink
A bit of a tidy and swift linting
Browse files Browse the repository at this point in the history
  • Loading branch information
gazreese committed Sep 19, 2024
1 parent 56401d1 commit f3b7993
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
11 changes: 4 additions & 7 deletions FlagsmithClient/Classes/Flagsmith.swift
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,8 @@ public final class Flagsmith: @unchecked Sendable {
}

private func handleSSEResult(_ result: Result<FlagEvent, any Error>) {
// Just print out the results for now
switch result {
case let .success(event):
print("handleSSEResult Received event: \(event)")

// Check whether this event is anything new
if lastUpdatedAt < event.updatedAt {
// Evict everything fron the cache
Expand All @@ -360,17 +357,17 @@ public final class Flagsmith: @unchecked Sendable {
getFeatureFlags(forIdentity: lastUsedIdentity) { result in
switch result {
case let .failure(error):
print("Error getting flags in SSE stream: \(error)")
print("Flagsmith - Error getting flags in SSE stream: \(error.localizedDescription)")

case let .success(value):
case .success:
// On success the flastream is updated automatically in the API call
print("Flags updated from SSE stream: \(value)")
print("Flagsmith - Flags updated from SSE stream.")
}
}
}

case let .failure(error):
print("handleSSEResult Error in SSE connection: \(error)")
print("handleSSEResult Error in SSE connection: \(error.localizedDescription)")
}
}

Expand Down
2 changes: 1 addition & 1 deletion FlagsmithClient/Tests/ReconnectionDelayTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,4 @@ class ReconnectionDelayTests: XCTestCase {
reconnectionDelay.reset()
XCTAssertEqual(reconnectionDelay.nextDelay(), 1.0, "After reset, delay should be 1.0 seconds")
}
}
}
2 changes: 1 addition & 1 deletion FlagsmithClient/Tests/SSEManagerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SSEManagerTests: FlagsmithClientTestCase {
requestFinished.fulfill()
}

if case .success(_) = result {
if case .success = result {
XCTFail("Should not have succeeded")
}
}
Expand Down

0 comments on commit f3b7993

Please sign in to comment.