Descriptor changes

This commit is contained in:
Scott Pfeil 2022-07-29 16:20:21 -04:00
parent cbb5ccded8
commit 36ec79f353
4 changed files with 7 additions and 6 deletions

View File

@ -21,7 +21,7 @@ open class ActionBackHandler: MVMCoreJSONActionHandlerProtocol {
} }
open func performAction(_ model: ActionModelProtocol, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws { open func performAction(_ model: ActionModelProtocol, delegateObject: DelegateObject?, additionalData: [AnyHashable : Any]?) async throws {
await withCheckedContinuation { (continuation: CheckedContinuation<Void, Never>) in await withCheckedContinuation { continuation in
Task(priority: .userInitiated) { Task(priority: .userInitiated) {
await MVMCoreNavigationHandler.shared()?.removeCurrentViewController(true, completionHandler: { await MVMCoreNavigationHandler.shared()?.removeCurrentViewController(true, completionHandler: {
continuation.resume() continuation.resume()

View File

@ -49,7 +49,8 @@ open class ActionOpenUrlHandler: MVMCoreJSONActionHandlerProtocol {
} }
/// Opens the url using UIApplication open(url:). Throws URLError.failedToOpen if it fails. /// Opens the url using UIApplication open(url:). Throws URLError.failedToOpen if it fails.
@MainActor public static func open(url: URL) async throws { @MainActor
public static func open(url: URL) async throws {
try await withCheckedThrowingContinuation { continuation in try await withCheckedThrowingContinuation { continuation in
UIApplication.shared.open(url, options: [:]) { successful in UIApplication.shared.open(url, options: [:]) { successful in
if successful { if successful {

View File

@ -24,7 +24,8 @@ open class ActionShareHandler: MVMCoreActionHandlerProtocol {
try await shareWith(activityItems: shareData, model: model) try await shareWith(activityItems: shareData, model: model)
} }
@MainActor open func shareWith(activityItems: [Any], model: ActionShareModel, delegateObject: DelegateObject? = nil) async throws { @MainActor
open func shareWith(activityItems: [Any], model: ActionShareModel, delegateObject: DelegateObject? = nil) async throws {
try await withCheckedThrowingContinuation { continuation in try await withCheckedThrowingContinuation { continuation in
let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: nil) let controller = UIActivityViewController(activityItems: activityItems, applicationActivities: nil)
controller.popoverPresentationController?.sourceView = MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn?.view controller.popoverPresentationController?.sourceView = MVMCoreNavigationHandler.shared()?.viewControllerToPresentOn?.view

View File

@ -139,6 +139,7 @@ extension MVMCoreActionHandlerProtocol {
} }
/// Performs the action as a task and returns immediately. /// Performs the action as a task and returns immediately.
@discardableResult
open func asyncHandleAction(with model: ActionModelProtocol, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> Task<Void, Error> { open func asyncHandleAction(with model: ActionModelProtocol, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) -> Task<Void, Error> {
let task = Task(priority: .userInitiated) { let task = Task(priority: .userInitiated) {
try Task.checkCancellation() try Task.checkCancellation()
@ -173,9 +174,7 @@ extension MVMCoreActionHandlerProtocol {
/// Subclass to log the action was fired. /// Subclass to log the action was fired.
open func logAction(with model: ActionModelProtocol, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) { open func logAction(with model: ActionModelProtocol, additionalData: [AnyHashable: Any]?, delegateObject: DelegateObject?) {
// Calls legacy log action function. // Calls legacy log action function.
Task { delegateObject?.actionDelegate?.logAction?(withActionInformation: model.toJSON(), additionalData: additionalData)
delegateObject?.actionDelegate?.logAction?(withActionInformation: model.toJSON(), additionalData: additionalData)
}
} }
/// Logs the error. /// Logs the error.