ONEAPP-4157: Code review cleanup

This commit is contained in:
Scott Pfeil 2023-06-07 12:06:02 -04:00
parent 5263f7db1a
commit 02b7d8bd93

View File

@ -373,20 +373,20 @@ open class NotificationHandler {
guard let responseJSON = loadObject.responseJSON,
let json = responseJSON.optionalDictionaryForKey(KeyTopAlert) else { return }
Task {
await showNotification(for: json, delegateObject: delegateObject)
do {
try await showNotification(for: json, delegateObject: delegateObject)
} catch {
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "\(self)") {
MVMCoreUILoggingHandler.addError(toLog: errorObject)
}
}
}
}
/// Converts the json to a model and creates the view and queues up the notification.
open func showNotification(for json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) async {
do {
let model = try NotificationModel.decode(json: json, delegateObject: delegateObject)
try await showNotification(for: model, delegateObject: delegateObject)
} catch {
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: "\(self)") {
MVMCoreUILoggingHandler.addError(toLog: errorObject)
}
}
open func showNotification(for json: [AnyHashable: Any], delegateObject: MVMCoreUIDelegateObject?) async throws {
let model = try NotificationModel.decode(json: json, delegateObject: delegateObject)
try await showNotification(for: model, delegateObject: delegateObject)
}
// MARK: - Operation Handling