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

V8/refactoring #104

Merged
merged 2 commits into from
Mar 2, 2024
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
33 changes: 33 additions & 0 deletions ios/src/helpers/ContinuationHelpers.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
@inlinable public func withCheckedThrowingContinuationSafe<T>(_ body: (CheckedContinuationSafe<T, Error>) -> Void) async throws -> T {
return try await withCheckedThrowingContinuation { c in
let continuation = CheckedContinuationSafe<T, Error>(continuation: c)
body(continuation)
}
}

public final class CheckedContinuationSafe<T, E> : Sendable where E : Error {
private let continuation: CheckedContinuation<T, E>
private var isResumed = false

public init(continuation: CheckedContinuation<T, E>) {
self.continuation = continuation
}

public func resume(returning value: T) {
if (isResumed) { return }
self.isResumed = true
continuation.resume(returning: value)
}

public func resume(throwing error: E) {
if (isResumed) { return }
self.isResumed = true
continuation.resume(throwing: error)
}

public func resume() where T == () {
if (isResumed) { return }
self.isResumed = true
continuation.resume()
}
}
9 changes: 0 additions & 9 deletions ios/src/helpers/ThreadingHelpers.swift

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@spryrocks/capacitor-ionic-core-plugin",
"version": "5.8.0-alpha.9",
"version": "5.8.1-alpha.1",
"description": "Ionic plugin core capacitor",
"main": "dist/plugin.cjs.js",
"module": "dist/esm/index.js",
Expand Down