Merge branch 'bugfix/prevent_feed_cache_clearing' into 'develop'
Digital PCT265 defect: Prevent standard session restarts from clearing the persistent cache. ### Summary Discovered during Monday's outage, the feed cache is actually getting prematurely cleared on standard session timeouts. Moving logic to be based on the logout action itself. ### JIRA https://onejira.verizon.com/browse/MVAPCT-322 Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/350
This commit is contained in:
commit
d57a86e140
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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 occrured.", 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