Skip to content

Commit

Permalink
Merge pull request #737 from adobe/staging
Browse files Browse the repository at this point in the history
staging -> main (v3.3.1)
  • Loading branch information
praveek authored Nov 9, 2021
2 parents 14dbeef + 83b7ad4 commit daa7245
Show file tree
Hide file tree
Showing 39 changed files with 408 additions and 109 deletions.
14 changes: 6 additions & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ jobs:

build-and-test:
macos:
xcode: 11.6.0 # Specify the Xcode version to use
xcode: 12.0.1 # Specify the Xcode version to use

steps:
- checkout

- run:
name: Install realm/SwiftLint
command: brew update-reset && brew install swiftlint
name: Pod install
command: pod install

- run:
name: Swift Linting
command: swiftlint lint
command: make lint
- run:
name: Install nicklockwood/SwiftFormat
command: brew install swiftformat
Expand All @@ -34,10 +36,6 @@ jobs:
- run:
name: Pre-start Simulator
command: xcrun instruments -w "iPhone 8 (13.0) [" || true

- run:
name: Pod install
command: pod install

- run:
name: Run AEPCore Tests
Expand Down
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ submitting a pull request!
## Style Guide

Code cleanliness and consistency is important. Please review and follow our code
[Style Guide](../Documentation/StyleGuide.md) when contributing.
[Style Guide](../Documentation/Contributing/StyleGuide.md) when contributing.

## From Contributor To Committer

Expand Down
4 changes: 2 additions & 2 deletions AEPCore.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "AEPCore"
s.version = "3.3.0"
s.version = "3.3.1"
s.summary = "Core library for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe."
s.description = <<-DESC
The core library provides the foundation for the Adobe Experience Platform SDK. Having the core library installed is a pre-requisite for any other Adobe Experience Platform SDK extension to work.
Expand All @@ -17,7 +17,7 @@ Pod::Spec.new do |s|
s.pod_target_xcconfig = { 'BUILD_LIBRARY_FOR_DISTRIBUTION' => 'YES' }

s.dependency 'AEPRulesEngine', '1.0.1'
s.dependency 'AEPServices', '3.3.0'
s.dependency 'AEPServices', '3.3.1'

s.source_files = 'AEPCore/Sources/**/*.swift'

Expand Down
42 changes: 21 additions & 21 deletions AEPCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130024E19C06007FDCF7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2864,7 +2864,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130124E19C10007FDCF7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2881,7 +2881,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130224E19C15007FDCF7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2898,7 +2898,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130424E19C23007FDCF7 /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2916,7 +2916,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130624E19C2E007FDCF7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2933,7 +2933,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
BB68130724E19C32007FDCF7 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
Expand All @@ -2950,7 +2950,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/zsh;
shellScript = "cd ${PROJECT_DIR}\nif which swiftlint >/dev/null; then\n swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
shellScript = "cd ${PROJECT_DIR}\nif which ./Pods/SwiftLint/swiftlint >/dev/null; then\n ./Pods/SwiftLint/swiftlint\nelse\n echo \"error: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down Expand Up @@ -3660,7 +3660,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.core;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3690,7 +3690,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.core;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3762,7 +3762,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.signal;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3790,7 +3790,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.signal;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -3855,7 +3855,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = come.adobe.aep.services;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -3882,7 +3882,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = come.adobe.aep.services;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -4002,7 +4002,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.AEPServicesMocks;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -4029,7 +4029,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.AEPServicesMocks;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -4055,7 +4055,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.lifecycle;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -4082,7 +4082,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.lifecycle;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -4149,7 +4149,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.identity;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -4176,7 +4176,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.identity;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -4243,7 +4243,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.AEPCoreMocks;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand All @@ -4270,7 +4270,7 @@
"@executable_path/Frameworks",
"@loader_path/Frameworks",
);
MARKETING_VERSION = 3.3.0;
MARKETING_VERSION = 3.3.1;
PRODUCT_BUNDLE_IDENTIFIER = com.adobe.aep.AEPCoreMocks;
PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)";
SKIP_INSTALL = YES;
Expand Down
1 change: 1 addition & 0 deletions AEPCore/Sources/configuration/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class Configuration: NSObject, Extension {
createSharedState(data: config, event: nil)
// notify rules engine to load cached rules
if let rulesURLString = config[ConfigurationConstants.Keys.RULES_URL] as? String {
Log.trace(label: name, "Reading rules from cache for URL: \(rulesURLString)")
rulesEngine.replaceRulesWithCache(from: rulesURLString)
}
}
Expand Down
2 changes: 1 addition & 1 deletion AEPCore/Sources/configuration/ConfigurationConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import Foundation
struct ConfigurationConstants {
static let EXTENSION_NAME = "com.adobe.module.configuration"
static let FRIENDLY_NAME = "Configuration"
static let EXTENSION_VERSION = "3.3.0"
static let EXTENSION_VERSION = "3.3.1"
static let DATA_STORE_NAME = EXTENSION_NAME

static let CONFIG_URL_BASE = "https://assets.adobedtm.com/"
Expand Down
2 changes: 2 additions & 0 deletions AEPCore/Sources/configuration/LaunchIDManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ struct LaunchIDManager {
/// - Returns: appId loaded from persistence, nil if not present
func loadAppIdFromPersistence() -> String? {
if let appId = dataStore.getString(key: ConfigurationConstants.DataStoreKeys.PERSISTED_APPID) {
Log.trace(label: logTag, "Loading App ID from persistence with appId: \(appId)")
return appId
}
Log.trace(label: logTag, "App ID not found in data store")
Expand All @@ -50,6 +51,7 @@ struct LaunchIDManager {
func loadAppIdFromManifest() -> String? {
if let appId = ServiceProvider.shared.systemInfoService.getProperty(for: ConfigurationConstants.CONFIG_MANIFEST_APPID_KEY) {
saveAppIdToPersistence(appId: appId)
Log.trace(label: logTag, "Loading App ID from manifest with appId: \(appId)")
return appId
}
Log.trace(label: logTag, "App ID not found in manifest")
Expand Down
2 changes: 1 addition & 1 deletion AEPCore/Sources/eventhub/EventHubConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ enum EventHubConstants {
static let XDM_STATE_CHANGE = "Shared state change (XDM)"
static let NAME = "com.adobe.module.eventhub"
static let FRIENDLY_NAME = "EventHub"
static let VERSION_NUMBER = "3.3.0"
static let VERSION_NUMBER = "3.3.1"

enum EventDataKeys {
static let VERSION = "version"
Expand Down
21 changes: 15 additions & 6 deletions AEPCore/Sources/rules/LaunchRulesEngine+Downloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,22 @@ public extension LaunchRulesEngine {
return
}
let rulesDownloader = RulesDownloader(fileUnzipper: FileUnzipper())
rulesDownloader.loadRulesFromUrl(rulesUrl: url) { data in
guard let data = data, let rules = JSONRulesParser.parse(data) else {
Log.debug(label: RulesConstants.LOG_MODULE_PREFIX, "Failed to load rules from url: \(urlString)")
return
rulesDownloader.loadRulesFromUrl(rulesUrl: url) { result in
switch result {
case .success(let data):
guard let rules = JSONRulesParser.parse(data) else {
Log.debug(label: RulesConstants.LOG_MODULE_PREFIX, "Unable to parse rules for data from URL: \(urlString)")
return
}
self.replaceRules(with: rules)
case .failure(let error):
switch error {
case .notModified:
Log.trace(label: RulesConstants.LOG_MODULE_PREFIX, "Rules were not modified, not loading rules from url: \(urlString)")
default:
Log.debug(label: RulesConstants.LOG_MODULE_PREFIX, "Failed to load rules from url: \(urlString), with error: \(error.localizedDescription)")
}
}

self.replaceRules(with: rules)
}
}

Expand Down
33 changes: 22 additions & 11 deletions AEPCore/Sources/rules/RulesDownloader.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,11 @@ struct RulesDownloader: RulesLoader {
cache = Cache(name: RulesDownloaderConstants.RULES_CACHE_NAME)
}

enum RulesDownloaderError: Error {
case unableToCreateTempDirectory
case unableToStoreDataInTempDirectory
}

func loadRulesFromCache(rulesUrl: URL) -> Data? {
return getCachedRules(rulesUrl: rulesUrl.absoluteString)?.cacheable
}

func loadRulesFromUrl(rulesUrl: URL, completion: @escaping (Data?) -> Void) {
func loadRulesFromUrl(rulesUrl: URL, completion: @escaping (Result<Data, RulesDownloaderError>) -> Void) {
/// 304 - Not Modified support
var headers = [String: String]()
if let cachedRules = getCachedRules(rulesUrl: rulesUrl.absoluteString) {
Expand All @@ -42,20 +37,20 @@ struct RulesDownloader: RulesLoader {
let networkRequest = NetworkRequest(url: rulesUrl, httpMethod: .get, httpHeaders: headers)
ServiceProvider.shared.networkService.connectAsync(networkRequest: networkRequest) { httpConnection in
if httpConnection.responseCode == 304 {
completion(nil)
completion(.failure(.notModified))
return
}

guard let data = httpConnection.data else {
completion(nil)
completion(.failure(.noData))
return
}
// Store Zip file in temp directory for unzipping
switch self.storeDataInTempDirectory(data: data) {
case let .success(url):
// Unzip the rules.json from the zip file in the temp directory and get the rules dict from the json file
guard let data = self.unzipRules(at: url) else {
completion(nil)
completion(.failure(.unableToUnzipRules))
return
}
let cachedRules = CachedRules(cacheable: data,
Expand All @@ -65,11 +60,11 @@ struct RulesDownloader: RulesLoader {
if !self.setCachedRules(rulesUrl: rulesUrl.absoluteString, cachedRules: cachedRules) {
Log.warning(label: "rules downloader", "Unable to cache rules")
}
completion(data)
completion(.success(data))
return
case let .failure(error):
Log.warning(label: "rules downloader", error.localizedDescription)
completion(nil)
completion(.failure(error))
return
}

Expand Down Expand Up @@ -150,3 +145,19 @@ struct RulesDownloader: RulesLoader {
return try? JSONDecoder().decode(CachedRules.self, from: cachedEntry.data)
}
}

///
/// Rules downloader error represents the different errors which can happen when downloading rules
///
enum RulesDownloaderError: Error {
// Unable to create a temp directory for the unzip functionality
case unableToCreateTempDirectory
// Unable to store data in the temp directory for the unzip functionality
case unableToStoreDataInTempDirectory
// unable to unzip the rules
case unableToUnzipRules
// rules were not modified, network request returns no data
case notModified
// no data returned from the rules download
case noData
}
Loading

0 comments on commit daa7245

Please sign in to comment.