Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev v4.0.0 to Main #43

Merged
merged 3 commits into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: Select Xcode 11.7
run: sudo xcode-select -switch /Applications/Xcode_11.7.app

- name: Xcode version
run: /usr/bin/xcodebuild -version

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1

- name: Install swiftformat
run: brew install swiftformat

Expand Down
28 changes: 26 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
ref: main
ref: ${{ github.event.inputs.branch }}

- uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: 14.1

- name: Install jq
run: brew install jq
Expand Down Expand Up @@ -49,7 +53,16 @@ jobs:
echo podspec file verification starts:
make test-podspec

- uses: release-drafter/release-drafter@v5

- name: Build Artifact
if: ${{ github.event.inputs.action_tag == 'yes' }}
run: |
make archive
make zip

- name: Create GH Release
id: create_release
uses: release-drafter/release-drafter@v5
if: ${{ github.event.inputs.action_tag == 'yes' }}
with:
name: v${{ github.event.inputs.tag }}
Expand All @@ -59,6 +72,17 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload Artifact
uses: actions/upload-release-asset@v1
if: ${{ github.event.inputs.action_tag == 'yes' }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/AEPUserProfile.xcframework.zip
asset_name: AEPUserProfile-${{ github.event.inputs.tag }}.xcframework.zip
asset_content_type: application/zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Publish Pods
run: |
set -eo pipefail
Expand Down
4 changes: 2 additions & 2 deletions AEPUserProfile.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AEPUserProfile"
s.version = "3.0.1"
s.version = "4.0.0"
s.summary = "Experience Platform UserProfile extension for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe."
s.description = <<-DESC
The Experience Platform UserProfile extension provides APIs that allow use of the custom client-side User Profile in the Adobe Experience Platform SDK.
Expand All @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.author = "Adobe Experience Platform SDK Team"
s.source = { :git => "https://github.com/adobe/aepsdk-userprofile-ios", :tag => s.version.to_s }

s.ios.deployment_target = '10.0'
s.ios.deployment_target = '11.0'
s.swift_version = '5.1'
s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }
s.dependency 'AEPCore'
Expand Down
7 changes: 6 additions & 1 deletion AEPUserProfile.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
archiveVersion = 1;
classes = {
};
objectVersion = 52;
objectVersion = 54;
objects = {

/* Begin PBXAggregateTarget section */
Expand Down Expand Up @@ -484,6 +484,7 @@
};
BBE24F0F2539F58D00C23435 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
buildActionMask = 2147483647;
files = (
);
Expand Down Expand Up @@ -706,6 +707,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = AEPUserProfile/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -736,6 +738,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = AEPUserProfile/Sources/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -761,6 +764,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = FKGEE875K4;
INFOPLIST_FILE = AEPUserProfile/Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -785,6 +789,7 @@
CODE_SIGN_STYLE = Automatic;
DEVELOPMENT_TEAM = FKGEE875K4;
INFOPLIST_FILE = AEPUserProfile/Tests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
2 changes: 1 addition & 1 deletion AEPUserProfile/Sources/UserProfileConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
enum UserProfileConstants {
static let EXTENSION_NAME = "com.adobe.module.userProfile"
static let FRIENDLY_NAME = "UserProfile"
static let EXTENSION_VERSION = "3.0.1"
static let EXTENSION_VERSION = "4.0.0"
static let LOG_PREFIX = FRIENDLY_NAME
static let DATASTORE_NAME = EXTENSION_NAME
static let DATASTORE_KEY_ATTRIBUTES = "attributes"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class UserProfileFunctionalTests: XCTestCase {
// Given
// EventHub.shared = EventHub()
let expectation = self.expectation(description: "register UserProfile extension")
UserDefaults.standard.set(["k1": "v1", "k4": 11], forKey: "Adobe.com.adobe.module.userProfile.attributes")
UserDefaults.standard.set(["k1": "v1", "k4": 11] as [String : Any], forKey: "Adobe.com.adobe.module.userProfile.attributes")

MobileCore.registerExtensions([UserProfile.self]) {
expectation.fulfill()
Expand Down Expand Up @@ -197,7 +197,7 @@ class UserProfileFunctionalTests: XCTestCase {
waitForExpectations(timeout: 2)

theExpectation = self.expectation(description: "monitor the shared state from UserProfile")
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "value": "value3", "operation": "write"]]])
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "value": "value3", "operation": "write"]] as [String : Any]])
MonitorExtension.profileSharedStateReceiver = { _ in
guard let data = EventHub.shared.getSharedState(extensionName: "com.adobe.module.userProfile", event: event)?.value?["userprofiledata"] as? [String: String] else {
return
Expand Down Expand Up @@ -228,7 +228,7 @@ class UserProfileFunctionalTests: XCTestCase {
waitForExpectations(timeout: 2)

theExpectation = self.expectation(description: "monitor the shared state from UserProfile")
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "delete"]]])
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "delete"]] as [String : Any]])
MonitorExtension.profileSharedStateReceiver = { _ in
guard let data = EventHub.shared.getSharedState(extensionName: "com.adobe.module.userProfile", event: event)?.value?["userprofiledata"] as? [String: String] else {
return
Expand Down Expand Up @@ -262,9 +262,9 @@ class UserProfileFunctionalTests: XCTestCase {
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["detail": ["key": "key3", "value": "value3", "operation": "write"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["detail": ["key": "key1", "operation": "delete"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["detail": ["key": "key2", "operation": "delete"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "add"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "operation": "write"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["value": "value1", "operation": "delete"]]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "add"]] as [String : Any]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "operation": "write"]] as [String : Any]]))
MobileCore.dispatch(event: Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["value": "value1", "operation": "delete"]] as [String : Any]]))
usleep(9000)
XCTAssertEqual(1, MonitorExtension.sharedStateChanged)

Expand Down
24 changes: 16 additions & 8 deletions AEPUserProfile/Tests/UserProfileTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class UserProfileTests: XCTestCase {
XCTFail()
return
}
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "value": "value3", "operation": "write"]]])
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key3", "value": "value3", "operation": "write"]] as [String : Any]])
handleRulesEngineResponse(event)
guard let storedAttributes = UserDefaults.standard.object(forKey: "Adobe.com.adobe.module.userProfile.attributes") as? [String: String] else {
XCTFail()
Expand All @@ -93,7 +93,7 @@ class UserProfileTests: XCTestCase {
XCTFail()
return
}
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "value": "", "operation": "write"]]])
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "value": "", "operation": "write"]] as [String : Any]])
handleRulesEngineResponse(event)
guard let storedAttributes = UserDefaults.standard.object(forKey: "Adobe.com.adobe.module.userProfile.attributes") as? [String: String] else {
XCTFail()
Expand All @@ -118,7 +118,7 @@ class UserProfileTests: XCTestCase {
XCTFail()
return
}
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "delete"]]])
let event = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["key": "key1", "operation": "delete"]] as [String : Any]])
handleRulesEngineResponse(event)
guard let storedAttributes = UserDefaults.standard.object(forKey: "Adobe.com.adobe.module.userProfile.attributes") as? [String: String] else {
XCTFail()
Expand Down Expand Up @@ -155,11 +155,11 @@ class UserProfileTests: XCTestCase {
XCTAssertEqual(1, storedAttributes.count)
XCTAssertEqual(0, runtime.createdSharedStates.count)

let consequenceEventWriteWithoutKey = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["value": "value3", "operation": "write"]]])
let consequenceEventWriteWithoutKey = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["value": "value3", "operation": "write"]] as [String : Any]])
handleRulesEngineResponse(consequenceEventWriteWithoutKey)
XCTAssertEqual(0, runtime.createdSharedStates.count)

let consequenceEventDeleteWithoutKey = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["operation": "delete"]]])
let consequenceEventDeleteWithoutKey = Event(name: "consequence event", type: "com.adobe.eventType.rulesEngine", source: "com.adobe.eventSource.responseContent", data: ["triggeredconsequence": ["type": "csp", "detail": ["operation": "delete"]] as [String : Any]])
handleRulesEngineResponse(consequenceEventDeleteWithoutKey)
XCTAssertEqual(0, runtime.createdSharedStates.count)
}
Expand Down Expand Up @@ -223,7 +223,7 @@ class UserProfileTests: XCTestCase {
}

func testUpdateAttributesWithMultipleValueTypes() throws {
UserDefaults.standard.set(["k_string": "value1", "k_int": 2, "k_bool": true, "k_double": 2.1], forKey: "Adobe.com.adobe.module.userProfile.attributes")
UserDefaults.standard.set(["k_string": "value1", "k_int": 2, "k_bool": true, "k_double": 2.1] as [String : Any], forKey: "Adobe.com.adobe.module.userProfile.attributes")
let runtime = TestableExtensionRuntime()
let profile = UserProfile(runtime: runtime)
profile.onRegistered()
Expand Down Expand Up @@ -271,7 +271,7 @@ class UserProfileTests: XCTestCase {
XCTFail()
return
}
let event = Event(name: "UserProfileUpdate", type: "com.adobe.eventType.userProfile", source: "com.adobe.eventSource.requestProfile", data: ["userprofileupdatekey": ["key1": "valuex", "key2": UserProfile(runtime: TestableExtensionRuntime())]])
let event = Event(name: "UserProfileUpdate", type: "com.adobe.eventType.userProfile", source: "com.adobe.eventSource.requestProfile", data: ["userprofileupdatekey": ["key1": "valuex", "key2": UserProfile(runtime: TestableExtensionRuntime())] as [String : Any]])
XCTAssert(event.isUpdateAttributesEvent)

handleRequestProfile(event)
Expand Down Expand Up @@ -320,7 +320,7 @@ class UserProfileTests: XCTestCase {
XCTFail()
return
}
let event = Event(name: "getUserAttributes", type: "com.adobe.eventType.userProfile", source: "com.adobe.eventSource.requestProfile", data: ["userprofilegetattributes": []])
let event = Event(name: "getUserAttributes", type: "com.adobe.eventType.userProfile", source: "com.adobe.eventSource.requestProfile", data: ["userprofilegetattributes": [] as NSArray])
XCTAssert(event.isGetAttributesEvent)
handleRequestProfile(event)
XCTAssertEqual(0, runtime.createdSharedStates.count)
Expand Down Expand Up @@ -449,6 +449,14 @@ class UserProfileTests: XCTestCase {
}

public class TestableExtensionRuntime: ExtensionRuntime {
public func getSharedState(extensionName: String, event: AEPCore.Event?, barrier: Bool, resolution: AEPCore.SharedStateResolution) -> AEPCore.SharedStateResult? {
nil
}

public func getXDMSharedState(extensionName: String, event: AEPCore.Event?, barrier: Bool, resolution: AEPCore.SharedStateResolution) -> AEPCore.SharedStateResult? {
nil
}

public func getHistoricalEvents(_ requests: [EventHistoryRequest], enforceOrder: Bool, handler: @escaping ([EventHistoryResult]) -> Void) {}

public func getXDMSharedState(extensionName _: String, event _: Event?, barrier _: Bool) -> SharedStateResult? {
Expand Down
11 changes: 8 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ IOS_ARCHIVE_PATH = ./build/ios.xcarchive/Products/Library/Frameworks/
IOS_ARCHIVE_DSYM_PATH = $(CURR_DIR)/build/ios.xcarchive/dSYMs/

lint-autocorrect:
./Pods/SwiftLint/swiftlint autocorrect
./Pods/SwiftLint/swiftlint --fix

lint:
./Pods/SwiftLint/swiftlint lint
Expand Down Expand Up @@ -44,12 +44,17 @@ test: clean
@echo "######################################################################"
@echo "### Testing iOS"
@echo "######################################################################"
xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme $(PROJECT_NAME)Tests -destination 'platform=iOS Simulator,name=iPhone 11 Pro' -derivedDataPath build/out -enableCodeCoverage YES
xcodebuild test -workspace $(PROJECT_NAME).xcworkspace -scheme $(PROJECT_NAME)Tests -destination 'platform=iOS Simulator,name=iPhone 14' -derivedDataPath build/out -enableCodeCoverage YES

archive: pod-update
archive: clean pod-update
xcodebuild archive -workspace $(PROJECT_NAME).xcworkspace -scheme $(SCHEME_NAME_XCFRAMEWORK) -archivePath "./build/ios.xcarchive" -sdk iphoneos -destination="iOS" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
xcodebuild archive -workspace $(PROJECT_NAME).xcworkspace -scheme $(SCHEME_NAME_XCFRAMEWORK) -archivePath "./build/ios_simulator.xcarchive" -sdk iphonesimulator -destination="iOS Simulator" SKIP_INSTALL=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES
xcodebuild -create-xcframework -framework $(SIMULATOR_ARCHIVE_PATH)$(EXTENSION_NAME).framework -debug-symbols $(SIMULATOR_ARCHIVE_DSYM_PATH)$(EXTENSION_NAME).framework.dSYM -framework $(IOS_ARCHIVE_PATH)$(EXTENSION_NAME).framework -debug-symbols $(IOS_ARCHIVE_DSYM_PATH)$(EXTENSION_NAME).framework.dSYM -output ./build/$(TARGET_NAME_XCFRAMEWORK)

zip:
cd build && zip -r $(EXTENSION_NAME).xcframework.zip $(EXTENSION_NAME).xcframework/
swift package compute-checksum build/$(EXTENSION_NAME).xcframework.zip

latest-version:
(which jq)
(pod spec cat AEPUserProfile | jq '.version' | tr -d '"')
Expand Down
12 changes: 6 additions & 6 deletions Package.resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@
"package": "AEPCore",
"repositoryURL": "https://github.com/adobe/aepsdk-core-ios.git",
"state": {
"branch": "main",
"revision": "51a6bd926c8c0beb526604ac0c2bc01b86158cc8",
"version": null
"branch": null,
"revision": "255e3fde7c478a48c57e3f6ee9df1700aae22278",
"version": "4.0.0"
}
},
{
"package": "AEPRulesEngine",
"repositoryURL": "https://github.com/adobe/aepsdk-rulesengine-ios.git",
"state": {
"branch": "main",
"revision": "b2e0247bf57975209997dd9a26fd576b7c420394",
"version": null
"branch": null,
"revision": "0923ec707340874000e06ad2926c5006ddfbc4c9",
"version": "4.0.0"
}
}
]
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ import PackageDescription

let package = Package(
name: "AEPUserProfile",
platforms: [.iOS(.v10)],
platforms: [.iOS(.v11)],
products: [
.library(name: "AEPUserProfile", targets: ["AEPUserProfile"]),
],
dependencies: [
.package(url: "https://github.com/adobe/aepsdk-core-ios.git", .upToNextMajor(from: "3.0.0")),
.package(url: "https://github.com/adobe/aepsdk-core-ios.git", .upToNextMajor(from: "4.0.0")),
],
targets: [
.target(name: "AEPUserProfile",
Expand Down
4 changes: 2 additions & 2 deletions Podfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Uncomment the next line to define a global platform for your project
platform :ios, '10.0'
platform :ios, '11.0'

# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

workspace 'AEPUserProfile'
project 'AEPUserProfile.xcodeproj'

pod 'SwiftLint', '0.44.0'
pod 'SwiftLint', '0.52.0'

target 'AEPUserProfile' do
pod 'AEPCore'
Expand Down
Loading