Skip to content

Commit

Permalink
Merge pull request #464 from adobe/staging
Browse files Browse the repository at this point in the history
Merge to main for 5.0.1 release
  • Loading branch information
kevinlind committed May 2, 2024
2 parents d605a7a + 5280a21 commit 7bbaf3e
Show file tree
Hide file tree
Showing 13 changed files with 842 additions and 323 deletions.
2 changes: 1 addition & 1 deletion AEPEdge.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AEPEdge"
s.version = "5.0.0"
s.version = "5.0.1"
s.summary = "Experience Platform Edge extension for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe."

s.description = <<-DESC
Expand Down
12 changes: 10 additions & 2 deletions AEPEdge.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@
BF947F9E244182B30057A6CC /* StoreResponsePayloadManagerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF947F9424414E3E0057A6CC /* StoreResponsePayloadManagerTests.swift */; };
BF947FA0244569190057A6CC /* EdgeRequestTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF947F9F244569190057A6CC /* EdgeRequestTests.swift */; };
BF947FA4244613FB0057A6CC /* RequestMetadataTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF947FA3244613FB0057A6CC /* RequestMetadataTests.swift */; };
BFDF25AB2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDF25AA2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift */; };
BFDF25AD2BDB077E002114B6 /* SharedStateReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFDF25AC2BDB077E002114B6 /* SharedStateReader.swift */; };
BFEEB5AB28D4E35D00B668B8 /* EdgePublicAPITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D45F2E8125EE1987000AC350 /* EdgePublicAPITests.swift */; };
D4000F35245A53FB0052C536 /* EdgeNetworkServiceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4000F34245A53FB0052C536 /* EdgeNetworkServiceTests.swift */; };
D4145F4025D1D3200019EA4C /* EdgeHitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = D4145F3F25D1D3200019EA4C /* EdgeHitTests.swift */; };
Expand Down Expand Up @@ -279,6 +281,8 @@
BF947F9424414E3E0057A6CC /* StoreResponsePayloadManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoreResponsePayloadManagerTests.swift; sourceTree = "<group>"; };
BF947F9F244569190057A6CC /* EdgeRequestTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EdgeRequestTests.swift; sourceTree = "<group>"; };
BF947FA3244613FB0057A6CC /* RequestMetadataTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RequestMetadataTests.swift; sourceTree = "<group>"; };
BFDF25AA2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EdgeQueuedEntityFunctionalTests.swift; sourceTree = "<group>"; };
BFDF25AC2BDB077E002114B6 /* SharedStateReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SharedStateReader.swift; sourceTree = "<group>"; };
C6F54D018682F0FF8E74A16F /* Pods-UnitTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UnitTests.debug.xcconfig"; path = "Target Support Files/Pods-UnitTests/Pods-UnitTests.debug.xcconfig"; sourceTree = "<group>"; };
C71524CA05BF6E5102E01187 /* Pods-E2EFunctionalTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-E2EFunctionalTests.debug.xcconfig"; path = "Target Support Files/Pods-E2EFunctionalTests/Pods-E2EFunctionalTests.debug.xcconfig"; sourceTree = "<group>"; };
C9510E11CC3DB2C62D9D17C0 /* Pods-UpstreamIntegrationTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-UpstreamIntegrationTests.release.xcconfig"; path = "Target Support Files/Pods-UpstreamIntegrationTests/Pods-UpstreamIntegrationTests.release.xcconfig"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -500,6 +504,7 @@
BF947F8E2440F0940057A6CC /* StateMetadata.swift */,
BF947F85243F24570057A6CC /* StoreResponsePayload.swift */,
BF947F92244126D70057A6CC /* StoreResponsePayloadManager.swift */,
BFDF25AC2BDB077E002114B6 /* SharedStateReader.swift */,
);
path = EdgeNetworkHandlers;
sourceTree = "<group>";
Expand Down Expand Up @@ -617,6 +622,7 @@
4CBEE6222A1577E40084BC50 /* NoConfigFunctionalTests.swift */,
4CBEE6242A157CB40084BC50 /* SampleFunctionalTests.swift */,
D4D5B53724325AB700CAB6E4 /* Info.plist */,
BFDF25AA2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift */,
);
name = FunctionalTests;
path = Tests/FunctionalTests;
Expand Down Expand Up @@ -1264,6 +1270,7 @@
buildActionMask = 2147483647;
files = (
D4EC0DBB25E73FF10026EBAA /* EdgeState.swift in Sources */,
BFDF25AD2BDB077E002114B6 /* SharedStateReader.swift in Sources */,
BF0F924F27476E6C00378913 /* ImplementationDetails.swift in Sources */,
D4C6B437251A76CB0038F4F9 /* XDMProtocols.swift in Sources */,
D4C6B438251A76CB0038F4F9 /* Edge+PublicAPI.swift in Sources */,
Expand Down Expand Up @@ -1351,6 +1358,7 @@
4CBEE61B2A1572E50084BC50 /* Edge+PublicAPITests.swift in Sources */,
4CBEE6192A1571DC0084BC50 /* Edge+ConsentTests.swift in Sources */,
D48CBD2224A17EEA00A24BD8 /* TestXDMSchema.swift in Sources */,
BFDF25AB2BD02E58002114B6 /* EdgeQueuedEntityFunctionalTests.swift in Sources */,
4CBEE6252A157CB40084BC50 /* SampleFunctionalTests.swift in Sources */,
2ECFB7522AB391F400653128 /* EdgeDatastreamConfigOverrideTests.swift in Sources */,
4CBEE61D2A1574CE0084BC50 /* EdgePathOverwriteTests.swift in Sources */,
Expand Down Expand Up @@ -1546,7 +1554,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 5.0.0;
MARKETING_VERSION = 5.0.1;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.edge;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down Expand Up @@ -1582,7 +1590,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 5.0.0;
MARKETING_VERSION = 5.0.1;
OTHER_LDFLAGS = "$(inherited)";
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.edge;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
Expand Down
4 changes: 2 additions & 2 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ PODS:
- AEPCore (5.0.0):
- AEPRulesEngine (< 6.0.0, >= 5.0.0)
- AEPServices (< 6.0.0, >= 5.0.0)
- AEPEdge (5.0.0):
- AEPEdge (5.0.1):
- AEPCore (< 6.0.0, >= 5.0.0)
- AEPEdgeIdentity (< 6.0.0, >= 5.0.0)
- AEPEdgeConsent (5.0.0):
Expand Down Expand Up @@ -54,7 +54,7 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS:
AEPAssurance: 7f260ded4df38a70a06efebade8c33a3e3221984
AEPCore: f1c3e9238bb12e7e1103f4407c341ebc65aeab5b
AEPEdge: 6bc7c3f6573fdf0a12fb3ddfd32420112a89c80b
AEPEdge: 0873041dfb29f3126260f2dc16d548a1fefbe0c4
AEPEdgeConsent: d7db1d19eb4c1e2146360ed3c8df315f671b26d5
AEPEdgeIdentity: 3161ff33434586962946912d6b8e9e8fca1c4d23
AEPRulesEngine: fe5800653a4bee07b1e41e61b4d5551f0dba557b
Expand Down
58 changes: 24 additions & 34 deletions Sources/Edge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ public class Edge: NSObject, Extension {
private let SELF_TAG = "Edge"
private var networkService: EdgeNetworkService = EdgeNetworkService()
private var networkResponseHandler: NetworkResponseHandler?
private let sharedStateReader: SharedStateReader
internal var state: EdgeState?

// MARK: - Extension
Expand All @@ -30,6 +31,8 @@ public class Edge: NSObject, Extension {

public required init(runtime: ExtensionRuntime) {
self.runtime = runtime
self.sharedStateReader = SharedStateReader(getSharedState: runtime.getSharedState(extensionName:event:barrier:))

super.init()

// set default on init for register/unregister use-case
Expand Down Expand Up @@ -96,12 +99,29 @@ public class Edge: NSObject, Extension {
/// - Parameter event: an event containing ExperienceEvent data for processing
func handleExperienceEventRequest(_ event: Event) {
guard !shouldIgnore(event: event) else { return }
processAndQueueEvent(event: event)
}

/// Handles the Consent Update event
/// - Parameter event: current event to process
func handleConsentUpdate(_ event: Event) {
processAndQueueEvent(event: event)
}

private func processAndQueueEvent(event: Event) {
guard let data = event.data, !data.isEmpty else {
Log.trace(label: EdgeConstants.LOG_TAG, "\(SELF_TAG) - Event with id \(event.id.uuidString) contained no data, ignoring.")
Log.trace(label: EdgeConstants.LOG_TAG, "\(SELF_TAG) - Event with id \(event.id.uuidString) contains no data, ignoring.")
return
}

// get Configuration shared state, this should be resolved based on readyForEvent check
let edgeConfig = sharedStateReader.getEdgeConfig(event: event)
guard let configId = edgeConfig[EdgeConstants.SharedState.Configuration.CONFIG_ID], !configId.isEmpty else {
Log.warning(label: EdgeConstants.LOG_TAG,
"\(SELF_TAG) - Unable to process the event '\(event.id.uuidString)', configuration 'edge.configId' is missing or empty.")
return // drop current event
}

// get IdentityMap from Identity shared state, this should be resolved based on readyForEvent check
guard let identityState =
getXDMSharedState(extensionName: EdgeConstants.SharedState.Identity.STATE_OWNER_NAME,
Expand All @@ -113,6 +133,7 @@ public class Edge: NSObject, Extension {
}

let edgeEntity = EdgeDataEntity(event: event,
configuration: AnyCodable.from(dictionary: edgeConfig) ?? [:],
identityMap: AnyCodable.from(dictionary: identityState) ?? [:])

guard let entityData = try? JSONEncoder().encode(edgeEntity) else {
Expand All @@ -139,7 +160,7 @@ public class Edge: NSObject, Extension {
/// Handles the generic identities reset event
/// - Parameter event: an `Event`
func handleIdentitiesReset(_ event: Event) {
let edgeEntity = EdgeDataEntity(event: event, identityMap: [:])
let edgeEntity = EdgeDataEntity(event: event, configuration: [:], identityMap: [:])

guard let entityData = try? JSONEncoder().encode(edgeEntity) else {
Log.debug(label: EdgeConstants.LOG_TAG, "\(SELF_TAG) - Failed to encode EdgeDataEntity for event with id: '\(event.id.uuidString)'.")
Expand All @@ -151,36 +172,6 @@ public class Edge: NSObject, Extension {
state?.hitQueue.queue(entity: entity)
}

/// Handles the Consent Update event
/// - Parameter event: current event to process
func handleConsentUpdate(_ event: Event) {
guard let data = event.data, !data.isEmpty else {
Log.trace(label: EdgeConstants.LOG_TAG, "\(SELF_TAG) - Consent update request event \(event.id.uuidString) contained no data, ignoring.")
return
}

// get IdentityMap from Identity shared state, this should be resolved based on readyForEvent check
guard let identityState =
getXDMSharedState(extensionName: EdgeConstants.SharedState.Identity.STATE_OWNER_NAME,
event: event)?.value else {
Log.warning(label: EdgeConstants.LOG_TAG,
"\(SELF_TAG) - Unable to process the event '\(event.id.uuidString)', " +
"Identity shared state is nil.")
return // drop current event
}

let edgeEntity = EdgeDataEntity(event: event,
identityMap: AnyCodable.from(dictionary: identityState) ?? [:])

guard let entityData = try? JSONEncoder().encode(edgeEntity) else {
Log.debug(label: EdgeConstants.LOG_TAG, "\(SELF_TAG) - Failed to encode EdgeDataEntity for event with id: '\(event.id.uuidString)'.")
return
}

let entity = DataEntity(uniqueIdentifier: event.id.uuidString, timestamp: event.timestamp, data: entityData)
state?.hitQueue.queue(entity: entity)
}

func handleRequestLocationHint(_ event: Event) {
var data: [String: Any] = [:]
if let hint = getLocationHint() {
Expand Down Expand Up @@ -248,8 +239,7 @@ public class Edge: NSObject, Extension {

let hitProcessor = EdgeHitProcessor(networkService: networkService,
networkResponseHandler: networkResponseHandler,
getSharedState: getSharedState(extensionName:event:),
getXDMSharedState: getXDMSharedState(extensionName:event:barrier:),
sharedStateReader: sharedStateReader,
readyForEvent: readyForEvent(_:),
getImplementationDetails: getImplementationDetails,
getLocationHint: getLocationHint)
Expand Down
2 changes: 1 addition & 1 deletion Sources/EdgeConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
enum EdgeConstants {

static let EXTENSION_NAME = "com.adobe.edge"
static let EXTENSION_VERSION = "5.0.0"
static let EXTENSION_VERSION = "5.0.1"
static let FRIENDLY_NAME = "AEPEdge"
static let LOG_TAG = FRIENDLY_NAME

Expand Down
3 changes: 3 additions & 0 deletions Sources/EdgeNetworkHandlers/EdgeDataEntity.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ struct EdgeDataEntity: Codable {
/// The `Event` responsible for the hit
let event: Event

/// The current configuration shared state at the time `Event` was queued
let configuration: [String: AnyCodable]

/// The current identity shared state at the time `Event` was queued
let identityMap: [String: AnyCodable]
}

0 comments on commit 7bbaf3e

Please sign in to comment.