From 98f55d4bc581b862d150e6421f417d8906292bcc Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 31 Jan 2024 09:18:36 -0500 Subject: [PATCH 1/3] add missing error screen --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 3 +++ 1 file changed, 3 insertions(+) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 382c5ca..61d4f84 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -766,6 +766,9 @@ error = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative]; } + if (error) { + error = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:error]; + } [MVMCoreLoadRequestOperation handleShouldContinue:shouldContinue error:error loadObject:loadObject errorBlock:NULL continueBlock:^{ completionHandler(viewController,loadObject); }]; From c89efeb3e79dd1cc43f99ead9ab25b12ab0256a6 Mon Sep 17 00:00:00 2001 From: Scott Pfeil Date: Wed, 31 Jan 2024 09:29:07 -0500 Subject: [PATCH 2/3] shift call to avoid duplication --- MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m index 61d4f84..e2ab27b 100644 --- a/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m +++ b/MVMCore/MVMCore/LoadHandling/MVMCoreLoadRequestOperation.m @@ -758,6 +758,9 @@ // Allows the view controller to handle specific errors (such as ensure it has all the required data). shouldContinue = [viewController shouldFinishProcessingLoad:loadObject error:&error]; + if (error) { + error = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:error]; + } if (!shouldContinue) { viewController = nil; } @@ -766,9 +769,6 @@ error = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorTitle] message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeInitViewController domain:ErrorDomainNative]; } - if (error) { - error = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:error]; - } [MVMCoreLoadRequestOperation handleShouldContinue:shouldContinue error:error loadObject:loadObject errorBlock:NULL continueBlock:^{ completionHandler(viewController,loadObject); }]; From 4552a57ea29916cb3e846b2f2aeecc9b22026931 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 1 Feb 2024 13:50:12 -0500 Subject: [PATCH 3/3] unixMilleseconds calculation off of existing date. open toJSONString options. --- MVMCore/MVMCore/Categories/Date+Extension.swift | 6 +++++- MVMCore/MVMCore/Models/Extensions/Encoder.swift | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/MVMCore/MVMCore/Categories/Date+Extension.swift b/MVMCore/MVMCore/Categories/Date+Extension.swift index 3f7df53..96a29ed 100644 --- a/MVMCore/MVMCore/Categories/Date+Extension.swift +++ b/MVMCore/MVMCore/Categories/Date+Extension.swift @@ -11,6 +11,10 @@ import Foundation public extension Date { static func unixMillisecondsNow() -> Int64 { - return Int64(Self().timeIntervalSince1970 * 1000) + return Self().unixMilliseconds() + } + + func unixMilliseconds() -> Int64 { + return Int64(self.timeIntervalSince1970 * 1000) } } diff --git a/MVMCore/MVMCore/Models/Extensions/Encoder.swift b/MVMCore/MVMCore/Models/Extensions/Encoder.swift index 832059b..a2ff048 100644 --- a/MVMCore/MVMCore/Models/Extensions/Encoder.swift +++ b/MVMCore/MVMCore/Models/Extensions/Encoder.swift @@ -43,9 +43,9 @@ extension Encodable { return jsonArray } - public func toJSONString() -> String? { + public func toJSONString(options: JSONSerialization.WritingOptions = .prettyPrinted) -> String? { guard let json = self.toJSON(), - let data = try? JSONSerialization.data(withJSONObject: json, options: .prettyPrinted), + let data = try? JSONSerialization.data(withJSONObject: json, options: options), let string = String(data: data, encoding: .utf8) else { return nil }