Skip to content

Commit

Permalink
Merge pull request #99 from adobe/staging
Browse files Browse the repository at this point in the history
Staging to Main for 3.1.2
  • Loading branch information
cdhoffmann authored May 19, 2023
2 parents 575ccdd + 7b83f73 commit 33bcb12
Show file tree
Hide file tree
Showing 13 changed files with 140 additions and 70 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/update_test_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Update Test App

on:
release:
types: [published]
jobs:
updateTestApp:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Build Test App
run: |
set -eo pipefail
echo Building Test App
make build-test-apps
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: Update test app with new release ${{ github.event.release.tag_name }}
title: Update Test App
body: updates the test app with new release ${{ github.event.release.tag_name }}
branch: update-test-app
base: main

6 changes: 3 additions & 3 deletions AEPAssurance.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AEPAssurance"
s.version = "3.1.1"
s.version = "3.1.2"
s.summary = "AEPAssurance SDK for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe."

s.description = <<-DESC
Expand All @@ -15,8 +15,8 @@ Pod::Spec.new do |s|
s.swift_version = '5.1'

s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
s.dependency 'AEPCore', '>= 3.1.0'
s.dependency 'AEPServices', '>= 3.1.0'
s.dependency 'AEPCore', '>= 3.9.0'
s.dependency 'AEPServices', '>= 3.9.0'

s.source_files = 'AEPAssurance/Source/**/*.swift'
end
7 changes: 6 additions & 1 deletion AEPAssurance.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1572,9 +1572,10 @@
buildSettings = {
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = "";
DEVELOPMENT_TEAM = FKGEE875K4;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
Expand Down Expand Up @@ -1644,6 +1645,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = TestApp/TestApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"TestApp/Preview Content\"";
DEVELOPMENT_TEAM = FKGEE875K4;
Expand All @@ -1655,6 +1657,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.assurance.testApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand All @@ -1667,6 +1670,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
CODE_SIGN_ENTITLEMENTS = TestApp/TestApp.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_ASSET_PATHS = "\"TestApp/Preview Content\"";
DEVELOPMENT_TEAM = FKGEE875K4;
Expand All @@ -1678,6 +1682,7 @@
);
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.assurance.testApp;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2";
};
Expand Down
5 changes: 3 additions & 2 deletions AEPAssurance/Source/AssuranceConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
enum AssuranceConstants {
static let EXTENSION_NAME = "com.adobe.assurance"
static let FRIENDLY_NAME = "Assurance"
static let EXTENSION_VERSION = "3.1.1"
static let EXTENSION_VERSION = "3.1.2"
static let LOG_TAG = FRIENDLY_NAME
static let DEFAULT_ENVIRONMENT = AssuranceEnvironment.prod

Expand Down Expand Up @@ -70,7 +70,8 @@ enum AssuranceConstants {
static let TIMESTAMP = "ACPExtensionEventTimestamp"
static let NUMBER = "ACPExtensionEventNumber"
static let UNIQUE_IDENTIFIER = "ACPExtensionEventUniqueIdentifier"
static let RESPONSE_IDENTIFIER = "ACPExtensionEventResponseIdentifier" // todo new key introduced : convey to UI team
static let RESPONSE_IDENTIFIER = "ACPExtensionEventResponseIdentifier"
static let PARENT_IDENTIFIER = "ACPExtensionEventParentIdentifier"
}

enum EventDataKey {
Expand Down
5 changes: 5 additions & 0 deletions AEPAssurance/Source/AssuranceEvent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ struct AssuranceEvent: Codable {
if let responseID = event.responseID {
payload[AssuranceConstants.ACPExtensionEventKey.RESPONSE_IDENTIFIER] = AnyCodable.init(responseID.uuidString)
}

// if available, add parentID
if let parentID = event.parentID {
payload[AssuranceConstants.ACPExtensionEventKey.PARENT_IDENTIFIER] = AnyCodable.init(parentID.uuidString)
}

return AssuranceEvent(type: AssuranceConstants.EventType.GENERIC, payload: payload)
}
Expand Down
59 changes: 41 additions & 18 deletions AEPAssurance/UnitTests/AssuranceEventTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class AssuranceEventTests: XCTestCase {
/*--------------------------------------------------
Initializer
--------------------------------------------------*/
func test_init() throws {
func test_init() {
// test
let event = AssuranceEvent(type: "generic", payload: SAMPLE_PAYLOAD)

Expand All @@ -35,7 +35,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual(AssuranceConstants.Vendor.MOBILE, event.vendor, "vendor should default to Mobile")
}

func test_init_withTimestamp() throws {
func test_init_withTimestamp() {
// test
let event = AssuranceEvent(type: "generic", payload: SAMPLE_PAYLOAD, timestamp: SAMPLE_TIMESTAMP)

Expand All @@ -47,7 +47,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual(SAMPLE_TIMESTAMP, event.timestamp, "Inaccurate event timestamp")
}

func test_init_withVendor() throws {
func test_init_withVendor() {
// test
let event = AssuranceEvent(type: "generic", payload: SAMPLE_PAYLOAD, vendor: AssuranceConstants.Vendor.SDK)

Expand All @@ -59,7 +59,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual(Date().getUnixTimeInSeconds(), event.timestamp?.getUnixTimeInSeconds())
}

func test_init_withVendorAndTimestamp() throws {
func test_init_withVendorAndTimestamp() {
// test
let event = AssuranceEvent(type: "generic", payload: SAMPLE_PAYLOAD, timestamp: SAMPLE_TIMESTAMP, vendor: AssuranceConstants.Vendor.SDK)

Expand All @@ -72,7 +72,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertNil(event.metadata, "Metadata should be nil")
}

func test_init_withMetaData() throws {
func test_init_withMetaData() {
let event = AssuranceEvent(type: "generic", payload: SAMPLE_PAYLOAD, timestamp: SAMPLE_TIMESTAMP, metadata: SAMPLE_METADATA)

// verify
Expand All @@ -84,7 +84,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual(SAMPLE_METADATA, event.metadata, "Inaccurate metadata")
}

func test_init_withNilAndEmptyPayload() throws {
func test_init_withNilAndEmptyPayload() {
// test
let event1 = AssuranceEvent(type: "generic", payload: nil)
let event2 = AssuranceEvent(type: "generic", payload: [:])
Expand All @@ -96,7 +96,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual(event2.payload, [:], "event payload should be empty")
}

func test_init_eventNumberIncrements() throws {
func test_init_eventNumberIncrements() {
// test
let event1 = AssuranceEvent(type: "generic", payload: nil)
let event2 = AssuranceEvent(type: "generic", payload: nil)
Expand All @@ -113,7 +113,7 @@ class AssuranceEventTests: XCTestCase {
InitFromJSONData
--------------------------------------------------*/

func test_initFromJSONData() throws {
func test_initFromJSONData() {
// setup
let data = """
{
Expand Down Expand Up @@ -147,7 +147,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual("20", metadataValue?.stringValue)
}

func test_initFromJSONData_withoutPayload() throws {
func test_initFromJSONData_withoutPayload() {
// setup
let data = """
{
Expand All @@ -166,7 +166,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertNil(event.payload, "Assurance event's payload should be nil")
}

func test_initWithJSONData_InvalidData() throws {
func test_initWithJSONData_InvalidData() {
// setup
let data1 = "".data(using: .utf8)!
let data2 = "I am meaningless".data(using: .utf8)!
Expand Down Expand Up @@ -215,7 +215,7 @@ class AssuranceEventTests: XCTestCase {
GetCommandEventType
--------------------------------------------------*/

func test_getCommandEventType() throws {
func test_getCommandEventType() {
// setup
let data = """
{
Expand All @@ -234,7 +234,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual("screenshot", event?.commandType, "Inaccurate command type")
}

func test_getCommandEventType_whenNotACommand() throws {
func test_getCommandEventType_whenNotACommand() {
// setup
let data = """
{
Expand All @@ -253,7 +253,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertNil(event?.commandType, "Command type should be nil")
}

func test_getCommandEventType_whenTypeUnavailable() throws {
func test_getCommandEventType_whenTypeUnavailable() {
// setup
let data = """
{
Expand All @@ -272,7 +272,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertNil(event?.commandType, "command type should be nil")
}

func test_getCommandEventType_whenTypeNotAString() throws {
func test_getCommandEventType_whenTypeNotAString() {
// setup
let data = """
{
Expand All @@ -297,7 +297,7 @@ class AssuranceEventTests: XCTestCase {
getCommandEventDetail
--------------------------------------------------*/

func test_getCommandEventDetail() throws {
func test_getCommandEventDetail() {
// setup
let data = """
{
Expand All @@ -319,7 +319,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertEqual("value", event?.commandDetails!["key"] as? String, "Inaccurate command type")
}

func test_getCommandEventDetail_whenNotACommand() throws {
func test_getCommandEventDetail_whenNotACommand() {
// setup
let data = """
{
Expand All @@ -341,7 +341,7 @@ class AssuranceEventTests: XCTestCase {
XCTAssertNil(event?.commandDetails, "command details should be nil")
}

func test_getCommandEventDetail_whenDetailNotADictionary() throws {
func test_getCommandEventDetail_whenDetailNotADictionary() {
// setup
let data = """
{
Expand All @@ -363,7 +363,7 @@ class AssuranceEventTests: XCTestCase {
/*--------------------------------------------------
fromMobileCoreEvent
--------------------------------------------------*/
func test_fromMobileCoreEvent() throws {
func test_fromMobileCoreEvent() {
// setup
let sampleEventData: Dictionary = ["oneKey": "oneValue"]
let coreEvent = Event(name: "coreEvent", type: "coreType", source: "coreSource", data: sampleEventData)
Expand All @@ -386,4 +386,27 @@ class AssuranceEventTests: XCTestCase {
// verify if the responseId is captured
XCTAssertEqual(responseCoreEvent.responseID?.uuidString, assuranceEventForResponse.payload?[AssuranceConstants.ACPExtensionEventKey.RESPONSE_IDENTIFIER]?.stringValue)
}

func test_fromMobileCoreParentEvent() {
let sampleEventData: Dictionary = ["oneKey": "oneValue"]
let coreEvent = Event(name: "coreEvent", type: "coreType", source: "coreSource", data: sampleEventData)
let childCoreEvent = coreEvent.createChainedEvent(name: "chainedEvent", type: "chainedEventType", source: "chainedEventSource", data: nil)

// test
let assuranceEvent = AssuranceEvent.from(event: coreEvent)
let assuranceEventForChild = AssuranceEvent.from(event: childCoreEvent)

// verify
XCTAssertEqual(AssuranceConstants.EventType.GENERIC, assuranceEvent.type)
XCTAssertEqual(AssuranceConstants.Vendor.MOBILE, assuranceEvent.vendor)
XCTAssertEqual("coreEvent", assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.NAME]?.stringValue)
XCTAssertEqual("coresource", assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.SOURCE]?.stringValue)
XCTAssertEqual("coretype", assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.TYPE]?.stringValue)
XCTAssertEqual(sampleEventData, assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.DATA]?.dictionaryValue as! [String: String])
XCTAssertEqual(coreEvent.id.uuidString, assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.UNIQUE_IDENTIFIER]?.stringValue)
XCTAssertEqual(coreEvent.timestamp, assuranceEvent.payload?[AssuranceConstants.ACPExtensionEventKey.TIMESTAMP]?.value as! Date)

// verify if the responseId is captured
XCTAssertEqual(childCoreEvent.parentID?.uuidString, assuranceEventForChild.payload?[AssuranceConstants.ACPExtensionEventKey.PARENT_IDENTIFIER]?.stringValue)
}
}
4 changes: 4 additions & 0 deletions AEPAssurance/UnitTests/Mocks/MockUIService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ class MockFullScreenMessage: FullscreenMessage {
}

class MockMessageMonitor: MessageMonitoring {
func show(message: AEPServices.Showable, delegateControl: Bool) -> Bool {
return true
}

func isMessageDisplayed() -> Bool {
return false
}
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,12 @@ lint-autocorrect:
lint:
(./Pods/SwiftLint/swiftlint lint Sources TestApp/)

build-test-apps:
xcodebuild -workspace $(PROJECT_NAME).xcworkspace -scheme $(APP_NAME) -destination 'platform=iOS Simulator,name=iPhone 8'
xcodebuild -workspace $(PROJECT_NAME).xcworkspace -scheme $(APP_NAME_OBJC) -destination 'platform=iOS Simulator,name=iPhone 8'
# Builds the test apps
build-test-apps: pod-install
xcodebuild -workspace $(PROJECT_NAME).xcworkspace -scheme $(APP_NAME) -derivedDataPath ./build -sdk iphonesimulator build
xcodebuild -workspace $(PROJECT_NAME).xcworkspace -scheme $(APP_NAME_OBJC) -derivedDataPath ./build -sdk iphonesimulator build
(cd build/Build/Products/Debug-iphonesimulator/ && zip -r AEPAssuranceTestApp.zip TestApp.app/)
(cp build/Build/Products/Debug-iphonesimulator/AEPAssuranceTestApp.zip TestAppBinaries/)

swift-build:
swift build -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios10.0-simulator"
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ let package = Package(
.library(name: "AEPAssurance", targets: ["AEPAssurance"])
],
dependencies: [
.package(url: "https://github.com/adobe/aepsdk-core-ios.git", .upToNextMajor(from: "3.1.0"))
.package(url: "https://github.com/adobe/aepsdk-core-ios.git", .upToNextMajor(from: "3.9.0"))
],
targets: [
.target(name: "AEPAssurance",
Expand Down
Loading

0 comments on commit 33bcb12

Please sign in to comment.