diff --git a/MVMCore/MVMCore/ActionHandling/ActionShareHandler.swift b/MVMCore/MVMCore/ActionHandling/ActionShareHandler.swift index c6e699a..3634c11 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionShareHandler.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionShareHandler.swift @@ -26,12 +26,6 @@ open class ActionShareHandler: MVMCoreActionHandlerProtocol { if completed { // Activity was completed, considered finished. continuation.resume() - } else if let _ = activityType { - // If a specific type of activity failed, the activity controller is still presented, cannot continue yet. - if let error = error, - let errorObject = MVMCoreErrorObject.createErrorObject(for: error, location: MVMCoreActionHandler.getErrorLocation(with: delegateObject?.actionDelegate, actionType: model.actionType)) { - MVMCoreLoggingHandler.addError(toLog: errorObject) - } } else if let error = error { continuation.resume(throwing: error) } else { diff --git a/MVMCore/MVMCore/ActionHandling/ActionShareModel.swift b/MVMCore/MVMCore/ActionHandling/ActionShareModel.swift index 7895c68..ddeb7d8 100644 --- a/MVMCore/MVMCore/ActionHandling/ActionShareModel.swift +++ b/MVMCore/MVMCore/ActionHandling/ActionShareModel.swift @@ -66,8 +66,8 @@ public struct ActionShareModel: ActionModelProtocol { // MARK: - Initializer //-------------------------------------------------- - public init(sharedText: String, sharedType: ActionShareItemModel.SharedType, _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) { - items = [ActionShareItemModel(type: sharedType, value: sharedText)] + public init(items: [ActionShareItemModel], _ extraParameters: JSONValueDictionary? = nil, _ analyticsData: JSONValueDictionary? = nil) { + self.items = items self.extraParameters = extraParameters self.analyticsData = analyticsData } @@ -83,24 +83,34 @@ public struct ActionShareModel: ActionModelProtocol { case sharedText } + private enum DeprecatedCodingKeys: String, CodingKey { + case sharedType + case sharedText + } + public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) if let items = try typeContainer.decodeIfPresent([ActionShareItemModel].self, forKey: .items) { - self.items = items + self.init(items: items) } else { // Legacy - let type = try typeContainer.decode(ActionShareItemModel.SharedType.self, forKey: .sharedType) - var value: Any - switch type { - case .url: - value = try typeContainer.decode(URL.self, forKey: .sharedText) - default: - value = try typeContainer.decode(String.self, forKey: .sharedText) - } - items = [ActionShareItemModel(type: type, value: value)] + try self.init(deprecatedFrom: decoder) } } + private init(deprecatedFrom decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: DeprecatedCodingKeys.self) + let type = try typeContainer.decode(ActionShareItemModel.SharedType.self, forKey: .sharedType) + var value: Any + switch type { + case .url: + value = try typeContainer.decode(URL.self, forKey: .sharedText) + default: + value = try typeContainer.decode(String.self, forKey: .sharedText) + } + items = [ActionShareItemModel(type: type, value: value)] + } + public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(actionType, forKey: .actionType)