Minor cleanup

This commit is contained in:
Scott Pfeil 2022-07-22 10:20:46 -04:00
parent f123be046c
commit 71b2146862

View File

@ -49,33 +49,26 @@ open class ActionOpenPageHandler: MVMCoreActionHandlerProtocol {
}
public extension ClientParameterHandler {
/// Iterates through the clientParameters list. Gets values from the individual handlers and attaches the parameters to extraParameters.
func getClientParameters(with model: ClientParameterModel, requestParameters: [String: Any], showLoadingOverlay: Bool) async throws -> [String: Any]? {
if showLoadingOverlay {
MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.startLoading()
}
do {
let parameters: [String: Any]? = try await withCheckedThrowingContinuation({ continuation in
do {
try getParameters(with: model, requestParameters: requestParameters) { parameters in
MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.stopLoading(true)
continuation.resume(returning: parameters)
}
} catch {
continuation.resume(throwing: error)
}
})
defer {
if showLoadingOverlay {
MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.stopLoading(true)
}
return parameters
} catch {
if showLoadingOverlay {
MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.stopLoading(true)
}
throw error
}
return try await withCheckedThrowingContinuation({ continuation in
do {
try getParameters(with: model, requestParameters: requestParameters) { parameters in
MVMCoreLoadingOverlayHandler.sharedLoadingOverlay()?.stopLoading(true)
continuation.resume(returning: parameters)
}
} catch {
continuation.resume(throwing: error)
}
})
}
}