Merge branch 'bugfix/CXTDT-544924' into 'develop'
Digital PCT32 defect CXTDT-544924 - Insert missing OpenUrlOptionsModel handling. ### Summary Insert missing OpenUrlOptionsModel handling for universalLinksOnly. ### JIRA Ticket https://onejira.verizon.com/browse/CXTDT-544924 Co-authored-by: Hedden, Kyle Matthew <kyle.hedden@verizonwireless.com> See merge request https://gitlab.verizon.com/BPHV_MIPS/mvm_core/-/merge_requests/322
This commit is contained in:
commit
58f7abb5fc
@ -54,9 +54,9 @@ open class ActionOpenUrlHandler: MVMCoreJSONActionHandlerProtocol {
|
|||||||
|
|
||||||
/// Opens the url using UIApplication open(url:). Throws URLError.failedToOpen if it fails.
|
/// Opens the url using UIApplication open(url:). Throws URLError.failedToOpen if it fails.
|
||||||
@MainActor
|
@MainActor
|
||||||
public static func open(url: URL) async throws {
|
public static func open(url: URL, options: [UIApplication.OpenExternalURLOptionsKey : Any] = [:]) async throws {
|
||||||
try await withCheckedThrowingContinuation { continuation in
|
try await withCheckedThrowingContinuation { continuation in
|
||||||
UIApplication.shared.open(url, options: [:]) { successful in
|
UIApplication.shared.open(url, options: options) { successful in
|
||||||
if successful {
|
if successful {
|
||||||
continuation.resume()
|
continuation.resume()
|
||||||
} else {
|
} else {
|
||||||
@ -76,12 +76,13 @@ open class ActionOpenUrlHandler: MVMCoreJSONActionHandlerProtocol {
|
|||||||
// Try loading the app url first, otherwise fall back to browser url.
|
// Try loading the app url first, otherwise fall back to browser url.
|
||||||
if let appURL = model.appURL {
|
if let appURL = model.appURL {
|
||||||
do {
|
do {
|
||||||
try await ActionOpenUrlHandler.open(url: appURL)
|
try await ActionOpenUrlHandler.open(url: appURL, options: model.appURLOptions?.options ?? [:])
|
||||||
return
|
return
|
||||||
} catch {
|
} catch {
|
||||||
// Log error and continue
|
// Log error and continue
|
||||||
MVMCoreLoggingHandler.shared()?.handleDebugMessage("Failed to open app url: \(appURL)")
|
MVMCoreLoggingHandler.shared()?.handleDebugMessage("Failed to open app url: \(appURL)")
|
||||||
if let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: MVMCoreActionHandler.getErrorLocation(with: delegateObject?.actionDelegate, actionType: model.actionType)) {
|
let isUsingUniversalLinksOnly = model.appURLOptions?.options[.universalLinksOnly] as? Bool ?? false
|
||||||
|
if !isUsingUniversalLinksOnly, let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: MVMCoreActionHandler.getErrorLocation(with: delegateObject?.actionDelegate, actionType: model.actionType)) {
|
||||||
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
|
MVMCoreLoggingHandler.shared()?.addError(toLog: errorObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user