Compare commits
11 Commits
2b36711bca
...
3e1581e28e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3e1581e28e | ||
|
|
8f2483eb1b | ||
|
|
12d17dbca8 | ||
|
|
c360c75512 | ||
|
|
d57a86e140 | ||
|
|
214ccfd8f6 | ||
|
|
31aa1d6df7 | ||
|
|
817d7900f4 | ||
|
|
4b35a8bb2d | ||
|
|
a29fa60e5e | ||
|
|
3103f8dd89 |
@ -1113,7 +1113,7 @@
|
|||||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../SharedFrameworks";
|
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../SharedFrameworks";
|
||||||
INFOPLIST_FILE = MVMCore/Info.plist;
|
INFOPLIST_FILE = MVMCore/Info.plist;
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
MARKETING_VERSION = 3.1;
|
MARKETING_VERSION = 3.1;
|
||||||
@ -1140,7 +1140,7 @@
|
|||||||
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../SharedFrameworks";
|
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../../SharedFrameworks";
|
||||||
INFOPLIST_FILE = MVMCore/Info.plist;
|
INFOPLIST_FILE = MVMCore/Info.plist;
|
||||||
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
|
||||||
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
|
IPHONEOS_DEPLOYMENT_TARGET = 15.0;
|
||||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
|
||||||
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
LIBRARY_SEARCH_PATHS = "$(inherited)";
|
||||||
MARKETING_VERSION = 3.1;
|
MARKETING_VERSION = 3.1;
|
||||||
|
|||||||
@ -25,11 +25,16 @@ open class ActionRestartHandler: MVMCoreActionHandlerProtocol {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
continuation.resume(throwing: MVMCoreError.errorObject(error))
|
continuation.resume(throwing: MVMCoreError.errorObject(error))
|
||||||
} else {
|
return
|
||||||
// Restarts the app (forcing any passed in page types).
|
|
||||||
MVMCoreSessionObject.sharedGlobal()?.restartSession(withPageType: model.pageType, request: model.requestURL, parameters: model.extraParameters?.toJSON(), clearAllVariables: true)
|
|
||||||
continuation.resume()
|
|
||||||
}
|
}
|
||||||
|
if let sessionObject = MVMCoreSessionObject.sharedGlobal() {
|
||||||
|
if model.hardReset {
|
||||||
|
sessionObject.clearPersistentCache()
|
||||||
|
}
|
||||||
|
// Restarts the app (forcing any passed in page types).
|
||||||
|
sessionObject.restartSession(withPageType: model.pageType, request: model.requestURL, parameters: model.extraParameters?.toJSON(), clearAllVariables: true)
|
||||||
|
}
|
||||||
|
continuation.resume()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ public struct ActionRestartModel: ActionModelProtocol {
|
|||||||
public static var identifier: String = "restart"
|
public static var identifier: String = "restart"
|
||||||
public var actionType: String = ActionRestartModel.identifier
|
public var actionType: String = ActionRestartModel.identifier
|
||||||
public var requestURL: URL?
|
public var requestURL: URL?
|
||||||
|
@DecodableDefault.True public var hardReset: Bool
|
||||||
public var extraParameters: JSONValueDictionary?
|
public var extraParameters: JSONValueDictionary?
|
||||||
public var analyticsData: JSONValueDictionary?
|
public var analyticsData: JSONValueDictionary?
|
||||||
|
|
||||||
@ -26,11 +27,12 @@ public struct ActionRestartModel: ActionModelProtocol {
|
|||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(_ pageType: String? = nil, _ requestUrl: URL? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
public init(_ pageType: String? = nil, _ requestUrl: URL? = nil, hardReset: Bool? = nil, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) {
|
||||||
self.pageType = pageType
|
self.pageType = pageType
|
||||||
self.requestURL = requestUrl
|
self.requestURL = requestUrl
|
||||||
self.extraParameters = extraParameters
|
self.extraParameters = extraParameters
|
||||||
self.analyticsData = analyticsData
|
self.analyticsData = analyticsData
|
||||||
|
self.hardReset = hardReset ?? true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
public func isEqual(to model: any ModelComparisonProtocol) -> Bool {
|
||||||
@ -39,5 +41,6 @@ public struct ActionRestartModel: ActionModelProtocol {
|
|||||||
&& analyticsData == model.analyticsData
|
&& analyticsData == model.analyticsData
|
||||||
&& requestURL == model.requestURL
|
&& requestURL == model.requestURL
|
||||||
&& pageType == model.pageType
|
&& pageType == model.pageType
|
||||||
|
&& hardReset == model.hardReset
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -686,19 +686,24 @@
|
|||||||
|
|
||||||
if (obj && [obj isKindOfClass:[NSDictionary class]]) {
|
if (obj && [obj isKindOfClass:[NSDictionary class]]) {
|
||||||
NSDictionary *responseInfo = [obj dict:KeyResponseInfo];
|
NSDictionary *responseInfo = [obj dict:KeyResponseInfo];
|
||||||
|
//Response Info is missing but errorObject should be created with generic message + code + domain
|
||||||
if (responseInfo == nil) {
|
if (responseInfo == nil) {
|
||||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] errorForLoadObject:loadObject withTitle:nil message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical] code:ErrorCodeJSONNotDictionary domain:ErrorDomainSystem];
|
errorObject = [[MVMCoreLoadHandler sharedGlobal]
|
||||||
}else {
|
errorForLoadObject:loadObject
|
||||||
if (![ValueTypeSuccess isEqualToString:[responseInfo string:KeyType]]) {
|
withTitle:nil
|
||||||
errorObject = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:
|
message:[MVMCoreGetterUtility hardcodedStringWithKey:HardcodedErrorCritical]
|
||||||
[[MVMCoreErrorObject alloc]
|
messageToLog:[NSString stringWithFormat:@"Module %@ is missing a %@ object.", key, KeyResponseInfo]
|
||||||
initWithTitle:[responseInfo stringForKey:KeyErrorHeading]
|
code:ErrorCodeJSONNotDictionary
|
||||||
message:[responseInfo stringForKey:KeyUserMessage]
|
domain:ErrorDomainServer];
|
||||||
messageToLog:[responseInfo stringForKey:KeyMessage]
|
} else if (![ValueTypeSuccess isEqualToString:[responseInfo string:KeyType]]) {
|
||||||
code:[[responseInfo string:KeyCode] integerValue]
|
errorObject = [[MVMCoreLoadHandler sharedGlobal] attachLoadInformation:loadObject toError:
|
||||||
domain:ErrorDomainServer
|
[[MVMCoreErrorObject alloc]
|
||||||
location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]];
|
initWithTitle:[responseInfo stringForKey:KeyErrorHeading]
|
||||||
}
|
message:[responseInfo stringForKey:KeyUserMessage]
|
||||||
|
messageToLog:[responseInfo stringForKey:KeyMessage]
|
||||||
|
code:[[responseInfo string:KeyCode] integerValue]
|
||||||
|
domain:ErrorDomainServer
|
||||||
|
location:[[MVMCoreLoadHandler sharedGlobal] errorLocationForRequest:loadObject]]];
|
||||||
}
|
}
|
||||||
// Caches each dictionary from the array.
|
// Caches each dictionary from the array.
|
||||||
[[MVMCoreCache sharedCache] addModuleToCache:obj module:key queue:nil waitUntilFinished:YES completionBlock:NULL];
|
[[MVMCoreCache sharedCache] addModuleToCache:obj module:key queue:nil waitUntilFinished:YES completionBlock:NULL];
|
||||||
|
|||||||
@ -70,9 +70,35 @@ import os
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func handleWarningMessage(_ message: String, category: String?) {
|
||||||
|
#if LOGGING
|
||||||
|
guard message.count < 1024 else {
|
||||||
|
getLogger(category: category).warning("\(message.prefix(300), privacy: .public)... <stdio>") // Send initial log to console.
|
||||||
|
print(message) // Print the whole on stdout.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getLogger(category: category).warning("\(message, privacy: .public)") // Assume that becaues this is a LOGGING build we want these messages to be unmasked.
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
open func handleErrorMessage(_ message: String, category: String?) {
|
||||||
|
#if LOGGING
|
||||||
|
guard message.count < 1024 else {
|
||||||
|
getLogger(category: category).error("\(message.prefix(300), privacy: .public)... <stdio>") // Send initial log to console.
|
||||||
|
print(message) // Print the whole on stdout.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
getLogger(category: category).error("\(message, privacy: .public)") // Assume that becaues this is a LOGGING build we want these messages to be unmasked.
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
@objc(addErrorToLog:)
|
@objc(addErrorToLog:)
|
||||||
open func addError(toLog errorObject: MVMCoreErrorObject) {
|
open func addError(toLog errorObject: MVMCoreErrorObject) {
|
||||||
// Subclass to handle.
|
if errorObject.silentError {
|
||||||
|
handleWarningMessage(errorObject.messageToLog ?? errorObject.messageToDisplay ?? "Some error occurred.", category: "Handled Exception")
|
||||||
|
} else {
|
||||||
|
handleErrorMessage(errorObject.messageToLog ?? errorObject.messageToDisplay ?? "Some error occurred.", category: "Handled Exception")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open func logLoadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: MVMCoreViewControllerProtocol?, error: MVMCoreErrorObject?) {}
|
open func logLoadFinished(_ loadObject: MVMCoreLoadObject?, loadedViewController: MVMCoreViewControllerProtocol?, error: MVMCoreErrorObject?) {}
|
||||||
|
|||||||
@ -38,6 +38,9 @@
|
|||||||
/// Clears the session singleton. Creates a new session NSURLSession also.
|
/// Clears the session singleton. Creates a new session NSURLSession also.
|
||||||
- (void)clearSessionObject;
|
- (void)clearSessionObject;
|
||||||
|
|
||||||
|
/// Clears any persistent cache related to the current session.
|
||||||
|
- (void)clearPersistentCache;
|
||||||
|
|
||||||
/// Copys string to clipboard and assigns self.clipboardString for validation
|
/// Copys string to clipboard and assigns self.clipboardString for validation
|
||||||
/// Should only be used when expected string is a secure string
|
/// Should only be used when expected string is a secure string
|
||||||
-(void)copyStringToClipboard :(nullable NSString *)clipboardString;
|
-(void)copyStringToClipboard :(nullable NSString *)clipboardString;
|
||||||
|
|||||||
@ -53,4 +53,6 @@
|
|||||||
self.session = [self createNSURLSession];
|
self.session = [self createNSURLSession];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void)clearPersistentCache {}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user