diff --git a/ACPLifecycleBeta.podspec b/ACPLifecycleBeta.podspec new file mode 100644 index 00000000..6672eac1 --- /dev/null +++ b/ACPLifecycleBeta.podspec @@ -0,0 +1,34 @@ +Pod::Spec.new do |s| + s.name = "ACPLifecycleBeta" + s.version = "0.0.1beta" + s.summary = "BETA - Lifecycle framework for Adobe Experience Cloud SDK. Written and Supported by Adobe, the official Pod for the Adobe Experience Cloud." + s.description = <<-DESC + By using the Adobe Cloud Platform SDKs (“Beta”), you hereby acknowledge that the Beta is provided “as is” without warranty of any kind. Adobe shall have no obligation to maintain, correct, update, change, modify or otherwise support the Beta. You are advised to use caution and not to rely in any way on the correct functioning or performance of such Beta and/or accompanying materials. + + The Lifecycle framework provides APIs that allow use of lifecycle collection in the V5 Adobe Experience Cloud SDK. + DESC + + s.homepage = "https://github.com/Adobe-Marketing-Cloud/acp-sdks/releases" + + s.license = {:type => "Commercial", :text => "Adobe Systems, Incorporated. All Rights Reserved."} + s.author = "Adobe Cloud Platform SDK Team" + s.source = { :git => 'https://github.com/Adobe-Marketing-Cloud/acp-sdks.git', :tag => "v0.0.1beta-ACPLifecycle" } + s.platform = :ios, '10.0' + + s.default_subspec = 'iOS' + + # dependency on the core framework + s.dependency "ACPCoreBeta", ">= 0.0.3beta" + + s.subspec 'iOS' do |ios| + ios.preserve_paths = '*/Frameworks/*.framework' + ios.source_files = 'Pod/Classes/**/*', 'ACPLifecycle_iOS.framework/Headers/*.h' + ios.public_header_files = 'ACPLifecycle_iOS.framework/Headers/*.h' + ios.vendored_frameworks = 'ACPLifecycle_iOS.framework', 'AdobeMarketingMobileLifecycle.framework' + ios.xcconfig = { + "FRAMEWORK_SEARCH_PATHS" => "'${PODS_ROOT}/ACPLifecycleBeta'", + "LD_RUNPATH_SEARCH_PATHS" => "@loader_path/../Frameworks" + } + ios.requires_arc = true + end +end diff --git a/ACPLifecycle_iOS.framework/ACPLifecycle_iOS b/ACPLifecycle_iOS.framework/ACPLifecycle_iOS new file mode 100755 index 00000000..7d5f2c07 Binary files /dev/null and b/ACPLifecycle_iOS.framework/ACPLifecycle_iOS differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/ACPCore_iOS b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/ACPCore_iOS new file mode 100755 index 00000000..aa4977dd Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/ACPCore_iOS differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPCore_iOS.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPCore_iOS.h new file mode 100755 index 00000000..4e1686af --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPCore_iOS.h @@ -0,0 +1,34 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#import + +//! Project version number for AdobeMobileMarketingCore_iOS. +FOUNDATION_EXPORT double AdobeMobileMarketingCore_iOSVersionNumber; + +//! Project version string for AdobeMobileMarketingCore_iOS. +FOUNDATION_EXPORT const unsigned char AdobeMobileMarketingCore_iOSVersionString[]; + +// import platform core public headers +#import +#import +#import +#import +#import +#import +#import diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtension.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtension.h new file mode 100755 index 00000000..443139ba --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtension.h @@ -0,0 +1,81 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONINTERFACE_H +#define ADOBEMOBILE_ADBEXTENSIONINTERFACE_H + +#import +#import "ACPExtensionApi.h" + +@interface ACPExtension : NSObject {} + +/* + * @brief Initialize a new extension instance. + * Implementers can override this and call into the core via `self.api` e.g. to set listeners. + * The `api` method returns a valid interface even during `init`, since it will be created prior to `init` being called. + * @return Valid instance of the extension or nil + * + */ +- (nullable instancetype) init; + +/* + * @brief Get extension name for use by the event hub to managing shared state and for logging. + * This MUST be overridden by the extension. + * This will be called at least once before {@code init}. Use a static initializer, don't wait for `init` method. + * If `nil` is returned, the extension will not be registered. + * + * @return NSString containing the extensions name + * + */ +- (nullable NSString*) name; + +/* + * @brief Get extension version as a string for use by the event hub for logging. + * This should be overridden by the extension. + * If it is not overridden, `nil` will be returned and logged for the extension. + * + * @return NSString containing the extensions version + * + */ +- (nullable NSString*) version; + +/* + * @brief Called when an unexpected error related to this extension has occurred during SDK processing. + * Implementers should override this to see what errors are occurring and handle them as needed. + * This should be called very infrequently for a well written extension implementation. + * @return + * + */ +- (void) unexpectedError: (nonnull NSError*) error; + +/* + * @brief Called when the extension is unregistered by the core. + * Implementers can override this to clean up resources when the extension is released. + * + */ +- (void) onUnregister; + +/* + * @brief This provides the services the extension will need. + * + */ +@property(nonatomic, readonly) ACPExtensionApi* _Nonnull api; + +@end + +#endif /* ADOBEMOBILE_ADBEXTENSIONINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionApi.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionApi.h new file mode 100755 index 00000000..61db3bcb --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionApi.h @@ -0,0 +1,102 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONSERVICES_H +#define ADOBEMOBILE_ADBEXTENSIONSERVICES_H + +#import +#import "ACPExtensionError.h" +#import "ACPExtensionEvent.h" +#import "ACPExtensionListener.h" +#import "ACPExtensionProcessor.h" + +/* + * @brief This interface is used by extensions to call into the core event hub. + * High level documentation for this interface is here: https://wiki.corp.adobe.com/display/ADMSMobile/V5+Extensions + */ +@interface ACPExtensionApi : NSObject {} + +/* + * @brief Called by the extension to register a processor to handle all events. When any event is fired, this interface will be called to process the event. + * @param processor A callback interface to receive events + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if processor was added, NO otherwise. For example if processing is not allowed. + */ +- (BOOL) registerProcessor: (nonnull Class) processorClass + error: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Called by the extension to register a listener for a specific event. When this event is fired, the listener interface will be called with details. + * @param listener A callback interface to receive events + * @param eventType The type of the event we are listening for. See documentation for the list of available types. + * @param eventSource The source for the events we are listening for. See documentation for the list of available sources. + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if listener was added, NO otherwise. For example if listening to this event is not allowed or event is unknown/unsupported. + */ +- (BOOL) registerListener: (nonnull Class) listenerClass + eventType: (nonnull NSString*) eventType + eventSource: (nonnull NSString*) eventSource + error: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Called by extension to dispatch an event for other extensions or the internal SDK to consume. + * @param event Event we are dispatching + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if event was dispatched, NO otherwise. For example if this extension is not allowed to dispatch this kind of event. + */ +- (BOOL) dispatchEvent: (nonnull ACPExtensionEvent*) event + error: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Called by extension to set a shared state for itself. Usually called from a listener during event processing. + * @param state State data (in JSON format). Passing `nil` will remove existing state data. + * @param event The event for which the state is being set. Passing `nil` will set default state for all events. + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if state was set, NO otherwise. For example if the JSON passed for the state data was invalid. + */ +- (BOOL) setSharedEventState: (nullable NSDictionary*) state + event: (nullable ACPExtensionEvent*) event + error: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Called by extension to clear all shared state it has previously set. Usually called during OnUnregister. + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if states were cleared, NO otherwise. For example if an internal error occurred. + */ +- (BOOL) clearSharedEventStates: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Called by extension from a listener to get a shared state during event processing. + * @param name State to retrieve data for. See documentation for the list of available states. + * @param event The event for which the state is being requested. Passing `nil` will retrieve latest state available. + * @param error An optional parameter where an NSError* will be returned in case of failure + * @return NULL if state does not exists or NSDictionary* containing state data at that version in JSON format + */ +- (nullable NSDictionary*) getSharedEventState: (nonnull NSString*) name + event: (nullable ACPExtensionEvent*) event + error: (NSError* _Nullable* _Nullable) error; + +/* + * @brief Un-register this extension. This can be called at any time after SDK initialization. + * This will result in the ACPExtension::OnUnregister callback being called. + */ +- (void) unregisterExtension; + +@end + +#endif /* ADOBEMOBILE_ADBEXTENSIONSERVICES_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionError.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionError.h new file mode 100755 index 00000000..896230aa --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionError.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONERROR_H +#define ADOBEMOBILE_ADBEXTENSIONERROR_H + +#import + +extern NSString* _Nonnull const ACPExtensionErrorDomain; + +/** + * @brief Errors that can be returned by either any of the 3rd party extension APIs. + */ +typedef NS_ENUM(NSUInteger, ACPExtensionError) { + ADBUnexpectedExtensionError = 0, + ADBBadExtensionNameExtensionError = 1, + ADBDuplicateExtensionNameExtensionError = 2, + ADBEventTypeNotSupportedExtensionError = 3, + ADBEventSourceNotSupportedExtensionError = 4, + ADBEventDataNotSupportedExtensionError = 5, + ADBBadExtensionClassExtensionError = 6 +}; + +#endif /* ADOBEMOBILE_ADBEXTENSIONERROR_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionEvent.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionEvent.h new file mode 100755 index 00000000..9f7f067d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionEvent.h @@ -0,0 +1,51 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONEVENT_H +#define ADOBEMOBILE_ADBEXTENSIONEVENT_H + +#import + +@interface ACPExtensionEvent : NSObject {} + +/** + * @brief Create a new broadcast event. See TBD for a list of supported types, sources and data formats. + * @param name The name of the event to be dispatched. + * @param type The type of the event to be dispatched. + * @param source The source of the event to be dispatched. + * @param data (Optional) Data associated with the event. The NSDictionary passed should follow NSCoding protocol. + * @param error (Optional) NSError** where any errors constructing the event can be reported. + * @return a new instance of ACPExtensionEvent + */ ++ (nullable instancetype) extensionEventWithName: (nonnull NSString*) name + type: (nonnull NSString*) type + source: (nonnull NSString*) source + data: (nullable NSDictionary*) data + error: (NSError* _Nullable* _Nullable) error; + +/** + * @brief Event details + */ +@property(nonatomic, readonly) NSString* _Nonnull eventName; +@property(nonatomic, readonly) NSString* _Nonnull eventType; +@property(nonatomic, readonly) NSString* _Nonnull eventSource; +@property(nonatomic, readonly) NSDictionary* _Nullable eventData; + +@end + +#endif /* ADOBEMOBILE_ADBEXTENSIONEVENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionListener.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionListener.h new file mode 100755 index 00000000..a65386e2 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionListener.h @@ -0,0 +1,54 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONLISTENER_H +#define ADOBEMOBILE_ADBEXTENSIONLISTENER_H + +#import + +@class ACPExtension; +@class ACPExtensionEvent; + +@interface ACPExtensionListener : NSObject {} + +/* + * @brief Initialize new listener. + * Implementers can access the extension via `self.extension` as needed. + * This method must be fast (<100ms) or the listener may be unregistered. Avoid file and/or network operations. + * The `extension` method returns a valid reference even during `init`, since it will be set prior to `init` being called. + * @return ACPExtensionListener* or nil + * + */ +- (nullable instancetype) init; + +/* + * @brief Reference to the extension that registered this listener + * + */ +@property(nonatomic, readonly) ACPExtension* _Nonnull extension; + +/* + * @brief Called when an event is fired that matches eventType and eventSource passed to RegisterListener. + * Be aware that this method will typically be called from a different thread than listener was registered on. + * @param event The event fired + */ +- (void) hear: (nonnull ACPExtensionEvent*) event; + +@end + +#endif /* ADOBEMOBILE_ADBEXTENSIONLISTENER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionProcessor.h new file mode 100755 index 00000000..7e6c6afb --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPExtensionProcessor.h @@ -0,0 +1,60 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_ADBEXTENSIONPROCESSOR_H +#define ADOBEMOBILE_ADBEXTENSIONPROCESSOR_H + +#import + +@class ACPExtension; +@class ACPExtensionEvent; + +@interface ACPExtensionProcessor : NSObject {} + +/* + * @brief Initialize new processor + * Implementers can access the extension via `self.extension` as needed. + * This method must be fast (<100ms) or the processor may be unregistered. Avoid file and/or network operations. + * The `extension` method returns a valid reference even during `init`, since it will be set prior to `init` being called. + * @return ACPExtensionProcessor* or nil + * + */ +- (nullable instancetype) init; + +/* + * @brief Reference to the extension that registered this processor + * + */ +@property(nonatomic, readonly) ACPExtension* _Nonnull extension; + +/** + * @brief Called when any event is fired. + * This method decides how to handle each event as it comes through. It must be fast (<100ms) else event processing WILL be blocked. + * Be aware that this method will typically be called from a different thread than listener was registered on. + * There are three potential outcomes: + * 1) Ignore this event and pass through unchanged. This is the most common case. Return the event passed in unchanged for this outcome. + * 2) Block this event. Return NULL for this outcome. + * 3) Add/Remove/Modify event details and pass through. Return a copy of the event with member data added/removed/modified as needed for this outcome. + * @param event The event to be processed + * @return one of the three choices above + */ +- (nullable ACPExtensionEvent*) process: (nonnull ACPExtensionEvent*) event; + +@end + +#endif /* ADOBEMOBILE_ADBEXTENSIONPROCESSOR_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPMarketingMobileCore.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPMarketingMobileCore.h new file mode 100755 index 00000000..5a37eb3b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/ACPMarketingMobileCore.h @@ -0,0 +1,209 @@ +// +// ACPMarketingMobileCore.h +// Adobe Digital Marketing Suite -- iOS Application Measurement Library +// +// Copyright 1996-2018. Adobe, Inc. All Rights Reserved +// +// SDK Version: 5.0.0b2 + +#import + +#if TARGET_OS_IOS || TARGET_OS_WATCH +@class UNNotificationResponse; +#endif +@class ACPExtension, ACPMobileVisitorId; + +@interface ACPMarketingMobileCore : NSObject {} + +#pragma mark - enums + +/** + * @brief An enum type representing different levels of logging used by the SDK. + * + * @see ACPMarketingMobileCore::setLogLevel: + */ +typedef NS_ENUM(NSUInteger, ACPMobileLogLevel) { + ACPMobileLogLevelError = 0, + ACPMobileLogLevelWarning = 1, + ACPMobileLogLevelDebug = 2, + ACPMobileLogLevelVerbose = 3 +}; + +/** + * @brief An enum type representing the possible Opt-Out and Privacy settings. + * + * The possible values for the Adobe Mobile Privacy Status. The privacy status controls whether + * specific activity is allowed on the device. The default privacy status is set in any ADBMobile JSON configuration + * file using the parameter `global.privacy`. Use ACPMarketingMobileCore::setPrivacyStatus: to override the + * default privacy status. + * + * @see ACPMarketingMobileCore::getPrivacyStatus: + * @see ACPMarketingMobileCore::setPrivacyStatus: + */ +typedef NS_ENUM(NSInteger, ACPMobilePrivacyStatus) { + ACPMobilePrivacyStatusOptIn, ///< Adobe Mobile Privacy Status opted-in + ACPMobilePrivacyStatusOptOut, ///< Adobe Mobile Privacy Status opted-out + ACPMobilePrivacyStatusUnknown ///< Adobe Mobile Privacy Status is unknown +}; + +/** + * @brief An enum type representing possible authentication states for Experience Cloud visitors. + * + * @see syncIdentifier + */ +typedef NS_ENUM(NSUInteger, ACPMobileVisitorAuthenticationState) { + ACPMobileVisitorAuthenticationStateUnknown = 0, /*!< Enum value ACPMobileVisitorAuthenticationStateUnknown. */ + ACPMobileVisitorAuthenticationStateAuthenticated = 1, /*!< Enum value ACPMobileVisitorAuthenticationStateAuthenticated. */ + ACPMobileVisitorAuthenticationStateLoggedOut = 2 /*!< Enum value ACPMobileVisitorAuthenticationStateLoggedOut. */ +}; + +#pragma mark - Configuration + +/** + * @brief Load remote configuration specified by the given application ID + * + * Configure the SDK by downloading the remote configuration file hosted on Adobe servers + * specified by the given application ID. The configuration file is cached once downloaded + * and used in subsequent calls to this API. If the remote file is updated after the first + * download, the updated file is downloaded and replaces the cached file. + * + * The \p appid is preserved, and on application restarts, the remote configuration file specified by \p appid + * is downloaded and applied to the SDK. + * + * On failure to download the remote configuration file, the SDK is configured using the cached + * file if it exists, or if no cache file exists then the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * ACPMarketingMobileCore::updateConfiguration: or ACPMarketingMobileCore::setPrivacyStatus:. Configuration updates + * made using ACPMarketingMobileCore::updateConfiguration: + * and ACPMarketingMobileCore::setPrivacyStatus: are always applied on top of configuration changes made using this API. + * + * @param appid a unique identifier assigned to the app instance by the Adobe Mobile Services. It is automatically + * added to the ADBMobile JSON file when downloaded from the Adobe Mobile Services UI and can be + * found in Manage App Settings. A value of `nil` has no effect. + */ ++ (void) configureWithAppId: (NSString* __nullable) appid; + +/** + * @brief Load configuration from local file + * + * Configure the SDK by reading a local file containing the JSON configuration. On application relaunch, + * the configuration from the file at \p filepath is not preserved and this method must be called again if desired. + * + * On failure to read the file or parse the JSON contents, the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * ACPMarketingMobileCore::updateConfiguration: or ACPMarketingMobileCore::setPrivacyStatus:. Configuration updates + * made using ACPMarketingMobileCore::updateConfiguration: + * and ACPMarketingMobileCore::setPrivacyStatus: are always applied on top of configuration changes made using this API. + * + * @param filepath absolute path to a local configuration file. A value of `nil` has no effect. + */ ++ (void) configureWithFileInPath: (NSString* __nullable) filepath; + +/** + * @brief Calls the provided callback with a JSON string containing all of the User's identifiers known by the SDK + * @param callback a void-returning method that has an NSString param containing a JSON string + */ ++ (void) getAllIdentifiers: (nullable void (^) (NSString* __nullable content)) callback; + +/** + * @brief Get the current Adobe Mobile Privacy Status + * + * Gets the currently configured \ref ACPMobilePrivacyStatus and passes it as a parameter to the given void function. + * + * @param callback method invoked with the configured privacy status as a parameter + * @see ACPMobilePrivacyStatus + */ ++ (void) getPrivacyStatus: (nonnull void (^) (ACPMobilePrivacyStatus status)) callback; + +/** + * @brief Gets the version. + * + * @return a string pointer containing the version value. + */ ++ (nonnull NSString*) sdkVersion; + +/** + * @brief set the app group used to sharing user defaults and files among containing app and extension apps + * @note This *must* be called in AppDidFinishLaunching and before any other interactions with the Adobe Mobile library have happened. + * Only the first call to this function will have any effect. + */ ++ (void) setAppGroup: (nullable NSString*) appGroup; + +/** + * @brief Set the logging level of the SDK + * + * @param logLevel ACPMarketingMobileCore::ACPMobileLogLevel to be used by the SDK + * @see ACPMobileLogLevel + */ ++ (void) setLogLevel: (ACPMobileLogLevel) logLevel; + +/** + * @brief Set the Adobe Mobile Privacy status + * + * Sets the \ref ACPMobilePrivacyStatus for this SDK. The set privacy status is preserved and applied over any new + * configuration changes from calls to ACPMarketingMobileCore::configureWithAppId: or ACPMarketingMobileCore::configureWithFileInPath:, + * even across application restarts. + * + * @param status ACPMarketingMobileCore::ACPMobilePrivacyStatus to be set to the SDK + * @see ACPMobilePrivacyStatus + */ ++ (void) setPrivacyStatus: (ACPMobilePrivacyStatus) status; + +/** + * @brief Update specific configuration parameters + * + * Update the current SDK configuration with specific key/value pairs. Keys not found in the current + * configuration are added. Configuration updates are preserved and applied over existing or new + * configurations set by calling ACPMarketingMobileCore::configureWithAppId: or ACPMarketingMobileCore::configureWithFileInPath:, + * even across application restarts. + * + * Using `nil` values is allowed and effectively removes the configuration parameter from the current configuration. + * + * @param config configuration key/value pairs to be updated or added. A value of `nil` has no effect. + */ ++ (void) updateConfiguration: (NSDictionary* __nullable) config; + +#pragma mark - Extensions + +/* + * @brief Register an extension class derived from `ACPExtension` with a unique name. + * + * This call validates the parameters to ensure name is not empty, name is unique and parent class is ACPExtension. + * If validation fails, NO is returned and if `error` is provided an NSError* is passed back with more details. + * + * In order to ensure that the extension can see all events (including the BOOTED event), `registerExtension` should be called + * from your AppDelegate's `application:didFinishLaunchingWithOptions` method. This call should be before any calls into + * the AdobeMarketingMobile interface except `setLogLevel`. + * + * @param extensionClass A class whose parent is `ACPExtension`. + * @param error An optional parameter where an NSError* will be returned if valid and NO was returned + * @return YES if registration params are valid, NO otherwise. + */ ++ (BOOL) registerExtension: (nonnull Class) extensionClass + error: (NSError* _Nullable* _Nullable) error; + +#pragma mark - Rules Engine + +/** + * RulesEngine API to download and refresh rules from the server. + * + * Forces Rules Engine to send a network request to the rules url in Configuration, + * to refresh rules content set in the SDK. + */ + ++ (void) downloadRules; + +@end + +/** + * @class ACPMobileVisitorId contains Visitor Id origin, identitfier type, identifier value and authentication state. + * @see getIdentifiers: + */ +@interface ACPMobileVisitorId : NSObject +@property(nonatomic, strong, nullable) NSString* idOrigin; +@property(nonatomic, strong, nullable) NSString* idType; +@property(nonatomic, strong, nullable) NSString* identifier; +@property(nonatomic, readwrite) ACPMobileVisitorAuthenticationState authenticationState; +@end diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/MobileMarketingCoreBridge.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/MobileMarketingCoreBridge.h new file mode 100755 index 00000000..021b1e28 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/MobileMarketingCoreBridge.h @@ -0,0 +1,39 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#include + +namespace AdobeMarketingMobile { + class Core; + class PlatformServicesInterface; + + class MobileMarketingCoreBridge : public Object { + + public: + static MobileMarketingCoreBridge* GetInstance(); + std::shared_ptr GetCore(); + static void ResetInstance(); + + private: + MobileMarketingCoreBridge(); + + static MobileMarketingCoreBridge* instance_; + std::shared_ptr core_object_; + std::shared_ptr platform_services_; + }; +} diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/TypeBridge.h b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/TypeBridge.h new file mode 100755 index 00000000..00cd2b28 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Headers/TypeBridge.h @@ -0,0 +1,210 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#import +#import +#import "ACPMarketingMobileCore.h" + +namespace AdobeMarketingMobile { + +#pragma mark - std::map, NSDictionary + /** + * Returns a copy of the provided dictionary, removing entries + * for which either key or value are not of type NSString + * + * @param dictionary NSDictionary to clean + * @param removed_entries contains removed entries from data + */ + NSDictionary* _Nonnull CleanDictionary(NSDictionary* _Nonnull dictionary, + NSDictionary* _Nonnull* _Nullable removed_entries); + + /** + * Converts NSDictionary to std::map + */ + std::map ToStringMap(NSDictionary* _Nonnull dictionary); + + /** + * Converts NSDictionary to map> + */ + std::map> ToVariantMap(NSDictionary* _Nullable dictionary); + + /** + * Converts std::map to NSDictionary + */ + NSDictionary* _Nonnull ToNSDictionary(const std::map& map); + + /** + * Converts map to NSDictionary + */ + NSDictionary* _Nonnull ToNSDictionary(const std::map>& map); + +#pragma mark - std::vector, NSArray + /** + * Returns a copy of the provided array, removing elements + * for which the value is not of type NSString + * + * @param array NSArray to clean + * @param removed_elements contains removed elements from array + */ + NSArray* _Nonnull CleanArray(NSArray* _Nonnull array, + NSArray* _Nonnull* _Nullable removed_elements); + + /** + * vector to NSArray + */ + NSArray* _Nonnull ToNSArray(const std::vector& str_vec); + + /** + * vector to NSArray + */ + NSArray* _Nonnull ToNSArray(const std::vector>& variant_vec); + + /** + * Converts NSArray to vector + */ + std::vector> ToVariantVector(NSArray* _Nullable array); + + /** + * Converts NSArray * to std::vector + */ + std::vector ToStringVector(NSArray* _Nonnull array); + +#pragma mark - std::string, NSString + /** + * Converts std::string to NSString + */ + NSString* _Nullable ToNSString(const std::string& str); + + /** + * Converts NSString to std::string + */ + std::string ToCppString(NSString* _Nullable str); + +#pragma mark - C++ primitives, NSNumber + /** + * NSNumber to double + */ + double ToDouble(NSNumber* _Nonnull num); + + /** + * NSNumber to float + */ + float ToFloat(NSNumber* _Nonnull num); + + /** + * NSNumber to bool + */ + bool ToBool(NSNumber* _Nonnull num); + + /** + * Converts int32_t to NSNumber + */ + NSNumber* _Nonnull ToNSNumber(const int32_t num); + + /** + * Converts NSNumber to int32_t + */ + int32_t ToInt32(NSNumber* _Nonnull num); + + /** + * double to NSNumber + */ + NSNumber* _Nonnull ToNSNumber(const double num); + + /** + * Converts int64_t to NSNumber + */ + NSNumber* _Nonnull ToNSNumber(const int64_t num); + + /** + * Converts bool to NSNumber + */ + NSNumber* _Nonnull ToNSNumber(const bool val); + + /** + * Converts float to NSNumber + */ + NSNumber* _Nonnull ToNSNumber(const float num); + + /** + * Converts NSNumber to int64_t + */ + int64_t ToInt64(NSNumber* _Nonnull num); + + /** + * Converts ACPMobilePrivacyStatus to MobilePrivacyStatus + */ + MobilePrivacyStatus ToMobilePrivacyStatus(const ACPMobilePrivacyStatus status); + + /** + * Converts C++ MobilePrivacyStatus to objective c ACPMobilePrivacyStatus + */ + ACPMobilePrivacyStatus ToACPMobilePrivacyStatus(const MobilePrivacyStatus status); + + /** + * ACPMobileLogLevel to LoggingMode + */ + LoggingMode ToLoggingMode(const ACPMobileLogLevel logLevel); + + /** + * Converts Objective-C type to a Variant + */ + std::shared_ptr ObjCToVariant(id _Nullable value); + + /** + * Converts Variant to an Objective-C type + */ + id _Nullable VariantToObjC(const std::shared_ptr& variant); + + /** + * Encode raw data as hex and return encoding as std::string with null termination + */ + std::string BinToHex(const unsigned char* _Nullable bin, size_t size); + + /** + * Decode hex encoded data and return raw data as std::vector + */ + std::vector HexToBin(const char* _Nullable hex, size_t size); + + /** + * std::chrono::seconds to NSTimeInterval + */ + NSTimeInterval ToNSTimeInterval(std::chrono::seconds ts); + + /** + * Converts cpp VisitorId to Objective c ACPMobileVisitorId + */ + NSArray* _Nullable ToACPMobileVisitorIdArray(const std::vector>& visitor_ids); + + /** + * Converts objective c ACPMobileVisitorAuthenticationState to cpp VisitorIdAuthenticationState + */ + VisitorIdAuthenticationState ToCppVisitorAuthenticationState(const ACPMobileVisitorAuthenticationState authentication); + + /** + * Converts cpp VisitorIdAuthenticationState to objective c ACPMobileVisitorAuthenticationState + */ + ACPMobileVisitorAuthenticationState ToObjCVisitorAuthenticationState(const VisitorIdAuthenticationState authentication); + + /** + * Converts NSData to Hex NSString. + */ + NSString* _Nullable ToHexFromEncodedData(NSData* _Nullable data); + +} diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Info.plist b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Info.plist new file mode 100755 index 00000000..3e73eb15 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Info.plist differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Modules/module.modulemap b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Modules/module.modulemap new file mode 100755 index 00000000..79d21638 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/ACPCore_iOS.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module ACPCore_iOS { + umbrella header "ACPCore_iOS.h" + + export * + module * { export * } +} diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore new file mode 100755 index 00000000..4d5ae6f9 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h new file mode 100755 index 00000000..57530467 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h @@ -0,0 +1,120 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#if TARGET_OS_IOS +#import +FOUNDATION_EXPORT double AdobeMarketingMobileCoreVersionNumber; +FOUNDATION_EXPORT const unsigned char AdobeMarketingMobileCoreVersionString[]; +#else +extern double AdobeMarketingMobileCoreVersionNumber; +extern const unsigned char AdobeMarketingMobileCoreVersionString[]; +#endif + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h new file mode 100755 index 00000000..fc36569b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h @@ -0,0 +1,36 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H + +#include +#include "NetworkServiceInterface.h" +#include "PeripheralServiceInterface.h" + +namespace AdobeMarketingMobile { + class BluetoothServiceInterface: public virtual ObjectInterface, public virtual PeripheralServiceInterface { + public: + virtual void StartScan() = 0; + + virtual void StopScan() = 0; + + virtual void RegisterForDevice(const std::string& identifier, const std::function& resultCallback) = 0; + }; +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Common.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Common.h new file mode 100755 index 00000000..379554fd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Common.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_COMMON_H +#define ADOBEMOBILE_UTIL_COMMON_H + +/** + * @file Common.h + * Header file containing generally useful constructs. + */ + +/** + * ADOBE_DEPRECATED(void SomeFunction()); + * + * When declaring a function, marks that function as deprecated. + */ +#ifdef __GNUC__ +#define ADOBE_DEPRECATED(FUNCTION_SIGNATURE) FUNCTION_SIGNATURE __attribute__ ((deprecated)) +#else +#pragma message("warning: ADOBE_DEPRECATED is not implemented for this compiler") +#define ADOBE_DEPRECATED(FUNCTION_SIGNATURE) FUNCTION_SIGNATURE +#endif + +/** + * Usage: + * + * ADOBE_VIRTUAL_FOR_TESTS void Foo(); + * + * ADOBE_VIRTUAL_FOR_TESTS should be used instead of `virtual` in cases where a function is only + * only virtual to enable test-related functionality such as mocking and should not be overrided otherwise. + * + * When declaring a function, ADOBE_VIRTUAL_FOR_TESTS is currently equivalent to virtual in all builds + * release or debug. However, non-test code should not rely upon this fact. In the future, + * ADOBE_VIRTUAL_FOR_TESTS may or may not be equivalent to virtual for all builds. + * + * Functions that are intended to be overrided by non-testing related subclasses should be marked virtual. + */ +#define ADOBE_VIRTUAL_FOR_TESTS virtual + +#endif //ADOBEMOBILE_UTIL_COMMON_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h new file mode 100755 index 00000000..dc3ae8d8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h @@ -0,0 +1,83 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A compression support error occurred. + */ + constexpr static const char* DECOMPRESSION_INIT = "compressed-file.init-failed"; + /** + * A decompression error occurred. + */ + constexpr static const char* DECOMPRESSION_ERROR = "compressed-file.decompression-failed"; + /** + * A filesystem error occurred while decompressing. + */ + constexpr static const char* DECOMPRESSION_READ = "compressed-file.read-failed"; + /** + * A filesystem error occurred while decompressing. + */ + constexpr static const char* DECOMPRESSION_WRITE = "compressed-file.write-failed"; + /** + * A compression support error occurred. + */ + constexpr static const char* DECOMPRESSION_CLOSE = "compressed-file.close-failed"; + /** + * The compressed file is corrupted. + */ + constexpr static const char* DECOMPRESSION_CORRUPTED = "compressed-file.corrupted"; + } + + enum class CompressedFileType : int32_t { + ZIP, + TAR + }; + + class CompressedFileServiceInterface : public virtual ObjectInterface { + public: + + /** + * Extract the compressed file found in the {@code compressed_file_path}. + * + *

+ * The extracted contents will be written to the {@code outputDirectoryPath}. If the file already exists, + * it will be overwritten. If a platform does not contain support for a particular {@link FileType}, as + * requested in {@code fileType} argument, then the extract might fail. + * + * @param compressed_file_path The path to the compressed file + * @param file_type The {@link CompressedFileType} of the compressed file + * @param output_directory_path The output directory where the extracted contents will be stored + * @return An indication of a successful extraction + */ + virtual bool Extract(const std::string& compressed_file_path, + CompressedFileType file_type, + const std::string& output_directory_path) = 0; + + }; + +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Configuration.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Configuration.h new file mode 100755 index 00000000..83aefdf2 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Configuration.h @@ -0,0 +1,519 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H + +#include +#include +#include "FileSystemServiceInterface.h" +#include "InternalModule.h" +#include "JsonUtilityServiceInterface.h" +#include "LocalStorageServiceInterface.h" +#include "NetworkServiceInterface.h" +#include "RemoteFileManagerServiceInterface.h" +#include "SystemInfoServiceInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class ConfigurationData; + class ConfigurationDownloader; + class ConfigurationDispatcherConfigurationRequestContent; + class ConfigurationDispatcherConfigurationResponseContent; + class ConfigurationDispatcherConfigurationResponseIdentity; + + /** + * @class Configuration + * The responsibility of Configuration is to handle fetch, storage, ordering, and delivery of the configuration + * of all modules within the SDK. + * + * Configuration can be done in multiple ways within the SDK. + * Bundled + * A configuration file can be bundled with the parent application prior to publishing the app. + * This configuration and its settings has the lowest priority. + * Remote + * Remote will be the Adobe recommended approach. Remote configuration is stored on a server that the sdk will + * pull from on a structured basis. Remote configuration will overwrite Bun dled configuration, + * but has a lower priority than Programmatic. + * Programmatic + * Customers can programmatically override settings in configuration by passing in the settings key value pair. + * Programmatic configuration has the highest priority of configurations + * and will always be obeyed. + */ + class Configuration : public InternalModule { + public: + using InternalModule::GetSharedEventState; // make GetSharedEventState public + using InternalModule::HasSharedEventState; // make HasSharedEventState public + + // Configuration storage keys + static const std::string CONFIGURATION_URL_BASE; ///< Base URL of remote configuration + static const std::string + CONFIG_BUNDLED_FILE_NAME; ///< Filename of Adobe Mobile SDK configuration bundled with application + static const std::string CONFIG_MANIFEST_APPID_KEY; ///< Manifest property key for App ID from System Info Service + static const std::string DATASTORE_KEY; ///< Local Storage Service Datastore key + static const std::string + PERSISTED_OVERRIDDEN_CONFIG; ///< Overridden configuration key in Local Storage Service Datastore + static const std::string PERSISTED_APPID; ///< App ID key in Local Storage Service Datastore + static const std::string LOG_PREFIX; ///< Prefix for all logging messages + static const std::string CACHE_FOLDER; ///< Cache sub folder for config data + static const std::string RULES_CACHE_FOLDER; ///< Cache sub folder for config-downloaded rules + static const std::string RULES_JSON_KEY; ///< Root key for rules definition within JSON + static const std::string RULES_JSON_FILE_NAME; ///< File name for rules definitions + static const std::string RULES_JSON_CONDITION_KEY; ///< Json key for condition collection of a single rule + static const std::string RULES_JSON_CONSEQUENCES_KEY; ///< Json key for actions array of single rule + + /** + * Create a new instance of a Configuration Module. + */ + Configuration(); + + /** + * Handler for all the configuration request content events + * + * @param event a configuration request content event. + */ + virtual void HandleConfigurationEvent(const std::shared_ptr& event); + + /** + * Handler for all the Lifecycle response content event + * + * Lifecycle start event will trigger the configuration to re-fetch the remote configuration. + * Re-fetch happens only when the app_id exists in manifest or in persistence. + * + * Note: Lifecycle start will not reload the bundled configuration. + */ + virtual void HandleLifeCycleEvent(); + + /** + * Handler for the Boot event created by EventHub. + * + * If AppId present, create a configureWithAppId request content event and then attempt to load configuration in the following + * order + * 1. CachedFile + * 2. Bundled + * 3. Overridden Config + * + * If No AppId, attempt to load the bundled/overridden configuration. + * + * @param event boot configuration event, which is generated when the module is initialized. + */ + virtual void HandleBootEvent(const std::shared_ptr& event); + + /** + * Handler for EventType#CONFIGURATION EventSource#REQUEST_IDENTITY Event. + * + * This event is generated when the getSDKIdentities public API is called. + * Configuration module attempts to read all the identities known to the SDK. It then generates + * a EventType#CONFIGURATION EventSource#RESPONSE_IDENTITY response Event with all + * the obtained identities in a JSON String format. + * + * @param event An Configuration Request Identity event + * @see MobileIdentities + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleGetSdkIdentitiesEvent(const std::shared_ptr& event); + + + /** + * Handler for EventType#HUB EventSource#SHARED_STATE Event. + * + * This event is generated by eventhub when there is a sharedstate change in any registered module. + * This method is called when there is a shared state change in either of the following modules. + * 1. Analytics + * 2. Audience + * 3. Target + * 4. Identity + * 5. Configuration + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleSharedStateChangeEvent(); + + /** + * Returns the configuration event queue that holds the pending EventType#CONFIGURATION EventSource#REQUEST_IDENTITY events. + */ + ADOBE_VIRTUAL_FOR_TESTS const std::deque>& GetEventQueue(); + + /** + * Helper method to queue EventType#CONFIGURATION EventSource#REQUEST_IDENTITY event into #getsdkids_event_queue_ + */ + ADOBE_VIRTUAL_FOR_TESTS void QueueGetSDKIdentitiesEvent(const std::shared_ptr& event); + + protected: + + /** + * Create a new instance of a Configuration Module. + * + * @param log_prefix an identifier for this moduled used in log messages. + */ + explicit Configuration(const std::string& log_prefix); + + /** + * Called when the EventHub registers this module. + * Registers new ConfigurationListenerResponseContent and new ConfigurationListenerLifecycleRequestContent. + * Creates new ConfigurationDispatcher. + */ + void OnRegistered() override; + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + **/ + ADOBE_VIRTUAL_FOR_TESTS std::string GetSharedStateName() override; + + /** + * Reads the app_id from the manifest file. + * Returns empty string if app_id is not found. + * + * @return application identifier from manifest file or empty string if could not read from manifest + */ + std::string GetAppIdFromManifest(); + + /** + * Reads the bundled ADBMobileConfig.json file from the assets folder. + * Returns an empty string if the bundled file is not found. + * + * @return bundled file content or empty string if could not retrieve bundled file + */ + std::string GetBundledFileContent(); + + /** + * Attempts to load a configuration from the provide file path + * + * @param event event which triggered the configuration request + */ + virtual void ProcessConfigWithFilePathEvent(const std::shared_ptr& event); + + /** + * Unpacks the update configuration request content event. The new configuration data is added over the existing + * configuration and new configuration response event is dispatched. + * + * @param event an update configuration event. + */ + virtual void ProcessUpdateConfigEvent(const std::shared_ptr& event); + + /** + * Process the boot configuration event. + * + * If app_id present, attempt to load configuration in the following order, and then create a ConfigureWithAppId + * request content event + * 1. CachedFile + * 2. Bundled + * 3. Overridden Config + * + * If No app_id, attempt to load the bundled/overridden configuration. + * + * @param event boot configuration event, which is generated when the module is initialized. + */ + virtual void ProcessBootConfigEvent(const std::shared_ptr& event); + + /** + * Process the configuration request content events with app_id. Tries to retrieve the latest configuration + * from the remote server. + * + * @param event the set app_id event + */ + virtual void ProcessConfigureWithAppIdEvent(const std::shared_ptr& event); + + /** + * Retrieves current configuration through a new configuration response event. + * + * @param event the publish configuration event + */ + virtual void ProcessPublishConfigurationEvent(const std::shared_ptr& event); + + /** + * Dispatches a ConfigurationResponseContent event with the provided JSON string. + * Overrides with the programmed configuration if they exist. + * + * @param json_config_string a String containing the JSON configuration + * @param event event which triggered the configuration request + * @param is_update if set to true, will try to update an existing shared state + */ + virtual void ConfigureWithJsonString(const std::string& json_config_string, + const std::shared_ptr& event, + const bool is_update); + + /** + * Processes the Events generated by getSDKIdentities public API. + * + * Calls the callback with empty string if JsonUtilityService is not available. + * Queues the Event in the #getsdkids_event_queue_ if the one of the requires shared state is in EventHub#SHARED_STATE_PENDING. + * Dispatches the paired EventType#CONFIGURATION EventSource#RESPONSE_IDENTITY event into the EventHub with string identities JSON. + */ + virtual void ProcessGetSdkIdsEvent(); + + /** + * Returns new instance of a configuration downloader for the specified url. + * + * @param app_id The app id required to build the url for the downloader. + * @return configuration downloader instance, nullptr if the remote file service is not availabe + */ + virtual std::shared_ptr GetConfigDownloader(const std::string& app_id); + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_request_content_; + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_response_content_; + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_response_identity_; + + private: + + /** + * @private + * Load the overridden configuration from memory. + * @param lock a mutex lock to synchronize the overridden config. The lock is not released within this method. + */ + void RetrieveOverriddenConfigFromPersistence(std::unique_lock& lock); + + /** + * @private + * Saves the overridden configuration map in the persistence under the Configuration DataStore. + * Used to persist the programmed Configuration between launches + * + * @param overridden_config new overridden config map to be saved + */ + void SaveOverriddenConfigToPersistence(const std::shared_ptr& overridden_config); + + /** + * @private + * Load the app id from memory. + * + * @return application identifier from persistence + */ + std::string RetrieveAppIdFromPersistence(); + + /** + * @private + * Saves the app id in the persistence under the Configuration DataStore. + * Used to persist the app id between launches to load the cached configuration. + * + * @param app_id app id to be saved + */ + void SaveAppIdToPersistence(const std::string& app_id); + + /** + * @private + * The purpose of the SetAppIDInternalEvent is to refresh the existing configurtion with the persisted appID + * This method validates the appid for the SetAppIDInternalEvent + * It return true, if the persisted appid is same as the internalEvent appid present in the event_data + * It return false, if the persisted appid is different from the internalEvent appid present in the event_data + * + * @param event_data eventdata associated to the set internal appId event. + * @param new_app_id app id to be fetched + */ + bool ValidateForInternalEventAppIDChange(const std::shared_ptr& event_data, const std::string new_app_id); + + + // ================================ + // Helper methods + // ================================ + + /** + * @private + * Get a valid app id. Retrieves the stored app id from persistence. + * If not found, retrieves the app id from manifest. + * + * @return application identifier + */ + std::string GetValidAppID(); + + /** + * @private + * Attempts to configure with the bundled configuration. + * + * @param event event which triggered the configruation request. + * + * @return true if the configuration is successfully loaded, false otherwise + */ + bool LoadBundledConfig(const std::shared_ptr& event); + + /** + * @private + * Attempts to configure with the cached file. + * + * @param app_id associated app id of that cache file. + * @param event event which triggered the configruation request. + * + * @return true if the cached file is successfully loaded, false otherwise + */ + bool LoadCachedConfig(const std::string& app_id, const std::shared_ptr& event); + + /** + * @private + * Attempts to configure with the overridden configuration. + * + * @param event event which triggered the configruation request. + * + * @return true if succeeded, false otherwise + */ + bool LoadOverriddenConfig(const std::shared_ptr& event); + + + /** + * @private + * Central function to process all configuration changes. Called by several functions in response to changes. + * + * @param config_data EventData object containing the configuration update to be processed + * @param update bool denoting if this is an update or an overwrite + */ + void ChangeConfiguration(const std::shared_ptr& trigger_event, const std::shared_ptr& config_data, + const bool update); + /** + * @private + * Helper to get the PlatformServices JsonUtilityService + * @param json_utility_service The returned JsonUtilityService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformServices is not available, true otherwise. + */ + bool GetPlatformJsonUtilityService(std::shared_ptr& json_utility_service); + + /** + * @private + * Helper to get the PlatformServices SystemInfoService + * @param system_info_service The returned SystemInfoService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformServices is not available, true otherwise. + */ + bool GetPlatformSystemInfoService(std::shared_ptr& system_info_service); + + /** + * @private + * Helper to get the PlatformService FileSystemService + * @param file_system_service The returned FileSystemService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformService is unavailable, true otherwise. + */ + bool GetFileSystemService(std::shared_ptr& file_system_service); + + /** + * @private + * Helper to create a new EventHub::PENDING Shared State for the given event. + * + * @param version the shared state version to create + */ + void CreatePendingSharedState(int32_t version); + + /** + * @private + * Helper to update previous EventHub::PENDING shared states to + * EventHub::PREV Configuration state. Call this method to "roll-back" + * to previous config shared state when failure occurs attempting to + * load new config. + * + * @param version the shared state version to create + */ + void UpdateSharedStateToPreviousConfig(int32_t version); + + /** + * @private + * Attempts to download and register rules from remote server described in config_data. + * + * @param config_data the EventData object containing all configuration settings. + */ + void DownloadRules(const std::shared_ptr& config_data); + + /** + * @private + * Called after rules are downloaded (by DownloadRules) to uncompress and register the rules. + * + * @param cached_file the Path to the downloaded rules. + * @param url the URL that was downloaded. + */ + void OnRulesDownloaded(const std::string& cached_file, const std::string& url); + + /** + * @private + * Loads rules from the given directory. Called by OnRulesDownloaded. + * + * @param directory_path string containing the path to the directory containing the rules definitions (rules.json). + * + * @return vector of Rule objects that were parsed from the directory. + */ + std::vector> LoadRulesFromDirectory(const std::string& directory_path); + + /** + * @private + * Parses rules from the standard rules json format into a list of Rule objects. Called by LoadRulesFromDirectory. + * + * @param json_object JsonObject containing the rules to parse. + * + * @return vector of rule objects parsed from the json object. + */ + std::vector> ParseRulesFromJsonObject(const std::shared_ptr& json_object); + + /** + * @private + * Generates consequence Event objects from a JsonArray of rule consequences. Called by ParseRulesFromJsonObject + * + * @param consequences JsonArray containing a list of consequence definitions. + * + * @return vector of Event objects containing the parsed consequence events. + */ + std::vector> GenerateConsequenceEvents(const std::shared_ptr& consequences); + + /** + * @private + * Returns the configuration datastore + * @return Shared pointer to Configuration State DataStore + */ + std::shared_ptr GetDataStore(); + + /** + * @private + * This module's current configuration + */ + std::shared_ptr current_config_; + + /** + * @private + * Application defined configuration applied over the current_config_ + */ + std::shared_ptr overridden_config_; + + /** + * @private + * For queueing the configuration request identity event. + */ + std::deque> getsdkids_event_queue_; + + /** + * @private + * Mutex for synchronization of current_config_ and overridden_config_ + * + * IMPORTANT: Be very very careful when calling external functions + * while holding mutex_, especially if those functions acquire + * mutexes. Failure to do this can result in hard-to-reproduce + * deadlocks. + */ + std::mutex mutex_; + + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h new file mode 100755 index 00000000..e2fe7b0a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h @@ -0,0 +1,128 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H + +#include + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationConstants + * + * This class holds all constant values used by the Configuration module + */ + class ConfigurationConstants { + public: + +#pragma mark - EventDataKeys + class EventDataKeys { + public: + class Configuration { + public: + static const std::string SHARED_STATE_NAME; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_APP_ID; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_FILE_PATH; + static const std::string CONFIGURATION_REQUEST_CONTENT_IS_INTERNAL_EVENT; + static const std::string CONFIGURATION_REQUEST_CONTENT_UPDATE_CONFIG; + static const std::string CONFIGURATION_REQUEST_CONTENT_RETRIEVE_CONFIG; + static const std::string RULES_REMOTE_URL; + static const std::string CONFIGURATION_RESPONSE_IDENTITY_ALL_IDENTIFIERS; + static const std::string EVENT_STATE_OWNER; + + private: + Configuration() = delete; + }; + + private: + EventDataKeys() = delete; + }; + + + class SharedStateKeys { + public: + + // Analytics shared state keys + class Analytics { + public: + static const std::string MODULE_NAME; + static const std::string ANALYTICS_ID; + private: + Analytics() = delete; + }; + + // Audience shared state keys + class Audience { + public: + static const std::string MODULE_NAME; + static const std::string DPID; + static const std::string DPUUID; + static const std::string UUID; + private: + Audience() = delete; + }; + + + // Identity shared state keys + class Identity { + public: + static const std::string MODULE_NAME; + static const std::string MID; + static const std::string VISITOR_IDS_LIST; + static const std::string ADVERTISING_IDENTIFIER; + static const std::string PUSH_IDENTIFIER; + static const std::string USER_IDENTIFIER; + + private: + Identity() = delete; + }; + + + // Configuration shared state keys + class Configuration { + public: + static const std::string MODULE_NAME; + static const std::string CONFIG_EXPERIENCE_CLOUD_ORGID_KEY; + static const std::string ANALYTICS_CONFIG_REPORT_SUITES; + private: + Configuration() = delete; + }; + + + // Target shared state keys + class Target { + public: + static const std::string MODULE_NAME; + static const std::string TNT_ID; + static const std::string THIRD_PARTY_ID; + private: + Target() = delete; + }; + + + private: + SharedStateKeys() = delete; + }; + + private: + ConfigurationConstants() = delete; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h new file mode 100755 index 00000000..802b9e81 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h @@ -0,0 +1,131 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H + +#include +#include +#include "JsonUtilityServiceInterface.h" +#include "EventData.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationData + * + */ + class ConfigurationData : public Object { + public: + + /** + * Construct new ConfigurationData object with the provided JSON parser. + * + * @param json_utilty_service JSON utility serviced used to parse JSON formatted strings into + * internal JsonObjects and vice versa + */ + explicit ConfigurationData(const std::shared_ptr& json_utilty_service); + + /** + * Add configuration data from a JSON formatted string into this object. The formatted string + * must only contain flattened key/value pairs and no nested objects or array structures. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param json_string A JSON formatted string + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::string& json_string); + + /** + * Add configuration data from a map into this object. The map must only contain + * flattended configuration key/value pairs and no nested object, array, or map structures. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param map Key/value pairs to add to this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::map>& map); + + /** + * Copy configuration data from another ConfigurationData object to this object. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param configuration_data ConfigurationData to copy into this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::shared_ptr& configuration_data); + + /** + * Add configuration data from a JsonObject to this configuration object. The JsonObject must + * only contain flattened key/value paris and no nested JSON objects or JSON array structures. + * Any matching keys in the given object will overwrite existing values in this ConfigurationData object + * + * @param json_object A JsonObject whose elements to add to this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::shared_ptr& json_object); + + /** + * Get a pointer to a new EventData object containing this configuration data. + * + * @return A pointer to a new EventData object containting this configuration data. + */ + std::shared_ptr GetEventData() const; + + /** + * Get a JSON formatted string representation of this configuration data. + * + * @return a JSON formatted string + */ + std::string GetJsonString() const; + + /** + * Determine if there are any configuration elements. + * + * @return true if there are no configuration elements, false otherwise + */ + bool IsEmpty() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + + /** + * @private + * Internal storage of configuration data. + */ + std::map> internal_map_; + + /** + * @private + * Json Utility Service from Platform Services, passed into constructor. + * Allowed to be nullptr. Must check for nullptr before using! + */ + std::shared_ptr json_utility_service_; + }; + + +} // end namespace AdobeMarketingMobile + + +#endif //ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h new file mode 100755 index 00000000..b8679409 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h @@ -0,0 +1,45 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationEventDispather + * Event dispatcher for the Configuration module. + */ + class ConfigurationDispatcherConfigurationRequestContent : public ModuleEventDispatcher { + + public: + + /** + * Dispatch Configuration request using App ID. Called internally by the Configuration Module. + * + * @param app_id App ID used for configuration + */ + virtual void DispatchInternalConfigureWithAppIdEvent(const std::string& app_id); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h new file mode 100755 index 00000000..3a94c939 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + class EventData; + + /** + * @class ConfigurationEventDispather + * Event dispatcher for the Configuration module. + */ + class ConfigurationDispatcherConfigurationResponseContent : public ModuleEventDispatcher { + + public: + + /** + * Dispatch Configuration response event with updated configuration data. + * + * @param event_data Updated configuration data as EventData + * @param pair_id A unique pairing id for the event (optional) + */ + virtual void DispatchConfigResponseWithEventData(const std::shared_ptr& event_data, + const std::string& pair_id); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h new file mode 100755 index 00000000..73d82039 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationDispatcherConfigurationResponseIdentity + * Event dispatcher for the Configuration Response Identity Events. + */ + class ConfigurationDispatcherConfigurationResponseIdentity : public ModuleEventDispatcher { + + public: + + /** + * Dispatches EventType#CONFIGURATION , EventSource#RESPONSE_IDENTITY event into the EventHub + * with #sdk_identities_json string for the given #pair_id. + * + * @param sdk_identities_json A Jsonstring containing all the identities + * @param pair_id A unique pairing id for one-time listener + */ + virtual void DispatchAllIdentities(const std::string& sdk_identities_json, const std::string& pair_id); + + }; +} + + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h new file mode 100755 index 00000000..f0de4acd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h @@ -0,0 +1,52 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class NetworkServiceInterface; + class RemoteFileManagerServiceInterface; + class SystemInfoServiceInterface; + + class ConfigurationDownloader : public Object { + public: + ConfigurationDownloader(const std::shared_ptr& remote_file_service, + const std::string& url); + + virtual std::string DownloadConfig(); + + virtual std::string LoadCachedConfig(); + + const std::string GetUrl() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + const std::string url_; + std::shared_ptr manager_; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h new file mode 100755 index 00000000..6844b85c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerBootEvent + * Listener for EventHub BOOTED events. + */ + class ConfigurationListenerBootEvent : public ModuleEventListener { + public: + /** + * Callback for EventHub BOOTED events to the Configuration Module. + * + * @param event an EventHub BOOTED. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h new file mode 100755 index 00000000..d4b4f074 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerHubSharedState + * Listener for shared state change events. + */ + class ConfigurationListenerHubSharedState : public ModuleEventListener { + public: + /** + * Callback for shared state change events. + * + * @param event HUB SHARED_STATE event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h new file mode 100755 index 00000000..314d66e9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h @@ -0,0 +1,41 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H + +#include "Configuration.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerLifecycleResponseContent + * Listener for Configuration lifecycle response events. + */ + class ConfigurationListenerLifecycleResponseContent : public ModuleEventListener { + public: + /** + * Callback for Configuration retrieval request events. + * + * @param event Configuration retrieval request event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h new file mode 100755 index 00000000..dd3168ba --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerRequestContent + * Listener for Configuration update events. + */ + class ConfigurationListenerRequestContent : public ModuleEventListener { + public: + /** + * Callback for Configuration update request events. + * + * @param event Configuration request content event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h new file mode 100755 index 00000000..9f33397a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerRequestIdentity + * Listener for Configuration Request Identity events. + */ + class ConfigurationListenerRequestIdentity : public ModuleEventListener { + public: + /** + * Callback for Configuration Request Identity events. + * + * @param event Configuration Request Identity event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ContextData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ContextData.h new file mode 100755 index 00000000..4b529b91 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ContextData.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_CONTEXTDATA_H_ +#define ADOBEMOBILE_UTIL_CONTEXTDATA_H_ + +#include +#include +#include + +namespace AdobeMarketingMobile { + + class ContextData { + + public: + static std::map DecodeContextData(const std::string& context_data_string); + static std::string EncodeContextData(const std::map& cdata); + static std::string CleanKey(const std::string& key); + static std::map CleanDictionaryKeys(const std::map& raw_dictionary); + + private: + std::map sub_items_; + std::string value_; + + static std::vector Split(const std::string& str, const char delim); + static void EncodeValueIntoMap(const std::string& value, std::map& destination_map, + const std::vector& keys, size_t index = 0); + static std::string SerializeToURLFormat(std::map& encoded_data); + static std::string Flatten(const std::vector& path, const std::string& end = ""); + }; +} + +#endif diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Core.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Core.h new file mode 100755 index 00000000..390c8742 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Core.h @@ -0,0 +1,297 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_CORE_H +#define ADOBEMOBILE_CORE_CORE_H + +#include +#include +#include +#include +#include +#include +#include + +#include "Common.h" +#include "Configuration.h" +#include "Core.h" +#include "CryptoServiceInterface.h" +#include "Event.h" +#include "EventBuilder.h" +#include "EventData.h" +#include "EventHub.h" +#include "EventSource.h" +#include "EventType.h" +#include "ExternalModuleInterface.h" +#include "InternalModule.h" +#include "Log.h" +#include "MobilePrivacyStatus.h" +#include "Module.h" +#include "ModuleEventDispatcher.h" +#include "ModuleEventDispatcherBase.h" +#include "ModuleEventListener.h" +#include "ModuleEventListenerBase.h" +#include "ModuleEventProcessor.h" +#include "ModuleEventProcessorBase.h" +#include "Object.h" +#include "ObjectInterface.h" +#include "OneTimeListener.h" +#include "PlatformServicesInterface.h" +#include "RandomUtil.h" +#include "SdkError.h" +#include "StringUtils.h" +#include "Variant.h" +#include "VariantKind.h" + +namespace AdobeMarketingMobile { + + /** + * @class Core + * + * @brief Core is the API surface used by the top-level native API. + * + * The native API layer instantiates and calls into the Core to implement most API functionality. + * This design allows the native API layer implementation to mostly consist of bindings to the native language. + * + * Internally, the Core takes care of EventHub registration and cleanup. + */ + class Core : public Object { + public: + std::shared_ptr event_hub; ///< the event hub instance + + std::shared_ptr platform_services; ///< the platform services instance + + /** + * @name Creation and Disposal + */ + ///@{ + + /** + * @brief Creates the Core. + * + * @param platform_services - the platform services to use + * @param event_hub - the event hub to use (for mocking). If `nullptr`, a new EventHub instance is created and + * registers all required modules. If passing an EventHub instance, no modules are + * registered. + * + * @note Make sure to cleanup after the returned Core by calling Dispose(). + * + * @returns a new Core with the given platform services. + */ + static std::shared_ptr Create(const std::shared_ptr& platform_services, + const std::shared_ptr& event_hub = nullptr); + + /** + * @brief Destructor + */ + ~Core(); + + /** + * @brief Cleans up after this + * + * Calls Dispose with a reasonable default wait time. + * + * @see bool Dispose(std::chrono::milliseconds max_wait_duration) + * + * @return true if clean up completed before the wait time elapsed. + */ + bool Dispose(); + + /** + * @brief Cleans up after this + * + * Clean up is asynchronous and this call may block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if clean up completed before the wait time elapsed. + */ + bool Dispose(std::chrono::milliseconds max_wait_duration); + + ///@} + + /** + * @name Module Registration + */ + ///@{ + + /** + * @brief Creates and registers a module of the specified type. + * + * `TModule` is the module class to register, must be a subclass of `Module`. + */ + template + void RegisterModule(); + + ///@} + + /** + * @name Configuration + */ + ///@{ + + /** + * @brief Loads remote configuration specified by given application ID. + * + * Configure the SDK by downloading the remote configuration file hosted on Adobe servers + * specified by the given application ID. The configuration file is cached once downloaded + * and used in subsequent calls to this API. If the remote file is updated after the first + * download, the updated file is downloaded and replaces the cached file. + * + * On failure to download the remote configuration file, the SDK is configured using the cached + * file if it exists, or if no cache file exists then the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * UpdateConfiguration() or SetPrivacyStatus(). Configuration updates made using UpdateConfiguration() + * and SetPrivacyStatus() are always applied on top of configuration changes made using this API. + * + * @param app_id a unique identifier assigned to the app instance by the Adobe Mobile Services. It is automatically + * added to the ADBMobile JSON file when downloaded from the Adobe Mobile Services UI and can be + * found in Manage App Settings. A value of empty string has no effect. + */ + void ConfigureWithAppId(const std::string& app_id) const; + + /** + * @brief Loads configuration from local file. + * + * Configure the SDK by reading a local file containing the JSON configuration. + * + * On failure to read the file or parse the JSON contents, the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * UpdateConfiguration() or SetPrivacyStatus(). Configuration updates made using UpdateConfiguration() + * and SetPrivacyStatus() are always applied on top of configuration changes made using this API. + * + * @param file_path absolute path to a local configuration file. A value of empty string has no effect. + */ + void ConfigureWithFileInPath(const std::string& file_path) const; + + /** + * @brief Update specific configuration parameters. + * + * Update the current SDK configuration with specific key/value pairs. Keys not found in the current + * configuration are added. Configuration updates are preserved and applied over existing or new + * configurations set by calling ConfigureWithAppId() or ConfigureWithFileInPath(). + * + * Using nullptr values is allowed and effectively removes the configuration parameter from the + * current configuration. + * + * @param config_map configuration key/value pairs to be updated or added. A value of empty map has no effect. + * @see EventDataKeys + */ + void UpdateConfiguration(const std::map>& config_map) const; + + /** + * @brief Set the Adobe Mobile Privacy status. + * + * Sets the MobilePrivacyStatus for this SDK. The set privacy status is preserved + * and applied over any new configuration changes from calls to ConfigureWithAppId() or ConfigureWithFileInPath(). + * + * @param privacy_status MobilePrivacyStatus to be set to the SDK + * @see MobilePrivacyStatus + * @see UpdateConfiguration() + */ + void SetPrivacyStatus(MobilePrivacyStatus privacy_status) const; + + /** + * @brief Get the current Adobe Mobile Privacy Status. + * + * Gets the currently configured MobilePrivacyStatus and passes it as a parameter + * to the given void function. + * + * @param callback method invoked with the configured privacy status as a parameter + * @see MobilePrivacyStatus + */ + void GetPrivacyStatus(const std::function& callback) const; + + /** + * Retrieve all identities stored by/known to the SDK in a JSONString format. + * + * Dispatches an EventType#CONFIGURATION - EventSource#REQUEST_IDENTITY Event. + * Returns an empty string if the SDK is unable to retrieve any identifiers. + * + * @param callback method which is invoked with all the known identifier in JSONString format + * @see AdobeCallback + */ + void GetSDKIdentities(const std::function& callback) const; + + /** + * @name External Module + */ + ///@{ + + /** + * @brief Register an external module. + * + * @param external_module The interface to the applications external module implementation. + * @param error_callback A callback called if errors occur during registration. + */ + void RegisterExternalModule(const std::shared_ptr& external_module, + std::function error_callback); + + ///@} + + /** + * @name Rules Engine Module + */ + ///@{ + + /** + * Called from the platform to force redownload rules. + *

+ * Rules Engine attempts to redownload rules from the already defined url provided in the configuration. + * Dispatches {@code EventType#RULES_ENGINE} - {@code EventSource.REQUEST_CONTENT} {code Event} to refresh rules. + */ + void DownloadRules(); + + ///@} + + private: + /** + * @private + * + * Default constructor, part of 2-phase initialization. + */ + Core(); + + /** + * @private + * + * Initializes this, part of 2-phase initialization. + */ + void Init(const std::shared_ptr& new_platform_services, + const std::shared_ptr& new_event_hub); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + void Core::RegisterModule() { + if (event_hub) { + event_hub->RegisterModule(); + } + } +} + +#endif //ADOBEMOBILE_CORE_CORE_H + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h new file mode 100755 index 00000000..5fd87f8b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h @@ -0,0 +1,71 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_CORECONSTANTS_H +#define ADOBEMOBILE_CORE_CORECONSTANTS_H + +#include + +namespace AdobeMarketingMobile { + class CoreConstants { + public: + static const std::string CORE_VERSION; + +#pragma mark - Event Data Keys + class EventDataKeys { + public: + static const std::string SHARED_STATE_OWNER; + + class Configuration { + public: + static const std::string SHARED_STATE_NAME; + static const std::string GLOBAL_CONFIG_PRIVACY; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_APP_ID; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_FILE_PATH; + static const std::string CONFIGURATION_REQUEST_CONTENT_UPDATE_CONFIG; + static const std::string CONFIGURATION_REQUEST_CONTENT_RETRIEVE_CONFIG; + static const std::string CONFIGURATION_RESPONSE_IDENTITY_ALL_IDENTIFIERS; + private: + Configuration() = delete; + }; + + class RulesEngine { + public: + static const std::string CONSEQUENCE_TRIGGERED; + static const std::string CONSEQUENCES_LOADED; + static const std::string CONSEQUENCE_ID; + static const std::string CONSEQUENCE_TYPE; + static const std::string CONSEQUENCE_DETAIL; + static const std::string CONSEQUENCE_ASSETS_PATH; + static const std::string RULES_REQUEST_CONTENT_DOWNLOAD_RULES; + private: + RulesEngine() = delete; + }; + + private: + EventDataKeys() = delete; + }; + + + private: + CoreConstants() = delete; + }; +} + +#endif /* ADOBEMOBILE_CORE_CORECONSTANTS_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h new file mode 100755 index 00000000..dc6e9645 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class UuidInterface : public virtual ObjectInterface { + public: + /** + * Get ASCII string representation of a random 128-bit UUID (Universally Unique Identifier) + * The generated UUID must conform to RFC 4122 version 4 ( https://tools.ietf.org/html/rfc4122 ) + * Random UUID ASCII string example: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + */ + virtual std::string GetString() const = 0; + + /** + * Get UUID bytes + * + * @param uuid_bytes 16 byte buffer + */ + virtual void GetBytes(unsigned char* uuid_bytes) const = 0; + }; + + class CryptoServiceInterface : public virtual ObjectInterface { + public: + /** + * Generate a random 128-bit UUID (Universally Unique Identifier) + * The generated UUID must conform to RFC 4122 version 4 ( https://tools.ietf.org/html/rfc4122 ) + * Random UUID ASCII string example: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + * + * @return UuidInterface shared_ptr + */ + virtual std::shared_ptr GetRandomUuid() const = 0; + + /** + * Get SHA-1 hash value for string ( https://tools.ietf.org/html/rfc3174 ) + * SHA-1 hash example: + * input: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + * output: "3ed187dcf5662d135760654b9d8f061dc18822d0" + * + * @return string representation of sha-1 hash value + */ + virtual std::string GetSha1Hash(const std::string& str) const = 0; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h new file mode 100755 index 00000000..df73a97f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITBASE_H +#define ADOBEMOBILE_SHARED_DATABASEHITBASE_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + /** + * DatabaseHitBase + * + * Abstract Base class that should be implemented by any class that represents a "Hit" which will be + * stored in a local database + */ + class DatabaseHitBase : public Object { + public: + + std::string identifier; ///< unique identifier for the database record + std::chrono::seconds timestamp; ///< created timestamp in seconds since jan 1, 1970 + }; +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h new file mode 100755 index 00000000..803303b1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h @@ -0,0 +1,95 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H +#define ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H + +#include +#include "DatabaseHitSchemaBase.h" +#include "DatabaseHitBase.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + /** + * DatabaseHitSchema + * + * Abstract Base class that should be implemented by any class that will create a new database table + */ + template + class DatabaseHitSchema : public DatabaseHitSchemaBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + + public: + /** + * GenerateHit must be implemented by classes that implement DatabaseHitSchema. + * + * @return a DatabaseHitBase object generated off the provided QueryResult parameter. + */ + virtual std::shared_ptr GenerateHit(const std::shared_ptr& query_result) = 0; + + /** + * Overrides DatabaseHitSchemaBase::GenerateHitBase to call GenerateHit and return the proper data type + */ + std::shared_ptr GenerateHitBase(const std::shared_ptr& query_result) override; + + /** + * GenerateDataMap must be implemented by classes that implement DatabaseHitSchema. + * + * @return a DatabaseHitBase object generated off the provided QueryResult parameter. + */ + virtual std::map> GenerateDataMap(const std::shared_ptr& hit) = 0; + + /** + * Overrides DatabaseHitSchemaBase::GenerateDataMapBase to call GenerateDataMap and accept the proper data type parameter + */ + std::map> GenerateDataMapBase(const std::shared_ptr& hit) + override; + + protected: + /** + * Constructor. + * For use by subclasses. + */ + DatabaseHitSchema(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + DatabaseHitSchema::DatabaseHitSchema() {} + + template + std::shared_ptr + DatabaseHitSchema::GenerateHitBase(const std::shared_ptr& query_result) { + return GenerateHit(query_result); + } + + template + std::map> + DatabaseHitSchema::GenerateDataMapBase(const std::shared_ptr& hit) { + return GenerateDataMap(std::dynamic_pointer_cast(hit)); + } +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h new file mode 100755 index 00000000..152040bf --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h @@ -0,0 +1,115 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H +#define ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H + +#include +#include +#include +#include "DatabaseServiceInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + + /** + * DatabaseHitSchemaBase + * + * Abstract Base class that should be implemented by any class that will create a new database table + */ + class DatabaseHitSchemaBase : public Object { + + public: + /** + * @returns table_name_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::string GetTableName(); + + /** + * @returns database_name_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::string GetDatabaseName(); + + /** + * @returns column_names_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector GetColumnNames(); + + /** + * @returns column_data_types_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector GetColumnDataTypes(); + + /** + * @returns column_constraints_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector> GetColumnConstraints(); + + /** + * GenerateHit must be implemented by classes that implement DatabaseHitSchemaInterface. + * This method returns a DatabaseHit object generated off the provided QueryResult parameter. + */ + virtual std::shared_ptr GenerateHitBase(const std::shared_ptr& query_result) = 0; + + /** + * GenerateDataMap must be implemented by classes that implement DatabaseHitSchemaInterface. + * This method returns a map of string-variants generated off the provided DatabaseHit parameter. + */ + virtual std::map> GenerateDataMapBase(const std::shared_ptr& hit) + = 0; + + protected: + /** + * Constructor. + * For use by subclasses. + */ + DatabaseHitSchemaBase(); + + /** + * table_name_ name of the database table represented by this class + */ + std::string table_name_; + + /** + * database_name_ name of the database file to be created + */ + std::string database_name_; + + /** + * column_names_ is a vector of strings defining the names for the database columns + * represented by this class + */ + std::vector column_names_; + + /** + * column_data_types_ is a vector of data types, in order, for the database columns + * represented by this class + */ + std::vector column_data_types_; + + /** + * column_constraints_ is a vector of vectors, representing column contraints for each column + * represented by this class + */ + std::vector> column_constraints_; + }; +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h new file mode 100755 index 00000000..9278d97d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h @@ -0,0 +1,252 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* DATABASE_OPEN_ERROR = "database.open_error"; ///< Database open error occurred. + constexpr static const char* DATABASE_QUERY_EXEC_ERROR = + "database.query_exec_error"; ///< A database query execution error occurred. + constexpr static const char* DATABASE_QUERYRESULT_INDEX_ERROR = + "database.queryresult_index_error"; ///< Error occurred in the index of the query result. + constexpr static const char* DATABASE_QUERYRESULT_ALREADY_CLOSED = + "database.queryresult_already_closed"; ///< Query result is already closed. + } + + /** + * Interface defining methods for reading query results from a database + */ + class QueryResultInterface : public virtual ObjectInterface { + public: + /** + * Get total number of rows in the result + * + * @return int32_t number of rows in the QueryResult + */ + virtual int32_t GetCount() const = 0; + + /** + * Get the value of the requested column as an integer + * + * @param column_index zero-based index of the target column + * @return int32_t the value of the column as an int32_t + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual int32_t GetInt(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a double + * + * @param column_index zero-based index of the target column + * @return double the value of the column as a double + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual double GetDouble(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a float + * + * @param column_index zero-based index of the target column + * @return float the value of the column as a float + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual float GetFloat(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a long + * + * @param column_index zero-based index of the target column + * @return the value of the column as int64_t + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual int64_t GetLong(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a string + * + * @param column_index zero-based index of the target column + * @return std::string the value of the column as a string + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual std::string GetString(uint32_t column_index) const = 0; + + /** + * Check if the value of the requested column is null + * + * @param column_index zero-based index of the target column + * @return bool indicating whether the column value is null + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool IsNull(uint32_t column_index) const = 0; + + /** + * Move to the first row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToFirst() = 0; + + /** + * Move to the last row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToLast() = 0; + + /** + * Move to the next row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToNext() = 0; + + /** + * Close this QueryResult + */ + virtual void Close() = 0; + + }; + /** + * Interface defining relational database operations + */ + + class Query; + class DatabaseInterface : public virtual ObjectInterface { + public: + /** + * Allowed data types for database columns + */ + enum class ColumnDataType : int32_t { + INTEGER = 0, + REAL, + TEXT + }; + + /** + * Allowed constraints for database columns + */ + enum class ColumnConstraint : int32_t { + NOT_NULL = 0, + UNIQUE, + PRIMARY_KEY, + AUTOINCREMENT + }; + + /** + * Create a table if it doesn't exist + * + * @param name the table name + * @param column_names list of column names + * @param column_data_types list of column data types + * @param column_constraints a list of lists containing column constraints for each table column + * @return bool indicating whether the create table operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool CreateTable(const std::string& name, const std::vector& column_names, + const std::vector& column_data_types, + const std::vector>& column_constraints) = 0; + + /** + * Insert a row into a table in the database + * + * @param table name of the table to insert the row into + * @param values map containing the initial column values for the row. The keys should be the column names and the values the column values. + * @return bool indicating whether the insert operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Insert(const std::string& table, const std::map>& values) = 0; + + /** + * Query a table in the database + * + * @param query the query to execute + * @return QueryResult the result of this query, positioned at the first row + */ + virtual std::shared_ptr RunQuery(const std::shared_ptr& query) = 0; + + /** + * Update rows for a table in the database + * + * @param table name of the table to update + * @param values a map from column names to new column values. Empty string is a valid value. + * @param where_clause the optional WHERE clause to apply when updating. Passing empty string will update all rows + * @param where_args A list of arguments for where clause. You may include ?s in the where clause, which will be replaced by the values from where_args. The values will be bound as strings + * @return bool indicating whether the update operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Update(const std::string& table, + const std::map>& values, + const std::string& where_clause, + const std::vector& where_args) = 0; + + /** + * Delete rows from a table in the Database + * + * @param table name of the table to delete rows from + * @param where_clause the optional WHERE clause to apply when deleting. Passing empty string will delete all rows + * @param where_args A list of arguments for where clause. You may include ?s in the where clause, which will be replaced by the values from where_args. The values will be bound as strings + * @return bool indicating whether the delete operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Delete (const std::string& table, + const std::string& where_clause, + const std::vector& where_args) = 0; + + /** + * Close this database + */ + virtual void Close() = 0; + + }; + + class DatabaseServiceInterface : public virtual ObjectInterface { + public: + /** + * Opens a database if it exists, otherwise creates a new one with the specified name. + * + * @param db_name the database name + * @return a Database instance, or null if error occurs + */ + virtual std::shared_ptr OpenDatabase(const std::string& db_name) = 0; + + /** + * Delete database if it exists + * + * @param db_name the database name + * @return bool indicating whether the database file delete operation was successful + */ + virtual bool DeleteDatabase(const std::string& db_name) = 0; + }; + +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h new file mode 100755 index 00000000..c3a68877 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class EncodingServiceInterface : public virtual ObjectInterface { + public: + virtual std::string Base64Decode(const std::string& encoded_string) const = 0; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Event.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Event.h new file mode 100755 index 00000000..19132ecd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Event.h @@ -0,0 +1,195 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENT_H +#define ADOBEMOBILE_CORE_EVENT_H + +#include +#include +#include "Object.h" +#include "EventType.h" +#include "EventSource.h" + +namespace AdobeMarketingMobile { + class EventBuilder; + class EventData; + + /** + * @class Event + * + * @brief An Event indicates that something notable happened and includes relevant information about what happened. + * + * Creating Events + * ---------------- + * + * Events are created using EventBuilder: + * + * auto event = EventBuilder{"the_event_name", EventType::ANALYTICS, EventSource::REQUEST_CONTENT}.Build(); + * + * Events can also be created via cloning using Event::Copy(): + * + * auto event2 = event.Copy(); + * + * Event Properties + * ---------------- + * Events carry the following pieces of information: + * - _Name_ is a descriptive string for an individual event. Primarily used for logging. + * - _Type_ is an EventType that identifies what happened. + * - _Source_ is an EventSource that identifies the origin of the event. + * - _Pairing ID_ is a string that, when set, uniquely identifies this event. A one-time listener can register on this + * pairing id for 1:1 communication. + * - _Response Pairing ID_ is relevant for events that follow a response-request pattern. When set, identifies the + * pairing ID that should be used for responses to this event. + * - _Number_ is an integer sequence number. Used primarily for debugging. + * - _Data_ is an EventData, an associative map of string keys to values of various types. Used to convey additional + * information. + * - _Timestamp_ is the time at which the event was generated. + * + * Dispatching, Processing, and Listening for Events + * ------------------------------------------------- + * To dispatch events, a module will typically subclass ModuleEventDispatcher and invoke EventHub::Dispatch(). + * + * To listen for events, a module will typically subclass ModuleEventListener. + * + * To process (change) events, module will typically subclass ModuleEventProcessor. + */ + class Event : public Object { + public: + // TODO: (AMSDK-5832) Some methods should return const& + + friend class EventBuilder; + + /** + * @brief Convenience event for retrieving the oldest shared state + **/ + static const std::shared_ptr SHARED_STATE_OLDEST; + + /** + * @brief Convenience event for retrieving the newest shared state + **/ + static const std::shared_ptr SHARED_STATE_NEWEST; + + /** + * @brief Copies this event. + * @return a copy of this event + */ + std::shared_ptr Copy() const; + + /** + * @brief Gets the name of this event. + * @return the name of this event + */ + std::string GetName() const; + + /** + * @brief Gets the source of this event. + * @return the source of this event + */ + const std::shared_ptr& GetEventSource(); + + /** + * @brief Gets the type of this event. + * @return the type of this event + */ + const std::shared_ptr& GetEventType(); + + /** + * @brief Gets the pairing id of this event. + * @return the pairing id of this event, or empty string if there is no pairing id + */ + std::string GetPairID() const; + + /** + * @brief Gets the response pairing id of this event. + * @return the response pairing id of this event, or empty string if there is no response pairing id + */ + std::string GetResponsePairID() const; + + /** + * @brief Gets the additional data for this event. + * @return the data for this event + */ + std::shared_ptr GetData(); + + /** + * @brief Gets the timestamp of this event. + * @return the time at which this event was generated, expressed as milliseconds since the UNIX epoch + */ + std::chrono::milliseconds GetTimestamp() const; // ms since epoch of std::chrono::steady_clock + + /** + * @brief Gets the number of this event. + * @return a sequence number for the event + */ + int32_t GetEventNumber() const; + + // TODO: (AMSDK-5834) Make SetEventNumber only accessible to EventHub + /** + * @brief Sets sequence number for the event. + * + * Intended for use by EventHub. + * + * @param number - the new event number + */ + void SetEventNumber(int32_t number); + + // TODO: (AMSDK-5833) Possibly remove GetError() + /** + * @brief Returns an error descriptor for this event. + * @return event error descriptor (generally only populated on error events) + */ + std::string GetError() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + /** + * @private + * Constructor. Intended for use by EventBuilder. + */ + explicit Event(const std::string& name, const std::shared_ptr& type, + const std::shared_ptr& source); + + /** + * @private + * Constructor. Only used by creating oldest and latest event constant. + */ + explicit Event(int32_t event_number); + + std::string name_; ///< @private the name of this event + std::shared_ptr source_; ///< @private the source of this event + std::shared_ptr type_; ///< @private the type of this event + std::string pair_id_; ///< @private the pairing id of this event + std::string response_pair_id_; ///< @private the response pairing id of this event + std::shared_ptr data_; ///< @private the additional data for this event + std::string error_; ///< @private the error message + + /** + * @private + * the time at which this event was generated, expressed as milliseconds since the UNIX epoch + */ + std::chrono::milliseconds timestamp_; + + int32_t event_number_; ///< @private sequence number for the event. + }; +} + +#endif //ADOBEMOBILE_CORE_EVENT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h new file mode 100755 index 00000000..9025be1f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h @@ -0,0 +1,126 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTBUILDER_H +#define ADOBEMOBILE_CORE_EVENTBUILDER_H + +#include +#include +#include + +namespace AdobeMarketingMobile { + class Event; + class EventData; + class EventSource; + class EventType; + + /** + * @class EventBuilder + * + * @brief EventBuilder is the builder class for creating instances of Event. + * + * EventBuilder is a POD class and should only be created on the stack. + * + * Example: + * + * std::shared_ptr event = EventBuilder{"the_event_name", + * EventType::ANALYTICS, + * EventSource::REQUEST_CONTENT} + * .SetPairID("1234") // methods can be chained + * .Build(); // when complete, call Build() to construct the Event + */ + class EventBuilder { + public: + /** + * @brief Constructs the builder for an event with the given name, type, and source. + */ + explicit EventBuilder(const std::string& name, const std::shared_ptr& type, + const std::shared_ptr& source); + + /* EventBuilder is not copyable or movable */ + EventBuilder(const EventBuilder&) = delete; + EventBuilder& operator=(const EventBuilder&) = delete; + EventBuilder(EventBuilder&&) = delete; + EventBuilder&& operator=(EventBuilder&&) = delete; + + /** + * @brief Sets the pair id for the event. + */ + EventBuilder& SetPairID(const std::string& pairId); + + /** + * @brief Sets the response pair id for the event. + */ + EventBuilder& SetResponsePairID(const std::string& responsePairId); + + // TODO: (AMSDK-5833) Is this used? + /** + * @brief Sets the error for the event. + */ + EventBuilder& SetError(const std::string& error); + + /** + * @brief Sets the timestamp for the event. + * If not explicitly set, the timestamp would be set to the number of milliseconds since Unix Epoch. + */ + EventBuilder& SetTimestamp(std::chrono::milliseconds timestamp); + + /** + * @brief Sets the data for the event. + * + * For efficiency reasons, the event's data will be set to the instance provided by the `data` argument. + * Do not modify the `data` instance after passing the instance to `SetData()` + */ + EventBuilder& SetData(const std::shared_ptr& data); + + /** + * @brief Sets the data for the event to a copy of the given EventData. + */ + EventBuilder& CopyData(const std::shared_ptr& data); + + /** + * @brief Sets the number of the event. + * + * Most users will not need to call this method directly, as the event number is typically set by the EventHub. + */ + EventBuilder& SetEventNumber(int32_t number); + + /** + * @brief Builds the specified event. + * + * Calling this method twice will result in an error. + * + * @returns the newly created event. + */ + std::shared_ptr Build(); + + private: + /** + * @private + * + * Throws an exception if this was already built. + */ + void ThrowIfAlreadyBuilt(); + + std::shared_ptr event_; ///< @private the underlying event + + bool did_build_; ///< @private true iff `Build()` was already called + }; +} + +#endif //ADOBEMOBILE_CORE_EVENTBUILDER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventData.h new file mode 100755 index 00000000..7f737526 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventData.h @@ -0,0 +1,763 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTDATA_H +#define ADOBEMOBILE_CORE_EVENTDATA_H + +#include +#include +#include +#include "Expected.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + enum class VariantKind : int32_t; + + + /** + * @class EventData + * + * @brief EventData is data that can be included with events or shared states. + * + * At the top-level, EventData is a map of `string` keys to `Variant` values. + * + * @note When making changes to the interface/implementation of EventData, any information stored in EventData + * MUST be convertible to JSON. If it can't be expressed as JSON, it shouldn't be stored in EventData. + * + * Constructing an EventData + * ------------------------- + * To construct an empty EventData, use `std::make_shared`: + * + * auto event_data = std::make_shared(); + * + * Adding key-value pairs to an EventData + * -------------------------------------- + * The `Put` methods can be used to add/modify EventData key-value pairs: + * + * auto event_data = std::make_shared(); + * event_data->PutString("a string", "some value"); + * event_data->PutInteger("a number", 42); + * + * EventData supports storing any values that Variant supports. + * + * Inspecting EventData + * -------------------- + * The `Get` methods can be used to retrieve key-value pairs: + * + * std::string value; + * if (event_data->GetString("a string", value)) { + * // the value associated with "a string" will be put into value + * } else { + * // event_data does not contain "a string" or it is not convertible to std::string + * } + * + * The `Opt` methods retrieve key-value pairs, returning a default value if the key was not found: + * + * auto value = event_data->OptString("a string", "value if missing"); + * + * Additonal methods such as EventData::ContainsKey(), EventData::IsEmpty(), EventData::Size(), + * EventData::GetKind() allow inspection of the underlying map. + * + * Cloning an EventData + * -------------------- + * EventData::Copy() can be used to (deep) clone an EventData instance: + * + * auto event_data_1 = std::make_shared(); + * event_data_1.PutString("flavor", "sour"); + * event_data_1.PutString("color, "blue"); + * + * auto event_data_2 = event_data_1->Copy(); + * event_data_2.PutString("color", "green"); + * + * // event_data_1 contains { "flavor" : "sour", "color" : "blue" } + * // event_data_2 contains { "flavor" : "sour", "color" : "green" } + * + * Converting an EventData to/from std::map + * ---------------------------------------- + * Constructors exist to construct EventData from `std::map` and + * `std::map>`. + * + * EventData::AsMapCopy() or can be used to (deep) copy the EventData contents into a map. + * + */ + class EventData : public Object { + public: + /** + * @brief Constructs an empty EventData + */ + EventData(); + + /** + * @brief Constructs an EventData with the given key-value pairs + */ + explicit EventData(const std::map>& map); + + /** + * @brief Constructs an EventData with the given key-value pairs + */ + explicit EventData(const std::map& map); + + /** + * @brief Deep copies this + * @returns a deep copy of this + */ + std::shared_ptr Copy() const; + + /** + * @brief Copies this to a `std::map` + * @returns a copy of this, as a `std::map` + */ + std::map> AsMapCopy() const; + + /** + * @brief Checks if the EventData contains the given key + * @returns true iff the EventData contains the given key + */ + bool ContainsKey(const std::string& key); + + /** + * @brief Checks if the EventData contains no keys + * @returns true iff there EventData contains no keys + */ + bool IsEmpty() const; + + /** + * @brief Gets the number of key-value pairs in this + * @returns the number of key-value pairs in this + */ + size_t Size() const; + + /** + * @brief Gets the kind of value for a given key + * @returns the kind of value that the specific key of EventData holds. EVENT_DATA_NO_SUCH_KEY if no such key. + */ + Expected GetKind(const std::string& key) const; + + /** + * @brief Sets the value for key to a copy of the given string. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromString(value)); + * + * @returns `*this` + */ + EventData& PutString(const std::string& key, const std::string& value); + + /** + * @brief Sets the value for key to the given `int32_t`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromInteger(value)); + * + * @returns `*this` + */ + EventData& PutInteger(const std::string& key, int32_t value); + + /** + * @brief Sets the value for key to the given `int64_t`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromLong(value)); + * + * @returns `*this` + */ + EventData& PutLong(const std::string& key, int64_t value); + + /** + * @brief Sets the value for key to the given `double`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromDouble(value)); + * + * @returns `*this` + */ + EventData& PutDouble(const std::string& key, double value); + + /** + * @brief Sets the value for key to the given `bool`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromBoolean(value)); + * + * @returns `*this` + */ + EventData& PutBoolean(const std::string& key, bool value); + + /** + * @brief Sets the value for key to the given variant. + * + * @returns `*this` + */ + EventData& PutVariant(const std::string& key, const std::shared_ptr& value); + + /** + * @brief Sets the value for key to a copy of the given vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromVariantVector(value)); + * + * @returns `*this` + */ + EventData& PutVariantVector(const std::string& key, const std::vector>& value); + + /** + * @brief Sets the value for key to a copy of the given string map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromStringMap(value)); + * + * @returns `*this` + */ + EventData& PutStringMap(const std::string& key, const std::map& value); + + /** + * @brief Sets the value for key to a copy of the given map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromVariantMap(value)); + * + * @returns `*this` + */ + EventData& PutVariantMap(const std::string& key, const std::map>& value); + + /** + * @brief Sets the value for key to a serialization of the given object to a variant. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedObject(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedObject(const std::string& key, const TObject* value); + + /** + * @brief Sets the value for key to a serialization of the given object to a variant. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedObject(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedObject(const std::string& key, const TObject* value, + const std::shared_ptr>& s); + + /** + * @brief Sets the value for key to a serialization of the given vector to a variant vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedVector(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedVector(const std::string& key, std::vector> value); + + /** + * @brief Sets the value for key to a serialization of the given vector to a variant vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedVector(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedVector(const std::string& key, std::vector> value, + const std::shared_ptr>& s); + + /** + * @brief Sets the value for key to a serialization of the given map to a variant map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedMap(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedMap(const std::string& key, std::map> value); + + /** + * @brief Sets the value for key to a serialization of the given map to a variant map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedMap(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedMap(const std::string& key, std::map> value, + const std::shared_ptr>& s); + + /** + * @brief Assigns `value` to a copy of the string value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetString(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a string + */ + bool GetString(const std::string& key, std::string& value) const; + + /** + * @brief Assigns `value` to the `int32_t` value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetInteger(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to an `int32_t` + */ + bool GetInteger(const std::string& key, int32_t& value) const; + + /** + * @brief Assigns `value` to the `int64_t` value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetLong(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to an `int64_t` + */ + bool GetLong(const std::string& key, int64_t& value) const; + + /** + * @brief Assigns `value` to the double value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetDouble(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `double` + */ + bool GetDouble(const std::string& key, double& value) const; + + /** + * @brief Assigns `value` to the boolean value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetBoolean(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `bool` + */ + bool GetBoolean(const std::string& key, bool& value) const; + + /** + * @brief Assigns `value` to the value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetBoolean(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present + */ + bool GetVariant(const std::string& key, std::shared_ptr& value) const; + + /** + * @brief Assigns `value` to the vector value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetVariantVector(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `vector` + */ + bool GetVariantVector(const std::string& key, std::vector>& value) const; + + /** + * @brief Assigns `value` to the string map value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetStringMap(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `vector` + */ + bool GetStringMap(const std::string& key, std::map& value) const; + + /** + * @brief Assigns `value` to a copy of the variant map associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetVariantMap(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a variant map + */ + bool GetVariantMap(const std::string& key, std::map>& value) const; + + /** + * @brief Assigns `value` to an object deserialization of the variant associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedObject(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected> GetTypedObject(const std::string& key) const; + + /** + * @brief Assigns `value` to an object deserialization of the variant associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedObject(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected> GetTypedObject(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Assigns `value` to an object vector deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedVector(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedVector(const std::string& key) const; + + + /** + * @brief Assigns `value` to an object vector deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedVector(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedVector(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Assigns `value` to an object map deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedMap(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedMap(const std::string& key) const; + + /** + * @brief Assigns `value` to an object map deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedMap(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedMap(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Gets the string value associated with the given key, or a default + * + * Equivalent to: + * + * std::string v; + * if (this->GetString(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a string if the key was present and convertible to a string, otherwise `fallback` + */ + std::string OptString(const std::string& key, const std::string& fallback); + + /** + * @brief Gets the `int32_t` value associated with the given key, or a default + * + * Equivalent to: + * + * int32_t v; + * if (this->GetInteger(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as an `int32_t` if the key was present and convertible to an `int32_t`, otherwise `fallback` + */ + int32_t OptInteger(const std::string& key, int32_t fallback); + + /** + * @brief Gets the `int64_t` value associated with the given key, or a default + * + * Equivalent to: + * + * int64_t v; + * if (this->GetLong(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as an `int64_t` if the key was present and convertible to an `int64_t`, otherwise `fallback` + */ + int64_t OptLong(const std::string& key, int64_t fallback); + + /** + * @brief Gets the `double` value associated with the given key, or a default + * + * Equivalent to: + * + * double v; + * if (this->GetDouble(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a `double` if the key was present and convertible to a `double`, otherwise `fallback` + */ + double OptDouble(const std::string& key, double fallback); + + /** + * @brief Gets the `bool` value associated with the given key, or a default + * + * Equivalent to: + * + * bool v; + * if (this->GetBoolean(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a `bool` if the key was present and convertible to a `bool`, otherwise `fallback` + */ + bool OptBoolean(const std::string& key, bool fallback); + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + std::map> internal_map_; ///< @private the internal map representation + }; + + namespace ErrorCodes { + constexpr static const char* EVENT_DATA_NO_SUCH_KEY = "event_data.no_such_key"; ///< no such key exists in the EventData + } + + template + EventData& EventData::PutTypedObject(const std::string& key, const TObject* value) { + return PutVariant(key, Variant::FromTypedObject(value)); + } + + template + EventData& EventData::PutTypedObject(const std::string& key, const TObject* value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedObject(value, s)); + } + + template + EventData& EventData::PutTypedVector(const std::string& key, std::vector> value) { + return PutVariant(key, Variant::FromTypedVector(value)); + } +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + EventData& EventData::PutTypedVector(const std::string& key, std::vector> value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedVector(value, s)); + } + + template + EventData& EventData::PutTypedMap(const std::string& key, std::map> value) { + return PutVariant(key, Variant::FromTypedMap(value)); + } + + template + EventData& EventData::PutTypedMap(const std::string& key, std::map> value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedMap(value, s)); + } + + template + Expected> EventData::GetTypedObject(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedObject(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected> EventData::GetTypedObject(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedObject(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedVector(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedVector(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedVector(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedVector(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedMap(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedMap(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedMap(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedMap(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } +} + +#endif //ADOBEMOBILE_CORE_EVENTDATA_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h new file mode 100755 index 00000000..1530486f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h @@ -0,0 +1,122 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H +#define ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H + +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class FlatDictionaryInterface; + class EventData; + class Variant; + + class EventDataFlattener : public Object { + + public: + + /** + * Construct an instance of EventDataFlattener + * + * @param event_data The EventData to flatten + */ + EventDataFlattener(const std::shared_ptr& event_data); + + /** + * Returns a `Map` which has been flattened in the following way: + * + * The Keys are of the format "eventdataKey"."nestedMapKeyOrFlatDictionaryKey".... + * So For example, an event data in the following format: + * + * [mapKey][key1]=value1 + * [mapKey][key2]=value2 + * + * will be flattened to + * + * [mapKey.key1]=value1 + * [mapKey.key1]=value2 + * + * @return flattened values as `std::map>` + */ + std::map> GetFlattenedDataMap() const; + + private: + + /** + * @private + * Inserts the value into a Map by flattening the value if needed. + * + * If the value is a Map it will be flattened (the namespaced key will be prefixed to the nested keys). + * If the value is a {@link FlatDictionary}, the result of {@link FlatDictionary::GetFlatDictionary()} + * will be inserted (the namespaced key will be prefixed to the keys). + * Else, the value will be inserted as is with the key being the {@code namespaced key} + * + * @param nameSpacedKey The key (which has been appropriately namespaced) that will be used as the key for the + * value inserted. + * If the value is further flattened for inserting into the returned map, then the key will + * be used as the + * prefix for the keys in the flattened representation. + * @param value The Object that will be inserted into the map after flattening (if needed) + * @param out The flattened map result. + */ + void Flatten(const std::string& namespaced_key, const std::shared_ptr& value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the map_value. It is done by recursively calling + * {@link ::Flatten(std::string, std::shared_ptr)} + * + * @param key_prefix The string that will be prefixed to the map keys. + * @param map_value The map that will be flattened. + * @param out The flattened map result. + */ + void Flatten(const std::string& key_prefix, const std::map>& map_value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the map_value. + * + * @param key_prefix The string that will be prefixed to the map keys. + * @param map_value The map to be flattened. + * @param out the flattended map result. + */ + void Flatten(const std::string& key_prefix, const std::map& map_value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the flat_dictionary. + * + * @param key_prefix The string that will be prefixed to the {@code flat_dictionary} keys. + * @param flat_dictionary The {@link FlatDictionary} instance, that will be inserted (after prefixing the {@code + * key_prefix}) + * @out The flattened map result. + */ + void Flatten(const std::string& key_prefix, const std::shared_ptr& flat_dictionary, + std::map>& out) const; + + std::map> data_; // the data to flatten + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventHub.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventHub.h new file mode 100755 index 00000000..23037e17 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventHub.h @@ -0,0 +1,524 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTHUB_H +#define ADOBEMOBILE_CORE_EVENTHUB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Object.h" +#include "Event.h" +#include "TaskExecutor.h" + +namespace AdobeMarketingMobile { + class Rule; + class Module; + class ModuleEventListenerBase; + class ModuleEventProcessorBase; + class PlatformServicesInterface; + class TaskExecutor; + class EventHubData; + enum class EventHubState : int32_t; + class ExternalModuleInterface; + + // declaration of global shared state variables + extern const std::shared_ptr + SHARED_STATE_PENDING; ///< state that is "on the way" and will eventually be resolved. + extern const std::shared_ptr + SHARED_STATE_PREV; ///< special "marker" state that indicates that this state is equal to the previous state. + extern const std::shared_ptr + SHARED_STATE_NEXT; ///< special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + extern const std::shared_ptr + SHARED_STATE_INVALID; ///< special state that indicates that the state is not valid. + + /** + * @class EventHub + * + * Core event loop for SDK activity. The EventHub manages module lifetime, dispatches events, dispatches + * callbacks, and manages the necessary threading. + * + * Starting an EventHub + * ==================== + * EventHub::Create() can be used to create and start the event hub. + * After calling RegisterModule for all modules, EventHub::FinishModuleRegistration() + * should be called to complete the startup process. This method will dispatch a HUB BOOTED event. + * + * Stopping an EventHub + * ==================== + * EventHub::Dispose() should be called to clean up after an event hub. Disposal will occur asynchronously. + * EventHub::IsFullyDisposed() can be polled to determine whether the EventHub disposal is complete. The + * destructor of EventHub will also initiate a Dispose(). + * + * Failure to dispose of an EventHub will result in resource leaks. + * + * Registering and Unregistering Modules + * ===================================== + * EventHub::RegisterModule() can be called to register modules with an EventHub. @see Module + * + * Module::UnregisterModule() can be called to unregister modules. @see Module + * + * Threading + * ========= + * All public EventHub or Module methods can be safely invoked from any thread. + * + * For a given module, the OnRegistered and OnUnregistered callbacks of a module and its processors, + * listeners, and dispatchers, as well as ModuleEventProcessor::Process and ModuleEventListener::Hear can often + * be treated as if they operated on a single thread. These methods will never get invoked concurrently for + * a given module. + * + * This allows most modules to be written without the use of synchronization primitives. + * + * An additional consideration for implementers is that callbacks should not perform long-running operations, + * as these may block the system as a whole. + * + * Threading in Detail + * =================== + * This section covers the current implementation, which may change in the future, but may be informative for + * module implementers. + * + * Upon creation, the EventHub starts a background thread (known as the EventHub thread). + * + * Some EventHub and Module methods require callbacks to be invoked. For example, Module::RegisterListener must + * invoke the callback ModuleEventListener::OnRegistered after registration completes. In these cases, callbacks are + * added to a callback queue. For example, after performing registration Module::RegisterListener will add + * ModuleEventListener::OnRegistered to the callback queue. The EventHub thread monitors the callback queue. + * When new callbacks are added to the queue, the EventHub thread empties the callback queue and executes the + * callbacks synchronously on the background thread. + * + * Similarly, when Dispatch(event) is called, an event is placed on an event queue. After processing any callbacks, + * the EventHub thread removes next event from the event queue then: + * - Invokes any registered processors. Processors are invoked in no particular order and are invoked + * synchronously, in-series. + * - Invoke registered listeners in parallel. Asynchronous jobs are started for each listener. Before + * moving on to the next event or callback, the EventHub waits for the asynchronous jobs to complete. + * + * Finally, upon disposal, all modules (and their child listeners, dispatchers, and processors) are unregistered + * and thread is terminated. + */ + class EventHub : public Object { + friend class Module; + friend class RuleTokenParser; + friend class EventHubMethods; // For testing + + public: + + /** + * Creates and returns a new EventHub. + * + * When the EventHub is no longer needed, EventHub::Dispose() must be called to free up resources used by the EventHub. + * + * @param name - the name of the EventHub to be created - for logging purposes + * @param platform_services - instance of PlatformServices class to provide platform-specific functionality + */ + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& platform_services); + + /** + * This method should be called after all modules are registered. + * This will trigger the dispatch of a booted event. + */ + virtual void FinishModulesRegistration() = 0; + + /** + * Dispatches an event onto the event queue. + * + * Most modules should not call this method directly and should instead define a + * subclass of ModuleEventDispatcher. + * + * @param event - the event to be added to the queue + * @see ModuleEventDispatcher + */ + virtual void Dispatch(const std::shared_ptr& event) = 0; + + /** + * Creates and registers a module of the specified type. + * + * TModule must a subclass of Module. + * + * Example: + * + * class MyModule : public Module { ... }; + * + * void RegisterMyModule(const std::shared_ptr& event_hub) { + * event_hub->RegisterModule(); + * } + */ + template + void RegisterModule(); + + /** + * Creates and registers an ExternalModule + * + * Example: + * + * std::shared_ptr& mod; // created by the Core + * RegisterExternalModule(mod); + */ + virtual void RegisterExternalModule(const std::shared_ptr& external_module) = 0; + + /** + * Check whether the name matches a module in the currently active modules list. + */ + virtual bool IsRegisteredModule(const std::string& name) = 0; + + /** + * Registers a one-time listener to modules of the specified type. + * + * TModule must be a subclass of Module. + * + * Example: + * + * class MyModule : public Module { ... }; + * + * void RegisterOneTimeListenerToMyModule(const std::shared_ptr& event_hub + * EventType event_type, EventSource event_source, const std::string& pair_id, + * const std::function&)>& listener_block) { + * event_hub->RegisterOneTimeListener(event_type, event_source, pair_id, listener_block); + * } + * + * @param event_type - the EventType of an event to listen for + * @param event_source - the EventSource of an event to listen for + * @param pair_id - pairID to listen for + * @param listener_block - the block to call when the event is heard + */ + template + void RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block); + + template + void RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::function&)>& listener_block); + + /** + * Calls Dispose with a reasonable default wait time. + */ + virtual bool Dispose() = 0; + + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * After calling Dispose(), most EventHub methods will have no effect. + * + * Calling Dispose() first triggers clean up to occur asynchronously. A number of actions will occur: + * - Events will stop firing, but a few events may still fire after Dispose() is called due to race conditions. + * - Modules, listeners, processors, and dispatchers will be unregistered. + * - Threads and other resources used by the EventHub will be terminated. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @see IsFullyDisposed() + * + * @return true if the event hub is fully disposed (background thread shut down, + * and all modules unregistered in background thread). + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + protected: + EventHub() {} + + /** + * @private + * + * Calls Module::OnEventHubRegisteredModule() + */ + static void CallModuleOnEventHubRegisteredModule(const std::shared_ptr& module, + const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services, + const std::shared_ptr& task_executor); + + /** + * @private + * + * Calls Module::Idle() + */ + static void CallModuleIdle(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::ProcessEvent() + */ + static bool CallModuleProcessEvent(const std::shared_ptr& module, + const std::shared_ptr& event, + std::shared_ptr& processed_event); + + /** + * @private + * + * Calls Module::NotifyListeners() + */ + static void CallModuleNotifyListeners(const std::shared_ptr& module, + const std::shared_ptr& event); + + /** + * @private + * + * Calls Module::GetSharedStateName(); + */ + static std::string CallModuleGetSharedStateName(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::UnregisterModule(); + */ + static void CallModuleUnregisterModule(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::RegisterOneTimeListenerBlock(); + */ + static void CallModuleRegisterOneTimeListener(const std::shared_ptr& module, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block); + + private: + /** + * @private + * + * Register a module after creation. Intended for use by RegisterModule(...). + */ + virtual void RegisterModule(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Register a rule for a given module. Intended for use by RegisterRule(...). + */ + virtual void RegisterRule(const std::shared_ptr& module, const std::shared_ptr& rule) = 0; + + /** + * @private + * + * Unregisters all rules for a given module, Intended for use by UnregisterRules(...). + */ + virtual void UnregisterAllRules(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Perform book-keeping after a Module is unregistered. Intended for use by Module. + */ + virtual void OnModuleUnregistered(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Register a one-time listener to the module who's type id matches the given hash. + * Intented to be called by RegisterOneTimeListener(...). + */ + virtual void RegisterOneTimeListener(const size_t module_type_hash, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block) = 0; + + /** + * @private + * + * Creates a shared state object for the given module versioned at the current event for this hub. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param version int32_t containing the version that this shared state should be begin to be valid for + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * Updates an existing EventHub::PENDING shared state for the given module and version + * + * Only for use by Module. + * + * @param module Module to update the shared state for + * @param version int32_t version version of the existing shared state to replace + * @param state new state to replace with existing state. Must be data, EventHub::PENDING, EventHub::INVALID, + * EventHub::NEXT, or EventHub::PREV. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void UpdateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * + * Creates or updates a shared state object for the given module and version. + * If no shared state exists for the module at the given version, then one is created with the given state. + * If a shared state already exists for the module at the given version and the state + * is EventHub::PENDING, then the state is updated with the given state. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param version int32_t version version of the existing shared state to add or replace + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID + * when creating or data, EventHub::PENDING, EventHub::INVALID, EventHub::NEXT, or EventHub::PREV when updating + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateOrUpdateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * + * Creates a shared state object for the given module at the next event number for this hub. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateOrUpdateSharedState(const std::shared_ptr& module, + const std::shared_ptr& state) = 0; + + /** + * @private + * Clears all the shared states for the given module. + * + * Only for use by Module. + * + * @param module Module to clear the shared states for + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void ClearSharedStates(const std::shared_ptr& module) = 0; + + /** + * @private + * Retrieves shared state by name that is valid for the given event + * + * Only for use by Module. + * + * @param state_name String identifier for the module that shared the state + * @param event Event to retrieve state for + * @param calling_module the module calling this method + * + * @return EventData object containing the valid state, EventHub::PENDING, or EventHub::INVALID + * @throws ErrorCodes::INVALID_ARGUMENT if given event is nullptr + **/ + virtual std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event, + const std::shared_ptr& calling_module) = 0; + + /** + * @private + * Determine if there are any shared states for the specified module. + * A module is considered to have a valid shared state if any state is data or EventHub::PENDING. + * States EventHub::INVALID, EventHub::NEXT, and EventHub::PREV are not considered valid. + * + * Only for use by Module. + * + * @param state_name String identifier for the module that shared the state + * @return true if the specified module has shared a valid state + */ + virtual bool HasSharedEventState(const std::string& state_name) = 0; + + /** + * @private + * + * Requests that Idle() be called soon. Intended for use by Module. + * + * This method may be called from any thread. + */ + virtual void RequestIdle() = 0; + + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + void EventHub::RegisterModule() { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterModule is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + // module registration is spread across multiple functions and threads + // to find all the steps, search for "module registration step" + + // module registration step 1: construct the module + auto module = std::make_shared(); + + // module registration step 2: pass it to the non-templated RegisterModule + RegisterModule(module); + } + + template + void EventHub::RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, const std::string& pair_id, + const std::function&)>& listener_block) { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterOneTimeListener is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + size_t type_hash = typeid(TModule).hash_code(); + + RegisterOneTimeListener(type_hash, event_type, event_source, pair_id, listener_block); + } + + template + void EventHub::RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::function&)>& listener_block) { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterOneTimeListener is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + size_t type_hash = typeid(TModule).hash_code(); + + RegisterOneTimeListener(type_hash, event_type, event_source, "", listener_block); + } +} + +#endif //ADOBEMOBILE_CORE_EVENTHUB_H + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventSource.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventSource.h new file mode 100755 index 00000000..dfa0194d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventSource.h @@ -0,0 +1,81 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTSOURCE_H +#define ADOBEMOBILE_CORE_EVENTSOURCE_H + +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * EventSource encapsulates the source of an Event. + */ + class EventSource : public Object { + public: + static const std::shared_ptr NONE; + static const std::shared_ptr OS; + static const std::shared_ptr REQUEST_CONTENT; + static const std::shared_ptr REQUEST_IDENTITY; + static const std::shared_ptr REQUEST_PROFILE; + static const std::shared_ptr REQUEST_RESET; + static const std::shared_ptr RESPONSE_CONTENT; + static const std::shared_ptr RESPONSE_IDENTITY; + static const std::shared_ptr RESPONSE_PROFILE; + static const std::shared_ptr SHARED_STATE; + static const std::shared_ptr BOOTED; + static const std::shared_ptr WILDCARD; + + /* + * @return Return prefix used for all Adobe event types + */ + static std::string GetAdobePrefix(); + + /* + * @brief Return source if found in known sources, otherwise add new source to the map and return. + * @param source_name the name of the EventSource to return + * @return an EventSource from the known_sources_ table + */ + static std::shared_ptr Get(const std::string& source_name); + + /** + * @returns a string representation of this + */ + const std::string& GetName(); + + protected: + explicit EventSource(const std::string& source_name); + + private: + std::string name_; ///< underlying string holding the name of the EventSource + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& value, const ToStringOptions& options); + +} + +#endif //ADOBEMOBILE_CORE_EVENTSOURCE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventType.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventType.h new file mode 100755 index 00000000..afec74e6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/EventType.h @@ -0,0 +1,85 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTTYPE_H +#define ADOBEMOBILE_CORE_EVENTTYPE_H + +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * EventType encapsulates the source of an Event. + */ + class EventType : public Object { + public: + static const std::shared_ptr ACQUISITION; + static const std::shared_ptr ANALYTICS; + static const std::shared_ptr AUDIENCE_MANAGER; + static const std::shared_ptr CONFIGURATION; + static const std::shared_ptr CUSTOM; + static const std::shared_ptr HUB; + static const std::shared_ptr IDENTITY; + static const std::shared_ptr LIFECYCLE; + static const std::shared_ptr LOCATION; + static const std::shared_ptr PII; + static const std::shared_ptr PLACES; + static const std::shared_ptr RULES_ENGINE; + static const std::shared_ptr SIGNAL; + static const std::shared_ptr SYSTEM; + static const std::shared_ptr TARGET; + static const std::shared_ptr USER_PROFILE; + static const std::shared_ptr WILDCARD; + + /* + * @return Return prefix used for all Adobe event types + */ + static std::string GetAdobePrefix(); + + /* + * @brief Return type if found in known types, otherwise add new type to the map and return. + * @param type_name the name of the EventType to return + * @return an EventType from the known_types_ table + */ + static std::shared_ptr Get(const std::string& type_name); + + /** + * @returns a string representation of this + */ + const std::string& GetName(); + + protected: + explicit EventType(const std::string& type_name); + + private: + std::string name_; ///< @private underlying string holding the name of the EventSource + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& value, const ToStringOptions& options); +} + +#endif //ADOBEMOBILE_CORE_EVENTTYPE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Expected.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Expected.h new file mode 100755 index 00000000..7da56d04 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Expected.h @@ -0,0 +1,215 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_EXPECTED_H +#define ADOBEMOBILE_UTIL_EXPECTED_H + +#include +#include "Object.h" +#include "SdkError.h" + +namespace AdobeMarketingMobile { + + /** + * Expected<> is a template class that can contain either a Value type or an Error type which defaults to SdkError. + * The name is taken from a talk by Andrei Alexandrescu here: + * https://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C + * although the implementation is very different. This can be used to avoid having to throw exceptions or have out + * params in many situations. This class also avoids the extra allocation overhead of using std::shared_ptr while + * providing for a richer error. + * + * Notes about usage: + * * Value type (V) cannot be the same as the Error type (E) + * * std::exception (and derived classes) may not work for Error type (E) without further work + * + * EXAMPLE USAGE: + * + * Expected> GetFile(const std::string& url); + * ... + * if (auto result = GetFile(url)) { + * auto file = result.Value(); // type is const std::shared_ptr& + * ... + * } + * else { + * auto error = result.Error(); // type is const SdkError& + * ... + * } + * + */ + template + class Expected { + public: + Expected() = default; + + Expected(const V& value) : initialized_(true), has_value_(true) { + new (&data_) V(value); + } + + Expected(const E& error) : initialized_(true), has_value_(false) { + new (&data_) E(error); + } + + Expected(const Expected& exp) : initialized_(exp.initialized_), has_value_(exp.has_value_) { + if (has_value_) { + new (&data_) V(exp.ConstValue()); + } else if (initialized_) { + new (&data_) E(exp.Error()); + } + } + + Expected& operator=(const Expected& exp) { + Expected temp(exp); + initialized_ = std::move(temp.initialized_); + has_value_ = std::move(temp.has_value_); + data_ = std::move(temp.data_); + temp.initialized_ = false; // Ensure temp destruction does NOT call Value or Error destructors + return *this; + } + + ~Expected() { + if (initialized_) { + if (has_value_) { + V* value = reinterpret_cast(&data_); + value->~V(); + } else { + E* error = reinterpret_cast(&data_); + error->~E(); + } + } + } + + explicit operator bool() const { + return has_value_; + } + + bool operator!() const { + return !has_value_; + } + + V& Value() { + if (!initialized_ || !has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Value type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + const V& ConstValue() const { + if (!initialized_ || !has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Value type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + const E& Error() const { + if (!initialized_ || has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Error type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + private: + static constexpr const std::size_t DATA_SIZE{ sizeof(V) > sizeof(E) ? sizeof(V) : sizeof(E) }; + static constexpr const std::size_t DATA_ALIGNMENT{ alignof(V) > alignof(E) ? alignof(V) : alignof(E) }; + typename std::aligned_storage::type data_; + bool initialized_ = false; + bool has_value_ = false; + }; + + /** + * Expected is a template class that can contain only an SdkError type. There is no Value. + * + * EXAMPLE USAGE: + * + * Expected GetFile(const std::string& url) { + * if(success) { return {}; } + * else { return { SdkError("bad news") }; } + * } + * ... + * if (auto result = GetFile(url)) { + * ... + * } + * else { + * auto error = result.Error(); // type is const SdkError& + * ... + * } + * + */ + template <> + class Expected { + public: + Expected() : initialized_(true), has_value_(true) { + } + + Expected(const SdkError& error) : initialized_(true), has_value_(false) { + new (&data_) SdkError(error); + } + + Expected(const Expected& exp) : initialized_(exp.initialized_), has_value_(exp.has_value_) { + if (initialized_ && !has_value_) { + new (&data_) SdkError(exp.Error()); + } + } + + Expected& operator=(const Expected& exp) { + Expected temp(exp); + initialized_ = std::move(temp.initialized_); + has_value_ = std::move(temp.has_value_); + data_ = std::move(temp.data_); + temp.initialized_ = false; // Ensure temp destruction does NOT call Value or Error destructors + return *this; + } + + ~Expected() { + if (initialized_) { + if (!has_value_) { + SdkError* error = reinterpret_cast(&data_); + error->~SdkError(); + } + } + } + + explicit operator bool() const { + return has_value_; + } + + bool operator!() const { + return !has_value_; + } + + const SdkError& Error() const { + if (!initialized_ || has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Error type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + private: + static constexpr const std::size_t DATA_SIZE{ sizeof(SdkError) }; + static constexpr const std::size_t DATA_ALIGNMENT{ alignof(SdkError) }; + typename std::aligned_storage::type data_; + bool initialized_ = false; + bool has_value_ = false; + }; + +} /* end of namespace AdobeMarketingMobile */ + +#endif /*ADOBEMOBILE_UTIL_EXPECTED_H*/ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h new file mode 100755 index 00000000..1aa2312c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h @@ -0,0 +1,124 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_H +#define ADOBEMOBILE_EXTERNALMODULE_H + +#include +#include + +#include "Common.h" +#include "InternalModule.h" +#include "ExternalModuleInterface.h" + +namespace AdobeMarketingMobile { + class Event; + class ExternalModuleServicesImpl; + class ExternalModuleListenerInterface; + class ExternalModuleProcessorInterface; + class ExternalModuleDispatcher; + + class ExternalModule : public InternalModule { + public: + ExternalModule(); + + explicit ExternalModule(const std::string& log_prefix, const std::shared_ptr& interface); + + std::string GetLogPrefix() { + return log_prefix_; + } + + ADOBE_VIRTUAL_FOR_TESTS std::string GetSharedStateName() override; + + ADOBE_VIRTUAL_FOR_TESTS void HandleUnexpectedError(SdkError& e); + + /* + * Interface methods called by the ExternalModuleServicesImpl + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_RegisterListener(const std::shared_ptr& + event_listener, + const std::string& event_type, + const std::string& event_source); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_RegisterProcessor(const std::shared_ptr& + event_processor); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_DispatchEvent(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_SetSharedEventState(const std::string& state, + const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_ClearSharedEventStates(); + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr ExternalServices_GetSharedEventState(const std::string& name, + const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_UnregisterModule(); + + /* + * Interface methods called by the ExternalModuleListener + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_OnRegistered(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_Hear(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_OnUnregistered(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + /* + * Interface methods called by the ExternalModuleProcessor + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalProcessor_OnRegistered(); + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr ExternalProcessor_Process(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalProcessor_OnUnregistered(); + + protected: + ADOBE_VIRTUAL_FOR_TESTS void OnRegistered() override; + ADOBE_VIRTUAL_FOR_TESTS void OnUnregistered() override; + + private: + std::shared_ptr GetDispatcher(); + + std::shared_ptr FindListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + std::shared_ptr GetProcessor(); + + // Prefix for all logging messages + std::string log_prefix_; + + // Used for locking access to the private members + std::mutex mutex_; + + // The internal module uses this to call the external module + std::shared_ptr interface_; + + // The external module uses this to call the internal module + std::shared_ptr services_; + + // The internal module uses this to dispatch events from the external module + std::shared_ptr dispatcher_; + + // The internal module uses this to call the external listeners + typedef std::pair, std::shared_ptr> ListenerKey; + std::map> listeners_; + + // The internal module uses this to call the external processor + std::shared_ptr processor_; + }; + +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h new file mode 100755 index 00000000..00b7cd2e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h @@ -0,0 +1,58 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H + +/** + * @brief This header contains shared methods used for bridging module code between C++ and Obj-C. + * + */ +namespace AdobeMarketingMobile { + + class Event; + class JsonUtilityServiceInterface; + + /* + * @brief This is a list of the errors returned to external modules from the core code. + */ + namespace ErrorCodes { + constexpr static const char* EXT_MODULE_UNEXPECTED_ERROR = "external_module.unexpected"; + constexpr static const char* EXT_MODULE_BAD_NAME = "external_module.bad_module_name"; + constexpr static const char* EXT_MODULE_DUP_NAME = "external_module.dup_module_name"; + constexpr static const char* EXT_MODULE_EVENT_TYPE_NOT_SUPPORTED = "external_module.event_type_not_supported"; + constexpr static const char* EXT_MODULE_EVENT_SOURCE_NOT_SUPPORTED = "external_module.event_source_not_supported"; + constexpr static const char* EXT_MODULE_EVENT_DATA_NOT_SUPPORTED = "external_module.event_data_not_supported"; + } + + std::shared_ptr CreateBroadcastEvent(const std::shared_ptr json_utility_service, + const std::string& event_name, + const std::string& event_type, + const std::string& event_source, + const std::string& event_data); + + std::string GetEventTypeAsString(const std::shared_ptr& event); + + std::string GetEventSourceAsString(const std::shared_ptr& event); + + std::string GetEventDataAsString(const std::shared_ptr& event, + const std::shared_ptr json_utility_service); + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h new file mode 100755 index 00000000..0303792c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h @@ -0,0 +1,46 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H + +#include "ExternalModule.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + + class Event; + + /** + * @class ExternalModuleDispatcher + * Event dispatcher for all events from the ExternalModule module. + * + */ + class ExternalModuleDispatcher : public ModuleEventDispatcher { + + public: + /** + * Dispatches a externally generated event onto the EventHub + * @param event The event to dispatch + * + */ + virtual void Dispatch(const std::shared_ptr& event); + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h new file mode 100755 index 00000000..825fe5c5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H + +#include "Object.h" +#include "ExternalModuleServicesInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Interface providing access to ADBModule for the event hub. + * + */ + class ExternalModuleInterface : public virtual ObjectInterface { + public: + virtual std::string GetModuleName() = 0; + virtual std::string GetModuleVersion() = 0; + virtual void OnRegister(const std::shared_ptr& services) = 0; + virtual void OnUnexpectedError(SdkError& e) = 0; + virtual void OnUnregister() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h new file mode 100755 index 00000000..614e8f4e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H + +#include "ModuleEventListener.h" +#include "ExternalModule.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + /** + * @class ExternalModuleListener + * Listener registered by an external module for various event types and sources + */ + class ExternalModuleListener : public ModuleEventListener { + public: + void Hear(const std::shared_ptr& event) override; + protected: + void OnRegistered() override; + void OnUnregistered() override; + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h new file mode 100755 index 00000000..3d95d7a9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H + +#include "Object.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Wrapper used to call the ADBModuleListenerInterface provided by the external module + * + */ + class ExternalModuleListenerInterface : public virtual ObjectInterface { + public: + virtual void OnRegistered() = 0; + virtual void Hear(const std::shared_ptr& event) = 0; + virtual void OnUnregistered() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h new file mode 100755 index 00000000..9011eab0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H + +#include "ModuleEventProcessor.h" +#include "ExternalModule.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + /** + * @class ExternalModuleProcessor + * Listener registered by an external module for various event types and sources + */ + class ExternalModuleProcessor : public ModuleEventProcessor { + public: + std::shared_ptr Process(const std::shared_ptr& event) override; + protected: + void OnRegistered() override; + void OnUnregistered() override; + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H */ + + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h new file mode 100755 index 00000000..5836b8f0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H + +#include "Object.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Wrapper used to call the ADBModuleProcessorInterface provided by the external module + * + */ + class ExternalModuleProcessorInterface : public virtual ObjectInterface { + public: + virtual void OnRegistered() = 0; + virtual std::shared_ptr Process(const std::shared_ptr& event) = 0; + virtual void OnUnregistered() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h new file mode 100755 index 00000000..06a9bc01 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h @@ -0,0 +1,58 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULESERVICES_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULESERVICES_H + +#include "Object.h" +#include "Event.h" +#include "SdkError.h" +#include "ExternalModuleListenerInterface.h" +#include "ExternalModuleProcessorInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Interface providing access to event hub for the ADBModule. + * + */ + class ExternalModuleServicesInterface : public virtual ObjectInterface { + public: + virtual void RegisterListener(const std::shared_ptr& event_listener, + const std::string& event_type, + const std::string& event_source) = 0; + + virtual void RegisterProcessor(const std::shared_ptr& event_processor) = 0; + + virtual void DispatchEvent(const std::shared_ptr& event) = 0; + + virtual void SetSharedEventState(const std::string& state, + const std::shared_ptr& event) = 0; + + virtual void ClearSharedEventStates() = 0; + + virtual std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event) = 0; + + virtual void UnregisterModule() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULESERVICES_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h new file mode 100755 index 00000000..d09c21c6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h @@ -0,0 +1,219 @@ +/* ************************************************************************ +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2017 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains +* the property of Adobe Systems Incorporated and its suppliers, +* if any. The intellectual and technical concepts contained +* herein are proprietary to Adobe Systems Incorporated and its +* suppliers and are protected by trade secret or copyright law. +* Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained +* from Adobe Systems Incorporated. +**************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H + +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A filesystem error occurred. + */ + constexpr static const char* FILESYSTEM_ERROR = "filesystem"; + } + + class FileHandlerInterface : public virtual ObjectInterface { + public: + /** + * Return the size of the file pointed to, if it exists. + * This is a synchronous call. + * + * @return size of file if exists, -1 otherwise. + */ + virtual int64_t Size() = 0; + + /** + * Return the last-modified date of the file pointed to, if it exists. + * This is a synchronous call. + * + * @return `time_point` representing last-modified date of file if exists, otherwise `time_point` containing 0. + */ + virtual std::chrono::time_point LastModified() = 0; + + /** + * Open the file referenced for reading only. + * This is a synchronous call. + * + * @return true if file was opened, false otherwise + */ + virtual bool OpenForReading() = 0; + + /** + * Open the file reference for writing. Creates if needed, and truncates existing file at this path. + * This is a synchronous call. + * + * @return true if file was opened, false otherwise + */ + virtual bool OpenForWriting() = 0; + + /** + * Move the read/write head for file to the offset. The offset passed must be less than reported Size(). + * This is a synchronous call. + * + * @param file_offset the offset from the beginning of the file + * @return true if file read/write head was moved, false if an error occurred + */ + virtual bool MoveToOffset(uint64_t file_offset) = 0; + + /** + * Write some data to the file. The file must have been opened for writing first, or no bytes will be read. + * This is a synchronous call. + * + * @param bytes_to_write the number of bytes to write to the file + * @param write_buffer the buffer to write to the file + * @return the number of bytes written to the file + */ + virtual uint32_t Write(uint32_t bytes_to_write, uint8_t* write_buffer) = 0; + + /** + * Read some data from the file. The file must have been opened for reading first, or no bytes will be read. + * This is a synchronous call. + * + * @param bytes_to_read the number of bytes to read from the file + * @param read_buffer the buffer to read into + * @return the number of bytes read from the file + */ + virtual uint32_t Read(uint32_t bytes_to_read, uint8_t* read_buffer) = 0; + + /** + * Close the file. After this call, no more reading or writing is allowed unless the file is opened again. + * This is a synchronous call. + * + * @return true if file was closed, false if an error occurred + */ + virtual bool Close() = 0; + }; + + class FileSystemServiceInterface : public virtual ObjectInterface { + public: + /** + * Make a new file handler at the given path. The path passed does not need to point to an existing file, + * but creation will *fail* if path points to an existing directory. + * + * @param path the full path to the file, either absolute or relative + * @return ptr to new FileHandlerInterface if created successfully, nullptr otherwise + */ + virtual std::shared_ptr CreateFileHandler(const std::string& path) = 0; + + /** + * Make a new directory at the given path. Creates a single directory. + * It is not assumed creating nonexistent parent directories is supported. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory was created successfully, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool MakeDirectory(const std::string& path) = 0; + + /** + * Delete the directory denoted by the given path. The directory must be empty in order + * to be deleted. + * + * @param path the directory pathname, either absolute or relative + * @return bool indicating the directory deletion was successful + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DeleteDirectory(const std::string& path) = 0; + + /** + * Delete the file denoted by the given path. + * + * @param path the file pathname, either absolute or relative + * @return bool indicating the file deletion was successful + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DeleteFile(const std::string& path) = 0; + + /** + * Determines if the given pathname denotes a directory. + * + * @param path a filesystem pathname, either absolute or relative + * @return true if the pathname is a directory, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual bool IsDirectory(const std::string& path) const = 0; + + /** + * Determines if the given directory path exists on the filesystem. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory exists on the filesystem, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual bool DirectoryExists(const std::string& path) const = 0; + + /** + * Determines if the given directory path is writable by the application. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory is writable by the application, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DirectoryIsWritable(const std::string& path) const = 0; + + /** + * Get all file and directory abstract pathnames contained within the given directory path. + * + * @param path the directory pathname, either absolute or relative + * @return list of all file and directory abstract pathnames contained within the given directory + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::vector GetDirectoryContents(const std::string& path) const = 0; + + /** + * Get all file abstract pathnames contained within the given directory path. + * + * @param path the directory pathname, either absolute or relative + * @return list of all file abstract pathnames contained within the given directory + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::vector GetDirectoryFiles(const std::string& path) const = 0; + + /** + * Read the contents of the given file and return as a string. + * The filepath may be relative or absolute, or this platform's specific file URI scheme. + * + * @param filepath the file pathname + * @return contents of the file pointed to by filepath as a string + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::string ReadStringFromFile(const std::string& filepath) const = 0; + + /** + * Get the filesystem specific path separator character. + * + * @return path separator character + */ + virtual char GetPathSeparatorChar() const = 0; + + /** + * Get the filesystem specific path separator as a string. + * + * @return path separator character as a string + */ + virtual std::string GetPathSeparator() const = 0; + }; + +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h new file mode 100755 index 00000000..8abfd58f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h @@ -0,0 +1,46 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H +#define ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * @class FlatDictionary + * + * Interface used for redefining complex objects as map of {string, variants} + */ + class FlatDictionaryInterface : public virtual ObjectInterface { + public: + /** + * Returns the internal state of the class in a flat KV map. + * The key is of string type, namespaced with periods if required, + * and the value is a Variant, with no nesting. + * + * @param out the flattened dictionary result + * @return true if a flat dictionary was correctly set to out, false if the operation failed. + */ + virtual bool GetFlatDictionary(std::map>& out) const = 0; + }; +} //namespace + + +#endif /* ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h new file mode 100755 index 00000000..7a0ce549 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h @@ -0,0 +1,132 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITDATABASEBASE_H +#define ADOBEMOBILE_SHARED_HITDATABASEBASE_H + +#include + +#include "Object.h" +#include "DatabaseHitBase.h" +#include "DatabaseHitSchema.h" +#include "DatabaseServiceInterface.h" + +namespace AdobeMarketingMobile { + + enum class DatabaseStatus : int32_t { + OK = 0, + FATALERROR + }; + + /* + * @class HitDatabaseBase + * Base class for hit data base management + */ + class HitDatabaseBase : public Object { + friend class HitQueueBaseMethods; ///< for testing + + public: + HitDatabaseBase() {} ///< makes mocking easier + + /** + * Opens the database with \p database_name_, if that exists or creates a new one if doesn't exist. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool OpenOrCreateDatabase(); + + /** + * Create a table in the database with \p table_name_. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool InitializeDatabase() = 0; + + virtual void PostReset(); + + /** + * Delete all items in the database table. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteAllHits(); + + /** + * Delete the database table. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteTable(); + + /** + * Attempts to remove the hit with given identifier from database. It resets the database and returns false if the + * deleteAllHits operation fails, true otherwise. + * + * @param identifier the ID of the hit that we want to remove + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteHitWithIdentifier(const std::string& identifier); + + /** + * Returns the count of current hits in database. It logs an error message when query fails + * + * @return number of rows if table exists, 0 if no entries or query has failed + */ + virtual int32_t GetSize(); + + /** + * Resets database (usually as a result of an unrecoverable exception) - it will remove the existing database and create + * a new one with the same filename and structure + */ + virtual void Reset(); + + protected: + std::string table_name_; ///< hit database table name + + std::shared_ptr database_; ///< DatabaseInterface + + DatabaseStatus database_status_ = DatabaseStatus::OK; ///< DatabaseStatus for database processing after throwing + + /** + * @protected + * @brief Constucts a HitDatabaseBase with database_service and database_hit_schema + */ + explicit HitDatabaseBase(const std::shared_ptr& database_service, + const std::shared_ptr& database_hit_schema); + + + private: + static const std::string LOG_PREFIX; ///< Logging prefix + + std::shared_ptr database_service_; ///< DatabaseServiceInterface + + std::string database_name_; ///< hit database name + + /** + * @private + * @brief Close the database + */ + void CloseDatabase(); + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITDATABASEBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h new file mode 100755 index 00000000..06987807 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h @@ -0,0 +1,64 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITPROCESSOR_H +#define ADOBEMOBILE_SHARED_HITPROCESSOR_H + +#include +#include "DatabaseHitBase.h" +#include "HitProcessorBase.h" + +namespace AdobeMarketingMobile { + + /* + * @class HitProcessor + * This class needs to be implemented and passed as a parameter to a HitQueue object. + */ + template + class HitProcessor : public HitProcessorBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + + public: + /** + * Process the hit that is retrieved from database. The return value of this method will decide whether + * or not the hit will be removed from the database. + * + * @param hit the hit retrieved from the database. + * @return a RetryType enum. Return RetryType::NO to remove the processed hit from the database. + */ + virtual RetryType Process(const std::shared_ptr& hit) = 0; + RetryType ProcessBase(const std::shared_ptr& hit) override; + + protected: + HitProcessor() : HitProcessorBase() {} ///< makes mocking easier + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + RetryType HitProcessor::ProcessBase(const std::shared_ptr& hit) { + return Process(std::dynamic_pointer_cast(hit)); + } +} + +#endif /* ADOBEMOBILE_SHARED_HITPROCESSOR_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h new file mode 100755 index 00000000..1531393c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h @@ -0,0 +1,53 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITPROCESSORBASE_H +#define ADOBEMOBILE_SHARED_HITPROCESSORBASE_H + +#include "Object.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + + /** + * RetryType is used to let the database know whether or not it should remove a database entry on a failed + * network request. + */ + enum class RetryType : int32_t { + RetryTypeNo = 0, + RetryTypeYes + }; + + class HitProcessorBase : public Object { + public: + /** + * Process the hit that is retrieved from database. The return value of this method will decide whether + * or not the hit will be removed from the database. + * + * @param hit the hit retrieved from the database. + * @return a RetryType enum. Return RetryType::NO to remove the processed hit from the database. + */ + virtual RetryType ProcessBase(const std::shared_ptr& hit) = 0; + + protected: + HitProcessorBase() {} ///< makes mocking easier + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITPROCESSORBASE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueue.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueue.h new file mode 100755 index 00000000..a353dec1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueue.h @@ -0,0 +1,147 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITQUEUE_H +#define ADOBEMOBILE_SHARED_HITQUEUE_H + +#include +#include "DatabaseHitBase.h" +#include "DatabaseHitSchema.h" +#include "HitQueueBase.h" +#include "HitProcessor.h" +#include "PlatformServicesInterface.h" +#include "Query.h" +#include "Common.h" + +namespace AdobeMarketingMobile { + + /** + * @class HitQueue + * + * Main class to be used by a module's database class to interface with the database + * provided by platform services. + */ + template + class HitQueue : public HitQueueBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + // If you get an error on the following line, you need to make sure that TDatabaseHitSchema is a type derived from DatabaseHitSchema. + static_assert(std::is_base_of, TDatabaseHitSchema>::value, + "Type of TDatabaseHitSchema must be derived from DatabaseHitSchema."); + // If you get an error on the following line, you need to make sure that THitProcessor is a type derived from HitProcessor. + static_assert(std::is_base_of, THitProcessor>::value, + "Type of THitProcessor must be derived from HitProcessor."); + + public: + /** + * Constructor + * =================== + * Initialize a HitQueueBase object and set properties for the provided parameters. + * + * @param platform_services platform services reference, needed to access the database service. + * @param hit_schema the hit schema defining the database object to be used. + * @param hit_processor processor to handle the hits. + */ + explicit HitQueue(const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor); + + /** + * Get the first hit that matches the provided query. + * + * Deliberately hides HitQueueBase::QueryHit() + * + * @param query Query object defining the query that should run. + * @returns the first hit to match the provided query. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr QueryHit(const std::shared_ptr& query); + + /** + * Allows the caller to insert a DatabaseHitBase object into the database. + * + * Deliberately hides HitQueueBase::Queue() + * + * @param hit database hit to queue. + * @returns true if the hit was successfully inserted into the database. + */ + ADOBE_VIRTUAL_FOR_TESTS bool Queue(const std::shared_ptr& hit); + + /** + * Get the oldest hit (according to timestamp) from the table defined in the hit_schema. + * + * Deliberately hides HitQueueBase::SelectOldestHit() + * + * @returns the oldest hit in the database table. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr SelectOldestHit(); + + /** + * Update the hit data to db. Use the identifier property of the hit as the index key. + * + * Deliberately hides HitQueueBase::UpdateHit() + * + * @param hit the hit to be updated to db. + */ + ADOBE_VIRTUAL_FOR_TESTS bool UpdateHit(const std::shared_ptr& hit); + + protected: + HitQueue() : HitQueueBase() {} ///< makes mocking easier + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + // ctor + template + HitQueue::HitQueue( + const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor) : + HitQueueBase(platform_services, hit_schema, hit_processor) + { } + + // public methods + template + std::shared_ptr + HitQueue::SelectOldestHit() { + return std::dynamic_pointer_cast(HitQueueBase::SelectOldestHit()); + } + + template + std::shared_ptr + HitQueue::QueryHit(const std::shared_ptr& + query) { + return std::dynamic_pointer_cast(HitQueueBase::QueryHit(query)); + } + + template + bool HitQueue::UpdateHit(const std::shared_ptr& hit) { + return HitQueueBase::UpdateHit(hit); + } + + template + bool HitQueue::Queue(const std::shared_ptr& hit) { + return HitQueueBase::Queue(hit); + } +} + + +#endif /* ADOBEMOBILE_SHARED_HITQUEUE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h new file mode 100755 index 00000000..22824f02 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h @@ -0,0 +1,218 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITQUEUEBASE_H +#define ADOBEMOBILE_SHARED_HITQUEUEBASE_H + +#include +#include +#include "HitDatabaseBase.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + class DatabaseHitSchemaBase; + class HitProcessorBase; + class PlatformServicesInterface; + class SystemInfoServiceInterface; + class TaskExecutor; + class Variant; + + /** + * @class HitQueueBase + * + * You should not inherit from this class. If you need a HitQueue in your module, add a HitQueue property. + */ + class HitQueueBase : public HitDatabaseBase { + friend class HitQueueBaseMethods; ///< for testing + + public: + /** + * Constructor + * =================== + * Initialize a HitQueueBase object and set properties for the provided parameters. + * + * @param platform_services platform services reference, needed to access the database service. + * @param hit_schema the hit schema defining the database object to be used. + * @param hit_processor processor to handle the hits. + */ + HitQueueBase(const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor); + + ~HitQueueBase(); + + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration); + + /** + * Indicates to the HitQueue that it should resume its background thread and process any queued hits. + */ + virtual void BringOnline(); + + /** + * Creates the database and table based on the provided hit_schema in the constructor. + * @returns true if successful + */ + virtual bool InitializeDatabase() override; + + /** + * Get the first hit that matches the provided query. + * + * @param query Query object defining the query that should run. + * @returns the first hit to match the provided query. + */ + std::shared_ptr QueryHit(const std::shared_ptr& query); + + /** + * Allows the caller to insert a DatabaseHitBase object into the database. + * + * @param hit database hit to queue. + * @returns true if the hit was successfully inserted into the database. + */ + bool Queue(const std::shared_ptr& hit); + + /** + * Get the oldest hit (according to timestamp) from the table defined in the hit_schema. + * + * @returns the oldest hit in the database table. + */ + std::shared_ptr SelectOldestHit(); + + /** + * Suspend the HitQueue. + * New hit can still be queued, processing will not resume until BringOnline is called. + */ + virtual void Suspend(); + + /** + * Update all the hits in the table with new values provided by parameters. + * + * @param parameters new values represented as {columnName}{value} pairs. + * @returns true if hits are successfully updated + */ + virtual bool UpdateAllHits(const std::map>& parameters); + + /** + * Update the hit data to db. Use the identifier property of the hit as the index key. + * + * @param hit the hit to be updated to db. + * @returns true if hit is successfully updated + */ + bool UpdateHit(const std::shared_ptr& hit); + + protected: + HitQueueBase() : HitDatabaseBase(), is_suspended_{false} {} ///< Makes mocking easier + + std::shared_ptr background_executor_; ///< Executor used to run tasks on separate threads + + std::mutex background_mutex_; ///< Mutex used to block access to background thread + + /** + * @protected + * Amount of time to wait until retry when there is a network connection failure + */ + static const int32_t DEFAULT_NETWORK_CONNECTION_FAIL_DELAY; + + /** + * @protected + * DatabaseHitSchema that defines the table to be used by this hit queue + */ + std::shared_ptr hit_schema_; + + /** + * @protected + * HitProcessorInterface used to process a hit. + */ + std::shared_ptr hit_processor_; + + bool is_suspended_; ///< Maintains status for hit queue suspension + + static const std::string LOG_TAG; ///< Tag used for logging + + std::shared_ptr platform_service_; ///< Reference to platform services + + std::shared_ptr system_info_service_; ///< Reference to system info services + + /** + * Get the function that can be used with the TaskExecutor to do our work on a controlled background thread. + * + * @returns function pointer whose implementation defines the work to be done to process a database hit + */ + std::function WorkerThread(); + + /** + * @protected + * Check the status of is_suspended_. + * + * @return true is \p is_suspended is true, false otherwise. + */ + bool IsSuspended(); + + private: + bool was_dispose_called_; ///< was Dispose() called? + + std::condition_variable worker_alarm_; ///< condition variable to wake up worker thread + + /** + * Helper for Dispose(). + * + * Non-virtual implementation of Dispose(). + */ + bool DisposeNonVirtualImpl(std::chrono::milliseconds max_wait_duration); + + /** + * Helper for WorkerThread(). + * + * Returns whether the worker thread should continue processing hits. + * + * Acquires background mutex during the body of this call. + * + * @returns whether the worker thread should continue processing hits + */ + bool ShouldWorkerContinue(); + + /** + * Helper for WorkerThread(). + * + * Version of ShouldWorkerContinue() that does not acquire background mutex. The caller of this function + * should hold background mutex for the duration of this call. + */ + bool ShouldWorkerContinueNoLock(); + + /** + * Helper for WorkerThread(). + * + * Pauses after processing a hit fails. + */ + void PauseBeforeRetrying(); + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITQUEUEBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h new file mode 100755 index 00000000..928149aa --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h @@ -0,0 +1,110 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H +#define ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H + +#include +#include + +namespace AdobeMarketingMobile { + + class HttpConnectionConstants { + + public: + /** + * http status code 200: ok + */ + static const int32_t HTTP_OK; + + /** + * http status code 404: not found + */ + static const int32_t HTTP_NOT_FOUND; + + /** + * http status code 408: request timeout. + */ + static const int32_t HTTP_CLIENT_TIMEOUT; + + /** + * http status code 416: range not satisfiable. + */ + static const int32_t HTTP_REQUESTED_RANGE_NOT_SATISFIABLE; + + /** + * http status code 504: gateway timeout. + */ + static const int32_t HTTP_GATEWAY_TIMEOUT; + + /** + * http status code 503: service unavailable. + */ + static const int32_t HTTP_UNAVAILABLE; + + + private: + HttpConnectionConstants() = delete; + + }; + + class HttpConnectionHeaderConstants { + + public: + /** + * Content-Type header is used to indicate the media type of the resource. + */ + static const std::string HTTP_HEADER_KEY_CONTENT_TYPE; + + /** + * HTTP header advertises which languages the client is able to understand, and which locale variant is preferred. + */ + static const std::string HTTP_HEADER_KEY_ACCEPT_LANGUAGE; + + /** + * The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able + * understand. + */ + static const std::string HTTP_HEADER_KEY_ACCEPT; + + /** + * The MIME media type for JSON text. The default encoding is UTF-8 + */ + static const std::string HTTP_HEADER_CONTENT_TYPE_JSON_APPLICATION; + + /** + * Headers for HTTP POST request. Here the body of the HTTP message sent to the server is essentially one giant + * query string -- name/value pairs are separated by the ampersand (&), and names are separated from values by the + * equals symbol (=) + */ + static const std::string HTTP_HEADER_CONTENT_TYPE_WWW_FORM_URLENCODED; + + /** + * Indicates you would only get HTML as a valid responses + */ + static const std::string HTTP_HEADER_ACCEPT_TEXT_HTML; + + + private: + HttpConnectionHeaderConstants() = delete; + }; + +} + +#endif /* ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/InternalModule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/InternalModule.h new file mode 100755 index 00000000..b025515d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/InternalModule.h @@ -0,0 +1,60 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_INTERNALMODULE_H +#define ADOBEMOBILE_CORE_INTERNALMODULE_H + +#include "Module.h" + +namespace AdobeMarketingMobile { + /** + * @class InternalModule + * + * Base class for internal (Adobe only) defined modules. Calling Module::GetPlatformServices() on an + * InternalModule allows access to platform-specific functionality in the environment owning the Module. + */ + class InternalModule : public Module { + protected: + /** + * Constructor. + * + * Subclasses should call this constructor to initialize the InternalModule. + * + * @param log_prefix - the name of the module + */ + explicit InternalModule(const std::string& log_prefix); + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + * + * =================================================== + * Example override + * =================================================== + * + * std::string Audience::GetSharedStateName() { + * return EventDataKeys::Audience::SHARED_STATE_NAME; + * } + * + **/ + virtual std::string GetSharedStateName() = 0; + }; +} + +#endif //ADOBEMOBILE_CORE_INTERNALMODULE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h new file mode 100755 index 00000000..a797abd3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h @@ -0,0 +1,45 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H + +#include +#include +#include "Expected.h" +#include "SdkError.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class JsonArray; + class JsonUtilityServiceInterface; + /** + * @brief Serializer for JsonArray objects + */ + class JsonArraySerializer : public Object, public virtual VariantSerializerInterface { + public: + explicit JsonArraySerializer(const std::shared_ptr& json_utility_service); + + Expected> Deserialize(const Variant& value) const override; + + std::shared_ptr Serialize(const JsonArray& o) const override; + private: + std::shared_ptr json_utility_service_; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h new file mode 100755 index 00000000..8765b47c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H + +#include +#include +#include "Expected.h" +#include "SdkError.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + class JsonObject; + class JsonUtilityServiceInterface; + /** + * @brief Serializer for JsonObject objects + */ + class JsonObjectSerializer : public Object, public virtual VariantSerializerInterface { + public: + explicit JsonObjectSerializer(const std::shared_ptr& json_utility_service); + + Expected> Deserialize(const Variant& value) const override; + + std::shared_ptr Serialize(const JsonObject& o) const override; + private: + std::shared_ptr json_utility_service_; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h new file mode 100755 index 00000000..d9f444ec --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h @@ -0,0 +1,694 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H + +#include +#include +#include +#include "EventData.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A json error occurred. Key is not found; + */ + constexpr static const char* JSON_KEY_NOT_FOUND = "json.key_not_found"; + /** + * A json error occurred. Index is not found. + */ + constexpr static const char* JSON_INDEX_NOT_FOUND = "json.index_not_found"; + /** + * A json error occurred. JsonObject is null. + */ + constexpr static const char* JSON_JSONOBJECT_IS_NULL = "json.jsonobject_is_null"; + /** + * A json error occurred. JsonArray is null. + */ + constexpr static const char* JSON_JSONARRAY_IS_NULL = "json.jsonarray_is_null"; + /** + * A json error occurred. Value is not of string type. + */ + constexpr static const char* JSON_VALUE_NOT_STRING_TYPE = "json.value_not_string_type"; + /** + * A json error occurred. Value is not of numeric type. + */ + constexpr static const char* JSON_VALUE_NOT_NUMERIC_TYPE = "json.value_not_numeric_type"; + /** + * A json error occurred. Value is not of boolean type. + */ + constexpr static const char* JSON_VALUE_NOT_BOOLEAN_TYPE = "json.value_not_boolean_type"; + /** + * A json error occurred. Value is not of array type. + */ + constexpr static const char* JSON_VALUE_NOT_ARRAY_TYPE = "json.value_not_array_type"; + /** + * A json error occurred. Value is not of dictionary type. + */ + constexpr static const char* JSON_VALUE_NOT_OBJECT_TYPE = "json.value_not_object_type"; + /** + * A json error occurred. Value is not of dictionary, array, numeric, boolean, string type. + */ + constexpr static const char* JSON_OBJECT_UNKNOWN = "json.object_unknown"; + /** + * A json serialization error occurred. + */ + constexpr static const char* JSON_SERIALIZATION_ERROR = "json.serialization_error"; + } + + enum class JsonType : int32_t { + NUMERIC = 0, + BOOLEAN, + STRING, + ARRAY, + OBJECT, + UNKNOWN + }; + + /** + * JSON objects are surrounded by curly braces {}. + * JSON objects are written in key/value pairs. + * Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null). + * Keys and values are separated by a colon. + * Each key/value pair is separated by a comma. + */ + class JsonArray; + class JsonObject : public virtual ObjectInterface { + public: + /** + * Returns a TYPE for the key specified + * + * @param name the key name + * @return the JsonType + * @throws ErrorCodes::JSON_OBJECT_UNKNOWN if JsonObject is not valid, ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual JsonType GetType(const std::string& name) const = 0; + + /** + * Returns a JsonObject value for the key specified + * + * @param name the key name + * @return the JsonObject + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if JsonObject value is null, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present, or + * ErrorCodes::JSON_VALUE_NOT_OBJECT_TYPE if the value for the key \p name is not a JsonObject + */ + virtual std::shared_ptr GetJsonObject(const std::string& name) const = 0; + + /** + * Returns a JsonArray value for the key specified + * + * @param name the key name + * @return the JsonArray + * @throws ErrorCodes::JSON_JSONARRAY_IS_NULL if JsonArray value is not null, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present, or + * ErrorCodes::JSON_VALUE_NOT_ARRAY_TYPE if the alue for the key \p name is not a JsonArray + */ + virtual std::shared_ptr GetJsonArray(const std::string& name) const = 0; + + /** + * Returns a int32_t value for the key specified + * + * @param name the key name + * @return the int32_t value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual int32_t GetInt(const std::string& name) const = 0; + + /** + * Returns a int64_t value for the key specified + * + * @param name the key name + * @return the int64_t value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual int64_t GetLong(const std::string& name) const = 0; + + /** + * Returns a double value for the key specified + * + * @param name the key name + * @return the double value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual double GetDouble(const std::string& name) const = 0; + + /** + * Returns a std::string value for the key specified + * + * @param name the key name + * @return the std::string value + * @throws ErrorCodes::JSON_VALUE_NOT_STRING_TYPE If the value is not a std::string, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual std::string GetString(const std::string& name) const = 0; + + /** + * Returns a boolean value for the key specified + * + * @param name the key name + * @return the bool value + * @throws ErrorCodes::JSON_VALUE_NOT_BOOLEAN_TYPE If the value is not a boolean, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual bool GetBoolean(const std::string& name) const = 0; + + /** + * Insert a JsonObject value + * + * @param name std::string the key name + * @param value value the JsonObject + * @return JsonObject this object + */ + virtual std::shared_ptr PutJsonObject(const std::string& name, + const std::shared_ptr& value) = 0; + + /** + * Insert a JsonArray value + * + * @param name std::string the key name + * @param value value the JsonArray value + * @return JsonObject this object + */ + virtual std::shared_ptr PutJsonArray(const std::string& name, const std::shared_ptr& value) = 0; + + /** + * Insert an int32_t value + * + * @param name std::string the key name + * @param value int32_t the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutInt(const std::string& name, int32_t value) = 0; + + /** + * Insert a int64_t value + * + * @param name std::string the key name + * @param value int64_t the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutLong(const std::string& name, int64_t value) = 0; + + /** + * Insert a double value + * + * @param name std::string the key name + * @param value double the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutDouble(const std::string& name, double value) = 0; + + /** + * Insert a std::string value + * + * @param name std::string the key name + * @param value std::string the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutString(const std::string& name, const std::string& value) = 0; + + /** + * Insert a boolean value + * + * @param name std::string the key name + * @param value boolean the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutBoolean(const std::string& name, bool value) = 0; + + /** + * Returns a JsonObject if a mapping exists, null otherwise. + * + * @param name the key name + * @return JsonObject, if mapping exists, null otherwise + */ + virtual std::shared_ptr OptJsonObject(const std::string& name) const = 0; + + + /** + * Returns a JsonArray if a mapping exists, null otherwise. + * + * @param name Key name + * @return JsonArray, if mapping exists, null otherwise + */ + virtual std::shared_ptr OptJsonArray(const std::string& name) const = 0; + + /** + * Returns the int32_t value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return int32_t value if a valid mapping exists, default_value otherwise. + */ + virtual int32_t OptInt(const std::string& name, int32_t default_value) const = 0; + + /** + * Returns the int64_t value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return int64_t value if a valid mapping exists, default_value otherwise. + */ + virtual int64_t OptLong(const std::string& name, int64_t default_value) const = 0; + + /** + * Returns the double value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return double value if a valid mapping exists, default_value otherwise. + */ + virtual double OptDouble(const std::string& name, double default_value) const = 0; + + /** + * Returns the String value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return String value if a valid mapping exists, default_value otherwise. + */ + virtual std::string OptString(const std::string& name, const std::string& default_value) const = 0; + + /** + * Returns the boolean value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return boolean value if a valid mapping exists, default_value otherwise. + */ + virtual bool OptBoolean(const std::string& name, bool default_value) const = 0; + + + /** + * Returns an iterator of the String keys in this object. + * + * @param keys list of the std::string keys + */ + virtual void Keys(std::vector& keys) const = 0; + + + /** + * Returns the number of mappings in this object + * + * @return The number of mappings + */ + virtual size_t Length() const = 0; + + /** + * Removes the specifed key and its value from the JSONObject + * + * @param name key that will be removed from the JSONObject + */ + virtual void Remove(const std::string& name) = 0; + + /** + * Convert this JsonObject to std::string + * + * @return std::string the string + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::string ToString() const = 0; + + }; + + class JsonArray : public virtual ObjectInterface { + public: + /** + * Returns a TYPE for the key specified + * + * @param index the uint32_t index + * @return the TYPE + * @throws ErrorCodes::JSON_JSONARRAY_IS_NULL or ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid. + */ + virtual JsonType GetType(uint32_t index) const = 0; + + /** + * Append a JsonObject value to the end of this array + * + * @param json_object JsonObject the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonObject(const std::shared_ptr& json_object) = 0; + + /** + * Sets the value at index to json_object, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param json_object JsonObject the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonObject(uint32_t index, const std::shared_ptr& json_object) = 0; + + /** + * Append a JsonArray to the end of this array + * + * @param json_array JsonArray the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonArray(const std::shared_ptr& json_array) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param json_array JsonArray the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonArray(uint32_t index, const std::shared_ptr& json_array) = 0; + + /** + * Append an int32_t value to the end of this array + * + * @param value int32_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutInt(int32_t value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value int32_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutInt(uint32_t index, int32_t value) = 0; + + /** + * Append an int64_t value to the end of this array + * + * @param value int64_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutLong(int64_t value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value int64_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutLong(uint32_t index, int64_t value) = 0; + + /** + * Append a double value to the end of this array + * + * @param value double the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutDouble(double value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value double the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutDouble(uint32_t index, double value) = 0; + + /** + * Append a std::string value to the end of this array + * + * @param value std::string the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutString(const std::string& value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced. + * + * @param index the uint32_t index + * @param value std::string the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutString(uint32_t index, const std::string& value) = 0; + + /** + * Append a boolean value to the end of this array + * + * @param value bool the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutBoolean(bool value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value bool the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutBoolean(uint32_t index, bool value) = 0; + + /** + * Returns the JsonObject value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonObject + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid + */ + virtual std::shared_ptr GetJsonObject(uint32_t index) const = 0; + + /** + * Returns the JsonArray value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonArray + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, + ErrorCodes::JSON_VALUE_NOT_ARRAY_TYPE the value at index is not an array. + */ + virtual std::shared_ptr GetJsonArray(uint32_t index) const = 0; + + /** + * Returns the int32_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return int32_t value + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual int32_t GetInt(uint32_t index) const = 0; + + /** + * Returns the int64_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return int64_t + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual int64_t GetLong(uint32_t index) const = 0; + + /** + * Returns the double value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return double + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual double GetDouble(uint32_t index) const = 0; + + /** + * Returns the std::string value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return String + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a std::string. + */ + virtual std::string GetString(uint32_t index) const = 0; + + /** + * Returns the boolean value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return boolean + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_BOOLEAN_TYPE the value at index is not a boolean. + */ + virtual bool GetBoolean(uint32_t index) const = 0; + + /** + * Returns the JsonObject value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonObject value at the index if exists and valid, null otherwise. + */ + virtual std::shared_ptr OptJsonObject(uint32_t index) const = 0; + + /** + * Returns the JsonArray value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonArray value at the index, if exists and valid, null otherwise. + */ + virtual std::shared_ptr OptJsonArray(uint32_t index) const = 0; + + /** + * Returns the int32_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return int32_t value at the index if exists and valid, default_value otherwise. + */ + virtual int32_t OptInt(uint32_t index, int32_t default_value) const = 0; + + /** + * Returns the int64_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return int64_t value at the index if exists and valid, default_value otherwise. + */ + virtual int64_t OptLong(uint32_t index, int64_t default_value) const = 0; + + /** + * Returns the double value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return double value at the index if exists and valid, default_value otherwise. + */ + + virtual double OptDouble(uint32_t index, double default_value) const = 0; + + /** + * Returns the std::string value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return String value at the index if exists and valid, default_value otherwise. + */ + virtual std::string OptString(uint32_t index, const std::string& default_value) const = 0; + + /** + * Returns the boolean value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return boolean value at the index if exists and valid, default_value otherwise. + */ + virtual bool OptBoolean(uint32_t index, bool default_value) const = 0; + + /** + * Returns the number of values in the array + * + * @return Number of values in the array. + */ + virtual size_t Length() const = 0; + + /** + * Convert this JsonArray to std::string + * + * @return std::string the string + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::string ToString() const = 0; + }; + + class JsonUtilityServiceInterface : public virtual ObjectInterface { + public: + /** + * Parse a Json string provided as input into a JsonObject instance, if the JSON string has the JSON object as + * the root element. + * + * @param json The json string to parse. + * @return A valid JsonObject if parse was successful + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::shared_ptr CreateJsonObject(const std::string& json) = 0; + /** + * Create a JsonObject from a Map + * + * @param map Map to create a JsonObject from + * @return A valid JsonObject if parse was successful, null otherwise + */ + virtual std::shared_ptr CreateJsonObject(const std::map>& map) = 0; + + /** + * Create a JsonObject from a String StringMap + * + * @param map Map to create a JsonObject from + * @return A valid JsonObject if parse was successful, null otherwise + */ + virtual std::shared_ptr CreateJsonObject(const std::map& map) = 0; + + /** + * Creates a valid empty JsonObject. + * + * @return An empty JsonObject. + */ + virtual std::shared_ptr CreateEmptyJsonObject() = 0; + + /** + * Parse a Json string provided as input into a JsonArray instance, if the JSON string has the JSON array as + * the root element. + * + * @param json The json string to parse + * @return A valid JsonArray if parse was successful + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::shared_ptr CreateJsonArray(const std::string& json) = 0; + + /** + * Creates a JsonArray from a variant vector + * + * @param vector variant vector to create the JsonArray from + * @return A valid JsonArray if parse was successful, nullptr otherwise + */ + virtual std::shared_ptr CreateJsonArray(const std::vector>& vector) = 0; + + /** + * Creates a valid empty JsonArray. + * + * @return An empty JsonArray. + */ + virtual std::shared_ptr CreateEmptyJsonArray() = 0; + + /** + * Parse a JsonObject and return the converted std::map of that object + * + * @param json_data The JsonObject to parse + * @return A valid string map if parse was successful, empty string map otherwise + */ + virtual std::map MapFromJsonObject( const std::shared_ptr& json_data) = 0; + + /** + * Parse EventData and deserialize the underlying variant map to JsonObject. + * + * @param data The EventData to parse + * @return Valid JsonObject if successful, nullptr otherwise + */ + virtual Expected> EventDataToJsonObject(const std::shared_ptr& data); + /** + * Parse a JsonObject and convert it to EventData by serializing to a variant map + * + * @param json_data The JsonObject to parse + * @return Valid EventData if successful, nullptr otherwise + */ + virtual Expected> JsonObjectToEventData(const std::shared_ptr& json_data); + }; + +} //namespace + +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LaunchType.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LaunchType.h new file mode 100755 index 00000000..a1ea7ab8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LaunchType.h @@ -0,0 +1,32 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_LAUNCHTYPE_H +#define ADOBEMOBILE_SHARED_LAUNCHTYPE_H + +namespace AdobeMarketingMobile { + + enum class LaunchType { + LAUNCH = 0, + INSTALL, + UPGRADE + }; + +} + +#endif /* ADOBEMOBILE_SHARED_LAUNCHTYPE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h new file mode 100755 index 00000000..2b2974c9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h @@ -0,0 +1,202 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Interface for the DataStore object containing persistent key-value pairs + */ + class DataStoreInterface : public virtual ObjectInterface { + public: + /** + * Set or update an int value + * + * @param key std::string key name + * @param value int value + */ + virtual void SetInt(const std::string& key, int32_t value) = 0; + + /** + * Get int value for key + * + * @param key std::string key name + * @param default_value int the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual int32_t GetInt(const std::string& key, int32_t default_value) const = 0; + + /** + * Set or update a std::string value for key + * + * @param key std::string key name + * @param value std::string The string value to store + */ + virtual void SetString(const std::string& key, const std::string& value) = 0; + + /** + * Get String value for key + * + * @param key std::string key name + * @param default_value std::string the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual std::string GetString(const std::string& key, const std::string& default_value) const = 0; + + /** + * Set or update a double value for key + * + * @param key std::string key name + * @param value The double value to store + */ + virtual void SetDouble(const std::string& key, double value) = 0; + + /** + * Get double value for key + * + * @param key std::string key name + * @param default_value double the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual double GetDouble(const std::string& key, double default_value) const = 0; + + /** + * Set or update a long value for key + * + * @param key std::string key name + * @param value The long value to store + */ + virtual void SetLong(const std::string& key, int64_t value) = 0; + + /** + * Get long value for key + * + * @param key std::string key name + * @param default_value long the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual int64_t GetLong(const std::string& key, int64_t default_value) const = 0; + + /** + * Set or update a float value for key + * + * @param key std::string key name + * @param value The float value to store + */ + virtual void SetFloat(const std::string& key, float value) = 0; + + /** + * Get float value for key + * + * @param key std::string key name + * @param default_value float the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual float GetFloat(const std::string& key, float default_value) const = 0; + + /** + * Set or update a boolean value for key + * + * @param key std::string key name + * @param value The bool value to store + */ + virtual void SetBoolean(const std::string& key, bool value) = 0; + + /** + * Get boolean value for key + * + * @param key std::string key name + * @param default_value boolean the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual bool GetBoolean(const std::string& key, bool default_value) const = 0; + + /** + * Set or update a Vector value for key + * + * @param key std::string key name + * @param value Vector to set or update + */ + virtual void SetVector(const std::string& key, const std::vector& value) = 0; + + /** + * Get Vector value for key + * + * @param key std::string key name + * @return persisted value if it exists, an empty vector otherwise + */ + virtual std::vector GetVector(const std::string& key) const = 0; + + /** + * Set or update a Map value for key + * + * @param key std::string key name + * @param value Map to set or update + */ + virtual void SetMap(const std::string& key, const std::map& value) = 0; + + /** + * Get Map value for key + * + * @param key std::string key name + * @return persisted value if it exists, an empty map otherwise + */ + virtual std::map GetMap(const std::string& key) const = 0; + + /** + * Check if the DataStore contains key + * + * @param key std::string key name + * @return true if key exists, false otherwise + */ + virtual bool Contains(const std::string& key) const = 0; + + /** + * Remove persisted value for key + * + * @param key std::string key name + */ + virtual void Remove(const std::string& key) = 0; + + /** + * Remove all key-value pairs from this DataStore + */ + virtual void RemoveAll() = 0; + }; + + class LocalStorageServiceInterface : public virtual ObjectInterface { + public: + /** + * Get a DataStore containing persistent key-value pairs + * + * @param data_store_name name of the DataStore + * @return DataStore object containing persisted data for dataStoreName. A new DataStore will be created if it doesn't exist + */ + virtual std::shared_ptr GetDataStore(const std::string& data_store_name) = 0; + }; + + +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Log.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Log.h new file mode 100755 index 00000000..777f347b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Log.h @@ -0,0 +1,263 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOG_H +#define ADOBEMOBILE_PLATFORMSHIM_LOG_H + +#include "LoggingServiceInterface.h" +#include "LoggingMode.h" +#include "StringUtils.h" + +namespace AdobeMarketingMobile { + + class Log : public Object { + public: + /** + * Sets the platform specific logging service to use for log output + * + * @param logging_service LoggingService to use for log output + * + * @see LoggingService + */ + static void SetLoggingService(const std::shared_ptr& logging_service); + + /** + * @returns the current logging service + */ + static std::shared_ptr GetLoggingService(); + + /** + * Sets the log level to operate at + * + * @param logging_mode LoggingMode to use for log output + * + * @see LoggingMode + */ + static void SetLogLevel(LoggingMode logging_mode); + + /** + * Gets the log level that the SDK is currently operating at + * + * @return LoggingMode describing the current level of logging. + */ + static LoggingMode GetLogLevel(); + + /** + * Gets the probable log level that the SDK is currently operating at, + * this may differ from the actual log level, but this call is very fast + * and does not acquire mutexes. To know the actual log level, call GetLogLevel(). + * + * This call is useful for preventing expensive log-related operations, but should + * be used sparingly. Example: + * + * if(GetLogLevelHint() >= LoggingMode::DEBUG_LOG) { + * std::string serialization = SomeExpensiveSerializationOperation(); + * Log::Debug("foo", "the serialization: %s", serialization); + * } + * + * @return LoggingMode describing the current level of logging. + */ + static LoggingMode GetLogLevelHint(); + + /** + * Used to print more verbose information. Info logging is expected to follow end-to-end every method an event hits. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Trace(const std::string& source, const char* format, const TArgs& ... args); + template + static void Trace(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the debug method should contain high-level details about the data being processed. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE, DEBUG + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Debug(const std::string& source, const char* format, const TArgs& ... args); + template + static void Debug(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the warning method indicates that a request has been made to the SDK, but the SDK + * will be unable to perform the requested task. An example is catching an expected or unexpected but + * recoverable exception. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE, DEBUG, WARNING + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Warning(const std::string& source, const char* format, const TArgs& ... args); + template + static void Warning(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the error method indicates that there has been an unrecoverable error. + * Prints information to the console regardless of current LoggingMode of the SDK. + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Error(const std::string& source, const char* format, const TArgs& ... args); + template + static void Error(const char* source, const char* format, const TArgs& ... args); + + private: + Log() {} + + static std::mutex mutex; ///< @private a mutex to protect logging vars + + static LoggingMode current_mode; ///< @private the current logging mode, synchronized on mutex + + /** + * @private the current logging service, protected by mutex + */ + static std::shared_ptr current_service; + + /** + * @private + * a hint about current_service (might be wrong in sometimes). + * true if current_service is not nullptr. + * accessible without mutex. + */ + static bool hint_service; + + /** + * @private + * a hint about current_mode (might be wrong in sometimes). + * accessible without mutex. + */ + static LoggingMode hint_mode; + + /** + * @private + * + * @returns true if there is probably a logging service and the mode is probably greater than mode. + * + * this function is fast and does not acquire mutexes. before logging, the actual service and mode should be + * checked. + */ + static bool Precheck(LoggingMode mode); + + /** + * @private + * @returns the current logging service if current_mode is >= mode. synchronized. + */ + static std::shared_ptr GetLoggingServiceIfModeGreq(LoggingMode mode); + + /** + * @private + * Non-generic part of Trace() implementation. + */ + static void TraceImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Debug() implementation. + */ + static void DebugImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Warning() implementation. + */ + static void WarningImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Error() implementation. + */ + static void ErrorImpl(const char* source, const std::string& s); + }; +} //namespace + + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + template + void Log::Trace(const std::string& source, const char* format, const TArgs& ... args) { + Trace(source.c_str(), format, args...); + } + + template + void Log::Trace(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::VERBOSE_LOG)) { + TraceImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Debug(const std::string& source, const char* format, const TArgs& ... args) { + Debug(source.c_str(), format, args...); + } + + template + void Log::Debug(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::DEBUG_LOG)) { + DebugImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Warning(const std::string& source, const char* format, const TArgs& ... args) { + Warning(source.c_str(), format, args...); + } + + template + void Log::Warning(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::WARNING_LOG)) { + WarningImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Error(const std::string& source, const char* format, const TArgs& ... args) { + Error(source.c_str(), format, args...); + } + + template + void Log::Error(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::WARNING_LOG)) { + ErrorImpl(source, StringUtils::FormatString(format, args...)); + } + } +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOG_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h new file mode 100755 index 00000000..15c73704 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h @@ -0,0 +1,33 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H + +namespace AdobeMarketingMobile { + + enum class LoggingMode : int32_t { + ERROR_LOG = 0, + WARNING_LOG = 1, + DEBUG_LOG = 2, + VERBOSE_LOG = 3, + + }; +} //namespace + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h new file mode 100755 index 00000000..3c382f6c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h @@ -0,0 +1,56 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class LoggingServiceInterface : public virtual ObjectInterface { + public: + /** + * Information provided to the debug method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Debug(const std::string& tag, const std::string& message) const = 0; + /** + * Information provided to the warning method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Warning(const std::string& tag, const std::string& message) const = 0; + /** + * Information provided to the error method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Error(const std::string& tag, const std::string& message) const = 0; + }; +} //namespace + + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Matchers.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Matchers.h new file mode 100755 index 00000000..fd1b0790 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Matchers.h @@ -0,0 +1,312 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_MATCHER_H +#define ADOBEMOBILE_RULESENGINE_MATCHER_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonObject; + class Variant; + + /** + * Base Matcher class. Matcher classes evaluate given values to values mapped to a given key. Derived Matcher + * classes specialize in the match operation used to evaluate the values. + */ + class Matcher : public Object { + friend class RuleConditionMatcher; + public: + + std::string key; ///< the key to which this Matcher evaluates values against + std::vector> values; ///< the values for this Matcher which will evaluate to true + + /** + * Creates a Matcher instance based on the given JSON Object. + * Searches the JSON object for a matcher operator, key, and values and returns a Matcher instance + * populated with those values. Returns `nullptr` if an error occurs creating the Matcher instance. + * + * @param dictionary a JSON object containing the definition for a Matcher instance + * @returns a new Matcher instance, or `nullptr` if a Matcher could not be created. + */ + static std::shared_ptr MatcherWithJsonObject(const std::shared_ptr& dictionary); + + protected: + + /** + * ctor. + */ + Matcher() = default; + + /** + * Searches the JSON object for matcher values and adds them to the given Matcher object. + * Logs a warning if no values are found. + * + * @param dictionary the JSON object containing a matcher values array + * @param matcher the Matcher instance to add the found values + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + static void SetMatcherValuesFromJson(const std::shared_ptr& dictionary, + const std::shared_ptr& matcher); + + /** + * Searches the JSON object for a matcher key and adds it to the given Matcher object. + * Logs a warning if the key is not found or if a JSON error occurs. + * + * @param dictionary the JSON object containing the matcher key + * @param matcher the Matcher instance to add the found key + */ + static void SetMatcherKeyFromJson(const std::shared_ptr& dictionary, + const std::shared_ptr& matcher); + + /** + * Evaluates the given \p value against this Matcher's values for this Matcher type's operation. + * + * @param value the value to match + * @returns true if the value matches against this Matcher's values, false otherwise. + */ + virtual bool Matches(const std::shared_ptr& value) const; + + /** + * Compares two values as doubles. The given Variant values are converted to doubles before being passed + * to the given comparison function. Converting the values to doubles allows for comparision between different + * numeric types and strings. + * + * @param value the value to compare + * @param match the Matcher's value to compare + * @param compare_func the comparison function + * @returns true if both values are able to be converted to double types and \p compare_func evaluates to true, + * false otherwise. + */ + static bool CompareAsDoubles(const std::shared_ptr& value, const std::shared_ptr& match, + std::function compare_func); + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + /** + * Helper class to perform common ToString formatting. + * + * @param options ToStringOptions used in formatting the result string + * @param description a simple description for this Matcher + * @returns a formatted string describing this Matcher + */ + std::string ToStringImplHelper(const ToStringOptions& options, const std::string& description) const; + + private: + + /** + * Gets a new Matcher instance of type represented by the given \p type string. + * + * @param type a string representation of a Matcher class + * @returns new Matcher instance of type defined by \p type, or `nullptr` if \p type does not define + * a valid Matcher class. + */ + static std::shared_ptr InitializeMatcherTypeDictionary(const std::string& type); + + }; + + class MatcherContains : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is contained within any of this Matcher's values. + * @param value the value to evaluate + * @returns true if the value is contained within any of this Matcher's values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherEndsWith : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value ends with any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value ends with any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherEquals : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherExists : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if this Matcher's \p key exists in any of the given \p maps. + * @param value the value to evaluate + * @returns true if this Matcher's \p key exists in any of the given \p maps, false otherwise. + */ + bool Matches(const std::shared_ptr& value) const override; + + }; + + class MatcherGreaterThan : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is greater than any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is greater than any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + + }; + + class MatcherGreaterThanOrEqual : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is greater than or equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is greater than or equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherLessThan : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is less than any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is less than any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherLessThanOrEqual : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is less than or equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is less than or equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotContains : public MatcherContains { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is not contained within any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is not contained within any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotEquals : public MatcherEquals { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value does not equal any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value does not equal any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotExists : public MatcherExists { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if this Matcher's \p key exists in any of the given \p maps. + * @param value the value to evaluate + * @returns true if this Matcher's \p key exists in any of the given \p maps, false otherwise. + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherStartsWith : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value starts with any of the Matcher's string \p values. + * @param value the value to evaluate + * @returns true if the value starts with any of this Matcher's string \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + +} + +#endif /* ADOBEMOBILE_RULESENGINE_MATCHER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h new file mode 100755 index 00000000..c5e848ba --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h @@ -0,0 +1,169 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE:All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any.The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H +#define ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H + +#include "Configuration.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + class MobileIdentities { + public: + /** + * Collects all the identities in the given string format from various modules. + * + * @param json_utility_service A JsonUtilityService instance from PlatformServices for creating a JSON string + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the shared state information + * @return A string with all available identities in json format + */ + static std::string GetAllIdentifiers(const std::shared_ptr& json_utility_service, + const std::shared_ptr& event, const std::shared_ptr& module); + + /** + * Verifies none of the shared states required for the GetSDKIdentities API are in PENDING State. + * The required shared states are: + * 1.Analytics + * 2.Audience + * 3.Configuration + * 4.Identity + * 5.Target + * + *Returns true, if the all the above shared state are valid. + *Returns false, if any one of the above shared state is in EventHub#SHARED_STATE_PENDING. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the shared state + * @return A boolean indicating the availability of the required module shared state + */ + static bool AreAllSharedStateReady(const std::shared_ptr& event, const std::shared_ptr& module); + + private: + /** + * Gets the required identities from Audience Module. + * A List of map in the following format will be appended depending the availability of the Audience shared state. + * + * [{ "namespace" : "0", "value" : "AAM_UUID", "type" : "namespaceId" }, + * { "namespace" : "AAM_DPID", "value" : "AAM_DPUUID", "type" : "namespaceId" }] + * + * An empty list will be returned if the Audience shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Audience shared state + * @return List containing Audience Identities + */ + static std::vector> GetAudienceIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the required identities from Analytics Module. + * A List of map in the following format will be appended depending the availability of theAnalytics} shared state. + * + * [ { "namespace" : "avid", "value" : "AID", "type" : "integrationCode" }, + * { "namespace" : "vid", "value" : "VID", "type" : "analytics", "rsids" : [ "rsid1", "rsid2", ... ] }] + * + * An empty list will be returned if the Analytics shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Analytics shared state + * @return List containing Analytics Identities + */ + static std::vector> GetAnalyticsIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the required identities from Identity Module. + * + * A List of map in the following format will be appended depending the availability of theIdentity shared state. + * [ { "namespace" : "INTEGRATION CODE", "value" : "ID", "type" : "integrationCode" }, + *{ "namespace" : "4", "value" : "MCID", "type" : "namespaceId" }, + *{ "namespace" : "20919", "value" : "PUSHID", "type" : "integrationCode" }, + *{ "namespace" : "DSID_20914","value" : "ADID", "type" : "integrationCode" }, + * ] + * + * An empty list will be returned if the Identity shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Identity shared state + * @return List containing Visitor Identities + */ + static std::vector> GetVisitorIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + + /** + * Gets the required identities from Target Module. + * + * A List of map in the following format will be appended depending the availability of the Target shared state. + * + * [{ "namespace" : "tntid", "value" : "TNTID", "type" : "target" }, + * { "namespace" : "3rdpartyid", "value" : "TNT3RDPARTYID", "type" : "target" }] + * + * An empty list will be returned if the Target shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Target shared state + * @return List containing Target Identities + */ + static std::vector> GetTargetIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the company context map in the following format. + * + *"companyContexts": [ + * { "namespace": "imsOrgID", "value": "ORGID" } + *] + * + * Returns null if the Configuration shared state is invalid or null. + * Returns null if the Configuration shared state is valid and marketingCloudID cannot be found + * inConfiguration shared state. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Identity shared state + * @return List representing company context + */ + static std::vector> GetCompanyContext(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Helper method to create a userID Map. + * + * @param name_space A String representing namespace + * @param value An String representing value + * @param type An String representing type + * @return An UserIDMap + */ + static std::map> CreateUserIdMap(const std::string& name_space, + const std::string& value, + const std::string& type); + + /** + * Verifies if the given shared state is valid. + * Returns false, if the give provided sharedState is invalid or pending. True otherwise. + * + * @param shared_state An EventData representing a shared state + * @return boolean value representing the validity of the shared state + */ + static bool IsSharedStateValid(const std::shared_ptr& shared_state); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h new file mode 100755 index 00000000..e8727735 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H +#define ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H + +#include +#include + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + enum class MobilePrivacyStatus : int32_t { + OPT_IN = 0, + OPT_OUT, + UNKNOWN + }; + + /** + * Converts a string to its respective MobilePrivacyStatus enum representation + * + * If not match is found, returns MobilePrivacyStatus::UNKNOWN + */ + MobilePrivacyStatus StringToMobilePrivacyStatus(const std::string& privacy_string); + + /** + * Converts a MobilePrivacyStatus enum to its respective string representation + * + * If not match is found, returns "optunknown" + */ + std::string MobilePrivacyStatusToString(MobilePrivacyStatus privacy_status); + + /** + * Used for logging + */ + void ToStringImpl(std::ostream& the_stream, MobilePrivacyStatus value, const ToStringOptions& options); +} + +#endif /* ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Module.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Module.h new file mode 100755 index 00000000..cc14294c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Module.h @@ -0,0 +1,862 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULE_H +#define ADOBEMOBILE_CORE_MODULE_H + +#include +#include +#include +#include +#include +#include "Common.h" +#include "EventType.h" +#include "EventSource.h" +#include "Expected.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class EventData; + class EventHub; + class Rule; + class InternalModule; + class ModuleEventDispatcherBase; + class ModuleEventListenerBase; + class ModuleEventProcessorBase; + class ModuleTaskOptions; + class PlatformServicesInterface; + class TaskExecutorInterface; + enum class ModuleState : int32_t; + + // TODO: (AMSDK-5893) does InternalModule make sense anymore given our current external module design? + + /** + * @class Module + * + * Module is the base class for modules. + * + * Quick Start + * =========== + * To create a module, derive from `Module` or `InternalModule` (for modules created internally): + * + * class MyModule : public Module { + * public: + * // Subclasses must have a default constructor: + * MyModule() : Module{ "MyModule" } {} // "MyModule" is the log prefix + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * }; + * + * To register a module, call EventHub::RegisterModule(): + * + * std::shared_ptr event_hub = ...; + * event_hub->RegisterModule(); + * + * Module Registration and Initialization + * ====================================== + * EventHub::RegisterModule() can be used to register a module. + * + * Registration completes asynchronously. After EventHub::RegisterModule(), the following occurs: + * + * 1) The event hub constructs an instance of the module using its default constructor + * (i.e. `MyModule::MyModule()`). During the constructor, the module is not yet registered with the EventHub + * and therefore cannot register listeners, dispatchers, or processors. + * + * 2) The event hub invokes `Module::OnRegistered()` on the event hub thread. During `Module::OnRegistered()`, + * subclasses may register listeners, dispatchers, or processors. + * + * The following is an example of a module that performs some initialization: + * + * class MyModule : public Module { + * public: + * MyModule() : Module{ "MyModule" }, + * some_variable_{42} { + * // Some initialization can happen this method, BUT: + * // + * // Do not call RegisterProcessor/RegisterListener/CreateDispatcher from the constructor. If called + * // during the constructor, these methods will throw since the module does not have a reference to + * // the EventHub yet. The same holds true for any calls that require an EventHub. + * } + * + * void OnRegistered() override { + * // During this method, you will typically perform the bulk of your initialization. + * RegisterListener(...); + * RegisterProcessor(...); + * + * // You can also perform additional initialization in this method. HOWEVER, this method is invoked + * // in the eventloop and therefore should not perform long-running, synchronous operations. + * } + * + * private: + * int32_t some_variable_; + * }; + * + * Unregistering Modules + * ===================== + * To register a module with EventHub, call `Module::UnregisterModule()`. + * + * After calling Module::UnregisterModule(), the following occurs: + * + * 1) The module drops pending, unstarted tasks and stops accepting new tasks. If a task was already started, it + * will be completed prior to invoking `Module::OnUnregistered()`. To schedule tasks that will be executed + * during unregistration (in order to peform blocking unregistration tasks) see Module::AddTaskToQueue(). + * + * 2) The module unregisters all listeners, processors, and dispatchers and stops accepting new listeners, + * processors and dispatchers. As usual, the event hub invokes `OnUnregistered()` on the event hub thread for + * listeners, processors, and dispatchers registered by the module. + * + * 3) The event hub invokes `Module::OnUnregistered()` on the eventhub thread. + * + * 4) All remaining tasks (required for unregistartion) are completed and the background task thread is terminated. + * + * 5) The event hub and module release their references to eachother. At this time, the EventHub and Module + * may get destructed. + * + * Threading + * ========= + * Module/listener/dispatcher/processor callbacks such as `OnRegistered()`, `OnUnregistered()`, + * `ModuleEventListener::Hear()` and `ModuleEventProcessor::Process()` are called synchronously from the + * event hub thread. + * + * This has a few consequences: + * + * 1) These methods will never be called concurrently and can be implemented as if they were executing on a single + * thread. + * + * 2) These callbacks must NEVER perform blocking operations, as those will block the event hub. + * + * Additional details: + * - Callbacks MAY be called concurrently for different Module instances. + * - Modules should not expect that callbacks will be called from a specific thread or always be + * called from the same thread. The event hub may invoke these callbacks from any actual thread so long as + * the callbacks are invoked as if they originated from the same thread. + */ + class Module : public Object { + friend class EventHub; // EventHub should only access private methods marked for use by EventHub. + friend class ModuleMethods; // For testing + + public: + /** + * Determines whether a module is currently registered. + * + * This method is thread-safe. + * + * NOTE: The result of this call be used as a hint. For threading reasons, it is possible + * to become unregistered after IsRegistered() has already returned true. + * + * @returns true if this module is currently registered with an EventHub, false otherwise. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsRegistered(); + + /** + * Determines whether a module is an InternalModule. + * + * This method is thread-safe. + * + * @returns true if this module is an InternalModule, false otherwise. + */ + bool IsInternal(); + + /** + * Get the name of this module + * + * @returns name of this module + */ + std::string GetModuleName() const { + return log_prefix_; + } + + protected: + /** + * For convenience, a ModuleTaskOptions with `required_for_unregistration` set to true. + */ + static const ModuleTaskOptions REQUIRED_FOR_UNREGISTRATION; + + /** + * Constructor. + * + * Subclasses should call this constructor to initialize the InternalModule. + * + * @param log_prefix - the name of the module + */ + explicit Module(const std::string& log_prefix); + + /** + * Creates, registers, and returns an event dispatcher for this module. + * + * TDispatcher is the class of the dispatcher to create. TDispatcher should extend ModuleEventDispatcher, + * where TDispatcher is the type of the current module. In rare cases, TDispatcher may extend ModuleEventDispatcherBase + * directly. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * This method is thread-safe. + * + * @return a TDispatcher registered with the current module and eventhub + * + * @see ModuleEventDispatcher + */ + template + std::shared_ptr CreateDispatcher(); + + /** + * This method is invoked shortly after the Module is registered. + * + * Subclasses may override this method to perform initialization tasks. Methods that require + * an event hub (i.e. `RegisterListener()`) may be safely invoked during this method. + * + * Threading + * ========= + * Do not perform blocking operations during this method. Consider moving these operations to a + * background thread. + * + * @see Module for additional threading information. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after EventHub::RegisterModule() + * is called. This call is guaranteed to occur prior to Module::OnUnregistered, ModuleEventListener callbacks, + * and ModuleEventProcessor callbacks. + */ + virtual void OnRegistered(); + + + /** + * This method is invoked shortly before the Module is fully unregistered. + * + * Subclasses may override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * Do not perform blocking operations during this method. Consider moving these operations to a + * background thread. + * + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This function is guaranteed to be called after pending Module callbacks, ModuleEventListener callbacks, + * and ModuleEventProcessor callbacks. All pending tasks are guaranteed to be complete or cancelled before this + * function is called (except tasks scheduled with `options.required_for_unregistration` set to true, which + * may complete after this function is called). After calling this method, Module and its child objects will + * receive no additional callbacks, and the EventHub will release any references to the Module and its child + * objects. + */ + virtual void OnUnregistered(); + + /** + * Registers an event processor for this module. + * + * Processors can process all events, not only events destined for the registering module + * + * TProcessor is the class of the processor to create. TProcessor should extend ModuleEventProcessor, + * where TProcessor is the type of the current module. In rare cases, TProcessor may extend ModuleEventProcessorBase + * directly. + * + * This method is thread-safe. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * @see ModuleEventProcessor + */ + template + void RegisterProcessor(); + + /** + * Registers an event listener for this module. + * + * Only one listener per type/source pair is allowed per module. Any collisions will be resolved by replacing + * the existing listener with the new listener. + * + * TListener is the class of the listener to create. TListener should extend ModuleEventListener, + * where TModule is the type of the current module. In rare cases, TListener may extend ModuleEventListenerBase + * directly. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for existing listeners on event_type/event_source to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override ModuleEventListener::OnUnregistered + * and ModuleEventListener::OnRegistered. + * + * @param event_type - EventType to listen for + * @param event_source - EventSource to listen for + * + * @see ModuleEventListener + */ + template + void RegisterListener(const std::shared_ptr& event_type, const std::shared_ptr& event_source); + + /** + * Registers a wild card event listener for this module. + * + * The wild card listener will receive all events that are dispatched by the event hub. + * Internally, this method uses the {@link #registerListener(EventType, EventSource, Class)} to register an event listener + * for {@link EventType#WILDCARD} and {@link EventSource#WILDCARD}. + * + */ + template + void RegisterWildCardListener(); + + /** + * Registers a one-time block with the parent event hub. + * + * A one-time block is an event handler that will cease to function after it sucessfully 'hears' one event. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for existing listeners on event_type/event_source to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override ModuleEventListener::OnUnregistered + * and ModuleEventListener::OnRegistered. + * + * @param type - the EventType of an event to listen for + * @param source - the EventSource of an event to listen for + * @param pair_id - optional pairID to listen for -- this is primarily used for request/response events + * @param block - the block to call when the event is heard + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterOneTimeListenerBlock(const std::shared_ptr& type, + const std::shared_ptr& source, + const std::string& pair_id, + const std::function&)>& block); + + /** + * Unregisters this module from the parent event hub. + * + * This method is thread-safe. + * + * Due to threading, it is possible for listeners and processors to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override OnUnregistered. + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterModule(); + + /** + * Unregisters a listener that matches the provided type/source + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for removed listeners to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override + * ModuleEventListener::OnUnregistered. + * + * @param type - event type of listener to unregister + * @param source - event source of listener to unregister + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterListener(const std::shared_ptr& type, + const std::shared_ptr& source); + + /** + * Unregisters a wild card listener that was registered earlier. + * + * @see {@link RegisterWildcardListener} + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterWildCardListener(); + + /** + * Add a task to the module's thread pool that will be executed asynchronously. + * + * Equivalent to: + * + * this->AddTaskToQueue(task_name, task_callback, ModuleTaskOptions{}); + * + * @see `void AddTaskToQueue(const std::string& task_name, std::function task_callback, const ModuleTaskOptions& options )` + */ + ADOBE_VIRTUAL_FOR_TESTS void AddTaskToQueue(const std::string& task_name, + std::function task_callback); + + /** + * Add a task to the module's thread pool that will be executed asynchronously. + * + * Calling this method during a Module's constructor is a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * This method will capture a reference to the calling Module to keep it alive while running the task. + * + * Tasks from a given Module will be started and completed in FIFO order. For example: + * + * AddTaskToQueue("a", [=] { Log::Debug("hello"); }); + * AddTaskToQueue("b", [=] { Log::Debug("world"); }); + * + * The above code will always print "hello" then "world". Task "b" will not start until task "a" completes. + * + * Unregistration + * ============== + * By default, pending, unstarted tasks will be cancelled when `Module::UnregisterModule()` is called. + * If a task is in progress at the time `Module::UnregisterModule()` was called, it will be completed prior + * to calling `Module::OnUnregistered`. + * + * To schedule tasks that can execute during/after unregistration, set `options.required_for_unregistration` to + * true. Tasks scheduled in this manner will not be cancelled when `Module::UnregisterModule()` is called. Thus, + * such tasks can execute after `Module::UnregisterModule()` and `Module::OnUnregistered()`. + * + * After `Module::OnUnregistered()` is called, no additional tasks may be scheduled regardless of the value of + * `options.required_for_unregistration`. However, pending unregistration tasks that were scheduled prior to + * `Module::OnUnregistered()` will be allowed to complete before fully unregistering the module and may + * start and/or complete after `Module::OnUnregistered()`. + * + * @param task_name - the name of task to execute (can be empty) + * @param task_callback - the task to execute + * @param options - additional options for this task + */ + ADOBE_VIRTUAL_FOR_TESTS void AddTaskToQueue(const std::string& task_name, + std::function task_callback, + const ModuleTaskOptions& options); + + /** + * Creates a shared state for this module versioned at the current event count of the registering hub + * + * @param state EventData object containing the state to save (can be nullptr) + * @param version int containing the version that this shared state should be begin to be valid for + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Updates an existing shared state for this module + * + * @param version version of the existing shared state to replace + * @param state new state to replace with existing state + **/ + ADOBE_VIRTUAL_FOR_TESTS void UpdateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Creates or updates a shared state for this module versioned at the current event count of the registering hub. + * + * @param state EventData object containing the state to save (can be nullptr) + * @param version version this shared state will be valid for + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateOrUpdateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Creates a shared state for this module versioned at the next event count of the registering hub + * + * @param state EventData object containing the state to save (can be nullptr) + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateOrUpdateSharedState(const std::shared_ptr& state); + + /** + * Clear all the shared states that exist for this module + * + **/ + ADOBE_VIRTUAL_FOR_TESTS void ClearSharedStates(); + + /** + * Retrieves the named shared state that is valid for the given event + * + * @param state_name name of the shared state to retrieve + * @param event event to retrieve named state + * + * @return EventData object containing the valid state + **/ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event); + + /** + * Determines if the named module contains any valid shared states. + * + * @param state_name name of the module to query for valid states + * + * @return true if the named module contains any valid shared states + **/ + ADOBE_VIRTUAL_FOR_TESTS bool HasSharedEventState(const std::string& state_name); + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + * + * =================================================== + * Example override + * =================================================== + * + * std::string Audience::GetSharedStateName() { + * return EventDataKeys::Audience::SHARED_STATE_NAME; + * } + * + **/ + virtual std::string GetSharedStateName() = 0; + + /** + * Gets the platform services. + * + * @return the platform services instance only if this is an internal module and is currently registered. + * otherwise, returns nullptr. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetPlatformServices(); + + /** + * Registers a rule to be executed by the eventhub + * + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterRule(const std::shared_ptr& rule); + + /** + * Unregisters all previously registered rules + * + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterAllRules(); + + private: + + /** + * @private + * + * Called by EventHub to complete registration of this module. Called with the event hub lock held. + */ + ADOBE_VIRTUAL_FOR_TESTS void OnEventHubRegisteredModule(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services, + const std::shared_ptr& task_executor); + + /** + * @private + * + * Called by EventHub to performs idle time operations (including invoking pending callbacks). + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void Idle(); + + /** + * @private + * + * Called by EventHub to synchronously invoke event processors. + * + * @return true if the event was processed and sets processed_event to the processed event. + * @return false if the event was not processed and does not change the value of processed_event. + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS bool ProcessEvent(const std::shared_ptr& event, std::shared_ptr& processed_event); + + /** + * @private + * + * Called by EventHub to synchronously invoke event listeners. + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void NotifyListeners(const std::shared_ptr& event); + + /** + * @private + * + * Called by EventHub to synchronously invoke wildcard event listeners. + * + * THREADING: Idle(), ProcessEvent(), and NotifyWildCardListener() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void NotifyWildCardListener(const std::shared_ptr& event); + + /** + * Register a listener after creation. Intended for use by RegisterListener<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterListener(const std::shared_ptr& listener, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id); + + /** + * @private + * + * Register a dispatcher after creation. Intended for use by CreateDispatcher<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterDispatcher(const std::shared_ptr& dispatcher); + + /** + * @private + * + * Register a processor after creation. Intended for use by RegisterProcessor<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterProcessor(const std::shared_ptr& processor); + + /** + * @private + * + * Enqueues a callback for execution in Idle(), ProcessEvent(), or NotifyListeners(). + * After enqueing a callback, EventHub::RequestIdle() should typically be called. + * + * @param guard - a lock that refers to mutex_. The method will acquire mutex_ if needed and upon exit, guard will hold mutex_. + * @param callback - the callback to queue up + */ + void EnqueueCallback(std::unique_lock& guard, const std::function& callback); + + /** + * @private + * + * Helper for DoCommonEventHubThreadWork(). + * + * If unregistration was initiated, completes it (in the eventhub thread). Acquires and releases mutex_. + */ + void CompleteUnregistrationIfNeeded(); + + /** + * @private + * + * Helper for CompleteUnregistration() + */ + void CompleteUnregistrationIfNeeded_UNREGISTERING(); + + /** + * @private + * Helper for CompleteUnregistration() + */ + void CompleteUnregistrationIfNeeded_DISPOSING_EXECUTOR(); + + /** + * @private + * Helper for CompleteUnregistrationIfNeeded() + */ + void CompleteUnregistrationIfNeeded_COMPLETING_NORMAL_TASKS(); + + /** + * @private + * + * This method performs common work that should happen during Idle(), ProcessEvent(), + * and NotifyListeners(). + * + * It does the following: + * - executes pending callbacks + * - if needed, performs unregistration work + * + * When this function exits with `true`, + * - `out_guard` will hold mutex_ + * - the Module is not unregistering and not unregistered + * - `pending_callbacks_` will be empty + * - the caller may continue normally + * + * When this function exits with `false`, + * - the Module is unregistering or unregistered + * - `out_guard` is unchanged + * - `pending_callbacks_` will be empty + * - the caller should return immediately since + * + * @param guard - on input, should be a default constructed `std::unique_lock` + */ + bool DoCommonEventHubThreadWork(std::unique_lock& guard); + + /** + * @private + * + * Main mutex for synchronization of Module. + * + * IMPORTANT: Be very very careful when calling external functions + * while holding mutex_, especially if those functions acquire + * mutexes. Failure to do this can result in hard-to-reproduce + * deadlocks. + * + * The following are known mutex orderings of this class: + * - EventHub::mutex_ BEFORE Module::mutex_ + */ + std::mutex mutex_; + + /** + * @private + * the log prefix for this module's logs + */ + std::string log_prefix_; + + /** + * @private + * + * The current state (registered, etc) of this. + * + * Synchronized on mutex_. + */ + ModuleState state_; + + /** + * @private + * + * the parent event hub. + * + * while the module is registered, this value should be non-null. this means that the parent event hub + * is kept alive as along as this module is registered. this is done deliberately to allow the module + * and child objects to make use of the event hub's background thread for callbacks. the reference cycle + * is broken after the module is unregistered. + * + * synchronized on mutex_. + */ + std::shared_ptr parent_hub_; + + /** + * the currently registered dispatchers. + * this variable ensures that ModuleEventDispatchers stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::vector> dispatchers_; + + /** + * the currently registered processors. + * this variable ensures that ModuleEventProcessors stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::vector> processors_; + + /** + * the currently registered listeners, may contain nullptr entries. + * + * using a shared_ptr value ensures that ModuleEventListeners stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::map, std::shared_ptr> listeners_; + + /** + * the platform services instance. + * may be null if the event hub was destructed or the module is unregistered. + * + * synchronized on mutex_. + */ + std::weak_ptr platform_services_; + + /** + * a queue of callbacks that need to be executed in Idle(), ProcessEvent(), or NotifyListeners(). + * + * synchronized on mutex_. + */ + std::deque> pending_callbacks_; + + /** + * @private + * + * Task executor for this module. + * + * synchronized on mutex_. + */ + std::shared_ptr task_executor_; + + /** + * @private + * + * Is a task with `options.required_for_unregistration` set to false currently executing? + * + * synchronized on mutex_. + */ + bool normal_task_is_executing_; + }; + + + + /** + * Options for Module::AddTaskToQueue(). POD class. + * + * @see Module::AddTaskToQueue() + */ + class ModuleTaskOptions { + public: + /** + * If true, this task can execute after UnregisterModule() has been called. + * If false, this task will be cancelled after UnregisterModule() (if it has not already started + * and/or completed). + * + * @see Module::AddTaskToQueue() + */ + bool required_for_unregistration = false; + }; + + /** + * Namespace that contains SdkError codes. @see SdkError + */ + namespace ErrorCodes { + constexpr static const char* MODULE_INVALID_STATE = + "module.invalid_state"; ///< Module is in an invalid state to perform the desired operation + } + +} + + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + std::shared_ptr Module::CreateDispatcher() { + // If you get an error on the following line, you need to make sure the type you pass + // into CreateDispatcher is a subclass of ModuleEventDispatcherBase. + static_assert(std::is_base_of::value, + "Type of TDispatcher must be derived from ModuleEventDispatcherBase."); + + static_assert(std::is_default_constructible::value, "TDispatcher must be default constructible."); + auto instance = std::make_shared(); + RegisterDispatcher(instance); + return instance; + } + + template + void Module::RegisterProcessor() { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterProcessor is a subclass of ModuleEventProcessorBase. + static_assert(std::is_base_of::value, + "Type of TProcessor must be derived from ModuleEventProcessorBase."); + + static_assert(std::is_default_constructible::value, "TProcessor must be default constructible."); + RegisterProcessor(std::make_shared()); + } + + template + void Module::RegisterListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source) { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterListener is a subclass of ModuleEventListenerBase. + static_assert(std::is_base_of::value, + "Type of TListener must be derived from ModuleEventListenerBase."); + + static_assert(std::is_default_constructible::value, "TListener must be default constructible."); + RegisterListener(std::make_shared(), event_type, event_source, std::string{}); + } + + template + void Module::RegisterWildCardListener() { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterListener is a subclass of ModuleEventListenerBase. + static_assert(std::is_base_of::value, + "Type of TListener must be derived from ModuleEventListenerBase."); + + static_assert(std::is_default_constructible::value, "TListener must be default constructible."); + RegisterListener(std::make_shared(), EventType::WILDCARD, EventSource::WILDCARD, std::string{}); + } + +} + +#endif //ADOBEMOBILE_CORE_MODULE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h new file mode 100755 index 00000000..6ca2046a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h @@ -0,0 +1,139 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H +#define ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H + +#include "ModuleEventDispatcherBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventDispatcher + * + * ModuleEventDispatcher is the base class for event dispatchers. ModuleEventDispatchers transform + * module-specific data into Events and dispatch them on the event hub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a dispatcher, derive from ModuleEventDispatcher: + * + * class MyDispatcher : public ModuleEventDispatcher { + * public: + * MyDispatcher() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * // a module-specific method + * void SendMyEvent() { + * auto event = EventBuilder{"Configure with AppId", EventType::CONFIGURATION, EventSource::REQUEST_CONTENT} + * .Build(); + * Dispatch(event); + * } + * }; + * + * To register a dispatcher, call Module::CreateDispatcher(): + * + * class MyModule : public Module { + * std::shared_ptr my_dispatcher_; + * + * void OnRegistered() override { + * my_dispatcher_ = CreateDispatcher(); + * my_dispatcher_->SendMyEvent(); + * } + * }; + * + * Registration + * ============ + * Module::CreateDispatcher() can be used to create a dispatcher. + * + * Registration completes asynchronously. After Module::CreateDispatcher() is called, + * ModuleEventDispatcher::OnRegistered() will be called asynchronously to notify the dispatcher that it is + * registered. Subclasses should perform initialization within this method. + * + * Unregistration + * ============== + * A dispatcher can be unregistered in several different ways: + * + * - If a module is unregistered via Module::UnregisterModule(), all dispatchers for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their dispatchers will be unregistered + * + * Unregistration completes asynchronously. ModuleEventDispatcher::OnUnregistered() will be called asynchronously + * to notify the dispatcher that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventDispatcher::OnRegistered() and + * ModuleEventDispatcher::OnUnregistered(), will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many listeners can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventDispatcher : public ModuleEventDispatcherBase { + // If you get an error on the following line, you need to make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventDispatcherBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventDispatcher(); + }; +} + + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventDispatcher::ModuleEventDispatcher() {} + + template + std::shared_ptr + ModuleEventDispatcher::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventDispatcherBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h new file mode 100755 index 00000000..94f72ef3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h @@ -0,0 +1,162 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class EventHub; + class Module; + + /** + * Base class for all event dispatchers. In most cases, subclasses should derive from + * ModuleEventDispatcher instead of deriving from this class directly. + */ + class ModuleEventDispatcherBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventDispatcherMethods; // For testing + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventDispatcherBase(); + + /** + * Dispatches an event to the associated EventHub. + * + * @param event - the Event to dispatch + */ + ADOBE_VIRTUAL_FOR_TESTS void Dispatch(const std::shared_ptr& event); + + /** + * This method is invoked shortly after the dispatcher is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::CreateDispatcher() + * is called. This call is guaranteed to occur after Module::OnRegistered. + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the dispatcher is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This call is guaranteed to occur before Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(std::shared_ptr parent_module, + const std::shared_ptr& event_hub); + + /** + * @private + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * the parent module's event hub + */ + std::weak_ptr event_hub_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h new file mode 100755 index 00000000..f72c9e19 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h @@ -0,0 +1,148 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H +#define ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H + +#include "ModuleEventListenerBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventListener + * + * ModuleEventListener is the base class for event listeners. ModuleEventListeners hear and react to Events + * that are dispatched through the EventHub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a listener, derive from ModuleEventListener: + * + * class MyListener : public ModuleEventListener { + * public: + * MyListener() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * void Hear(const std::shared_ptr& event) override { + * // do something when event occurs + * } + * }; + * + * To register a listener, call Module::RegisterListener(): + * + * class MyModule : public Module { + * void OnRegistered() override { + * RegisterListener(EventSource::SOME_VALUE, EventType::SOME_VALUE); + * } + * }; + * + * Registration + * ============== + * Module::RegisterListener() can be used to register a listener for a given event type or event source. + * + * Registration completes asynchronously. After Module::RegisterListener() is called, + * ModuleEventListener::OnRegistered() will be called asynchronously to notify the listener that it is + * registered. Subclasses should perform initialization within this method. + * + * A module may only have a single listener for a given event type and source. + * + * Alternatively, one time listeners can be registered to react once to a single, specific event. + * @see Module::RegisterOneTimeListenerBlock. + * + * Responding to Events + * ==================== + * When an event is dispatched, any registered listeners will receive notification that the event occurred + * via ModuleEventListenerBase::Hear(). Subclasses should override this method to react appropriately to + * Events. + * + * Unregistration + * ============== + * A listener can be unregistered in several different ways: + * + * - Explicitly, via Module::UnregisterListener() + * + * - If a different listener is registered for the same event type and source, the old listener will be + * unregistered prior to registering the new listener. + * + * - If a module is unregistered via Module::UnregisterModule(), all listeners for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their listeners will be unregistered + * + * Unregistration completes asynchronously. ModuleEventListener::OnUnregistered() will be called asynchronously + * to notify the listener that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventListener::OnRegistered(), ModuleEventListener::OnUnregistered(), + * and ModuleEventListener::Hear() will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many listeners can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventListener : public ModuleEventListenerBase { + // If you get an error on the following line, make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + public: + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventListenerBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventListener(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventListener::ModuleEventListener() {} + + template + std::shared_ptr + ModuleEventListener::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventListenerBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h new file mode 100755 index 00000000..813ecb47 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h @@ -0,0 +1,215 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class Module; + class EventType; + class EventSource; + + /** + * Base class for all event listeners. In most cases, subclasses should derive from + * ModuleEventListener instead of deriving from this class directly. + * + * @see ModuleEventListener + */ + class ModuleEventListenerBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventListenerMethods; // For testing + + public: + /** + * @returns the event type this listener is listening for + */ + ADOBE_VIRTUAL_FOR_TESTS const std::shared_ptr& GetEventType(); + + /** + * @returns the event source this listener is listening for + */ + ADOBE_VIRTUAL_FOR_TESTS const std::shared_ptr& GetEventSource(); + + /** + * Called when an event matching the EventType and EventSource of this listener is + * received on the EventHub that this listener is registered with. + * + * @param event - the event that was received. + */ + virtual void Hear(const std::shared_ptr& event) = 0; + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventListenerBase(); + + /** + * This method is invoked shortly after the listener is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * THREADING + * ========= + * @see Module for threading guarantees. + * + * ORDERING + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::RegisterListener() + * is called. This call is guaranteed to occur after Module::OnRegistered + * and before the ModuleEventListenerBase::Hear(...) is called + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the listener is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * THREADING + * ========= + * @see Module for threading guarantees. + * + * ORDERING + * ======== + * This method is guaranteed to be called once, asynchronously, after the listener is + * unregistered via Module::UnregisterListener(), Module::RegisterListener(), or + * Module::UnregisterModule() is called. This call is guaranteed to occur before + * Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + * Made public for testing listener in isolation. In production treat as private access. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(const std::shared_ptr& parent_module, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + /** + * @private + * + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + /** + * @private + * + * @returns true if this is a one time listener + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsOneTime(); + + /** + * @private + * + * Actual implementation of GetParentModule, present and virtual to enable mocking. + * + * @returns the parent module + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * + * the event type this listener is listening for + */ + std::shared_ptr event_type_; + + /** + * @private + * + * the event source this listener is listening for + */ + std::shared_ptr event_source_; + + /** + * @private + * + * is this a one time listener? + */ + bool is_one_time_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h new file mode 100755 index 00000000..29c9d269 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h @@ -0,0 +1,139 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTPROCESSOR_H +#define ADOBEMOBILE_CORE_MODULEEVENTPROCESSOR_H + +#include "ModuleEventProcessorBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventProcessor + * + * ModuleEventProcessor is the base class for event processors. ModuleEventProcessors can transform + * or can events that are dispatched through the EventHub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a processor, derive from ModuleEventProcessor: + * + * class MyModuleEventProcessor : public ModuleEventProcessor { + * public: + * MyModuleEventProcessor() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * std::shared_ptr Process(const std::shared_ptr& event) override { + * // do something when event occurs + * // this example just forwards the event: + * return event + * } + * }; + * + * To register a processor, call Module::RegisterProcessor(): + * + * class MyModule : public Module { + * void OnRegistered() override { + * RegisterProcessor(); + * } + * }; + * + * Registration + * ============ + * Module::RegisterProcessor() can be used to register a processor for a given event type or event source. + * + * Registration completes asynchronously. After Module::RegisterProcessor() is called, + * ModuleEventProcessor::OnRegistered() will be called asynchronously to notify the processor that it is + * registered. Subclasses should perform initialization within this method. + * + * Processing Events + * ================= + * When an event is dispatched, any registered processors will receive a chance to intercept and replace, + * transform the event via ModuleEventProcessorBase::Process(). Subclasses should override this method. + * + * Unregistering a Processor + * ======================== + * A processor can be unregistered in several different ways: + * + * - If a module is unregistered via Module::UnregisterModule(), all processors for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their processors will be unregistered + * + * Unregistration completes asynchronously. ModuleEventProcessor::OnUnregistered() will be called asynchronously + * to notify the processor that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventProcessor::OnRegistered(), ModuleEventProcessor::OnUnregistered(), + * and ModuleEventProcessor::Process() will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many processors can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventProcessor : public ModuleEventProcessorBase { + // If you get an error on the following line, you need to make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventProcessorBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventProcessor(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventProcessor::ModuleEventProcessor() {} + + template + std::shared_ptr + ModuleEventProcessor::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventProcessorBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h new file mode 100755 index 00000000..e5c41040 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h @@ -0,0 +1,149 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTPROCESSORBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTPROCESSORBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class Module; + + /** + * Base class for all event procesors. In most cases, subclasses should derive from + * ModuleEventProcessor instead of deriving from this class directly. + */ + class ModuleEventProcessorBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventProcessorMethods; // For testing + + public: + virtual std::shared_ptr Process(const std::shared_ptr& event) = 0; + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventProcessorBase(); + + /** + * This method is invoked shortly after the processor is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::RegisterProcessor() + * is called. This call is guaranteed to occur after Module::OnRegistered. + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the processor is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This call is guaranteed to occur before Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(const std::shared_ptr& parent_module); + + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + /** + * @private + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBESDK_CORE_MODULEEVENTPROCESSORBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h new file mode 100755 index 00000000..5768e351 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ +#define ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ + +#include +#include +#include +#include "HttpConnectionConstants.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class NetworkConnectionUtil : public Object { + public: + /** + * Searches through RECOVERABLE_NETWORK_ERROR_CODES to find the given error_code + * + * @param error_code error code to check for recoverability + * @returns true if error_code is a recoverable network error + */ + static bool IsRecoverableNetworkError(int32_t error_code); + + /** + * Returns the default headers for connection: Accept-Language(locale), Content-Type, User-Agent + * @param locale active locale from platform + * @param content_type the custom content type string + * @return map with the specified keys and values + */ + static std::map GetHeaders(const std::string& locale, + const std::string& content_type = ""); + /** + * Get the name of the given locale in a string format suitable for HTTP's Accept-Language header. + * The returned format is - where is two or three lowercase characters and + * is two uppercase characters. + * + * Reference: https://www.w3.org/International/articles/language-tags/ + * + * @param locale the active locale object + * @return Locale as string + */ + static std::string GetLocaleString(const std::locale& locale); + + protected: + + /** + * Get the name of the given locale in a string format suitable for HTTP's Accept-Language header. + * The returned format is - where is two or three lowercase characters and + * is two uppercase characters. + * + * Reference: https://www.w3.org/International/articles/language-tags/ + * + * @param locale as a string object + * @return Locale as string + */ + static std::string GetLocaleString(const std::string& locale); + + private: + static const std::vector RECOVERABLE_NETWORK_ERROR_CODES; + }; +} +#endif /* ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h new file mode 100755 index 00000000..06eee7be --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h @@ -0,0 +1,151 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* NETWORK_UNSUPPORTED_HTTP_COMMAND_TYPE = + "network.unsupported_http_command_type"; ///< Unsupported http command type + } + + /** + * Currently supported command types are GET/POST + **/ + enum class HttpCommandType : int32_t { + GET, + POST + }; + + class HttpConnectionDataInterface : public virtual ObjectInterface { + public: + /** + * Returns application server response as raw data from the connection, if available + * + * @param bytes_to_read the number of bytes that need to be read in the buffer + * @param output_buffer allocated buffer where the response raw data will be copied + * @return the number of bytes that were written in the read_buffer + */ + virtual uint64_t GetData(uint64_t bytes_to_read, uint8_t* output_buffer) const = 0; + + /** + * Returns application server response raw data size + * + * @return the size to be read + */ + virtual uint64_t GetSize() const = 0; + }; + + class HttpConnectionInterface : public virtual ObjectInterface { + public: + /** + * Returns application server response as string from the connection, if available. + * + * @return std::string Network response + */ + virtual std::string GetResponse() const = 0; + + /** + * Returns application server response as HttpConnectionDataInterface from the connection + * + * @return HttpConnectionDataInterface containing the network response + */ + virtual std::shared_ptr GetResponseRawData() const = 0; + + /** + * Returns the connection attempt responseCode for the connection request. + * @return int32_t The status code + */ + virtual int32_t GetResponseCode() const = 0; + + /** + * Returns a connection attempt response message, if available. + * @returns std::string The status code string + */ + virtual std::string GetResponseMessage() const = 0; + + /** + * Returns a value for the response property key that might have been set when a connection was made to the resource pointed to by the Url. + * + * This is protocol specific. For example, HTTP urls could have properties like "last-modified", or "ETag" set. + * + * @param response_property_key Any additional property key sent in response when requesting a connection to the url. This will be dependent on the protocol used. + * @return std::string corresponding to the response property value for the key specified, or empty string, if the key does not exist. + */ + virtual std::string GetResponsePropertyValue(const std::string& response_property_key) const = 0; + + /** + * Close this connection + */ + virtual void Close() const = 0; + }; + + class NetworkServiceInterface : public virtual ObjectInterface { + public: + /** Connect to a url + * + * @param url The full url for connection + * @param command Http command. For example "POST", "GET" etc. + * @param connect_payload Payload to send to the server + * @param request_property Any additional key value pairs to be used while requesting a + * connection to the url. This will be dependent on the protocol used. + * @param connect_timeout timeout value in seconds. + * @param read_timeout The timeout that will be used to wait for a read to finish after a successful connect. + * + * @return A HttpConnectionInterface instance, representing a connection attempt. + */ + virtual std::shared_ptr ConnectUrl(const std::string& url, + const HttpCommandType& command, + const std::string& connect_payload, + const std::map& request_property, + const std::chrono::seconds connect_timeout, + const std::chrono::seconds read_timeout) = 0; + + /** + * Async variation of the ConnectUrl api, that will deliver the result through the callback. + * + * @param url The full url for connection + * @param command Http command. For example "POST", "GET" etc. + * @param connect_payload Payload to send to the server + * @param request_property Any additional key value pairs to be used while requesting a + * connection to the url. This will be dependent on the protocol used. + * @param connect_timeout timeout value in seconds. + * @param read_timeout The timeout that will be used to wait for a read to finish after a successful connect. + * @param result_callback Callback that will receive the HttpConnectionInterface instance after the connection has been made. + * + */ + virtual void ConnectUrlAsync(const std::string& url, + const HttpCommandType& command, + const std::string& connect_payload, + const std::map& request_property, + const std::chrono::seconds connect_timeout, + const std::chrono::seconds read_timeout, + const std::function&)>& result_callback) = 0; + + }; +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Object.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Object.h new file mode 100755 index 00000000..0428605c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Object.h @@ -0,0 +1,148 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_OBJECT_H +#define ADOBEMOBILE_CORE_OBJECT_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @class Object + * Object is the root base class for most classes in the SDK. + * + * WHEN TO DERIVE FROM OBJECT + * -------------------------- + * + * Most classes in the SDK should be derived from Object (either directly or via a base class). Generally, if a class is not an interface, + * enum class, or a POD class, it should derive from Object. + * + * More formally, the following classes must be derived from Object: + * - Any class that has any data members, except POD classes. A POD class is a struct with no inheritance or virtual members. + * - Any class that is intended to be used as a base class, except pure virtual classes (interfaces). Pure virtual classes should + * be derived from ObjectInterface. + * + * HOW TO DERIVE FROM OBJECT + * ------------------------- + * + * When defining a direct subclass of Object, public non-virtual inheritance must be used: + * + * class MyClass : public Object { + * }; + * + * The same is true for descendent classes: + * + * class A : public Object {}; + * class B : public A {}; // <-- public non-virtual inheritance + * + * Subclasses must derive from Object exactly once. That is, multiple inheritance from Object is not allowed: + * + * class A : public Object {}; + * class B : public Object {}; + * class C : public A, public B {}; // <-- NOT ALLOWED!!! + * + * WHY DERIVE FROM OBJECT + * ---------------------- + * + * Object provides subclasses a number of benefits: + * - Objects are compatible with ObjectToSharedPtr, which retrieves a shared_ptr from a raw ptr in a safe way. + * - Objects get all the benefits of Object Interface, including: + * - Preventing common C++ errors. Subclasses automatically have a virtual destructor and do not generate the copy and move functions. + * - Allows instances to be treated polymorphically, which allows instances to be stored into maps and other data structures. + * + * + * CREATING AND PASSING AROUND OBJECTS + * ----------------------------------- + * + * Objects are typically created on the heap, using std::make_shared: + * + * class A : public Object { + * public: + * A(); + * SomeMethod(); + * }; + * + * void foo() { + * auto anInstanceOfA = std::make_shared(); + * anInstanceOfA->SomeMethod(); + * } + * + * Some classes may provide factory functions to create instances. + * + * Objects are intended be passed by pointer or reference: + * + * class A : public Object { + * public: + * A(); + * SomeMethod(); + * }; + * + * void foo() { + * auto anInstanceOfA = std::make_shared(); + * bar(*anInstanceOfA); + * } + * + * void bar(A& anInstanceOfA) { + * anInstanceOfA->SomeMethod(); + * } + * + * CONVERTING REFERENCES AND RAW PTRS TO SHARED PTRS + * ------------------------------------------------- + * + * To convert an Object pointer or reference to a std::shared_ptr, use ObjectToSharedPtr: + * + * class A : public Object {}; + * + * void example1(A* a) { + * auto aSharedPtr = ObjectToSharedPtr(*a); // aSharedPtr is a std::shared_ptr + * } + * + * void example2(A& a) { + * auto aSharedPtr = ObjectToSharedPtr(a); // aSharedPtr is a std::shared_ptr + * } + * + * EQUALITY + * -------- + * AdobeMarketingMobile::IsEqual(...) can be used to check if two objects are equal. Subclasses + * can override Object::Equals to provide a custom definiton of equality. See ObjectInterface. + */ + class Object : + public std::enable_shared_from_this, + public virtual ObjectInterface { + public: + Object() {} + + /** + * @see ObjectInterface + */ + bool Equals(const ObjectInterface& right) const override; + + /** + * @see ObjectInterface + */ + std::shared_ptr SharedPtrToThisObjectInterface() override final; + + /** + * @see StringUtils::ToString() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; +} + +#endif //ADOBEMOBILE_CORE_OBJECT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h new file mode 100755 index 00000000..9398f230 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h @@ -0,0 +1,311 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_OBJECTINTERFACE_H +#define ADOBEMOBILE_CORE_OBJECTINTERFACE_H + +#include + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * @class ObjectInterface + * ObjectInterface is the root base class for pure virtual interfaces (Java-style interfaces) in the SDK. + * + * HOW TO IMPLEMENT AN INTERFACE + * ----------------------------- + * + * When implementing an interface, PUBLIC VIRTUAL inheritance must be used for interface: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual ObjectInterface {}; + * class ABImplementation : + * public Object, // <-- Object inheritance is public non-virtual + * public virtual AInterface, // <-- interface inheritance is public virtual + * public virtual BInterface // <-- interface inheritance is public virtual + * {} + * + * WHEN TO DERIVE FROM OBJECT INTERFACE + * ------------------------------------ + * + * All pure virtual classes should be derived from Object (either directly or via a base class). + * + * Pure virtual classes may not have any data members. A class that defines data members should be derived + * from Object or be a POD class. See Object for additional details. + * + * HOW TO DERIVE FROM OBJECT INTERFACE + * ----------------------------------- + * + * When defining a direct subclass of ObjectInterface, PUBLIC VIRTUAL inheritance must be used: + * + * Example: + * + * class MyInterface : public virtual ObjectInterface { + * }; + * + * The same is true for descendent classes: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual AInterface {}; // <-- public virtual inheritance + * + * Multiple inheritance from Object Interface is allowed, but again must be public virtual: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual ObjectInterface {}; + * class CInterface : public virtual AInterface, public virtual BInterface {}; // <-- public virtual inheritance + * + * WHY DERIVE FROM OBJECT INTERFACE + * -------------------------------- + * + * ObjectInterface provides subclasses a number of benefits: + * - ObjectInterface prevents common C++ errors. Subclasses automatically have a virtual destructor and do not generate the copy and move functions. + * - Subclasses are automatically compatible with ObjectToSharedPtr, which lets you get a shared_ptr from a raw ptr in a safe way. + * - Instances can be treated polymorphically, which allows them to be stored into maps and other data structures. + * + * PASSING AROUND INSTANCES + * ------------------------ + * + * ObjectInterfaces are intended be passed by pointer or reference. + * + * CONVERTING REFERENCES AND RAW PTRS TO SHARED PTRS + * ------------------------------------------------- + * + * To convert an ObjectInterface pointer or reference to a std::shared_ptr, use ObjectToSharedPtr: + * + * class AInterface : public virtual ObjectInterface {}; + * + * void example1(AInterface* a) { + * auto aSharedPtr = ObjectToSharedPtr(*a); // aSharedPtr is a std::shared_ptr + * } + * + * void example2(AInterface& a) { + * auto aSharedPtr = ObjectToSharedPtr(a); // aSharedPtr is a std::shared_ptr + * } + * + * EQUALITY + * -------- + * AdobeMarketingMobile::IsEqual(...) can be used to check if two interface instances are equal. See + * ObjectInterface::Equals(...) and AdobeMarketingMobile::IsEqual(...). + */ + class ObjectInterface { + public: + virtual ~ObjectInterface() {} + + /** + * ObjectInterfaces are not copyable, as they should be passed by pointer or reference. + * Subclasses that need copy functionality should add a method to the subclass that will perform the copy. + */ + ObjectInterface(const ObjectInterface&) = delete; + ObjectInterface& operator=(const ObjectInterface&) = delete; + + /** + * ObjectInterfaces are not movable, as they should be passed by pointer or reference. + * Subclasses that need move functionality should add a method to the subclass that will perform the move. + */ + ObjectInterface(ObjectInterface&&) = delete; + ObjectInterface&& operator=(ObjectInterface&&) = delete; + + /** + * Instead of calling this function directly, since IsEqual checks for null. + * + * Subclasses can override this to provide a custom definition of equality. When implementing Equals, it is + * suggested that implementers: + * - Make sure that the operation is order independent: `this.Equals(someObject) == someObject.Equals(*this);` + * - If necessary, check the type of right using `dynamic_cast(right)` and comparing against nullptr. + * + * The default implementation of Object::Equals is true only if both objects are the same instance. + * + * Example: + * + * class Person : public Object { + * public: + * explicit Person(const std::string& name) : name_{ name } {} + * + * bool Equals(const ObjectInterface& right) override { + * const Person* rightPerson = dynamic_cast(right); + * return right != nullptr && // right must be a Person + * rightPerson.name_ == name; // right must have the same name as this + * } + * }; + */ + virtual bool Equals(const ObjectInterface& right) const = 0; + + /** + * Internal use only. See ObjectToSharedPtr for a method that will convert raw ptrs to smart ptrs. + * Returns a std::shared_ptr to this. + */ + virtual std::shared_ptr SharedPtrToThisObjectInterface() = 0; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this)`. + * + * @return a string respresentation of this + * + * @see StringUtils::ToString() + */ + std::string ToString() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this, options)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString(const ToStringOptions& options) const; + + /** + * Called by StringUtils::ToString() to actually convert this object to a string. Only subclasses and + * StringUtils::ToString() should invoke this method. Others should not invoke this method directly, and instead + * call StringUtils::ToString() to conver this object to a string. + * + * Subclasses can override this method to provide a custom string representation. To get the superclass string + * representation implementations should invoke ToStringImpl on their base class directly. Objects are + * encouraged to format their representations as JSON. + * + * @see StringUtils::ToString() + * + * @param options - options for the string representation + * + * @return a string representation of this + */ + virtual std::string ToStringImpl(const ToStringOptions& options) const = 0; + + protected: + ObjectInterface() {} + }; + + /** + * Converts an instance to a std::shared_ptr. Useful for converting this or other raw ptrs to shared_ptrs. + * + * Argument must be an instance derived from Object or Object Interface. See Object Interface. + */ + template + std::shared_ptr ObjectToSharedPtr(T& o); + template<> + std::shared_ptr ObjectToSharedPtr(ObjectInterface& o); + + /** + * bool IsEqual(left, right) compares two Objects (or ObjectInterfaces) and returns true if left.Equals(right). + * + * See ObjectInterface for information on how to correctly implement Object::Equals. + * + * IsEqual accepts multiple different types for left and right. left and right can be: + * - Object/ObjectInterface instances (or subclasses), + * - shared_ptrs to Objects/ObjectInterfaces (or subclasses) + * - raw pointers to Objects/ObjectInterfaces (or subclasses) + * + * If left and right are pointers or shared_ptrs, nullptr values will be treated specially. If both left and right are nullptr, + * IsEqual returns true. If only one of left or right is nullptr, IsEqual returns false. + * + * Examples: + * + * class Person : public Object { + * public: + * explicit Person(const std::string& name) : name_{ name } {} + * + * bool Equals(const ObjectInterface& right) override { + * const Person* rightPerson = dynamic_cast(right); + * return right != nullptr && // right must be a Person + * rightPerson.name_ == name; // right must have the same name as this + * } + * }; + * + * void AnExampleUsage() { + * std::shared_ptr fred1 = std::make_shared("fred"); + * std::shared_ptr fred2 = std::make_shared("fred"); + * std::shared_ptr susan = std::make_shared("susan"); + * std::shared_ptr rock = std::make_shared(); + * std::shared_ptr nullPointer; + * + * IsEqual(fred1, fred1); // true + * IsEqual(fred1, susan); // false + * IsEqual(fred1, rock); // false + * IsEqual(fred1, fred2); // returns true because IsEqual compares by name + * IsEqual(fred1, nullPointer); // false + * IsEqual(nullPointer, nullPointer); // true + * + * // you can also pass in Object instances directly + * IsEqual(*fred1, *fred2); // false + * IsEqual(*fred1, *rock); // false + * + * // ... or raw ptrs to Objects + * IsEqual(fred1.get(), fred2.get()); // false + * IsEqual(fred1.get(), rock.get()); // false + * IsEqual(fred1.get(), nullptr); // false + * } + */ + template + bool IsEqual(const std::shared_ptr& left, const std::shared_ptr& right); + template + bool IsEqual(const TLeft* left, const std::shared_ptr& right); + template + bool IsEqual(const std::shared_ptr& left, const TRight* right); + bool IsEqual(const ObjectInterface* left, const ObjectInterface* right); + bool IsEqual(const ObjectInterface& left, const ObjectInterface& right); + + /** + * @private + * + * `ToStringImpl` for `ObjectInterface`. + */ + void ToStringImpl(std::ostream& the_stream, const ObjectInterface& value, const ToStringOptions& options); +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + template + std::shared_ptr ObjectToSharedPtr(T& o) { + static_assert(std::is_base_of::value, "Type of o must be derived from ObjectInterface."); + return std::dynamic_pointer_cast(o.SharedPtrToThisObjectInterface()); + } + + template + bool IsEqual(const std::shared_ptr& left, const std::shared_ptr& right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left.get(), right.get()); + } + + template + bool IsEqual(const TLeft* left, const std::shared_ptr& right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left, right.get()); + } + + template + bool IsEqual(const std::shared_ptr& left, const TRight* right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left.get(), right); + } +} + +#endif //ADOBEMOBILE_CORE_OBJECTINTERFACE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h new file mode 100755 index 00000000..8707a9c5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h @@ -0,0 +1,59 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_ONETIMELISTENER_H +#define ADOBEMOBILE_CORE_ONETIMELISTENER_H + +#include +#include "ModuleEventListenerBase.h" + +namespace AdobeMarketingMobile { + class Module; + + /** + * @class OneTimeListener + * Used to wrap a Module.OneTimeListenerBlock in an EventListener so it can be added to an EventHub. + * + * Do not use directly. @see Module::RegisterOneTimeListenerBlock. + */ + class OneTimeListener : public ModuleEventListenerBase { + friend class Module; + + public: + /** + * @see ModuleEventListenerBase::Hear + */ + void Hear(const std::shared_ptr& event) override final; + + private: + /** + * @private + * Constructor. + * For use by Module only. + */ + explicit OneTimeListener(const std::function&)>& block); + + /** + * @private + * the block this listener should execute. + */ + std::function&)> block_; + }; +} + +#endif //ADOBEMOBILE_CORE_ONETIMELISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h new file mode 100755 index 00000000..2486c97b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h @@ -0,0 +1,36 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H +/** + * Peripheral Service (callback) Interface definition in C++ + * This defined a callback interface for the peripheral services +**/ +namespace AdobeMarketingMobile { + class PeripheralServiceInterface: public virtual ObjectInterface { + + // public: + // enum class PeripheralType : int { + // BLUETOOTH, + // }; + // // callback function + // virtual int cbCallbackFunction(int) = 0; + }; +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h new file mode 100755 index 00000000..f8d2023b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h @@ -0,0 +1,191 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H + +#include +#include +#include "ObjectInterface.h" +#include "Expected.h" + +namespace AdobeMarketingMobile { + + class LoggingServiceInterface; + class NetworkServiceInterface; + class DatabaseServiceInterface; + class SystemInfoServiceInterface; + class UIServiceInterface; + class JsonUtilityServiceInterface; + class FileSystemServiceInterface; + class LocalStorageServiceInterface; + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class EncodingServiceInterface; + class URLServiceInterface; + class CompressedFileServiceInterface; + + /** + * This is part of what defines the SDK's platform agnostic interface APIs to the native language services + **/ + class PlatformServicesInterface : public virtual ObjectInterface { + public: + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + /** + * Returns the Logging service implementation from the Platform. + * + * @return LoggingService implementation, if the platform provides any. null otherwise. + * + * @see LoggingService + */ + virtual std::shared_ptr GetLoggingService() const = 0; + + /** + * Returns the Network service implementation from the Platform. + * + * @return NetworkService implementation, if the platform provides any. null otherwise. + * + * @see NetworkService + */ + virtual std::shared_ptr GetNetworkService() const = 0; + + /** + * Returns the Local Storage Service implementation from the Platform. + * + * @return LocalStorageService implementation, if the platform provides any. null otherwise. + * + * @see LocalStorageService + */ + virtual std::shared_ptr GetLocalStorageService() const = 0; + + /** + * Returns the Structured Data Service implementation from the Platform. + * + * @return DatabaseService implementation, if the platform provides any. null otherwise. + * + * @see DatabaseService + */ + virtual std::shared_ptr GetDatabaseService() const = 0; + + /** + * Returns the System Information service implementation from the Platform. + * + * @return SystemInfoService implementation, if the platform provides any. null otherwise. + * + * @see SystemInfoService + */ + virtual std::shared_ptr GetSystemInfoService() const = 0; + + /** + * Returns the UI Service implementation from the Platform. + * + * @return UIService implementation, if the platform provides any. null otherwise. + * + * @see UIService + */ + virtual std::shared_ptr GetUIService() const = 0; + + /** + * Returns the Json Utility service implementation from the Platform. + * + * @return JsonUtilityService implementation, if the platform provides any. null otherwise. + * + * @see JsonUtilityService + */ + virtual std::shared_ptr GetJsonUtilityService() const = 0; + + /** + * Returns the File System service from the Platform. The File System Service contains + * utility methods for dealing with directory manipulations. + * + * @return FileSystemService implementation if the platform provides any. Null otherwise. + * @see FileSystemService + */ + virtual std::shared_ptr GetFileSystemService() const = 0; + + /** + * Returns the Remote File Manager service from the Platform. + * The Remote File Manager Service replace the old RemoteDownloader+CacheManager functionality/ + * + * @return ptr to RemoteFileManagerServiceInterface or SdkError + * @see RemoteFileManagerService + */ + virtual Expected> GetRemoteFileManagerService() const = 0; + + /** + * Returns the Crypto Service service implementation from the Platform. + * + * @return CryptoService implementation, if the platform provides any. null otherwise. + * + * @see CryptoService + */ + virtual std::shared_ptr GetCryptoService() const = 0; + + /** + * Returns the Encoding Service implementation from the Platform. + * + * @return EncodingService implementation, if the platform provides any. null otherwise. + * + * @see EncodingService + */ + virtual std::shared_ptr GetEncodingService() const = 0; + + /** + * Returns the URL Service implementation from the Platform. + * + * @return URL implementation, if the platform provides any. null otherwise. + * + * @see URLService + */ + virtual std::shared_ptr GetURLService() const = 0; + + /** + * Returns the CompressedFileService implementation from the Platform. + * + * @return CompressedFileService implementation, if the platform provides any. null otherwise. + * + * @see CompressedFileService + */ + virtual std::shared_ptr GetCompressedFileService() const = 0; + + }; + + namespace ErrorCodes { + constexpr static const char* MISSING_PLATFORM_SERVICES = + "platform_services.missing_service"; ///< A missing platform service exception + + } + +} //namespace + + +#endif /* ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Query.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Query.h new file mode 100755 index 00000000..cd52fba3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Query.h @@ -0,0 +1,167 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_QUERY_H +#define ADOBEMOBILE_PLATFORMSHIM_QUERY_H + +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class Query; + + /** + * QueryBuilder class is POD type and is used to build a Query object. + */ + class QueryBuilder { + public: + /** + * Create a QueryBuilder object with required Query parameters + * + * @param table The table name to compile the query against + * @param columns A list of columns to return. Passing empty vector will return all columns + */ + explicit QueryBuilder(const std::string& table, const std::vector& columns); + + QueryBuilder(const QueryBuilder&) = delete; ///< delete default copy constructor + QueryBuilder& operator=(const QueryBuilder&) = delete; ///< delete assignment operator + QueryBuilder(QueryBuilder&&) = delete; ///< delete move constructor + QueryBuilder&& operator=(QueryBuilder&&) = delete; ///< delete move assignment operator + + /** + * Query selection + * + * @param selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing empty string will return all rows for the given table + * @param selection_args A list of selection args. You may include ?s in selection, which will be replaced by the values from selection_args, in order that they appear in the selection. The values will be bound as std::string + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Selection(const std::string& selection, const std::vector& selection_args); + + /** + * Group query result + * + * @param group_by A filter declaring how to group rows, formatted as an SQL GROUP BY clause (excluding the GROUP BY itself). Passing empty string will cause the rows to not be grouped + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& GroupBy(const std::string& group_by); + + /** + * Having clause for this query + * + * @param having A filter declaring which row groups to include in the cursor, if row grouping is being used, formatted as an SQL HAVING clause (excluding the HAVING itself). Passing empty string will cause all row groups to be included, and is required when row grouping is not being used + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Having(const std::string& having); + + /** + * Order result rows for this query's result + * + * @param order_by Indicates how to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing empty string will use the default sort order, which may be unordered + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& OrderBy(const std::string& order_by); + + /** + * Limit the number of rows in the query result + * + * @param limit Limits the number of rows returned by the query, formatted as LIMIT clause. Passing empty string denotes no LIMIT clause + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Limit(const std::string& limit); + + /** + * Build the Query object + * + * @return the Query object + */ + std::shared_ptr Build(); + + private: + void ThrowIfAlreadyBuilt(); + + std::shared_ptr query_; + bool did_build_; + + }; + + class Query : public Object { + friend class QueryBuilder; + public: + /** + * @return table name in this query + */ + std::string GetTable() const; + + /** + * @return table column names in this query + */ + std::vector GetColumns() const; + + /** + * @return SELECT clause in this query + */ + std::string GetSelection() const; + + /** + * @return SELECT clause arguments in this query + */ + std::vector GetSelectionArgs() const; + + /** + * @return GROUP BY clause in this query + */ + std::string GetGroupBy() const; + + /** + * @return HAVING clause in this query + */ + std::string GetHaving() const; + + /** + * @return ORDER BY clause in this query + */ + std::string GetOrderBy() const; + + /** + * @return LIMIT clause in this query. It can be used to constrain the number of rows returned. + */ + std::string GetLimit() const; + + private: + /** + * @private + * Constructor. Intended for use by QueryBuilder. + */ + Query() {} + + std::string table_; + std::vector columns_; + std::string selection_; + std::vector selection_args_; + std::string group_by_; + std::string having_; + std::string order_by_; + std::string limit_; + + }; + +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_QUERY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h new file mode 100755 index 00000000..d8ad72d6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h @@ -0,0 +1,72 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H +#define ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H + +#include +#include "Object.h" +#include "DatabaseServiceInterface.h" + +namespace AdobeMarketingMobile { + + class QueryStringBuilder : public Object { + public: + /** + * Builds a query string to create table with the given column names, data types and constraints. + * + * @param name table name + * @param column_names list of column names in the table + * @param column_data_types list of column data types for the table columns + * @param column_constraints list of column contrainsts for the table columns + * @return create table query string + */ + static std::string PrepareCreateTableQueryString(const std::string& name, + const std::vector& column_names, + const std::vector& column_data_types, + const std::vector>& column_constraints); + + private: + QueryStringBuilder(); ///< Private Constructor + + /** + * @private + * Fetches the list of column data types. + * + * @param column_data_types list of column data types + * @return column data types list with data types expressed as string + */ + static std::vector GetColumnDataTypes(const std::vector& + column_data_types); + + /** + * @private + * Fetches the list of column constraints. + * + * @param column_constraints list of column constraints + * @return column constraints list with constraints expressed as string + */ + static std::vector GetColumnConstraints(const std::vector>& + column_constraints); + + static const std::map COLUMN_DATA_TYPE_MAP; + static const std::map COLUMN_CONSTRAINT_MAP; + + }; +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h new file mode 100755 index 00000000..a5341172 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_RANDOMUTIL_H +#define ADOBEMOBILE_UTIL_RANDOMUTIL_H + +namespace AdobeMarketingMobile { + class RandomUtil { + public: + + /** + * Produces random integer values, uniformly distributed on the closed interval [0, n], it uses + * std::uniform_int_distribution + * + * @param n the upper bound for the distribution + * @return the generated random integer as string + */ + static std::string Rand(const uint64_t n); + + /** + * @see RandomUtil::Rand(int64_t) Distribution used is [0, UINT64_MAX] + */ + static std::string Rand(); + }; +} + +#endif /* ADOBEMOBILE_UTIL_RANDOMUTIL_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h new file mode 100755 index 00000000..344e0828 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h @@ -0,0 +1,318 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_RANGEDRESOLVER_H +#define ADOBEMOBILE_CORE_RANGEDRESOLVER_H + +#import +#import +#import "Log.h" +#import "Object.h" + +namespace AdobeMarketingMobile { + + /** + * @note This class is not thread-safe. It is strongly recommended to implement a locking scheme when calling any of these class methods. + * + * States will always be one of the following: + * + * - A `DATA` state is a normal, valid shared state. + * - The `PENDING` state is a state that is "on the way" and will eventually be resolved. + * - The `INVALID` state is a special state that indicates that the state is not valid. + * - The `NEXT` state is a special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + * - The `PREV` state is a special "marker" state that indicates that this state is equal to the previous state. + * + * Modules will be able to perform the following operations: + * + * - Create can insert a `DATA`, `PENDING`, or `INVALID` state. + * - Update can change a PENDING state to a... + * + DATA state upon successful asynchronous operations. + * + INVALID state for asynchronous operations that invalidate the shared state. + * + NEXT state for asynchronous operations that should return the next state. + * + PREV state for asynchronous operations that should revert to the previous state. + * - Get for a version v should... + * + If the state at version *v* is DATA, PENDING, or INVALID, return it. + * + If the state at version *v* is NEXT, return the first state after *v* that is either DATA, PENDING, or INVALID. + * + If there are no such states after *v*, return PENDING. + * + If the state at version *v* is PREV, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v* that is either DATA, PENDING, INVALID, or NEXT. + * + If there are no such states before *v*, return PENDING. + * + If no state has exactly version *v*, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v*. + * + If there are no such states before *v*, return PENDING. + * + * Notice that: + * - Get(*v*) will always return DATA, PENDING, or INVALID. + * - Only PENDING states can be updated. + * - Once a state is DATA or INVALID, Gets for that state will always return the same value. This prevents history from changing. + * + * Under this solution, asynchronous operations would typically follow this process: + * - Create(version, PENDING) + * - Initiate the operation + * - When the operation completes, + * + If the operation succeeds, Update(version, ) + * + Else (the operation failed): + * + If state should use the previous valid shared state, Update(version, PREV) + * + If state should use the next valid shared state, Update(version, NEXT) + * + If state should be invalid, Update(version, INVALID) + */ + template + class RangedResolver : public Object { + + public: + + /** + * @brief Creates a new Ranged Resolver instance. + * + * Creates a new RangedResolver instance using the given special marker objects. The special state markers + * must be unique with each other and should be unique within your system. + * + * @param pending_state a unique marker object indicating a state will eventuall be resolved + * @param invalid_state a unique marker object indication a state is not valid + * @param next_state a unique marker object indicating the state is equal to the next valid state + * @param previous_state a unique marker object indicating the state is equal to the previous valid state + */ + RangedResolver(const std::shared_ptr& pending_state, + const std::shared_ptr& invalid_state, + const std::shared_ptr& next_state, + const std::shared_ptr& previous_state); + + /** + * Deconstructs this Ranged Resolver. Clears the list of states. + */ + ~RangedResolver(); + + /** + * @brief Add new state for a specific version. + * + * Adds a new shared state to the list for the given version. + * Only adds the state if the version is greater than the previous state's version. + * Only adds the state if it is equal to DATA, PENDING, or INVALID. + * + * @param version the version of this state to add + * @param state the state to add + * @returns true if the state was added + */ + bool Add(const int32_t version, const std::shared_ptr& state); + + /** + * @brief Update an existing state. + * + * Update an existing PENDING state at the specified version. + * @note Only existing PENDING states may be updated. + * + * @param version the version of the state to update + * @param state the state to replace the existing state + * @returns true if the state was updated + */ + bool Update(const int32_t version, const std::shared_ptr& state); + + /** + * @brief Resolves the given version to a shared state. + * + * Resolves the given version by traversing the list of shared states, returning the appropriate state. + * + If the state at version *v* is DATA, PENDING, or INVALID, return it. + * + If the state at version *v* is NEXT, return the first state after *v* that is either DATA, PENDING, or INVALID. + * + If there are no such states after *v*, return PENDING. + * + If the state at version *v* is PREV, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v* that is either DATA, PENDING, INVALID, or NEXT. + * + If there are no such states before *v*, return PENDING. + * + If no state has exactly version *v*, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v*. + * + If there are no such states before *v*, return PENDING. + * + * @param version the version to resolve to a state + * @returns a state of either EventData, RangedResolver::PENDING, or RangedResolver::INVALID + */ + const std::shared_ptr& Get(const int32_t version); + + /** + * @brief Determines if there are any valid states contained within this RangedResolver. + * + * A valid state is any value other than INVALID, NEXT, or PREV. + * A PENDING state is considered valid as it is the expectation of data. + * + * @return true if this RangedResolver constains any value which is not INVALID, NEXT, or PREV + */ + bool ContainsValidState() const; + + private: + const std::shared_ptr& PENDING; ///< state that is "on the way" and will eventually be resolved. + const std::shared_ptr& + INVALID; ///< special "marker" state that indicates that this state is equal to the previous state. + const std::shared_ptr& + NEXT; ///< special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + const std::shared_ptr& PREV; ///< special state that indicates that the state is not valid. + + typedef typename std::map>::iterator states_it; ///< iterator type over states map + + /** + * Iterate over the map of states starting at the given states iterator to find the first valid state. + * Returns the state value (DATA, PENDING, or INVALID). + * If the state is equal to the end of the states map, returns PENDING. + * + * @param it an iterator + * @returns state value of DATA, PENDING, or INVALID + */ + const std::shared_ptr& Resolve(states_it it) const; + + std::map> states_; ///< map of state version and data + }; + +} + +////////////////////////////////// +// Template Method Definitions +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + RangedResolver::RangedResolver(const std::shared_ptr& pending_state, + const std::shared_ptr& invalid_state, + const std::shared_ptr& next_state, + const std::shared_ptr& previous_state) : + PENDING{pending_state}, + INVALID{invalid_state}, + NEXT{next_state}, + PREV{previous_state} { + + if (PENDING == INVALID + || PENDING == NEXT + || PENDING == PREV + || INVALID == NEXT + || INVALID == PREV + || PREV == NEXT) { + Log::Warning("RangedResolver", "Found equality between marker states! Pending(%p) Invalid(%p) Next(%p) Previous(%p)", + PENDING, INVALID, NEXT, PREV); + } + + // Add initial NEXT state at beginning of map + // May be replaced when adding a state to version 0 + states_.emplace(-1, NEXT); + } + + template + RangedResolver::~RangedResolver() { + states_.clear(); + } + + template + bool RangedResolver::Add(const int32_t version, const std::shared_ptr& state) { + // only add states of DATA, PENDING, or INVALID + if (state == NEXT || state == PREV) { + return false; + } + + if (version > states_.rbegin()->first) { + // Only add higher versions. + states_.emplace(version, state); + return true; + } + + return false; + } + + template + bool RangedResolver::Update(const int32_t version, const std::shared_ptr& state) { + // Update may only update PENDING states. + // Return false for updating PENDING with PENDING so it does not trigger a state change event. + if (state == PENDING) { + return false; + } + + auto it = states_.find(version); + + // Only allow updates to PENDING states + if (it != states_.end() && it->second == PENDING) { + it->second = state; + return true; + } + + return false; + } + + template + const std::shared_ptr& RangedResolver::Get(const int32_t version) { + + // returns an iterator to the first element not less than the given key (ie equal to or greater than) + auto it = states_.lower_bound(version); + + // didn't find state with given version number, return latest state (which is less than given version) + if (it == states_.end()) { + if (it != states_.begin()) { + return Resolve(std::prev(it)); // greatest shared state (version < event version) + + } else { + // found no shared states in module map of shared states (iterator equals both end() and begin()) + // this should not occur as the map is created with an initial value + return PENDING; + } + } + + // found state but but not exact match + if (it->first != version) { + if (it != states_.begin()) { + // given version doesn't have shared state, return state not higher than requested for version + return Resolve(std::prev(it)); + } + // only found states with higher versions than requested + } + + return Resolve(it); // exact match to event state or no lower states + + } + + template + bool RangedResolver::ContainsValidState() const { + auto it = states_.begin(); + + while (it != states_.end()) { + if (it->second != INVALID && it->second != NEXT && it->second != PREV) { + return true; // state is either DATA or PENDING + } + it = std::next(it); + } + + return false; // reached end with no valid entries + } + + template + const std::shared_ptr& RangedResolver::Resolve(states_it it) const { + // sanity check + if (it == states_.end()) { + return PENDING; + } + + // trace back through states + while (it->second == PREV) { + it = std::prev(it); + } + // trace forward through states. once we move forward we don't go back. + while ( it != states_.end() && (it->second == NEXT || it->second == PREV)) { + it = std::next(it); + } + + // off end of list and found no valid value + if (it == states_.end()) { + return PENDING; + } + + return it->second; + } + +} + + +#endif /* ADOBEMOBILE_CORE_RANGEDRESOLVER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h new file mode 100755 index 00000000..f71d62a8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h @@ -0,0 +1,154 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" +#include "Expected.h" + +namespace AdobeMarketingMobile { + + /* forward declaration */ + class NetworkServiceInterface; + + /* + * Errors specific to the RemoteFileManagerService Interface + */ + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* REMOTEFILEMANAGER_SERVICES_FAILURE{"remotefilemanager.services_failed"}; ///< One or more of the required services are not available. + constexpr static const char* REMOTEFILEMANAGER_REQUEST_FAILURE{"remotefilemanager.request_failed"}; ///< Network failure when requesting file. Response code available. + constexpr static const char* REMOTEFILEMANAGER_CACHE_FAILURE{"remotefilemanager.cache_failed"}; ///< File system failure when requesting file. File system error available. + } + + /* + * Helper class for returning remote file contents. + */ + class RemoteFileInterface : public virtual ObjectInterface { + public: + + /** + * Get local path to cached copy of remote file as a URI. + * This must be accessible to the HTML renderer we are using (e.g. for Messages). + * + * @return path to local cached file + */ + virtual std::string ToUri() = 0; + + /** + * Get the contents of the remote file as a JSON string. + * + * @return JSON data + */ + virtual std::string ReadJsonStringFromFile() = 0; + }; + + + /* + * This interface is intended to replace the current usage of RemoteDownloader and CacheManager. + * This higher level interface will be more flexible when porting cross-platform. + * + * Current usage patterns: + * 1. RemoteDownloader --> startDownload --> getFileForCachedURL --> onDownloadComplete --> readFromFile (and then convert to JSON) + * 2. RemoteDownloader --> startDownloadSync --> getFileForCachedURL --> readJSONFromFile + * 3. CacheManager --> getFileForCachedURL --> readJSONFromFile + * 4. CacheManager --> getFileForCachedURL --> getURL --> downloadAssetCollection --> HTML Renderer + * 5. RemoteDownloaded --> syncRemoteAssets --> deleteCachedUrlsNotInList + * + * You may encounter the following errors: + * HTTP response errors (e.g. something besides HTTP/200 OK) + * OS networking errors (e.g. network timeout) + * OS filesystem errors (e.g. someone deleted the cached file out from under us) + * + */ + class RemoteFileManagerServiceInterface : public virtual ObjectInterface { + public: + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + /** + * Asynchronously get the file corresponding to the url passed. + * If file was cached and we could not get an updated file, return the cached file. + * If file was NOT cached and we could not get the file, return an error. + * WARNING! The file may be returned on a different thread than the calling thread. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the remote file url. Schemes supported: https, http(?) + * @param completed - callback function called when download has completed or failed + */ + virtual void GetFileAsync(const std::string& cache_subfolder, + const std::string& url, + const std::function>&)>& completed) = 0; + + /** + * Synchronously get the file corresponding to the url passed. + * If file was cached and we could not get an updated file, return the cached file. + * If file was NOT cached and we could not get the file, return an error. + * WARNING! This call will block until the file is fully downloaded or errors out. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the url to look for the remote file at. Schemes supported: https, http(?) + * @return ptr to RemoteFileInterface or SdkError + */ + virtual Expected> GetFileSync(const std::string& cache_subfolder, + const std::string& url) = 0; + + /** + * Get a file from the cache using the url as the lookup key. Optionally ignore partially downloaded files. + * If file was not cached, return an error. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the remote file url. Schemes supported: https, http(?) + * @param ignore_partial_downloads - ignore files which are still being downloaded + * @return ptr to RemoteFileInterface or SdkError + */ + virtual Expected> GetFileFromCache(const std::string& cache_subfolder, + const std::string& url, + bool ignore_partial_downloads) = 0; + + /** + * Delete all urls from the cache that are not found in the list passed. + * If list is empty, all urls in the cache will be removed. + * If none of the urls in the list are in the cache, all urls in the cache will be removed. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param urls_to_retain - the remote file url. Schemes supported: https, http(?) + */ + virtual void DeleteCachedDataNotInList(const std::string& cache_subfolder, + const std::deque& urls_to_retain) = 0; + + }; + +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Rule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Rule.h new file mode 100755 index 00000000..d8d0fa6b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Rule.h @@ -0,0 +1,94 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULE_H +#define ADOBEMOBILE_RULESENGINE_RULE_H + +#include +#include +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class RuleCondition; + class RuleTokenParser; + class Event; + + /** + * @class Rule + * + * This class is the concrete rule implementation that encapsulates the rule conditions and consequences for each rule. + * + * This class holds all the necessary component instances to represent a rule in memory. + */ + class Rule : public Object { + + public: + + /** + * Creates an instance of a Rule. + * + * @param condition a RuleCondition object describing the conditional requirements of this rule. + * @param consequenceEvents a vector of Event objects to be published when the rule conditions are met. + */ + explicit Rule(const std::shared_ptr& condition, + const std::vector>& consequenceEvents); + + /** + * Evaluate the rule based on the condition data input. + * + * For example, consider the rule is configured with a matcher ("key1 = value1"). + * In this case, if the condition data contains a KV pair {"key", "value1"}, then this + * function will evaluate to true. + * + * @param rule_token_parser RuleTokenParser will be run through the evaluation matchers. + * @param event Event to be evaluated with the rule + * @return True, if the KV pairs contain data that match the rule matchers as configured. + */ + ADOBE_VIRTUAL_FOR_TESTS + bool EvaluateCondition(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const; + + /** + * Get all consequence events associated for the rule. + * @returns a vector of Event objects for this rule. + */ + ADOBE_VIRTUAL_FOR_TESTS + const std::vector>& GetConsequenceEvents() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + protected: + Rule() {}; // for mocking :( + + private: + + static const std::string RULE_JSON_CONDITIONS_KEY; + static const std::string RULE_JSON_CONSEQUENCES_KEY; + + std::vector> consequenceEvents_; ///< Events to publish when this rule evaluates to true + std::shared_ptr condition_; ///< the conditions which this rule applies (non-null) + + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h new file mode 100755 index 00000000..7cc7ebe0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h @@ -0,0 +1,210 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULECONDITION_H +#define ADOBEMOBILE_RULESENGINE_RULECONDITION_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonObject; + class Matcher; + class Variant; + class Event; + class RuleTokenParser; + + // ================================================================================ + // RuleCondition + // ================================================================================ + /** + * Base class for a Rule's condition, which are a set of conditions used to evaluate a rule. + */ + class RuleCondition : public Object { + public: + static const std::string RULE_CONDITION_TYPE_KEY_JSON; + static const std::string RULE_CONDITION_TYPE_GROUP_JSON; + static const std::string RULE_CONDITION_TYPE_MATCHER_JSON; + static const std::string RULE_CONDITION_DEFINITION_KEY_JSON; + + /** + * Evaluate the condition and return true if the condition holds, with the data that is supplied. + * + * @param rule_token_parser The {@link RuleTokenParser} for token expansion. + * @param event {@link Event} associated with the rule condition + * @return True, if the condition holds. False otherwise. + */ + virtual bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const = 0; + + /** + * Instantiate a Rule condition class. The condition types supported are "group" (Condition Group) and "matcher" (Condition Matcher). + * + * @param condition_json The json representing the rule condition. + * @return A {@link RuleCondition} instance. + * + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + */ + static std::shared_ptr RuleConditionFromJson(const std::shared_ptr& condition_json); + + }; + + // ================================================================================ + // RuleConditionGroup + // ================================================================================ + /** + * Base class for a group of rule conditions. + */ + class RuleConditionGroup : public RuleCondition { + public: + static const std::string RULE_CONDITIONS_JSON_KEY; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC_AND; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC_OR; + + /** + * Instantiate a Rule condition group. + * + * @param condition_json The JsonObject + * @return RuleConditionGroup + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + **/ + static std::shared_ptr RuleConditionGroupFromJson( + const std::shared_ptr& condition_json); + + /** + * Retrieve the rule conditions in this group. + * @return list of RuleConditions in this group + **/ + const std::vector>& GetConditions() const; + + protected: + RuleConditionGroup(const std::vector>& conditions); + + std::vector> conditions_; + }; + + + // ================================================================================ + // RuleConditionOrGroup + // ================================================================================ + /** + * Concrete class for an OR group rule condition. If any condition in this group evaluates + * to `true`, then the entire group evaluates to `true`. + */ + class RuleConditionOrGroup : public RuleConditionGroup { + public: + /** + * Constructs a RuleConditionOrGroup instance. + * @param conditions the conditions in this RuleConditionOrGroup + */ + explicit RuleConditionOrGroup(const std::vector>& conditions); + + /** + * Evaluate the \p data against the conditions in this rule condition group. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion + * @param event event {@link Event} to be evaluated with the rule + * @returns true if any condition in this group evaluates to true, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; + + + // ================================================================================ + // RuleConditionAndGroup + // ================================================================================ + /** + * Concrete class for an AND group rule condition. If all conditions in this group evaluate + * to `true`, then the entire group evaluates to `true`. + */ + class RuleConditionAndGroup : public RuleConditionGroup { + public: + /** + * Constructs a RuleConditionAndGroup instance. + * @param conditions the conditions in this RuleConditionAndGroup + */ + explicit RuleConditionAndGroup(const std::vector>& conditions); + + /** + * Evalute the \p data against the conditions in this rule condition group. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion. + * @param event event {@link Event} to be evaluated with the rule + * @returns true if all conditions in this group evaluate to true, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; + + // ================================================================================ + // RuleConditionMatcher + // ================================================================================ + /** + * Rule condition matcher class which evaluates a specific rule condition. + */ + class RuleConditionMatcher : public RuleCondition { + public: + /** + * Constructs a RuleConditionMatcher instance. + * @param matcher the condition matcher + */ + explicit RuleConditionMatcher(const std::shared_ptr& matcher); + + /** + * Create a new RuleConditionMatcher instance from a json file. + * + * @param condition_json the JSON file containing the definition of a RuleConditionMatcher + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + */ + static std::shared_ptr RuleConditionMatcherFromJson(const std::shared_ptr& + condition_json); + + /** + * Evaluate \p data against that condition matcher. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion + * @param event event {@link Event} to be evaluated with the rule + * @returns true if \p data validates against the matcher, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + std::shared_ptr matcher_; + }; + +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULECONDITION_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h new file mode 100755 index 00000000..39079c26 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h @@ -0,0 +1,114 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H +#define ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H + +#include +#include +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonUtilityServiceInterface; + class JsonObject; + class EventData; + class Variant; + class JsonObject; + class JsonArray; + + /** + * @class RuleConsequence + * This class is a base class representing a generic rule consequence. + */ + class RuleConsequence : public Object { + public: + + + /** + * Parse the supplied json object and instantiate the concrete consequence class. + * + * @param consequence_json The json object for the consequence. + * + * @return A RuleConsequence instance. Could be null if the consequence type in the json is not supported, or due to a json + * error. + * + * @throws when the json format is not correct. + */ + static std::shared_ptr ConsequenceFromJson(const std::shared_ptr& consequence_json); + + /** + * Creates an Map containing the consequence information. + *

+ * The Map contains the following information about the consequence. + *

    + *
  • The id in key EventDataKeys#RulesEngine#CONSEQUENCE_ID.
  • + *
  • The consequence_type in key EventDataKeys#RulesEngine#CONSEQUENCE_TYPE.
  • + *
  • The detail in key EventDataKeys#RulesEngine#CONSEQUENCE_DETAIL.
  • + *
  • The provided asset_path in key EventDataKeys#RulesEngine#CONSEQUENCE_ASSETS_PATH.
  • + *
+ * + * @param asset_path A valid String asset path for the consequence + * @return Map representing a consequence + */ + std::map> GenerateConsequenceMap(const std::string& asset_path); + + /** + * Returns {@link EventData} populated with the data the Consequence would like to broadcast to the Core. The data + * should be sufficient for the Core to perform the requested consequences. Assume that core will expand + * any tokens required. + * + * @return An instance of EventData. + * + * @see EventDataKeys.RulesEngine + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GenerateEventData(); + + /** + * Convert and flatten JsonObject into a Variant map + * @param json_object The JsonObject + * @return the Variant map + */ + static std::map> ParseJsonObjectIntoMap(const std::shared_ptr& + json_object); + /** + * Convert and flatten JsonArray into a string map + * @param json_array The JsonArray + * @return the string map + */ + static std::vector> ParseJsonArrayIntoList(const std::shared_ptr& json_array); + + /** + * @return the map with consequence detail + */ + std::map> GetConsequenceDetail(); + + /** + * @return the string consequence id + */ + std::string GetConsequenceId(); + + private: + std::string id_; + std::string type_; + std::map> detail_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h new file mode 100755 index 00000000..44e2993e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h @@ -0,0 +1,242 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H +#define ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class EventHub; + class RulesEngine; + class PlatformServicesInterface; + class Event; + class Variant; + /** + * @class RuleTokenParser + * + * The V5 SDK should support token expansions on the static endpoint, to allow for injection of properties, prefixes replacement. + * + */ + + class RuleTokenParser : public Object { + friend class EventHub; + public: + + // ======================================================== + // Constructor + // ======================================================== + + /** + * RuleTokenParser Constructor + * + * @param parent_hub parent EventHub module instance + */ + explicit RuleTokenParser(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services); + + /** + * Sets triggering Event instance to be used by this RuleTokenParser. + * + * @param event triggering Event instance + */ + void SetEvent(const std::shared_ptr& event); + + /** + * Returns the value for the key provided as input. + *

+ * If the key is a special key recognized by SDK, the value is determined based on incoming Event, + * or EventHub#ModuleSharedStates data. Otherwise the key is searched in the current Event's Eventdata + * and the corresponding value is returned. + * + * @param key std::string containing the key whose value needs to be determined + * @param event triggering Event instance + * + * @return Variant containing value to be substituted for the key + */ + std::shared_ptr ExpandKey(const std::string& key, const std::shared_ptr& event); + + /** + * Finds and expands the tokens in the sourceString. + *

+ * The token format is as follows {@literal {%key%}}, valid characters for key include [a-zA-Z0-9~_.] + *

+ * If the token contains special key recognized by SDK, the value is determined based on incoming Event, + * or EventHub#ModuleSharedStates data. Otherwise the key contained in the token is searched in the current Event's + * data and the corresponding value is used. + * + * @param source_string input std::string containing tokens to be replaced + * @param event triggering Event instance + * + * @return std::string containing source_string with the valid tokens replaced with the corresponding values + */ + std::string ExpandTokensForString(const std::string& source_string, const std::shared_ptr& event); + + private: + // ======================================================== + // private methods + // ======================================================== + + /** + * Returns the value for shared state key specified by the key. + *

+ * The key is provided in the format {@literal ~state.valid_shared_state_name/key} + * For example: {@literal ~state.com.adobe.marketing.mobile.Identity/mid} + * + * @param key std::string containing the key to search for in EventHub#ModuleSharedStates + * + * @return Variant containing the value for the shared state key if valid, null otherwise + */ + std::shared_ptr GetSharedStateKey(const std::string& key); + + /** + * Extracts the key from passed token. + *

+ * For example, key extracted from a token of the given format {@literal {%myKey%}} shall be myKey + * + * @param token std::string containing the token + * @param url_encode true if token requires url_encode + * + * @return std::string containing the key in the passed token + */ + std::string GetKeyFromToken(const std::string& token, bool url_encode = false); + + + /** + * Finds and returns all the valid tokens in the provided input. + *

+ * A valid token follows the regex {@literal {%[a-zA-Z0-9_~.]*?%}} + * + * @param input the input String containing tokens to be parsed + * + * @return std::vector of valid tokens contained in the input string + */ + std::vector FindTokens(const std::string& input); + + // ======================================================== + // package-protected methods + // ======================================================== + + /** + * Returns the event type from the triggering event. + * + * @return std::string containing the event type name + * @see EventType + */ + std::string GetEventType() const; + + /** + * Returns the event source from the triggering event. + * + * @return std::string containing the event source name + * @see EventSource + */ + std::string GetEventSource() const; + + /** + * Returns the current device time in epoch format (seconds since epoch). + * + * @return std::string value of the number of seconds since epoch + * @see TimeUtil#getUnixTime() + */ + std::string GetTimestamp(); + + /** + * Returns the current SDK version string. + * + * @return std::string indicating the current version of SDK + * @see SystemInfoService#getSdkVersion() + */ + std::string GetSdkVersion(); + + /** + * Generates and returns a random number to be used for cache-busting purposes. + * + * @return std::string value of the random number + */ + std::string GetCachebust(); + + /** + * Returns a std::string containing all data in the triggering Event object encoded in url format. + * + * @return std::string containing url encoded key-value pairs in Event data + */ + std::string GetAllUrl(); + + /** + * Returns a std::string containing all data in the triggering Event object encoded in json format. + * + * @return std::string containing json data + */ + std::string GetAllJson(); + + /** + * Returns value for the key stored in module shared state with name sharedStateName. + *

+ * This method invokes Module#GetSharedEventState(std::string, Event) to get the shared state key. + * + * @param shared_state_name std::string containing name of the module shared state + * @param key std::string containing name of the key in the module shared state + * + * @return Variant containing the value for given shared state key + */ + std::shared_ptr GetSharedStateKey(const std::string& shared_state_name, const std::string& key); + + private: + /** + * @brief Variant containing a mapping of rule condition special key types to their getter + */ + std::shared_ptr ReturnKeyType(const std::string& key); + + /** + * Find all the occurrance of a string pattern inside of the input string and replace them in place. + * + * @param data the input std::string containing keywords + * @param to_search the search pattern + * @param replace_str the replacement to the matched pattern + */ + void FindAndReplaceAll(std::string& data, const std::string& to_search, const std::string& replace_str); + + private: + static const int32_t RANDOM_INT_BOUNDARY; + static const std::string KEY_PREFIX; + static const std::string SHARED_STATE_KEY_DELIMITER; + static const int32_t MIN_TOKEN_LEN; + static const std::string KEY_EVENT_TYPE; + static const std::string KEY_EVENT_SOURCE; + static const std::string KEY_TIMESTAMP_UNIX; + static const std::string KEY_SDK_VERSION; + static const std::string KEY_CACHEBUST; + static const std::string KEY_ALL_URL; + static const std::string KEY_ALL_JSON; + static const std::string KEY_SHARED_STATE; + static const std::string KEY_URL_ENCODE; + static const std::string KEY_URL_ENCODE_PREFIX; + static const std::string KEY_URL_ENCODE_SUFFIX; + static const unsigned long MIN_URL_ENC_TOKEN_LEN; + + std::weak_ptr parent_hub_; ///< parent module to get shared event data + std::weak_ptr platform_services_; ///< platform services provide access to sdk version + std::shared_ptr event_; ///< event associated with the rule token parser + + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h new file mode 100755 index 00000000..fc51916d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H +#define ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + /** + * This is the contract for a concrete implementation that would support + * processing a Rules Engine bundle downloaded from the configured end-point + * + * The interface allows the handling of the actual file type downloaded to be changed / plugged -in/out. + * The implementation is responsible for processing the downloaded bundle (file) + */ + class RulesBundleNetworkProtocolHandler : virtual ObjectInterface { + + /** + * Process the file that was downloaded by the RulesDownloader. + * + * The implementation is free to process the file as it wishes. The processed contents should be stored in the + * #output_path path. + * + * @param downloaded_bundle The file that was downloaded by the RulesDownloader + * @param output_path The absolute path of the output folder. The implementation is free to create sub-folders underneath. + * + * @return Indication of whether the processing was successful + */ + virtual bool ProcessDownloadedBundle(const std::string& downloaded_bundle, + const std::string& output_path) = 0; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H */ + + + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h new file mode 100755 index 00000000..66565920 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h @@ -0,0 +1,87 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H +#define ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H + +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class FileSystemServiceInterface; + class CompressedFileServiceInterface; + class ZipBundleHandler; + + class RulesDownloader : public Object { + public: + + /** + * Create RulesDownloader for the given URL. + * + * @param platform_services an instance of PlatformServicesInterface + * @param cache_folder a string containing the subfolder to use for caching of downloaded urls + * @param bundle_ready_callback a callback function to be called when the download is completed + * @throws ErrorCodes::MISSING_PLATFORM_SERVICES if the RemoteFileManagerService is not available. + */ + explicit RulesDownloader(const std::shared_ptr& platform_services, + const std::string& cache_folder, + const std::function& bundle_ready_callback); + + /** + * Start asynchronous download of rules. Once finished, triggers completed callback function + * passing URI to local cached file. + * + * @param url the remote url to download the rule configuration + */ + ADOBE_VIRTUAL_FOR_TESTS + void StartDownload(const std::string& url); + + /** + * Processes the downloaded file and returns the destination path + * + * @param downloaded_file_path The file that was downloaded by this + * @return The destination path where the processed file contents were stored, + * null if the processing failed + */ + std::string ProcessBundle(const std::string& downloaded_file_path); + + private: + /** + * @private + * Called when rules have been downloaded from the server and the content url is passed in + * + * @param file_path The path to the downloaded rules zip file + */ + void OnDownloadComplete(const std::string& file_path); + + void RulesBundleDownloaded(const std::string& bundlePath, const std::string& url); + + std::shared_ptr manager_; + std::shared_ptr file_system_service_; + std::shared_ptr crypto_service_; + std::shared_ptr zip_bundle_handler_; + std::function bundle_ready_callback_; + std::string url_; + std::string cache_folder_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h new file mode 100755 index 00000000..f3fdec97 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h @@ -0,0 +1,127 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESENGINE_H +#define ADOBEMOBILE_RULESENGINE_RULESENGINE_H + +#include +#include +#include +#include +#include +#include "InternalModule.h" + +namespace AdobeMarketingMobile { + class JsonUtilityServiceInterface; + class FileSystemServiceInterface; + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class CompressedFileServiceInterface; + class Rule; + class RuleConsequence; + class RulesConfiguration; + class RulesDownloader; + class RulesDispatcherRulesResponseContent; + class RulesEngineState; + class Variant; + class RuleTokenParser; + + /** + * @class RulesEngine + * RulesEngine module is responsible for evaluation of configured rules upon receiving a specific trigger event, + * and if a rule evaluates to true, then perform the associated rule consequence. + * + * The module downloads, parses and stores the concrete rule implementations in-memory for evaluation when a trigger event is received. + */ + class RulesEngine: public Object { + friend class EventHub; + + public: + + static const std::string LOG_PREFIX; + /** + * Create a new instance of a RulesEngine Module. + */ + RulesEngine(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services); + + /** + * Add a rule for the given module + * + * @param module module to add rule to (needed for RemoveRulesForModule to work) + * @param rule rule object to add for the given module + */ + ADOBE_VIRTUAL_FOR_TESTS void AddRule(const std::shared_ptr& module, const std::shared_ptr& rule); + + /** + * Remove all rules for the given module + * + * @param module module to remove all rules for + */ + ADOBE_VIRTUAL_FOR_TESTS void RemoveRulesForModule(const std::shared_ptr& module); + + /** + * Evaluate the current rules against the shared states the module is aware of, along with any additional data + * that may have been provided. + * Rules that belong to the eventType passed in along with the rules that belong to RuleEventType::ANY + * are evaluated for matches. + * + * @param event triggering Event to be processed and evaluated by the rules + */ + ADOBE_VIRTUAL_FOR_TESTS + std::vector> ProcessRules(const std::shared_ptr& event); + + private: + + /** + * Returns the original map with tokens (if any) expanded with the appropriate values. + * + * If the map contains a map or a list then this function will recursively expand tokens within them. + * If the map contains any other data types apart from primitive data type then it will be returned as is. + * + * @param map_with_tokens The map with more zero or more tokens + * @param event The Event that will be used to expand tokens + * @return A map with all the tokens expanded + */ + ADOBE_VIRTUAL_FOR_TESTS std::map> GetTokenExpandedMap(const + std::map>& map_with_tokens, + const std::shared_ptr event); + + /** + * Returns the original list with tokens (if any) expanded with the appropriate values. + * + * If the list contains a map or a list then this function will recursively expand tokens within them. + * If the list contains any other Object apart from primitive data type containers, or collections, then it will be returned as is. + * + * @param list_with_tokens The list with more zero or more tokens + * @param event The Event that will be used to expand tokens + * @return A list with all the tokens expanded + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector> GetTokenExpandedList(const + std::vector> list_with_tokens, + const std::shared_ptr event); + + std::shared_ptr rule_token_parser_; + + // governs access to rules_module_map_ + std::mutex rules_mutex_; + // maintains the list of rules registered, attached to the module that registered them + std::map, std::vector>> rule_module_map_; + }; +} +#endif /* ADOBEMOBILE_RULESENGINE_RULESENGINE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SdkError.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SdkError.h new file mode 100755 index 00000000..b0dd5bbc --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SdkError.h @@ -0,0 +1,598 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_SDKERROR_H +#define ADOBEMOBILE_CORE_SDKERROR_H + +#include +#include +#include +#include "Common.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * A POD that encapsulates debugging information. + */ + class DebugInfo { + public: + DebugInfo() = default; + DebugInfo(const DebugInfo& right) = default; + DebugInfo& operator=(const DebugInfo& right) = default; + DebugInfo(DebugInfo&& right) = default; + DebugInfo& operator=(DebugInfo&& right) = default; + + /** + * Constructs a DebugInfo with the given field values + */ + DebugInfo(const std::string& file, + int32_t line_number, + const std::string& stack_trace); + /** + * The file name where an error occurred. + * Empty string if unavailable. + */ + std::string file; + + /** + * The line number where an error occurred. + * -1 if unavailable. + */ + int32_t line_number = -1; + + /** + * The stack trace for the error. + * Empty string if unavailable. + */ + std::string stack_trace; + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const DebugInfo& debug_info, const ToStringOptions& options); + + namespace GetCurrentDebugInfoPrivate { + // this namespace is only intended for use by the ADOBE_GET_CURRENT_DEBUG_INFO() macro + // it is present to prevent unintended usage of this function + + /** + * @private + * @return the current stack trace + */ + std::string GetCurrentStackTrace(); + } + + /** + * DebugInfo ADOBE_GET_CURRENT_DEBUG_INFO() + * + * @returns a DebugInfo object populated with the current line number and stack trace. + */ +#define ADOBE_GET_CURRENT_DEBUG_INFO() AdobeMarketingMobile::DebugInfo{ __FILE__, __LINE__, GetCurrentDebugInfoPrivate::GetCurrentStackTrace() } + + /** + * @class SdkError + * An SdkError represents an error signaled by the SDK. It is also the base class for all exceptions thrown from the SDK. + * + * Best Practices + * -------------- + * 1) Throw SdkError to signal uncommon, fatal errors. Return `Expected<...>` if errors are common. + * + * 2) When throwing, code should almost always throw SdkError: + * + * - Internal SDK functions (accessible only within Adobe) may bubble up + * std::exception, but should not explicitly throw std::exception. + * + * - Public SDK functions (accessible to customers) should only throw/return SdkError. + * In this case, std::exception and other exception types should be wrapped + * in SdkError. + * + * 3) Prefer using ADOBE_THROW() to a native throw. + * + * 4) Prefer the TrySwallow(), TryCatch(), TryCatchFinally(), TryFinally() methods to + * hand-rolled try catch blocks. + * + * 5) Be specific with your errors. If you need a new error code, add one. + * + * 6) If you must write your own try-catch block, always catch by reference: + * + * try { + * ... + * } catch(SdkError& e) { // <- non-const reference + * ... + * } + * + * Why is this class useful? + * ------------------------- + * SdkError provides a standard way for errors to be thrown, caught, and returned in the SDK. + * It provides an error code and stack trace to ease analysis. + * + * How to create and throw SdkError + * -------------------------------- + * Use SdkErrorconstructors to create an SdkError. SdkError::From can also be used to create + * SdkError from std::exception or std::exception_ptr. SdkError are typically created on stack + * (do not new SdkError). + * + * Use ADOBE_THROW() to throw SdkError. ADOBE_THROW() will add a stack trace and line number information + * to the SdkError (if available on the current platform). + * + * When an exception needs to be rethrown, use std::rethrow_exception. + * + * Examples: + * + * void SimpleExample() { + * if(SomeOtherErrorCondition()) { + * SdkError error{ ErrorCodes::MY_ERROR_CODE, "something crazy happened" }; // constructs an exception + * Throw(error); // throws it, canonical form + * } + * if(SomeErrorCondition()) { + * Throw(ErrorCodes::MY_ERROR_CODE, "something crazy happened"); // convenience form + * } + * } + * + * void RethrowExample() { + * TryCatch([&]{ + * DoSomething(); + * }, [&](SdkError& e) { + * if(e.GetCode() == ErrorCodes::AN_ERROR_I_CAN_RECOVER_FROM) { + * recover(); + * } else { + * std::rethrow_exception(std::current_exception()); // <- rethrow + * } + * }); + * } + * + * How to catch SdkError + * --------------------- + * Use TrySwallow(), TryCatch(), TryCatchFinally(), TryFinally() to catch and handle exceptions. These + * provide a number of benefits over hand-rolled try-catch blocks: + * + * - Catch/Swallow functions will catch all exception types (including std::exception and unrecognized + * exception classes), convert exceptions to SdkError, and invoke the catch block. + * + * - Try functions make sure code always catches by reference (to avoid slicing of exceptions). + * + * - Finally functions provide java-like finally blocks. + * + * Examples: + * + * void Example1() { + * TryCatch([&]{ + * DoSomething(); + * }, [&](SdkError& e) { + * if(e.CodeIs(ErrorCodes::AN_ERROR_I_CAN_RECOVER_FROM)) { + * DoSomethingToRecover(); + * } else { + * DoSomethingOnFail(); + * } + * }); + * } + * + * void Example2() { + * TrySwallow([&]{ + * DoSomething(); + * }); + * } + * + * + * Understanding error codes + * ------------------------- + * Each SdkError has a string error code that indicates what happened. Error code values can be found in + * the ErrorCodes namespace. The core provides a set of default error codes and modules can + * add custom error codes. + * + * Use CodeIs() To check if error codes match: + * + * void Example() { + * SdkError error1{ErrorCodes::SOME_ERROR, "some description"}; // assume SOME_ERROR is "my_module.some_error" + * SdkError error2{ErrorCodes::ANOTHER_ERROR, "some description"}; // assume ANOTHER_ERROR is "my_module.another_error" + * std::cout << error1.CodeIs(ErrorCodes::SOME_ERROR) << std::endl; // prints true + * std::cout << error1.CodeIs(ErrorCodes::ANOTHER_ERROR) << std::endl; // prints false + * } + * + * Error codes are hierarchical. For example, if PEAR_ERROR is "fruit.pear" and FRUIT_ERROR is + * "fruit", a PEAR_ERROR is a FRUIT_ERROR. CodeIs() takes this into consideration: + * + * void Example() { + * SdkError pear_error{ErrorCodes::PEAR_ERROR, "some description"}; // assume PEAR_ERROR is "fruit.pear" + * SdkError fruit_error{ErrorCodes::FRUIT_ERROR, "some description"}; // assume FRUIT_ERROR is "fruit" + * std::cout << pear_error.CodeIs(ErrorCodes::PEAR_ERROR) << std::endl; // prints true + * std::cout << pear_error.CodeIs(ErrorCodes::FRUIT_ERROR) << std::endl; // prints true + * std::cout << fruit_error.CodeIs(ErrorCodes::PEAR_ERROR) << std::endl; // prints false + * } + * + * Hierarchical error codes allow new error codes to be specialized without breaking backward compatibility. + * + * Defining new error codes + * ------------------------ + * New error codes should typically be added to the ErrorCodes namespace. Error code string values should consist + * of lowercase alphanumeric or underscore characters separated by periods. + * + * Module-specific error code values should typically be prefixed with a module-specific token. The identifier + * should also be prefixed with a module-specific prefix. + * + * Examples: + * + * namespace AdobeMarketingMobile { + * namespace ErrorCodes { + * constexpr static const char* MYMODULE_CAMERA_UNAVAILABLE = "my_module.camera_unavailable"; + * } + * } + * + * Inner errors + * ------------ + * An SdkError may contain a nested error for additional information. @see HasInner(), GetInner(). + */ + class SdkError { + public: + /** + * Default constructor. + * + * The SdkError will be initialized with code ErrorCodes::NOTHING, no inner + */ + SdkError(); + + SdkError(const SdkError& right) = default; + SdkError& operator=(const SdkError& right) = default; + SdkError(SdkError&& right) = default; + SdkError& operator=(SdkError&& right) = default; + + /** + * Copies the given SdkError, replacing its debug information with the + * given debug_info. + * + * @param right - the error to copy + * @param debug_info - the new debug_info for the error + */ + explicit SdkError(const SdkError& right, + const DebugInfo& debug_info); + + /** + * Constructs an SdkError with the given error code and description. + * @param code - the error code + * @param message - a description of the error + * @param debug_info - (optional) debug information for the error + */ + explicit SdkError(const std::string& code, + const std::string& message, + const DebugInfo& debug_info = DebugInfo()); + + /** + * Constructs an SdkError with the given error code, description, and inner error. + * @param code - the error code + * @param message - a description of the error + * @param inner - the inner error + * @param debug_info - (optional) debug information for the error + */ + explicit SdkError(const std::string& code, + const std::string& message, + const SdkError& inner, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Converts a std::exception to an SdkError. + * + * Converted exceptions will a STD_ error codes. + * + * @param e - the std::exception to convert + * @param debug_info - (optional) debug information for the error + */ + static SdkError From(const std::exception& e, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Converts any exception to an SdkError. + * + * Converted std::exceptions will a STD_ error codes. + * Converted SdkErrors will be unchanged. + * Other errors will be converted to UNKNOWN_EXCEPTION. + * + * @param e - the exception to convert + * @param debug_info - (optional) debug information for the error + */ + static SdkError From(const std::exception_ptr& e, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Compares the error code of this against another error code, factoring in hierarchical codes. + * + * @return true if this' error code matches error_code + */ + bool CodeIs(const std::string& error_code) const; + + /** + * @return the error code. Consider using CodeIs() instead of this function. + */ + std::string GetCode() const; + + /** + * @return true if the error has a nested error + */ + bool HasInner() const; + + /** + * Obtains the nested error, if there is one. + * + * @param value - (out) if there is a nested error, value will be set to the nested error. + * + * @return true if the error has a nested error, false otherwise. + */ + bool GetInner(SdkError& value) const; + + /** + * @return a description of the error + */ + std::string GetMessage() const; + + /** + * @return the stack trace for a thrown exception + */ + const DebugInfo& GetDebugInfo() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this, options)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString(const ToStringOptions& options) const; + + /** + * @private + * + * For use by AdobeMarketingMobile::ToStringImpl(). + */ + void ToStringImpl(std::ostream& the_stream, const ToStringOptions& options) const; + + private: + std::string code_; ///<@private the error code from ErrorCodes namespace + std::shared_ptr inner_; ///<@private the inner exception, const to enable fast, shared copies + std::string message_; ///<@private the error description + DebugInfo debug_info_; ///<@private the stack trace + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const SdkError& error, const ToStringOptions& options); + + /** + * Helper to swallow and log exceptions. + * + * Invokes f(), catching and logging any exceptions thrown by f(). This function + * is designed to work with C++ lambdas. + * + * Examples: + * + * void Foo(bool try_throw) { + * TrySwallow([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(ErrorCodes::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", then "foo" + * Foo(true); // prints "try", the exception, then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TrySwallow(const std::function& f) noexcept; + + /** + * Simple replacement for try-catch. Converts all exceptions to SdkError so a single catch block can be + * used. This function is designed to work with C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are converted to SdkError + * and catch_block() is called with the exception. + * + * Exceptions thrown from catch_block() are rethrown. They are not converted or translated to + * SdkError. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryCatch([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(ErrorCodes::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [&](SdkError& e) { + * std::cout << "catch" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", then "foo" + * Foo(true); // prints "try", "catch", then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryCatch(const std::function& try_block, + const std::function& catch_block); + + + /** + * Simple replacement for try-catch that adds a java-like finally. Converts all exceptions to + * SdkError so a single catch block can be used. This function is designed to work with + * C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are converted to SdkError + * and catch_block() is called with the exception. Before returning, the function always calls + * finally_block(). + * + * Exceptions thrown from catch_block() or finally_block() are rethrown. They are not converted + * to SdkErrors. If catch_block() throws an exception, finally_block() will still be invoked. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryCatchFinally([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(SdkErrorCode::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [&](SdkError& e) { + * std::cout << "catch" << std::endl; + * }, [&]() { + * std::cout << "finally" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", "finally", then "foo" + * Foo(true); // prints "try", "catch", "finally", then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryCatchFinally(const std::function& try_block, + const std::function& catch_block, + const std::function& finally_block); + + /** + * C++ version of a java-like finally. This function is designed to work with C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are bubbled up (unconverted). + * Before exiting, the function always calls finally_block(). + * + * Exceptions thrown from finally_block() are rethrown. They are not converted to SdkExceptions. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryFinally([=] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(SdkErrorCode::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [=]() { + * std::cout << "finally" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", "finally", then "foo" + * Foo(true); // prints "try", "finally", then throws + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryFinally(const std::function& try_block, + const std::function& finally_block); + + /** + * Throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(SdkError error)); + + /** + * Creates and throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(const std::string& code, const std::string& message)); + + /** + * Creates and throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(const std::string& code, const std::string& message, const SdkError& inner)); + + /** + * ADOBE_THROW(const SdkError& error) + * ADOBE_THROW(const std::string& code, const std::string& message) + * ADOBE_THROW(const std::string& code, const std::string& message, const SdkError& inner) + * + * Throws an SdkError setting the stack trace and providing line number information when available. + */ +#define ADOBE_THROW(...) \ + do { \ + throw AdobeMarketingMobile::SdkError{__VA_ARGS__, ADOBE_GET_CURRENT_DEBUG_INFO()}; \ + } while(false) + + /** + * Namespace that contains SdkError codes. @see SdkError + */ + namespace ErrorCodes { + constexpr static const char* NOTHING = ""; ///< Special error code for default constructed SdkErrors. Do not use + constexpr static const char* OK = "general.ok"; ///< The operation completed successfully. + constexpr static const char* INVALID_ARGUMENT = "general.invalid_argument"; ///< A function was called with bad argument + constexpr static const char* UNEXPECTED = "general.unexpected"; ///< An error that should never occur occurred + constexpr static const char* UNSUPPORTED = "general.unsupported"; ///< The desired functionality is not supported + constexpr static const char* UNKNOWN_EXCEPTION = "general.unknown_exception"; ///< An unrecognized exception was thrown + + // Standard library errors + constexpr static const char* STD_ERROR = "std"; ///< A standard library error occurred. + constexpr static const char* STD_LOGIC_ERROR = "std.logic_error"; ///< A std::logic_error occurred. + constexpr static const char* STD_DOMAIN_ERROR = "std.logic_error.domain_error"; ///< A std::domain_error occurred. + constexpr static const char* STD_INVALID_ARGUMENT = + "std.logic_error.invalid_argument"; ///< A std::invalid_argument occurred. + constexpr static const char* STD_LENGTH_ERROR = "std.logic_error.length_error"; ///< A std::length_error occurred. + constexpr static const char* STD_OUT_OF_RANGE = "std.logic_error.out_of_range"; ///< A std::out_of_range occurred. + constexpr static const char* STD_FUTURE_ERROR = "std.logic_error.future_error"; ///< A std::future_error occurred. + constexpr static const char* STD_RUNTIME_ERROR = "std.runtime_error"; ///< A std::runtime_error occurred. + constexpr static const char* STD_SYSTEM_ERROR = "std.runtime_error.system_error"; ///< A std::system_error occurred. + constexpr static const char* STD_RANGE_ERROR = "std.runtime_error.range_error"; ///< A std::range_error occurred. + constexpr static const char* STD_OVERFLOW_ERROR = + "std.runtime_error.overflow_error"; ///< A std::overflow_error occurred. + constexpr static const char* STD_UNDERFLOW_ERROR = + "std.runtime_error.underflow_error"; ///< A std::underflow_error occurred. + constexpr static const char* STD_BAD_CAST = "std.bad_cast"; ///< A std::bad_cast occurred. + constexpr static const char* STD_BAD_TYPEID = "std.bad_typeid"; ///< A std::bad_typeid occurred. + constexpr static const char* STD_BAD_EXCEPTION = "std.bad_exception"; ///< A std::bad_exception occurred. + constexpr static const char* STD_BAD_ALLOC = "std.bad_alloc"; ///< A std::bad_alloc occurred. + constexpr static const char* STD_BAD_ARRAY_NEW_LENGTH = + "std.bad_alloc.bad_array_new_length"; ///< A std::bad_array_new_length occurred. + constexpr static const char* STD_BAD_WEAK_PTR = "std.bad_weak_ptr"; ///< A std::bad_weak_ptr occurred. + constexpr static const char* STD_BAD_FUNCTION_CALL = + "std.bad_function_call"; ///< A std::bad_function_call occurred. + } +} + +#endif //ADOBEMOBILE_CORE_SDKERROR_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/StringUtils.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/StringUtils.h new file mode 100755 index 00000000..b4f6d319 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/StringUtils.h @@ -0,0 +1,1204 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_STRINGUTILS_H +#define ADOBEMOBILE_UTIL_STRINGUTILS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + class StringUtils { + public: + static const std::string LOG_PREFIX; + + // Do not reference these directly unless you need the default values. + // Instead, use the values from an instance of ToStringOptions + static const size_t DEFAULT_MAX_DEPTH; ///< @private the maximum nesting level of ToString + static const size_t DEFAULT_MAX_ELEMENTS; ///< @private the maximum number of collection elements to print + static const size_t DEFAULT_MAX_STRING_LENGTH; ///< @private the maximum number of string characters to print + + /** + * Split string into a word vector using regex delimiter and a limit + * This is specifically to emulate the String.Split call in Java. + * Limit parameter can have three effects depending on value: + * + * limit > 1 : The pattern will be applied at most limit-1 times and the output vector size will not be + * more than n. The output vectors last entry will contain all input beyond last matched pattern. + * + * limit = 1 : The input string is returned. + * + * limit = 0 : The pattern will be applied as many times as possible and the output vector can be of any size. + * Empty vector elements are discarded. + * + * limit < 0 : The pattern will be applied as many times as possible and the output vector can be of any size. + * + * @param str string to split + * @param regex_delim regex string delimiter used to split into words + * @param limit the number of results to return + * @return vector containing word strings + */ + static std::vector SplitWithLimit(const std::string& str, + const std::string& regex_delim, + size_t limit); + + /** + * Split string into a word vector using regex delimiter + * + * @param str string to split + * @param regex_delim regex string delimiter used to split into words + * @return vector containing word strings + */ + static std::vector Split(const std::string& str, + const std::string& regex_delim); + + /** + * Searches through a string and replaces occurances of old_string with new_string + * + * @param base_string the initial string to search through + * @param old_string the string to search for in the base_string + * @param new_string if old_string is found, new_string will replace it + * @return string with replaced strings + */ + static std::string Replace(const std::string& base_string, + const std::string& old_string, + const std::string& new_string); + + + /** + * Check if a string ends with suffix + * + * @param str string to check suffix + * @param suffix the suffix string + * @return bool whether the string str ends with the suffix + */ + static bool EndsWith(const std::string& str, const std::string& suffix); + + /** + * Read contents of a file. The "file://" prefix will be removed if present + * + * @param filename full path to file to read + * @return string containing the contents of the file + * @throws STD_SYSTEM_ERROR if an error occurs reading the file + */ + static std::string FileToString(const std::string& filename); + + /* @private + * Not porting this method from Java. String empty check is simple enough without added method call. + * If using std::string, know that it cannot be nullptr. + * std::string msg; + * if (msg.empty()) { ... } // true if empty + * If using C style string (rare) check for null then check for zero terminator. + * char* msg; + * if (msg && msg[0]) { ... } // true if nullptr or empty string + */ + //static bool IsNullOrEmpty(const char* msg); + + /** + * Generates a locale instance with en_US.UTF-8, if it fails then return the default locale. + * + * @return a locale object with en_US.UTF-8 if it is valid on the platform, otherwise the default locale + */ + static std::locale GetLocale(); + + /** + * Convert all characters in the given std::string to lowercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::string to convert to lowercase characters + * @param loc The locale rules to use for lowercase conversion + * @return std::string as lowercase + */ + static std::string ToLower(const std::string& str, const std::locale& loc); + + /** + * Convert all characters in the given std::wstring (wide string) to lowercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::wstring (wide string) to convert to lowercase characters + * @param loc The locale rules to use for lowercase conversion + * @return std::wstring as lowercase + */ + static std::wstring ToLower(const std::wstring& str, const std::locale& loc); + + /** + * Convert all characters in the given std::string to lowercase according to + * the US English (en_US) locale. This is a convenience method for internal processing or + * normalization of strings. + * Do not use this method for strings returned back to the application. Instead, prefer to + * use ToLower by passing in the application defined locale object. + * + * @param str The std::string to convert to lowercase characters + * @return std::wstring as lowercase + */ + static std::string ToLower(const std::string& str); + + /** + * Convert all characters in the given std::string to uppercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::string to convert to uppercase characters + * @param loc The locale rules to use for uppercase conversion + * @return std::string as uppercase + */ + static std::string ToUpper(const std::string& str, const std::locale& loc); + + /** + * Convert all characters in the given std::wstring (wide string) to uppercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::wstring (wide string) to convert to uppercase characters + * @param loc The locale rules to use for uppercase conversion + * @return std::wstring as uppercase + */ + static std::wstring ToUpper(const std::wstring& str, const std::locale& loc); + + /** + * Convert all characters in the given std::string to uppercase according to + * the US English (en_US) locale. This is a convenience method for internal processing or + * normalization of strings. + * Do not use this method for strings returned back to the application. Instead, prefer to + * use ToUpper by passing in the application defined locale object. + * + * @param str The std::string to convert to uppercase characters + * @return std::wstring as uppercase + */ + static std::string ToUpper(const std::string& str); + + /** + * Check if given string is a valid URL. + * + * @param url string to check + * @return true if the string is a valid URL, false otherwise + */ + static bool StringIsUrl(const std::string& url); + + /** + * Replaces the tokens present in the input string with the values present in the tokens + * + * @param inputString the string in which the tokens has to be replaced + * @param tokens the token map which has the values to be replaced. + * @return final string with replaced tokens + */ + static std::string ExpandTokens(const std::string& inputString, const std::map& tokens); + + + /** + * find all the valid tokens contained in the string, the regex for a valid token is '\{([a-zA-Z0-9_.%])+\}' + * + * @param input_string the input string + * @return the list of valid tokens contained in the input string + */ + static std::vector FindTokensForExpansion(const std::string& input_string); + + /** + * Equivalent to calling `StringUtils::Quotify(s, MAX_STRING_LENGTH)`; + */ + static std::string Quotify(const std::string& s); + + /** + * Wraps s in quotes, escaping special characters. + * + * The following characters are escaped: + * - newline as "\n" + * - horizontal tab as "\t" + * - vertical tab as "\v" + * - backspace as "\b" + * - carriage return as "\r" + * - form feed as "\f" + * - alert as "\a" + * - backslash as "\\" + * - single quote as "\'" + * - double quote as "\"" + * - characters with ascii values < ' ', as hex prefixed by `\x` + * - characters with ascii values > '~', as hex prefixed by `\x` + * + * @param s - the string to enclose in quotes + * @param max_string_length - the maximum string length to output. `max_string_length` characters of `s` will be + * included in the output. if the length of `s` exceeds `max_string_length`, the + * returned string will end with `..."`. if `max_string_length` is 0, all characters + * of `s` will included in the output. + * + * @return s surrounded by quotes, with special characters escaped. + */ + static std::string Quotify(const std::string& s, size_t max_string_length); + + /** + * Equivalent to `ToString(value, ToStringOptions{})`. + */ + template + static std::string ToString(const T& value); + + /** + * Converts value to a `std::string`. + * + * @param value - the value to convert + * @param options - options for serialization + * + * @returns value, converted to a `std::string` + * + * Introduction + * ------------ + * + * This function is a better version of std::to_string and iostreams. + * + * It improves upon iostream in the following ways: + * - ToString(...) supports collection types, pointers, and a few other types not supported by ostream. + * - ToString(...) detects re-entrancy and will stop infinite recursion. + * - ToString(...) can accept a formatting string. + * - ToString(...) can accept a additional, custom flags, as needed. + * + * ToString() also allows us to maintain strict control over the behavior of ToString(...). + * + * ToString() is used by the logging framework. Specifically, ToString() is used by StringUtils::FormatString(), + * which is used by the logging macros (ADOBE_LOG_DEBUG, etc). + * + * Example: + * + * std::cout << ToString + * + * Supported Types + * --------------- + * + * The following types for value are supported by default: + * - Standard library collection types: `vector`, `list`, `deque`, `map`, `multimap`, `set`, `multiset`, + * `unordered_map`,`unordered_multimap`, `unordered_set`, `unordered_multiset`, `pair`, `tuple` + * - Standard library smart pointers: `unique_ptr`, `shared_ptr`, `weak_ptr` + * - Raw pointers + * - Classes derived from `Object` or `ObjectInterface` + * - Primitives: `bool`, `char`, `unsigned char`, `int`, `unsigned int`, `long`, `unsigned long`, `long long`, + * `unsigned long long`, `float`, `double` + * - Strings: `const char*`, `string` + * - `std::chrono::milliseconds` + * + * Customizing String Output for Objects + * ------------------------------------- + * + * To provide a custom string representation for classes that derive from `Object` or `ObjectInterface`, + * override `ToStringImpl`. + * + * Example: + * + * namespace AdobeMarketingMobile { + * class MyObject : public Object { + * public: + * void ToStringImpl(std::ostream& the_stream, const ToStringOptions& options) const override { + * // the impl can be whatever string you feel is appropriate, but by convention, Objects + * // use a JSON-like structure + * the_stream << "MyObjectType {"; + * + * // Invoke the superclass implementation. + * // When invoking superclass, be sure to invoke Object::ToStringImpl directly, since + * + * the_stream << " super: "; + * Object::ToStringImpl(the_stream, options); + * + * the_stream << "}"; + * }; + * }; + * + * Customizing String Output for Other Types + * ----------------------------------------- + * + * To provide a custom string representation for other types, define an overload of `ToStringImpl`. + * + * The overload should belong to the `AdobeMarketingMobile` namespace and have the following signature: + * + * namespace AdobeMarketingMobile { + * void ToStringImpl(std::ostream& the_stream, const MyType& value, const ToStringOptions& options); + * } + * + * Where `MyType` is the type you would like to serialize. The string representation of `value` should be + * appended to `the_stream`. You may optionally choose to change the representation based on `options`. + * + * Example: + * + * namespace AdobeMarketingMobile { + * class MyType {}; + * + * void ToStringImpl(std::ostream& the_stream, const MyType& value, const ToStringOptions& options) { + * the_stream << "my custom serialization"; + * } + * } + * + */ + template + static std::string ToString(const T& value, + const ToStringOptions& options); + + /** + * Appends the string representation of `value` to the given `std::ostream`. + * + * @see ToString() + */ + template + static void ToString(std::ostream& the_stream, const T& value); + + /** + * Appends the string representation of `value` to the given `std::ostream` using the provided `options`. + * + * @see ToString() + */ + template + static void ToString(std::ostream& the_stream, const T& value, const ToStringOptions& options); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const char* format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const ToStringOptions& options, const char* format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const std::string& format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const ToStringOptions& options, const std::string& format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const char* format, const TArgTypes& ... args); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const ToStringOptions& options, const char* format, const TArgTypes& ... args); + + /** + * Returns a formatted version of the given string. + * + * This function is used by the `Log` functions to format the output. + * + * Motivation + * ---------- + * This function was added instead of using sprintf or ostream for a few reasons: + * - It uses the same format as Java, which eases porting. + * - It will not causes crashes or corruption when invalid format strings are passed in. + * - It is extensible. + * - Under the covers, this function uses StringUtils::ToString() and gains all the benefits thereof: + * - Infinite recursion detection (a common string formatting error) + * - Support for collection types like `vector` and `map`. + * - Support for custom formatting options + * - Support for pointer types + * - Easy serialization of `Object` subclasses + * + * The Format String + * ----------------- + * The `format` string should follow the conventions of + * [Java's Formatter class](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html). This is by + * design, as it allows for easier porting of Java code. The implementation does not implement all of the + * formatting options that are supported by the Java version, but has the capability to do so in the future. + * If an option is not supported, the default formatting for the argument will be used. Currently, the only + * option supported is argument indices. + * + * HOW CAN I CUSTOMIZE HOW MY OBJECT IS SERIALIZED? + * ------------------------------------------------ + * @see ToString() + * + * @param format - the format string + * @param args - the arguments for the foramt string + * + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const std::string& format, const TArgTypes& ... args); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const ToStringOptions& options, const std::string& format, const TArgTypes& ... args); + + private: + static std::mutex current_depths_mutex; ///< @private mutex that protects current_depths, do not let this mutex escape + + static std::map current_depths; ///< @private thread id to nesting level map + + static size_t GetCurrentDepth(); ///< @private @returns the current nesting level of ToString + + static void SetCurrentDepth(size_t depth); ///< @private sets the current nesting level of ToString + + static bool IsTokenValid(const std::string& + token); ///< @private Check whether the token is valid. A valid token should only contain characters [a-zA-Z0-9_.%] + }; + + /** + * Options for `ToString()`. `ToStringImpl` support for all options is optional. + */ + class ToStringOptions { + public: + ToStringOptions() = default; + ToStringOptions(const ToStringOptions&) = default; + ToStringOptions& operator=(const ToStringOptions&) = default; + ToStringOptions(ToStringOptions&&) = default; + ToStringOptions& operator=(ToStringOptions&&) = default; + + /** + * @returns a ToStringOptions with pretty set to true + */ + static ToStringOptions Pretty(); + + bool pretty = false; ///< if true, strings should be "pretty" + std::string pretty_indent; ///< the indent for newlines in pretty strings, each new level should be 4 spaces + bool quotify_strings = false; ///< if true, strings should be enclosed in quotes + std::string format; ///< if non-empty, the format that should be used for the value + size_t max_depth = StringUtils::DEFAULT_MAX_DEPTH; ///< the maximum nesting level of ToString + size_t max_elements = StringUtils::DEFAULT_MAX_ELEMENTS; ///< the maximum number of collection elements to print + size_t max_string_length = StringUtils::DEFAULT_MAX_STRING_LENGTH; ///< the maximum number of string characters to print + }; +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + + /** + * @private + * + * `ToStringImpl` for `std::chrono::milliseconds`. + */ + void ToStringImpl(std::ostream& the_stream, const std::chrono::milliseconds& the_duration, + const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `std::string`. + */ + void ToStringImpl(std::ostream& the_stream, const std::string& value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `const char*`. + */ + void ToStringImpl(std::ostream& the_stream, const char* value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `bool`. + */ + void ToStringImpl(std::ostream& the_stream, bool value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `char`. + */ + void ToStringImpl(std::ostream& the_stream, char value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned char` (and `uint8_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned char value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int` (and `int32_t`). + */ + void ToStringImpl(std::ostream& the_stream, int value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned int` (and `uint32_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned int value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long` (and `int64_t`). + */ + void ToStringImpl(std::ostream& the_stream, long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned long` (and `uint64_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long long`. + */ + void ToStringImpl(std::ostream& the_stream, long long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned long long`. + */ + void ToStringImpl(std::ostream& the_stream, unsigned long long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `float`. + */ + void ToStringImpl(std::ostream& the_stream, float value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `double`. + */ + void ToStringImpl(std::ostream& the_stream, double value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long double`. + */ + void ToStringImpl(std::ostream& the_stream, long double value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `uint16_t`. + */ + void ToStringImpl(std::ostream& the_stream, uint16_t value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int8_t`. + */ + void ToStringImpl(std::ostream& the_stream, int8_t value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int16_t`. + */ + void ToStringImpl(std::ostream& the_stream, int16_t value, const ToStringOptions& options); + + /** + * @private + * + * Default `ToStringImpl` for enum classes that derive from numeric types. + */ + template + typename std::enable_if::value, void>::type + // ^this confusing line matches this template only for enum classes that inherit from a numeric type + ToStringImpl(std::ostream& the_stream, TEnum value, const ToStringOptions& options) { + typedef typename std::underlying_type::type EnumUnderlyingNumericType; + ToStringImpl(the_stream, static_cast(value), options); + } + + /** + * @private + * + * Default `ToStringImpl` for raw pointers. + */ + template + void ToStringImpl(std::ostream& the_stream, const T* pointer, const ToStringOptions& options) { + if (pointer == nullptr) { + the_stream << "null"; + } else { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, *pointer, options); + } + } + + /** + * @private + * + * Default `ToStringImpl` for `shared_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.get(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `weak_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::weak_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.lock(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `unique_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unique_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.get(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `pair`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::pair& the_pair, const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; // quotify strings + + the_stream << "[ "; + StringUtils::ToString(the_stream, the_pair.first, element_options); + the_stream << ", "; + StringUtils::ToString(the_stream, the_pair.second, element_options); + the_stream << " ]"; + } + + namespace StringUtilsInternal { + /** + * @private + * + * Helper for tuple Impl. Metaprogramming construct to append tuple elements to a stream. + * This is a very rare instance where metaprogramming is necessary. + */ + template < typename TTuple, size_t I = std::tuple_size::value - 1 > + struct AppendTupleElementsToStream { + static void Call(std::ostream& the_stream, const TTuple& the_tuple, const ToStringOptions& element_options) { + AppendTupleElementsToStream < TTuple, I - 1 >::Call(the_stream, the_tuple, element_options); + the_stream << ", "; + StringUtils::ToString(the_stream, std::get(the_tuple), element_options); + } + }; + + /** + * @private + * + * Stopping condition for the above metaprogramming. + */ + template + struct AppendTupleElementsToStream { + static void Call(std::ostream& the_stream, const TTuple& the_tuple, const ToStringOptions& element_options) { + the_stream << StringUtils::ToString(std::get<0>(the_tuple), element_options); + } + }; + } + + /** + * @private + * + * Default `ToStringImpl` for `tuple`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::tuple& the_tuple, + const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; // quotify strings + + the_stream << "[ "; + StringUtilsInternal::AppendTupleElementsToStream>::Call(the_stream, the_tuple, + element_options); + the_stream << " ]"; + } + + + + namespace StringUtilsInternal { + /** + * @private + * + * Actual implementation of `ToStringImpl` for collection types that are like arrays. + */ + template + void CollectionToStringImpl(std::ostream& the_stream, const T& collection, const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; + + the_stream << "["; + size_t element_index = 0; + + for (auto& element : collection) { + if (element_index == 0) { + the_stream << " "; + } else { + the_stream << ", "; + } + + if (element_index >= options.max_elements) { + the_stream << "..."; + break; + } + + the_stream << StringUtils::ToString(element, element_options); + + ++element_index; + } + + if (element_index > 0) { + the_stream << " "; + } + + the_stream << "]"; + } + } + + /** + * @private + * + * `ToStringImpl` for `vector`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::vector& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `list`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::list& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `deque`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::deque& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `map`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::map& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::multimap& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::set& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multiset`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::multiset& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_map`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_map& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_multimap& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_set`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_set& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_multiset`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_multiset& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + template + std::string StringUtils::ToString(const T& value) { + return ToString(value, ToStringOptions{}); + } + + template + std::string StringUtils::ToString(const T& value, const ToStringOptions& options) { + std::ostringstream the_stream; + ToString(the_stream, value, options); + return the_stream.str(); + } + + template + void StringUtils::ToString(std::ostream& the_stream, const T& value) { + ToString(the_stream, value, ToStringOptions{}); + } + + template + void StringUtils::ToString(std::ostream& the_stream, const T& value, const ToStringOptions& options) { + size_t current_depth = GetCurrentDepth(); + + if (current_depth >= options.max_depth) { + // infinite recursion guard + the_stream << "..."; + return; + } + + SetCurrentDepth(++current_depth); + + try { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, value, options); + } catch (...) { + the_stream << "ERROR"; + } + + SetCurrentDepth(--current_depth); + } + + namespace StringUtilsInternal { + + /** + * @private + * + * Helper for FormatString. + * + * GenericFormatArgs and PolymorphicFormatArgs are used to represent the args to FormatString in a polymorphic + * manner. PolymorphicFormatArgs is the interface, and GenericFormatArgs is the implementation. + * + * See implementation of FormatString() for details. + */ + class PolymorphicFormatArgs { + public: + /** + * @private + * + * Destructor + */ + virtual ~PolymorphicFormatArgs() {} + + /** + * @private + * + * @return the number of arguments. + */ + virtual size_t GetSize() const = 0; + + /** + * @private + * + * Invokes ToString(...) on argument at the specified index. + */ + virtual void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const = 0; + }; + +#ifndef ADOBE_DOXYGEN + // doxygen cannot handle these templates + + /** + * @private + * + * Helper for FormatString. + * + * GenericFormatArgs and PolymorphicFormatArgs are used to represent the args to FormatString in a polymorphic + * manner. PolymorphicFormatArgs is the interface, and GenericFormatArgs is the implementation. + * + * See implementation of FormatString() for details. + */ + template + class GenericFormatArgs : public GenericFormatArgs { + public: + typedef GenericFormatArgs Super; + + /** + * @private + * + * Constructor + */ + explicit GenericFormatArgs(const TCurrentArg& current_arg, const TMoreArgs& ...more_args) : + Super{more_args...}, // template recurse, without first arg + current_arg_{current_arg} {} // save a ref to the first arg + + /** + * @private + * + * Impl of PolymorphicFormatArgs::GetSize + */ + size_t GetSize() const override { + // Deep C++: + // https://stackoverflow.com/questions/12024304/c11-number-of-variadic-template-function-parameters + return sizeof...(TMoreArgs) + 1; + } + + /** + * @private + * + * Impl of PolymorphicFormatArgs::CallToString + */ + void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const override { + if (index == 0) { + // 0 always refers to current arg + StringUtils::ToString(the_stream, current_arg_, options); + } else { + // template recursion. + // By subtracting 1 from index, we're basically performing a shift + // Stopping condition is + Super::CallToString(index - 1, the_stream, options); + } + } + + private: + const TCurrentArg& current_arg_; + }; + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + */ + template + class GenericFormatArgs : public PolymorphicFormatArgs { + public: + /** + * @private + * + * Constructor + */ + explicit GenericFormatArgs(const TCurrentArg& current_arg) : + current_arg_{current_arg} {} // save a ref to the first arg + + size_t GetSize() const override { + return 1; + } + + /** + * @private + * + * Impl of PolymorphicFormatArgs::CallToString + */ + void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const override { + // Stopping condition + if (index == 0) { + // 0 always refers to current arg + StringUtils::ToString(the_stream, current_arg_, options); + } else { + // indices beyond size are noops + } + } + + private: + const TCurrentArg& current_arg_; + }; +#endif + + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + * + * Defined in StringUtils.cpp + */ + std::string PolymorphicFormatString(const ToStringOptions& options, const char* format, + const PolymorphicFormatArgs& args); + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + */ + template + std::string GenericFormatString(const ToStringOptions& options, const char* format, const TArgs& ...args) { + return PolymorphicFormatString(options, format, GenericFormatArgs {args...}); + } + } + + template + std::string StringUtils::FormatString(const ToStringOptions& options, const std::string& format, + const TArgs& ... args) { + return FormatString(options, format.c_str(), args...); + } + + template + std::string StringUtils::FormatString(const std::string& format, const TArgs& ... args) { + return FormatString(ToStringOptions{}, format.c_str(), args...); + } + + template + std::string StringUtils::FormatString(const char* format, const TArgs& ... args) { + return FormatString(ToStringOptions{}, format, args...); + } + + template + std::string StringUtils::FormatString(const ToStringOptions& options, const char* format, const TArgs& ... args) { + // This implementation is very confusing, but necessarily so, due to variadic templates. + // + // This implementation uses C++ features that are discouraged by our coding guidelines. This is OK in this case, + // since there is no other way to implement this function, minimize unnecessary memory allocations, and + // minimize binary size. + // + // To understand the C++ behind this implementation, you need to understand: + // - Variadic Templates: http://eli.thegreenplace.net/2014/variadic-templates-in-c/ + // - Template specialization + // - Polymorphic types vs. Generic types + // + // SHORT VERSION OF HOW THIS FUNCTION WORKS: + // + // - Through C++ magic, a call to FormatString(...) eventually becomes a call to PolymorphicFormatString(...). + // - PolymorphicFormatString is defined in StringUtils.cpp. + // + // LONG VERSION OF HOW THIS FUNCTION WORKS: + // + // 1) For clarity, FormatString() is a wrapper around GenericFormatString(). + // + // 2) GenericFormatString() is a generic (template) function. + // + // 3) We do not we do not want to duplicate code for every FormatString instantiation. To achieve this, + // we need to: + // + // - Convert args to a polymorphic (non-template) class. That's the hard part. The polymorphic + // class we eventually will convert to is PolymorphicFormatArgs. + // + // - Call a polymorphic function that has the real implementation and pass it the PolymorphicFormatArgs. + // That function is PolymorphicFormatString, which is defined in StringUtils.cpp. + // + // 4) GenericFormatArgList is a subclass of PolymorphicFormatArgs. Basically, it is a bridge that + // lets us treat our template arg list polymorphically. GenericFormatList works as follows: + // + // - GenericFormatArgList uses recursive templates. GenericFormatArgList is a subclass of + // GenericFormatArgList. GenericFormatArgList is a subclass of + // GenericFormatArgList. GenericFormatArgList is a subclass of PolymorphicFormatArgs + // (via template specialialization). + // + // - GenericFormatArgList::CallToString accepts an index, an ostream, and options and invokes ToString for + // the given argument at the given index. Because of our use of recursive templates, this function is also + // recursive. GenericFormatArgList<> is a noop, our stopping condition. + // + // 5) In GenericFormatString, we instantiate a GenericFormatArgList then pass it to PolymorphicFormatString + // (as a PolymorphicFormatArgs). + // + // 6) In PolymorphicFormatString, we do the actual work of parsing the string, formatting the args, and + // calling ToString() (indirectly via PolymorphicFormatArgs::CallToString). + // + // Whew. + return StringUtilsInternal::GenericFormatString(options, format, args...); + } +} + +#endif /* ADOBEMOBILE_UTIL_STRINGUTILS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h new file mode 100755 index 00000000..5e07662f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h @@ -0,0 +1,245 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + class DisplayInformationInterface : public virtual ObjectInterface { + public: + /** + * Returns absolute width of the available display size in pixels. + * + * @return width in pixels if available. -1 otherwise. + */ + virtual int32_t GetWidthPixels() const = 0; + + /** + * Returns absolute height of the available display size in pixels. + * + * @return height in pixels if available. -1 otherwise. + */ + virtual int32_t GetHeightPixels() const = 0; + + /** + * Returns the screen dots-per-inch + * + * @return dpi if available. -1 otherwise. + */ + virtual int32_t GetDensityDpi() const = 0; + + }; + + class SystemInfoServiceInterface : public virtual ObjectInterface { + public: + enum class ConnectionStatus : int32_t { + CONNECTED = 0, + DISCONNECTED, + UNKNOWN + }; + + static constexpr const uint32_t MAX_THREAD_NAME_LEN{15}; + + /** + * Returns the currently selected / active locale value (as set by the user on the system). + * + * @return Locale value. + */ + virtual std::locale GetActiveLocale() const = 0; + + /** + * Returns the directory which can be used as a application data directory. + * + * @return A directory path string representing the application data directory + */ + virtual std::string GetApplicationBaseDir() const = 0; + + /** + * Returns the application specific cache directory. The application will be able to read and write to the + * directory, but there is no guarantee made as to the persistence of the data (it may be deleted by the system + * when storage is required). + * + * @return A directory path string representing the application cache directory. + */ + virtual std::string GetApplicationCacheDir() const = 0; + + /**x + * Returns the application name. + * + * @return Application name or empty if not available. + */ + virtual std::string GetApplicationName() const = 0; + + /** + * Returns the application version. + * + * @return Application version or empty if not available. + */ + virtual std::string GetApplicationVersion() const = 0; + + /** + * Returns the application version code as a string. + * + * @return Application version code formatted as string using the active locale, or empty if not available. + */ + virtual std::string GetApplicationVersionCode() const = 0; + + /** + * Return the contents of the asset file as a string. The given filename is a relative path to the + * application's assets folder. The application must have read access to the assets folder. + * + * @param filename relative file path of a file within the application's assets folder + * @return string contents of the assets file, or an empty string in case of an error + */ + virtual std::string GetAsset(const std::string& filename) const = 0; + + /** + * Returns a string that identifies a particular device OS build. + * + * @return Build ID string. + */ + virtual std::string GetDeviceBuildId() const = 0; + + /** + * Returns a human readable device name. + * + * @return Device name or empty if not available. + */ + virtual std::string GetDeviceName() const = 0; + + /** + * Returns information about the display hardware, as returned by the underlying OS. + * + * @see DisplayInformation + * + * @return std::shared_ptr Display information, or null if not available + */ + virtual std::shared_ptr GetDisplayInformation() const = 0; + + /** + * Returns a human readable mobile carrier name. + * + * @return A std::string representing the carrier name or empty if not available. + */ + virtual std::string GetMobileCarrierName() const = 0; + + /** + * Returns the state of the network connectivity + * + * @return SystemInfoService::ConnectionStatus. + */ + virtual SystemInfoServiceInterface::ConnectionStatus GetNetworkConnectionStatus() const = 0; + + /** + * Returns the string representation of the operating system name. + * + * @return Operating system name or empty if not available. + */ + virtual std::string GetOperatingSystemName() const = 0; + + /** + * Returns the string representation of the canonical platform name. + * + * @return Platform name string. + */ + virtual std::string GetCanonicalPlatformName() const = 0; + + /** + * @return a string with the current line number + * + * implementation is platform specific. + */ + virtual std::string GetCurrentStackTrace() const = 0; + + /** + * Returns the string representation of the operating system version. + * + * @return Operating system version or empty if not available. + */ + virtual std::string GetOperatingSystemVersion() const = 0; + + /** + * Returns the property value specific to the key from the manifest file. + * + * @param resource_key std::string key in the manifest file. + * @return A std::string value of the requested property or empty if not available. + */ + virtual std::string GetProperty(const std::string& resource_key) const = 0; + + /** + * Returns a string that identifies the SDK running mode, e.g. Application, Extension + * + * @return Running mode string + */ + virtual std::string GetRunMode() const = 0; + + /** + * Returns the version for the SDK, which is determined by the platform + * + * @return string containing the SDK version + */ + virtual std::string GetSdkVersion() const = 0; + + /** + * Returns the default platform/device user agent string + * + * @return string containing the default user agent + */ + virtual std::string GetDefaultUserAgent() const = 0; + + /** + * Set the name of the current thread + * + * @param name - Empty names are ignored and names longer than MAX_THREAD_NAME_LEN chars are truncated. + */ + virtual void SetCurrentThreadName(const std::string& name) const = 0; + + /** + * Sets the current system info service. Intended for use by Core. + */ + static void SetCurrentService(const std::shared_ptr& new_service); + + /** + * @return the current system info service + */ + static std::shared_ptr GetCurrentService(); + + private: + /** + * @private + * Lock for `current_service` + */ + static std::mutex mutex; + + /** + * @private + * The current system info service. + * Synchronized on mutex; + */ + static std::shared_ptr current_service; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h new file mode 100755 index 00000000..6ce5dc2d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h @@ -0,0 +1,162 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TASKEXECUTOR_H +#define ADOBEMOBILE_CORE_TASKEXECUTOR_H + +#include "Object.h" +#include "TaskExecutorInterface.h" + +namespace AdobeMarketingMobile { + + class TaskExecutorData; + class PlatformServicesInterface; + class SystemInfoServiceInterface; + + /** + * @class TaskExecutor + * + * TaskExecutor implements a C++11 implementation of TaskExecutorInterface. + * + * TaskExecutor is a standard thread pool + task queue. See https://en.wikipedia.org/wiki/Thread_pool. + * Each TaskExecutor manages a set of worker threads and a synchronized task queue. Tasks are + * added to the back of the queue using AddTask(). The thread workers monitor the task queue. + * When tasks are added, all threads not currently running a task will wakeup and pull a task + * from the front of the queue (FIFO). Tasks are simply callable objects taking no parameters + * and returning no values. When a worker pulls a task it will immediately execute it. There + * are currently no guarantees on task start ordering. If an exception is thrown during task + * execution, the error callback (if any) will be called with the exception thrown and the + * task name (if any). When the pool needs to be closed, the owner calls Dispose() which + * flushes any remaining tasks and notifies the threads to shutdown. Each thread worker has a + * TaskExecutor reference which it retains until it terminates. + * + * Requirements + * ==================== + * - TaskExecutor must be implemented using standard C++11, nothing platform-specific. + * - TaskExecutor must be a standalone utility class (EventHub will use TaskExecutor). + * - TaskExecutor must have a method that cleanly shuts down all threads. + * - TaskExecutor must capture exceptions thrown during task execution and report them. + * - TaskExecutor must represent task as std::function to represent the callback. + * - TaskExecutor must support multiple threads in a pool. + * - TaskExecutor must allow multiple concurrent TaskExecutors to be instantiated. + * + * Future thinking + * ==================== + * - TaskExecutor should have a way to serialize sets of tasks (e.g. virtual thread number) + * - We might need a way to grow and shrink the pool dynamically (e.g. based on external load) + * -- This may mean we need a bidirectional channel with individual threads + * + * Task ordering models + * ==================== + * #1 Any start ordering <== this is our MVP + * + * #2 Strict sequential start ordering <== this can be accomplished with #3 or #4 + * + * #3 Strict sequential start order within a set, any start ordering between sets + * + * #4 Strict sequential start order between sets, any start ordering within a set + * + * #5 Any start ordering within a set or between sets, but sets are non-overlapping + * + */ + class TaskExecutor : public Object, public virtual TaskExecutorInterface { + public: + /** + * Constants + * + */ + static constexpr const uint32_t MAX_THREADS{16}; + static constexpr const std::chrono::milliseconds MAX_NOTIFICATION_WAIT{100}; + + /** + * Instantiate a default TaskExecutor with requested number of active worker threads. + * The TaskExecutor will begin with num_thread detached threads watching the task queue. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * + * @param num_threads - number of threads in the pool must be between 1 and MAX_THREADS. + * @return A valid TaskExecutor instance + */ + static std::shared_ptr Create(uint32_t num_threads); + + /** + * Instantiate a named TaskExecutor with requested number of active worker threads. + * The TaskExecutor will begin with num_thread detached threads watching the task queue. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4, "Worker"); + * + * @param num_threads - number of threads in the pool must be between 1 and MAX_THREADS. + * @param name - Name for threads owned by this executor. Truncated to MAX_THREAD_NAME_LENGTH chars as needed. + * @param platform - platform-specific services used for setting thread name. + * @return A valid TaskExecutor instance + */ + static std::shared_ptr Create(uint32_t num_threads, + const std::string& name, + const std::shared_ptr& platform); + + static std::shared_ptr Create(uint32_t num_threads, + const std::string& name, + const std::shared_ptr& system_info); + /** + * Destructor + */ + ~TaskExecutor() override; + + protected: + /** + * @protected + * + * Called by Create(). + * + */ + TaskExecutor(); + + /** + * @see TaskExecutorInterface + */ + bool DisposeImpl(std::chrono::milliseconds wait_time) override; + + /** + * @see TaskExecutorInterface + */ + bool AddTaskImpl(std::function task_callback, + std::function error_callback, + const std::string& task_name) override; + + private: + /** + * Actual implementation of DisposeImpl, but non-virtual so it can be invoked from the destructor safely. + */ + bool DisposeNonVirtualImpl(std::chrono::milliseconds wait_time); + + /** + * @private + * + * Private data used by TaskExecutor and shared with worker threads. + * + */ + std::shared_ptr data_; + }; + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TASKEXECUTOR_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h new file mode 100755 index 00000000..0d688eb2 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h @@ -0,0 +1,190 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H +#define ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H + +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + class SdkError; + + /** + * @class TaskExecutorInterface + * + * A TaskExecutorInterface is a standard thread pool + task queue. See https://en.wikipedia.org/wiki/Thread_pool. + * + * A TaskExecutorInterface manages a set of zero or more workers and a task queue. AddTask() adds tasks to the back + * of the queue. Workers remove tasks from the queue (in FIFO order) and execute them. If a TaskExecutor has a + * single worker, tasks must be executed in the same order in which AddTask() was called. When a TaskExecutor + * has multiple workers, there are no ordering guarantees between tasks. + * + * TaskExecutor provides a C++11 implementation of TaskExecutorInterface that suits most needs. + */ + class TaskExecutorInterface : public virtual ObjectInterface { + public: + /** + * Constants + * + */ + static const char* DEFAULT_TASK_NAME; + static const std::chrono::milliseconds NO_DISPOSE_WAIT; + static const std::chrono::milliseconds MAX_DISPOSE_WAIT; + static const std::chrono::milliseconds DEFAULT_DISPOSE_WAIT; + + /** + * @brief Cleans up resources associated with this. + * + * Equivalent to: + * + * Dispose(DEFAULT_DISPOSE_WAIT); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * + * pool->Dispose(); + */ + bool Dispose(); + + /** + * @brief Cleans up resources associated with this. + * + * Tell all workers to stop consuming tasks. Tasks already in progress will continue + * to run, but no new tasks will be started. All pending tasks will be dropped. + * + * Waits up to `wait_time` millseconds for workers to terminate cleanly. `wait_time` is capped at 10s. + * + * Example #1: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * // shutdown and wait up to 1s for threads to terminate + * + * pool->Dispose(std::chrono::milliseconds(1000)); + * + * Example #2: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * // shutdown and don't wait for threads to terminate + * + * pool->Dispose(NO_DISPOSE_WAIT); + * + * @param wait_time - maximum time to wait for threads to finish (defaults to 10ms) + * @return true if threads have actually shutdown, false otherwise + */ + bool Dispose(std::chrono::milliseconds wait_time); + + /** + * @brief Adds a task to the queue. + * + * Equivalent to: + * + * AddTask(task_callback, [](std::string, SdkError&) {}, DEFAULT_TASK_NAME); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are ignored + * }); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback); + + /** + * @brief Adds a task to the queue. + * + * Equivalent to: + * + * AddTask(task_callback, error_callback, DEFAULT_TASK_NAME); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are handed to your callback + * }, [&](std::string name, SdkError& e){ + * // handle the failure - default name passed + * }); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @param error_callback - a callable object passed with "unique" ownership, taking string and error parameters. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback, + std::function error_callback); + + /** + * @brief Add a task to the queue. + * + * After queuing, the task will be asynchronously executed by a worker. To execute the task, the worker + * will invoke `task_callback()`. If an error occurs, `error_callback(task_name, error)` will be invoked where + * `task_name` is the passed-in task name, and `error` represents the error that occurred. + * + * A TaskExecutorInterface with a single worker will always execute tasks in the order in which AddTask() was + * called. A TaskExecutorInterface with multiple workers provides no such guarantee. + * + * Calling AddTask() after Dispose() is a noop. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are handed to your callback + * }, [&](std::string name, SdkError& e){ + * // handle the failure - "sketchy_task" passed for name + * }, "sketchy_task"); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @param error_callback - a callable object passed with "unique" ownership, taking string and error parameters. + * @param task_name - a name to use for identifying this task. Reported to error_callback. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback, + std::function error_callback, + const std::string& task_name); + + protected: + /** + * Actual implementation of AddTask. Subclasses should override this. + */ + virtual bool AddTaskImpl(std::function task_callback, + std::function error_callback, + const std::string& task_name) = 0; + + /** + * Actual implementation of AddTask. Subclasses should override this. + */ + virtual bool DisposeImpl(std::chrono::milliseconds wait_time) = 0; + }; + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h new file mode 100755 index 00000000..5e53ae81 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_TIMEUTILS_H +#define ADOBEMOBILE_UTIL_TIMEUTILS_H + +#include +#include +#include + +namespace AdobeMarketingMobile { + + class TimeUtils { + + public: + /** + * Get current unix timestamp + * + * @return current timestamp in milliseconds + */ + static std::chrono::milliseconds GetUnixTime(); + + /** + * Get current unix timestamp + * + * @return current timestamp in seconds + */ + static std::chrono::seconds GetUnixTimeInSeconds(); + + /** + * Get the timestamp from the provided time_point + * + * @return timestamp in milliseconds + */ + static std::chrono::milliseconds GetTimeInMilliseconds(const std::chrono::time_point + time_point); + + /** + * Get the the Iso8601 formatted date string for the current date + * @return Iso8601 formatted date string + */ + static std::string GetIso8601Date(); + + /** + * Get the the Iso8601 formatted date string for the passed in date + * @param date the date to generate the string for + * @return Iso8601 formatted date string + */ + static std::string GetIso8601Date(const std::tm* date); + + private: + TimeUtils() = delete; + + }; + +} + +#endif /* ADOBEMOBILE_UTIL_TIMEUTILS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Timer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Timer.h new file mode 100755 index 00000000..246082d5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Timer.h @@ -0,0 +1,220 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TIMER_H +#define ADOBEMOBILE_CORE_TIMER_H + +#include +#include +#include "Common.h" +#include "Object.h" +#include "TaskExecutor.h" + +namespace AdobeMarketingMobile { + + /** + * @class TimerTask + * + * This class represents a timed task and is stored in the task queue. + * + */ + class TimerTask { + public: + static constexpr const std::chrono::milliseconds DO_NOT_REPEAT{-1}; + + /** + * Construct a TimerTask. A negative period indicates a task that does not repeat. + * + */ + TimerTask(const std::function& task, std::chrono::milliseconds period = DO_NOT_REPEAT) : + task_callback_(task), period_(period) {} + + public: + std::function task_callback_; + std::chrono::milliseconds period_; + }; + + /** + * @class Timer + * + * This is a timed task executor that leverages the TaskExecutor class. It is designed to cover roughly + * the same use cases that the Java Timer and TimerTask classes cover. All tasks scheduled on the same Timer will + * execute in serial, according to the start time specified. + * + * Questions + * ==================== + * How should Timer handle repeating tasks that fail? Currently Timer ignores failures. Tasks must handle errors. + * + */ + class Timer : public Object { + public: + static constexpr const std::chrono::milliseconds TIMER_SHUTDOWN_MAX_WAIT{100}; + static constexpr const std::chrono::milliseconds TIMER_RUNNING_MAX_WAIT{1000}; + + /** + * Construct a Timer. + * + * Examples: + * + * std::shared_ptr timer = Timer::Create(); + * + */ + static std::shared_ptr Create(); + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& platform_services); + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& system_info_service); + + /** + * Destructor + * + */ + ~Timer(); + + /** + * Terminates this timer, discarding any currently scheduled tasks. + * Will wait a maximum of `wait_time` milliseconds. + * + * Examples: + * + * std::shared_ptr timer = std::make_shared(); + * timer->Schedule([](){...}, std::chrono::seconds(10000)); + * ... + * timer->Cancel(); + * + * @param wait_time - the time to wait for tasks to complete + * @return true if tasks completed before wait time, false otherwise + */ + ADOBE_VIRTUAL_FOR_TESTS bool Cancel(std::chrono::milliseconds wait_time = TIMER_SHUTDOWN_MAX_WAIT); + + /** + * Schedules the specified task for execution at the specified time. + * + * Examples: + * + * std::shared_ptr timer = std::make_shared(); + * timer->Schedule([](){...}, std::chrono::now() + std::chrono::seconds(10000)); + * + * @param task - a callable to execute at the appropriate time + * @param start_time - the time to execute the task + * @return true if task was scheduled, false if Timer::Cancel() was already called + */ + ADOBE_VIRTUAL_FOR_TESTS bool Schedule(const std::function& task, + std::chrono::system_clock::time_point start_time); + + /** + * Schedules the specified task for repeated fixed-rate execution, beginning at the specified time. + * + * Example: + * + * std::shared_ptr timer = std::make_shared(); + * timer->ScheduleAtFixedRate([](){...}, + * std::chrono::now() + std::chrono::seconds(100), + * std::chrono::seconds(60)); + * + * @param task - a callable to execute at the appropriate time + * @param start_time - the time to execute the task + * @param period - the period at which the task will be repeated once the loop is started + * @return true if task was scheduled, false if Timer::Cancel() was already called + */ + ADOBE_VIRTUAL_FOR_TESTS bool ScheduleAtFixedRate(const std::function& task, + std::chrono::system_clock::time_point start_time, + std::chrono::milliseconds period); + + protected: + /** + * @protected + * Called by Create(). This is not exposed because we don't want these to be created on the stack. + */ + Timer(const std::string& name, + const std::shared_ptr& system_info_service); + + /** + * @private + * Second half of two-phase Timer construction + */ + ADOBE_VIRTUAL_FOR_TESTS void StartTimerThread(); + + private: + + /** + * @private + * Mutex used to synchronize Timer with its task thread. + */ + std::mutex mutex_; + + /** + * @private + * Condition variable used to signal when new tasks are added or Cancel is called. + */ + std::condition_variable condition_; + + // TODO: (AMSDK-5892) Consider using atomic for cancel_called_ + /** + * @private + * Flag to signal to task thread that Cancel was called. + */ + bool cancel_called_; + + /** + * @private + * Thread pool. + */ + std::shared_ptr executor_; + + /** + * @private + * The queue of scheduled tasks. + */ + std::multimap tasks_; + + std::string name_; + + std::shared_ptr system_info_service_; + + bool flag_task_added; + }; + +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + /* Templated version of Schedule() for convenience */ + template + bool Schedule(const std::function& task, std::chrono::time_point start_time) { + auto start_time_system_clock = std::chrono::time_point_cast(start_time); + return Schedule(task, start_time_system_clock); + } + + /* Templated version of ScheduleAtFixedRate() for convenience */ + template + bool ScheduleAtFixedRate(const std::function& task, + std::chrono::time_point start_time, + std::chrono::duration period) { + auto start_time_system_clock = std::chrono::time_point_cast(start_time); + auto period_milliseconds = std::chrono::duration_cast(period); + return ScheduleAtFixedRate(task, start_time_system_clock, period_milliseconds); + } + + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TIMER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h new file mode 100755 index 00000000..a03dc5e7 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h @@ -0,0 +1,269 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H + +#include +#include "Object.h" +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Enum representing application states + */ + enum class AppState : int32_t { + FOREGROUND = 0, // app is in the foreground + BACKGROUND, // app is in the background + UNKNOWN // unknown app state + }; + + /** + * Alert message event listener + */ + class AlertListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked on positive button clicks + */ + virtual void OnPositiveResponse() = 0; + + /** + * Invoked on negative button clicks + */ + virtual void OnNegativeResponse() = 0; + + /** + * Invoked when the alert is displayed + */ + virtual void OnShow() = 0; + + /** + * Invoked when the alert is dismissed + */ + virtual void OnDismiss() = 0; + }; + + /** + * UI service interface defining a fullscreen message + */ + class FullScreenMessageUiInterface : public virtual ObjectInterface { + public: + /** + * Display the fullscreen message + */ + virtual void Show() = 0; + + /** + * Open a url from this message + * + * @param url String the url to open + */ + virtual void OpenUrl(const std::string& url) = 0; + + /** + * Remove the fullscreen message from view. + */ + virtual void Remove() = 0; + }; + + /** + * Fullscreen message event listener + */ + class FullscreenListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked when the fullscreen message is displayed + * + * @param message FullscreenMessage the message being displayed + */ + virtual void OnShow(const std::shared_ptr& message) = 0; + + /** + * Invoked when the fullscreen message is dismissed + * + * @param message FullscreenMessage the message being dismissed + */ + virtual void OnDismiss(const std::shared_ptr& message) = 0; + + /** + * Invoked when the fullscreen message is attempting to load a url + * + * @param message FullscreenMessage the message attempting to load the url + * @param url String the url being loaded by the message + * + * @return True if the core wants to handle the URL (and not the fullscreen message view implementation) + */ + virtual bool OverrideUrlLoad(const std::shared_ptr& message, const std::string& url) = 0; + }; + + /** + * Listener for app state transition events + */ + class AppStateListenerInterface : public virtual ObjectInterface { + public: + /** + * invoked when the application transitions into the AppState::FOREGROUND state + */ + virtual void OnForeground() = 0; + + /** + * invoked when the application transitions into the AppState::BACKGROUND state + */ + virtual void OnBackground() = 0; + }; + + /** + * Listener for UI floating button + */ + class FloatingButtonListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked when the floating button is tapped + */ + virtual void OnTapDetected() = 0; + + /** + * Invoked when the floating button is dragged on the screen + */ + virtual void OnPanDetected() = 0; + }; + + /** + * UI service interface defining a floating button + */ + class FloatingButtonInterface : public virtual ObjectInterface { + public: + /** + * Display the floating button on the screen + */ + virtual void Display() = 0; + + /** + * Remove the floating button + */ + virtual void Remove() = 0; + }; + + /** + * Interface for displaying alerts, local notifications, and fullscreen web views + */ + class UIServiceInterface : public virtual ObjectInterface { + public: + + /** + * Display an alert + * + * @param title String alert title + * @param message String alert message + * @param positive_button_text String positive response button text. Positive button will not be displayed if this value is null or empty + * @param negative_button_text String negative response button text. Negative button will not be displayed if this value is null or empty + * @param listener AlertListener listener for alert message events + */ + virtual void ShowAlert(const std::string& title, + const std::string& message, + const std::string& positive_button_text, + const std::string& negative_button_text, + const std::shared_ptr& listener) = 0; + + + + /** + * Create a fullscreen message + * + * @param html String html content to be displayed with the message + * @param fullscreenListener FullscreenListener listener for fullscreen message events + * @return FullscreenMessage object if the html is valid, null otherwise + */ + virtual std::shared_ptr CreateFullscreenMessage(const std::string& html, + const std::shared_ptr& fullscreenListener) = 0; + /** + * Display a local notification + * + * @param identifier String unique identifier for the local notification + * @param content String notification message content + * @param sound String notification message sound + * @param category String notification message category + * @param delay_seconds int number of seconds to wait before displaying this local notification + * @param deep_link String the link to be opened on notification clickthrough + * @param fire_date number of seconds from epoch when the local notification should fire + * @param user_info String (json) additional data for the local notification + */ + virtual void ShowLocalNotification(const std::string& identifier, + const std::string& content, + const std::string& sound, + const std::string& category, + std::chrono::seconds delay_seconds, + const std::string& deep_link, + std::chrono::seconds fire_date, + const std::string& user_info) = 0; + + /** + * Triggers the \p url to be shown by the platform. + * For example, if this URL contains a http scheme, then the URL will be handled by the system http handler. + * This API does not require a specific scheme, and will do the best effort to trigger the URL on the platform. + * + * @returns true, if the url was successfully shown. + */ + virtual bool ShowUrl(const std::string& url) = 0; + + /** + * Creates and returns an instance of UIService. + * + */ + static std::shared_ptr Create(); + + /** + * Get the current application state + * + * @return AppState the current application state + */ + virtual AppState GetAppState() const = 0; + + /** + * Register application state transition listener + * + * @param listener an implementation of AppStateListener + */ + virtual void RegisterAppStateListener(const std::shared_ptr& listener) = 0; + + /** + * Unregister application state transition listener + * + * @param listener the AppStateListener to unregister + */ + virtual void UnregisterAppStateListener(const std::shared_ptr& listener) = 0; + + /** + * Creates a floating button instance + * + * @param listener used for tracking UI floating button activity (tap/drag). + */ + virtual std::shared_ptr CreateFloatingButton(const + std::shared_ptr& + listener) = 0; + + /** + * Returns true if there is another message displayed at this time, false otherwise. + * The status is collected from the platform messages monitor and it applies if either + * an alert message or a full screen message is displayed at some point. + */ + virtual bool IsMessageDisplayed() = 0; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h new file mode 100755 index 00000000..799a4754 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h @@ -0,0 +1,66 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Interface for parsing URL strings + */ + class URLServiceInterface : public virtual ObjectInterface { + public: + + /** + * Extracts the query parameters as string. Any percent-encoded characters are not unescaped. + * If given URL does not conform to RFC standard, this method returns empty string. + * Example: for URL http://www.example.com/index.php?key1=value1&key2=value2, the query string is key1=value1&key2=value2 + * + * @return URL query + */ + virtual std::string GetQuery(const std::string& url) const = 0; + + /** + * Extracts the URL path, unescaped. If given URL does not conform to RFC standard, this method returns empty string. + * Example: for URL http://www.example.com/index.html, the path is /index.html + * + * @return URL path + */ + virtual std::string GetPath(const std::string& url) const = 0; + + /** + * Extracts the scheme of given URL. If given URL is invalid, it returns empty string. + * Example: for URL http://www.example.com/index.html, the scheme is http + * + * @return URL scheme + */ + virtual std::string GetScheme(const std::string& url) const = 0; + + /** + * Extracts the host of given URL. If given URL is invalid, it returns empty string. + * Example: for URL http://www.example.com/index.html, the host is www.example.com + * + * @return URL host + */ + virtual std::string GetHost(const std::string& url) const = 0; + }; + +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h new file mode 100755 index 00000000..a57e8a30 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h @@ -0,0 +1,120 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLBUILDER_H +#define ADOBEMOBILE_UTIL_URLBUILDER_H + +#include +#include + +namespace AdobeMarketingMobile { + + class UrlBuilder { + + public: + enum class EncodeType : int32_t { + NONE = 1, + ENCODE + }; + + /** + * constructor + */ + UrlBuilder(); + + UrlBuilder(const UrlBuilder&) = delete; + + UrlBuilder& operator=(const UrlBuilder&) = delete; + + UrlBuilder(UrlBuilder&&) = delete; + + UrlBuilder&& operator=(UrlBuilder&&) = delete; + + /** + * set whether SSL is enabled + * @param ssl_enabled the boolean flag to indicated whether SSL is enabled + * @return this + */ + UrlBuilder& EnableSsl(const bool ssl_enabled); + + /** + * set the host after converting host name to lowercase string. + * @param host host name + * @return this + */ + UrlBuilder& SetHost(const std::string& host); + + /** + * add path to the url, should not include '/' in the string + * @param path path string without '/' + * @return this + */ + UrlBuilder& AddPath(const std::string& path); + + /** + * add multiple query parameters + * @param query_parameters the map containing query parameters + * @return this + */ + UrlBuilder& AddQueryParameters(const std::map& query_parameters); + + /** + * add one query parameter with key/value pair, both key and value will be encoded + * @param key the key of the query parameter + * @param value the value of the query parameter + * @return this + */ + UrlBuilder& AddQueryParameter(const std::string& key, const std::string& value); + + /** + * add a whole string as a query in the url, the string will be encoded + * @param new_query the query string to be added to the url + * @return this + */ + UrlBuilder& AddQuery(const std::string& new_query); + + /** + * add a whole string as a query in the url + * @param new_query the query string to be added to the url + * @param encode_type encode type to be used to encode the query + * @return this + */ + UrlBuilder& AddQuery(const std::string& new_query, const EncodeType encode_type); + + /** + * build the url string based on all the data provided before + * @return the url string + */ + std::string Build(); + + private: + bool ssl_enabled_ = false; + std::string path_; + std::string host_; + std::string query_; + + std::string url_; + bool did_build_; + + void ThrowIfAlreadyBuilt(); + + }; + +} + +#endif /* ADOBEMOBILE_UTIL_URLBUILDER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h new file mode 100755 index 00000000..7f4a2b48 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLENCODER_H +#define ADOBEMOBILE_UTIL_URLENCODER_H + +#include + +namespace AdobeMarketingMobile { + + class UrlEncoder { + public: + static std::string Encode(const std::string& raw_value); + static std::string Decode(const std::string& encoded_value); + private: + static inline unsigned char HexDecode(char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } + + if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } + + if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + + return 255; + }; + }; + +} + +#endif /* ADOBEMOBILE_UTIL_URLENCODER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h new file mode 100755 index 00000000..7aad02e1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLUTIL_H +#define ADOBEMOBILE_UTIL_URLUTIL_H + +namespace AdobeMarketingMobile { + class UrlUtil { + public: + + /** + * Extracts the query parameters as a map from the given deep link query. If one parameter + * is null or empty or either key/value is empty, that parameter will be skipped + * + * @param deep_link_query query string extracted from the deep link/universal link + */ + static std::map ExtractQueryParameters(const std::string& deep_link_query); + }; +} + +#endif /* ADOBEMOBILE_UTIL_URLUTIL_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Variant.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Variant.h new file mode 100755 index 00000000..8e39bf1b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/Variant.h @@ -0,0 +1,454 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANT_H +#define ADOBEMOBILE_CORE_VARIANT_H + +#include +#include +#include "Object.h" +#include "Expected.h" +#include "VariantSerializerInterface.h" +#include "Common.h" + +namespace AdobeMarketingMobile { + enum class VariantKind : int32_t; + + /** + * @class Variant + * + * A variant is an Object that can contain different types of data. A variant can contain + * one of the following: + * - a std::string + * - an int32_t (referred to as an Integer) + * - an int64_t (referred to as a Long) + * - a bool + * - a std::map> (referred to as a Map or VariantMap) + * - a std::vector> (referred to as a Vector or VariantVector) + * - null + * + * CONSTRUCTING A VARIANT + * ---------------------- + * Variant::FromXyz(...) functions can be used to construct a variant: + * + * std::shared_ptr v = Variant::FromInteger(123); // constructs a variant that contains 123 + * + * INSPECTING A VARIANT + * -------------------- + * Variant::GetKind(...) and Variant::GetXyz(...) can be used to get the value of a variant: + * + * Example: + * + * std::shared_ptr v = Variant::FromLong(123L); // constructs a variant that contains 123L + * v->GetKind(); // returns VariantKind::LONG + * int64_t aLong; + * v->GetLong(aLong); // returns true and sets aLong to 123L + * std::shared_ptr anObject; + * v->GetObject(anObject); // returns false + * + * Variant::GetXyz(...) will not perform any type conversions. For example, if an int32_t is stored in a + * variant, calling GetLong(...) will not convert the int32_t to an int62_t. + * + * STORING VARIANTS IN A COLLECTION + * -------------------------------- + * The primary use of variants is to store different types of data in a single collection: + * + * Example: + * + * std::vector> aVector; + * aVector.push(Variant::FromString("hello")); + * aVector.push(Variant::FromInteger(123)); + * aVector.push(Variant::FromObject(std::make_shared())); + * + * LIMITS ON VARIANT VALUES + * -------------------------------- + * Because JSON is widely exchanged and processed on a wide range of platforms, it is practical to look at common + * limitations to avoid overflow issues. Most JSON parser implementations use a double for holding all numeric + * types. This leads to a range of [-(2**53)+1, (2**53)-1] for integers, since only that range can be accurately + * represented in a double. + * More discussion in + * RFC-7159: https://tools.ietf.org/html/rfc7159#section-6 + * ECMA-262: https://tc39.github.io/ecma262/#sec-number.min_safe_integer + */ + class Variant : public Object { + public: + static const int64_t MAX_SAFE_INTEGER = 9007199254740991; + static const int64_t MIN_SAFE_INTEGER = -9007199254740991; + + // returns a new variant with no value + static std::shared_ptr FromNull(); + + /** + * @return a new variant with the given string as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromString(const std::string& value); + + /** + * @return a new variant with the given int32 as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromInteger(int32_t value); + + /** + * @return a new variant with the given int64 as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromLong(int64_t value); + + /** + * @return a new variant with the given double as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromDouble(double value); + + /** + * @return a new variant with the given bool as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromBoolean(bool value); + + /** + * @return a new variant with the given map as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromVariantVector(const std::vector>& value); + + /** + * @return a new variant with the given string map as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromStringMap(const std::map& out_value); + + /** + * @return a new variant with the given string vector as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromStringVector(const std::vector& value); + + /** + * @return a new variant with the given variant map as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromVariantMap(const std::map>& out_value); + + // returns a new variant whose value is serialized from the given typed object + // NOTE: The variant will contain a COPY of the given object. + template + static std::shared_ptr FromTypedObject(const TObject* val); + + // returns a new variant whose value is serialized from a vector of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedObject(const TObject* val, + const std::shared_ptr>& s); + + // returns a new variant whose value is serialized from a vector of the given typed object + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedVector(const std::vector>& val); + + // returns a new variant whose value is serialized from a vector of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedVector(const std::vector>& val, + const std::shared_ptr>& s); + + // returns a new variant whose value is serialized from a map of the given typed object + // NOTE: The variant will contain a COPY of the given map. + template + static std::shared_ptr FromTypedMap(const std::map>& val); + + // returns a new variant whose value is serialized from a map of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given map. + template + static std::shared_ptr FromTypedMap(const std::map>& val, + const std::shared_ptr>& s); + + /** + * @return true if variant is of INTEGER/LONG/DOUBLE kind + * @param kind - VariantKind + */ + static bool IsNumericKind(const VariantKind& kind); + + /** + * @return the kind of value that this variant stores + * @return VariantKind - the kind of variant + */ + virtual VariantKind GetKind() const = 0; + + /** + * @return if this' value is a string, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetString(std::string& out_value) const; + + /** + * @return if this' value is an integer, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetInteger(int32_t& out_value) const; + + /** + * @return if this' value is a long, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetLong(int64_t& out_value) const; + + /** + * @return if this' value is a double, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetDouble(double& out_value) const; + + /** + * @return if this' value is a boolean, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetBoolean(bool& out_value) const; + + /** + * @return if this' value is a variant vector, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + * + * @note This function will COPY the stored map. + */ + virtual bool GetVariantVector(std::vector>& out_value) const; + + /** + * @return if this' value is a string map, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + * + * @note This function will COPY the stored map. + */ + bool GetStringMap(std::map& out_value) const; + + // if this' value is a variant map, returns true and sets out_value to the variant's value. + // otherwise, returns false. + // + // NOTE: This function will COPY the stored map. + virtual bool GetVariantMap(std::map>& out_value) const; + + // if typed object can be created from value, return typed object. Else return StdError. + template + Expected> GetTypedObject() const; + + // if typed object can be created from value and given serializer, return typed object. Else return StdError. + template + Expected> GetTypedObject(const std::shared_ptr>& s) const; + + // if vector of typed object can be created from value, return vector of typed object. Else return StdError. + // NOTE: This function will COPY the stored vector. + template + Expected>> GetTypedVector() const; + + // if vector of typed object can be created from value and given serializer, return vector of typed object. Else return StdError. + // NOTE: This function will COPY the stored vector. + template + Expected>> GetTypedVector(const + std::shared_ptr>& s) const; + + /** + * @return if map of typed object can be created from value, return map of typed object. Else return StdError. + * + * @note This function will COPY the stored map. + */ + template + Expected>> GetTypedMap() const; + + + /** + * @return if map of typed object can be created from value and given serializer, return map of typed object. Else return StdError. + * + * @note This function will COPY the stored map. + */ + template + Expected>> GetTypedMap(const + std::shared_ptr>& s) const; + /** + * @return a copy of this. If this' value is an object, the new variant's value will refer + * to the same object as the old variant. Otherwise, the new variant's value will be a copy + * of the old variant's value. + */ + virtual std::shared_ptr Copy() const = 0; + + // Equals is implemented by subclasses. + // Two variants are equal if all of the following are true: + // - They are both Variants + // - They are both the same kind + // - If both values are an object, the values are Equal + // - If both values are not an object, the values are == + // bool Equals(const ObjectInterface& right) const override final; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + /** + * @return if this' value is a string or numeric type that can be converted to double, returns true and + * sets \p out_value to the converted double value. + * Otherwise, returns false. + */ + virtual bool ConvertToDouble(double& out_value) const; + + /** + * @return if this' value is a numeric type that can be converted to string, returns true and + * sets \p out_value to the converted string value. + * Otherwise, returns false. + */ + virtual bool ConvertToString(std::string& out_value) const; + + protected: + // Internal use only + Variant() {}; + }; + + + + ///////////////////////////////// + // template/inline definitions // + ///////////////////////////////// + + // Error codes specific to Variants + namespace ErrorCodes { + constexpr static const char* VARIANT_NOT_TYPE = "variant.not_type"; ///< Variant does not contain requested type + constexpr static const char* VARIANT_NOT_VECTOR = "variant.not_vector"; ///< Variant does not contain a vector + constexpr static const char* VARIANT_NOT_MAP = "variant.not_map"; ///< Variant does not contain a map + } + + template + struct GetDefaultSerializer { + using type = typename TObject::Serializer; + }; + + template + using Serializer = typename GetDefaultSerializer::type; + + template + std::shared_ptr Variant::FromTypedObject(const TObject* objptr) { + return Variant::FromTypedObject(objptr, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedObject(const TObject* objptr, + const std::shared_ptr>& s) { + if (objptr == nullptr) { + return Variant::FromNull(); + } + return s->Serialize(*objptr); + } + + template + std::shared_ptr Variant::FromTypedVector(const std::vector>& typed_vector) { + return Variant::FromTypedVector(typed_vector, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedVector(const std::vector>& typed_vector, + const std::shared_ptr>& s) { + std::vector> variant_vector; + for (auto& item : typed_vector) { + variant_vector.push_back(FromTypedObject(item.get(), s)); + } + return Variant::FromVariantVector(variant_vector); + } + + template + std::shared_ptr Variant::FromTypedMap(const std::map>& typed_map) { + return Variant::FromTypedMap(typed_map, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedMap(const std::map>& typed_map, + const std::shared_ptr>& s) { + std::map> variant_map; + for (auto& item : typed_map) { + variant_map.insert({ item.first, FromTypedObject(item.second.get(), s) }); + } + return Variant::FromVariantMap(variant_map); + } + + template + Expected> Variant::GetTypedObject() const { + return GetTypedObject(std::make_shared>()); + } + + template + Expected> Variant::GetTypedObject(const std::shared_ptr>& + s) const { + return s->Deserialize(*this); + } + + template + Expected>> Variant::GetTypedVector() const { + return GetTypedVector(std::make_shared>()); + } + + template + Expected>> Variant::GetTypedVector(const + std::shared_ptr>& s) const { + std::vector> variant_vector; + if (GetVariantVector(variant_vector)) { + std::vector> typed_vector; + for (auto& variant : variant_vector) { + Expected> typed_object = variant->GetTypedObject(s); + if (typed_object) { + typed_vector.push_back(typed_object.Value()); + } else { + return { typed_object.Error() }; + } + } + return { typed_vector }; + } + return { SdkError(ErrorCodes::VARIANT_NOT_VECTOR, "type conversion error") }; + } + + template + Expected>> Variant::GetTypedMap() const { + return GetTypedMap(std::make_shared>()); + } + + template + Expected>> Variant::GetTypedMap(const + std::shared_ptr>& s) const { + std::map> variant_map; + if (GetVariantMap(variant_map)) { + std::map> typed_map; + for (auto& iter : variant_map) { + Expected> typed_object = (iter.second)->GetTypedObject(s); + if (typed_object) { + typed_map.insert({ iter.first, typed_object.Value() }); + } else { + return { typed_object.Error() }; + } + } + return { typed_map }; + } + return { SdkError(ErrorCodes::VARIANT_NOT_MAP, "type conversion error") }; + } + +} + +#endif //ADOBEMOBILE_CORE_VARIANT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantKind.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantKind.h new file mode 100755 index 00000000..3b69c2f8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantKind.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANTKIND_H +#define ADOBEMOBILE_CORE_VARIANTKIND_H + +#include "StringUtils.h" + +namespace AdobeMarketingMobile { + + /** + * VariantKind indicates type of value that a variant contains. See Variant. + */ + enum class VariantKind : int32_t { + + VARIANT_NULL, ///< The variant contains no values + + STRING, ///< The variant contains a std::string + + INTEGER, ///< The variant contains an int32_t + + LONG, ///< The variant contains an int64_t + + DOUBLE, ///< The variant contains a double + + BOOLEAN, ///< The variant contains a bool + + VARIANT_VECTOR, ///< The variant contains a std::vector> + + VARIANT_MAP, ///< The variant contains a std::map> + + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, VariantKind value, const ToStringOptions& options); +} + +#endif //ADOBEMOBILE_CORE_VARIANTKIND_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h new file mode 100755 index 00000000..164ca546 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h @@ -0,0 +1,96 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H +#define ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H + +#include "ObjectInterface.h" + +/** + * @brief Derive from VariantSerializerInterface for serializing class instances to and/from Variant + * For each class you would like to use with the Variant::*Typed* methods, + * you will need to implement a template specialization. An example is provided. + * + * NOTE: You should *not* use this template directly for serialization - use FromTypedObject et al instead. + * + * Reqs: + * Must be feasible to implement for types we cannot change, so we can't rely on adding methods to the type + * Must return StdError when Variant cannot be converted to the type specified + * + * Questions: + * If Variant has extra data irrelevant to type serialization, is that ok? Assume YES + * If we want to have multiple serializers, what should we do? We will add another template param + * + * Example implementation: + * + * class MyObject { + * public: + * const std::string& GetStrMember() { return str_member; } + * int GetIntMember() { return int_member; } + * private: + * std::string str_member; + * int int_member; + * }; + * + * class MyObjectSerializer : public Object, public virtual VariantSerializerInterface const { + * public: + * Expected> Deserialize(const Variant& value) { + * std::map> variant_map; + * if(value.GetVariantMap(variant_map)) { + * std::string str_member; + * if(variant_map("str_member") == variant_map() || !variant_map["str_member"]->GetString(str_member)) { + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * int int_member; + * if(variant_map("int_member") == variant_map() || !variant_map["int_member"]->GetString(int_member)) { + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * return { std::make_shared({ str_member, int_member }) }; + * } + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * + * std::shared_ptr Serialize(const MyObject& o) const { + * std::map> variant_value; + * variant_value.insert({ "str_member", Variant::FromString(o.GetStrMember()) }); + * variant_value.insert({ "int_member", Variant::FromInt(o.GetIntMember()) }); + * return Variant::FromVariantMap(variant_value); + * } + * + * }; + * + */ +namespace AdobeMarketingMobile { + class Variant; + + template + class VariantSerializerInterface : public virtual ObjectInterface { + public: + /* @brief Create a TObject from a Variant + * Implementations must handle when Variant is not a serialized TObject e.g. return error or nullptr as needed. + * @return TObject or SdkError + */ + virtual Expected> Deserialize(const Variant& variant) const = 0; + + /* @brief Create a Variant from a TObject instance + * @return heap allocated Variant + */ + virtual std::shared_ptr Serialize(const TObject& object) const = 0; + }; +} // namespace AdobeMarketingMobile +#endif /* ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorId.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorId.h new file mode 100755 index 00000000..2b79a154 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorId.h @@ -0,0 +1,62 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_VISITORID_H +#define ADOBEMOBILE_SHARED_VISITORID_H + +#include +#include "VisitorIdAuthenticationState.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + class VisitorIdSerializer; + /** + * This class encapsulates the visitor identity information + */ + class VisitorId : public Object { + public: + using Serializer = VisitorIdSerializer; + std::string id_origin; + std::string id_type; + std::string id; + VisitorIdAuthenticationState authentication_state; + + VisitorId() {}; + + VisitorId(const std::string& id_origin, + const std::string& id_type, + const std::string& id, + const VisitorIdAuthenticationState authentication_state) ; + + bool Equals(std::shared_ptr& right) const; + }; + + /** + * @brief Serializer for VisitorId objects + */ + class VisitorIdSerializer : public Object, public virtual VariantSerializerInterface { + public: + Expected> Deserialize(const Variant& value) const override; + std::shared_ptr Serialize(const VisitorId& o) const override; + }; + +} + +#endif /* ADOBEMOBILE_SHARED_VISITORID_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h new file mode 100755 index 00000000..2d410cc3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h @@ -0,0 +1,56 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H +#define ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H + +#include + +namespace AdobeMarketingMobile { + class ToStringOptions; + + /** + * This class describes the possible values of the visitor id authentication state parameter + */ + enum class VisitorIdAuthenticationState : int32_t { + UNKNOWN = 0, + AUTHENTICATED, + LOGGED_OUT + }; + + /** + * Converts an int to its respective authentication state enum representation. + * + * If not match is found, returns VisitorIdAuthenticationState::UNKNOWN + */ + VisitorIdAuthenticationState IntegerToVisitorIdAuthenticationState(const int32_t authentication_state); + + /** + * Returns the authentication state string value for a given VisitorIdAuthenticationState. + */ + std::string AuthenticationStateToString(const VisitorIdAuthenticationState value); + + /** + * String version of the VisitorIdAuthenticationState used for logging + */ + void ToStringImpl(std::ostream& the_stream, + const VisitorIdAuthenticationState value, + const ToStringOptions& options); +} + +#endif /* ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h new file mode 100755 index 00000000..5807044e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h @@ -0,0 +1,59 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H +#define ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H + +#include +#include "RulesBundleNetworkProtocolHandler.h" + +namespace AdobeMarketingMobile { + class RulesFileMetadata; + class CompressedFileServiceInterface; + class FileSystemServiceInterface; + + class ZipBundleHandler : public Object, public virtual RulesBundleNetworkProtocolHandler { + public: + + /** + * ZipBundleHandler constructor + * The FileSystemService and CompressedFileService will be used for extracting the zip file + * when ZipBundleHandler::ProcessDownloadedBundle is called. + * + * @see ZipBundleHandler::ProcessDownloadedBundle + */ + ZipBundleHandler(const std::shared_ptr& file_system_service, + const std::shared_ptr& compressed_file_service); + + /** + * Extracts the downloaded bundle in the provided output path and removes the downloaded zip after extraction. + * + * @param downloaded_bundle the path to the downloaded zip file + * @param output_path the path where the extracted zip content will be placed + * + * @see RulesBundleNetworkProtocolHandler:ProcessDownloadedBundle + */ + bool ProcessDownloadedBundle(const std::string& downloaded_bundle, + const std::string& output_path); + private: + std::shared_ptr file_system_service_; + std::shared_ptr compressed_file_service_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Info.plist b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Info.plist new file mode 100755 index 00000000..6338e8e6 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Info.plist differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Modules/module.modulemap b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Modules/module.modulemap new file mode 100755 index 00000000..b2511750 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileCore.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AdobeMarketingMobileCore { + umbrella header "AdobeMarketingMobileCore.h" + + export * + module * { export * } +} diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore new file mode 100755 index 00000000..589f50f9 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7 b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7 new file mode 100755 index 00000000..14ae406f Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7 differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7s b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7s new file mode 100755 index 00000000..1cb7d502 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/AdobeMarketingMobileCore-armv7s differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h new file mode 100755 index 00000000..57530467 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/AdobeMarketingMobileCore.h @@ -0,0 +1,120 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#if TARGET_OS_IOS +#import +FOUNDATION_EXPORT double AdobeMarketingMobileCoreVersionNumber; +FOUNDATION_EXPORT const unsigned char AdobeMarketingMobileCoreVersionString[]; +#else +extern double AdobeMarketingMobileCoreVersionNumber; +extern const unsigned char AdobeMarketingMobileCoreVersionString[]; +#endif + +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h new file mode 100755 index 00000000..fc36569b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/BluetoothServiceInterface.h @@ -0,0 +1,36 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H + +#include +#include "NetworkServiceInterface.h" +#include "PeripheralServiceInterface.h" + +namespace AdobeMarketingMobile { + class BluetoothServiceInterface: public virtual ObjectInterface, public virtual PeripheralServiceInterface { + public: + virtual void StartScan() = 0; + + virtual void StopScan() = 0; + + virtual void RegisterForDevice(const std::string& identifier, const std::function& resultCallback) = 0; + }; +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_BLUETOOTHSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Common.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Common.h new file mode 100755 index 00000000..379554fd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Common.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_COMMON_H +#define ADOBEMOBILE_UTIL_COMMON_H + +/** + * @file Common.h + * Header file containing generally useful constructs. + */ + +/** + * ADOBE_DEPRECATED(void SomeFunction()); + * + * When declaring a function, marks that function as deprecated. + */ +#ifdef __GNUC__ +#define ADOBE_DEPRECATED(FUNCTION_SIGNATURE) FUNCTION_SIGNATURE __attribute__ ((deprecated)) +#else +#pragma message("warning: ADOBE_DEPRECATED is not implemented for this compiler") +#define ADOBE_DEPRECATED(FUNCTION_SIGNATURE) FUNCTION_SIGNATURE +#endif + +/** + * Usage: + * + * ADOBE_VIRTUAL_FOR_TESTS void Foo(); + * + * ADOBE_VIRTUAL_FOR_TESTS should be used instead of `virtual` in cases where a function is only + * only virtual to enable test-related functionality such as mocking and should not be overrided otherwise. + * + * When declaring a function, ADOBE_VIRTUAL_FOR_TESTS is currently equivalent to virtual in all builds + * release or debug. However, non-test code should not rely upon this fact. In the future, + * ADOBE_VIRTUAL_FOR_TESTS may or may not be equivalent to virtual for all builds. + * + * Functions that are intended to be overrided by non-testing related subclasses should be marked virtual. + */ +#define ADOBE_VIRTUAL_FOR_TESTS virtual + +#endif //ADOBEMOBILE_UTIL_COMMON_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h new file mode 100755 index 00000000..dc3ae8d8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CompressedFileServiceInterface.h @@ -0,0 +1,83 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A compression support error occurred. + */ + constexpr static const char* DECOMPRESSION_INIT = "compressed-file.init-failed"; + /** + * A decompression error occurred. + */ + constexpr static const char* DECOMPRESSION_ERROR = "compressed-file.decompression-failed"; + /** + * A filesystem error occurred while decompressing. + */ + constexpr static const char* DECOMPRESSION_READ = "compressed-file.read-failed"; + /** + * A filesystem error occurred while decompressing. + */ + constexpr static const char* DECOMPRESSION_WRITE = "compressed-file.write-failed"; + /** + * A compression support error occurred. + */ + constexpr static const char* DECOMPRESSION_CLOSE = "compressed-file.close-failed"; + /** + * The compressed file is corrupted. + */ + constexpr static const char* DECOMPRESSION_CORRUPTED = "compressed-file.corrupted"; + } + + enum class CompressedFileType : int32_t { + ZIP, + TAR + }; + + class CompressedFileServiceInterface : public virtual ObjectInterface { + public: + + /** + * Extract the compressed file found in the {@code compressed_file_path}. + * + *

+ * The extracted contents will be written to the {@code outputDirectoryPath}. If the file already exists, + * it will be overwritten. If a platform does not contain support for a particular {@link FileType}, as + * requested in {@code fileType} argument, then the extract might fail. + * + * @param compressed_file_path The path to the compressed file + * @param file_type The {@link CompressedFileType} of the compressed file + * @param output_directory_path The output directory where the extracted contents will be stored + * @return An indication of a successful extraction + */ + virtual bool Extract(const std::string& compressed_file_path, + CompressedFileType file_type, + const std::string& output_directory_path) = 0; + + }; + +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_COMPRESSEDFILESERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Configuration.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Configuration.h new file mode 100755 index 00000000..83aefdf2 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Configuration.h @@ -0,0 +1,519 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H + +#include +#include +#include "FileSystemServiceInterface.h" +#include "InternalModule.h" +#include "JsonUtilityServiceInterface.h" +#include "LocalStorageServiceInterface.h" +#include "NetworkServiceInterface.h" +#include "RemoteFileManagerServiceInterface.h" +#include "SystemInfoServiceInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class ConfigurationData; + class ConfigurationDownloader; + class ConfigurationDispatcherConfigurationRequestContent; + class ConfigurationDispatcherConfigurationResponseContent; + class ConfigurationDispatcherConfigurationResponseIdentity; + + /** + * @class Configuration + * The responsibility of Configuration is to handle fetch, storage, ordering, and delivery of the configuration + * of all modules within the SDK. + * + * Configuration can be done in multiple ways within the SDK. + * Bundled + * A configuration file can be bundled with the parent application prior to publishing the app. + * This configuration and its settings has the lowest priority. + * Remote + * Remote will be the Adobe recommended approach. Remote configuration is stored on a server that the sdk will + * pull from on a structured basis. Remote configuration will overwrite Bun dled configuration, + * but has a lower priority than Programmatic. + * Programmatic + * Customers can programmatically override settings in configuration by passing in the settings key value pair. + * Programmatic configuration has the highest priority of configurations + * and will always be obeyed. + */ + class Configuration : public InternalModule { + public: + using InternalModule::GetSharedEventState; // make GetSharedEventState public + using InternalModule::HasSharedEventState; // make HasSharedEventState public + + // Configuration storage keys + static const std::string CONFIGURATION_URL_BASE; ///< Base URL of remote configuration + static const std::string + CONFIG_BUNDLED_FILE_NAME; ///< Filename of Adobe Mobile SDK configuration bundled with application + static const std::string CONFIG_MANIFEST_APPID_KEY; ///< Manifest property key for App ID from System Info Service + static const std::string DATASTORE_KEY; ///< Local Storage Service Datastore key + static const std::string + PERSISTED_OVERRIDDEN_CONFIG; ///< Overridden configuration key in Local Storage Service Datastore + static const std::string PERSISTED_APPID; ///< App ID key in Local Storage Service Datastore + static const std::string LOG_PREFIX; ///< Prefix for all logging messages + static const std::string CACHE_FOLDER; ///< Cache sub folder for config data + static const std::string RULES_CACHE_FOLDER; ///< Cache sub folder for config-downloaded rules + static const std::string RULES_JSON_KEY; ///< Root key for rules definition within JSON + static const std::string RULES_JSON_FILE_NAME; ///< File name for rules definitions + static const std::string RULES_JSON_CONDITION_KEY; ///< Json key for condition collection of a single rule + static const std::string RULES_JSON_CONSEQUENCES_KEY; ///< Json key for actions array of single rule + + /** + * Create a new instance of a Configuration Module. + */ + Configuration(); + + /** + * Handler for all the configuration request content events + * + * @param event a configuration request content event. + */ + virtual void HandleConfigurationEvent(const std::shared_ptr& event); + + /** + * Handler for all the Lifecycle response content event + * + * Lifecycle start event will trigger the configuration to re-fetch the remote configuration. + * Re-fetch happens only when the app_id exists in manifest or in persistence. + * + * Note: Lifecycle start will not reload the bundled configuration. + */ + virtual void HandleLifeCycleEvent(); + + /** + * Handler for the Boot event created by EventHub. + * + * If AppId present, create a configureWithAppId request content event and then attempt to load configuration in the following + * order + * 1. CachedFile + * 2. Bundled + * 3. Overridden Config + * + * If No AppId, attempt to load the bundled/overridden configuration. + * + * @param event boot configuration event, which is generated when the module is initialized. + */ + virtual void HandleBootEvent(const std::shared_ptr& event); + + /** + * Handler for EventType#CONFIGURATION EventSource#REQUEST_IDENTITY Event. + * + * This event is generated when the getSDKIdentities public API is called. + * Configuration module attempts to read all the identities known to the SDK. It then generates + * a EventType#CONFIGURATION EventSource#RESPONSE_IDENTITY response Event with all + * the obtained identities in a JSON String format. + * + * @param event An Configuration Request Identity event + * @see MobileIdentities + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleGetSdkIdentitiesEvent(const std::shared_ptr& event); + + + /** + * Handler for EventType#HUB EventSource#SHARED_STATE Event. + * + * This event is generated by eventhub when there is a sharedstate change in any registered module. + * This method is called when there is a shared state change in either of the following modules. + * 1. Analytics + * 2. Audience + * 3. Target + * 4. Identity + * 5. Configuration + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleSharedStateChangeEvent(); + + /** + * Returns the configuration event queue that holds the pending EventType#CONFIGURATION EventSource#REQUEST_IDENTITY events. + */ + ADOBE_VIRTUAL_FOR_TESTS const std::deque>& GetEventQueue(); + + /** + * Helper method to queue EventType#CONFIGURATION EventSource#REQUEST_IDENTITY event into #getsdkids_event_queue_ + */ + ADOBE_VIRTUAL_FOR_TESTS void QueueGetSDKIdentitiesEvent(const std::shared_ptr& event); + + protected: + + /** + * Create a new instance of a Configuration Module. + * + * @param log_prefix an identifier for this moduled used in log messages. + */ + explicit Configuration(const std::string& log_prefix); + + /** + * Called when the EventHub registers this module. + * Registers new ConfigurationListenerResponseContent and new ConfigurationListenerLifecycleRequestContent. + * Creates new ConfigurationDispatcher. + */ + void OnRegistered() override; + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + **/ + ADOBE_VIRTUAL_FOR_TESTS std::string GetSharedStateName() override; + + /** + * Reads the app_id from the manifest file. + * Returns empty string if app_id is not found. + * + * @return application identifier from manifest file or empty string if could not read from manifest + */ + std::string GetAppIdFromManifest(); + + /** + * Reads the bundled ADBMobileConfig.json file from the assets folder. + * Returns an empty string if the bundled file is not found. + * + * @return bundled file content or empty string if could not retrieve bundled file + */ + std::string GetBundledFileContent(); + + /** + * Attempts to load a configuration from the provide file path + * + * @param event event which triggered the configuration request + */ + virtual void ProcessConfigWithFilePathEvent(const std::shared_ptr& event); + + /** + * Unpacks the update configuration request content event. The new configuration data is added over the existing + * configuration and new configuration response event is dispatched. + * + * @param event an update configuration event. + */ + virtual void ProcessUpdateConfigEvent(const std::shared_ptr& event); + + /** + * Process the boot configuration event. + * + * If app_id present, attempt to load configuration in the following order, and then create a ConfigureWithAppId + * request content event + * 1. CachedFile + * 2. Bundled + * 3. Overridden Config + * + * If No app_id, attempt to load the bundled/overridden configuration. + * + * @param event boot configuration event, which is generated when the module is initialized. + */ + virtual void ProcessBootConfigEvent(const std::shared_ptr& event); + + /** + * Process the configuration request content events with app_id. Tries to retrieve the latest configuration + * from the remote server. + * + * @param event the set app_id event + */ + virtual void ProcessConfigureWithAppIdEvent(const std::shared_ptr& event); + + /** + * Retrieves current configuration through a new configuration response event. + * + * @param event the publish configuration event + */ + virtual void ProcessPublishConfigurationEvent(const std::shared_ptr& event); + + /** + * Dispatches a ConfigurationResponseContent event with the provided JSON string. + * Overrides with the programmed configuration if they exist. + * + * @param json_config_string a String containing the JSON configuration + * @param event event which triggered the configuration request + * @param is_update if set to true, will try to update an existing shared state + */ + virtual void ConfigureWithJsonString(const std::string& json_config_string, + const std::shared_ptr& event, + const bool is_update); + + /** + * Processes the Events generated by getSDKIdentities public API. + * + * Calls the callback with empty string if JsonUtilityService is not available. + * Queues the Event in the #getsdkids_event_queue_ if the one of the requires shared state is in EventHub#SHARED_STATE_PENDING. + * Dispatches the paired EventType#CONFIGURATION EventSource#RESPONSE_IDENTITY event into the EventHub with string identities JSON. + */ + virtual void ProcessGetSdkIdsEvent(); + + /** + * Returns new instance of a configuration downloader for the specified url. + * + * @param app_id The app id required to build the url for the downloader. + * @return configuration downloader instance, nullptr if the remote file service is not availabe + */ + virtual std::shared_ptr GetConfigDownloader(const std::string& app_id); + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_request_content_; + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_response_content_; + + /** + * @protected + * The event dispatcher. Created when this module is registered in the Event Hub. + */ + std::shared_ptr dispatcher_response_identity_; + + private: + + /** + * @private + * Load the overridden configuration from memory. + * @param lock a mutex lock to synchronize the overridden config. The lock is not released within this method. + */ + void RetrieveOverriddenConfigFromPersistence(std::unique_lock& lock); + + /** + * @private + * Saves the overridden configuration map in the persistence under the Configuration DataStore. + * Used to persist the programmed Configuration between launches + * + * @param overridden_config new overridden config map to be saved + */ + void SaveOverriddenConfigToPersistence(const std::shared_ptr& overridden_config); + + /** + * @private + * Load the app id from memory. + * + * @return application identifier from persistence + */ + std::string RetrieveAppIdFromPersistence(); + + /** + * @private + * Saves the app id in the persistence under the Configuration DataStore. + * Used to persist the app id between launches to load the cached configuration. + * + * @param app_id app id to be saved + */ + void SaveAppIdToPersistence(const std::string& app_id); + + /** + * @private + * The purpose of the SetAppIDInternalEvent is to refresh the existing configurtion with the persisted appID + * This method validates the appid for the SetAppIDInternalEvent + * It return true, if the persisted appid is same as the internalEvent appid present in the event_data + * It return false, if the persisted appid is different from the internalEvent appid present in the event_data + * + * @param event_data eventdata associated to the set internal appId event. + * @param new_app_id app id to be fetched + */ + bool ValidateForInternalEventAppIDChange(const std::shared_ptr& event_data, const std::string new_app_id); + + + // ================================ + // Helper methods + // ================================ + + /** + * @private + * Get a valid app id. Retrieves the stored app id from persistence. + * If not found, retrieves the app id from manifest. + * + * @return application identifier + */ + std::string GetValidAppID(); + + /** + * @private + * Attempts to configure with the bundled configuration. + * + * @param event event which triggered the configruation request. + * + * @return true if the configuration is successfully loaded, false otherwise + */ + bool LoadBundledConfig(const std::shared_ptr& event); + + /** + * @private + * Attempts to configure with the cached file. + * + * @param app_id associated app id of that cache file. + * @param event event which triggered the configruation request. + * + * @return true if the cached file is successfully loaded, false otherwise + */ + bool LoadCachedConfig(const std::string& app_id, const std::shared_ptr& event); + + /** + * @private + * Attempts to configure with the overridden configuration. + * + * @param event event which triggered the configruation request. + * + * @return true if succeeded, false otherwise + */ + bool LoadOverriddenConfig(const std::shared_ptr& event); + + + /** + * @private + * Central function to process all configuration changes. Called by several functions in response to changes. + * + * @param config_data EventData object containing the configuration update to be processed + * @param update bool denoting if this is an update or an overwrite + */ + void ChangeConfiguration(const std::shared_ptr& trigger_event, const std::shared_ptr& config_data, + const bool update); + /** + * @private + * Helper to get the PlatformServices JsonUtilityService + * @param json_utility_service The returned JsonUtilityService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformServices is not available, true otherwise. + */ + bool GetPlatformJsonUtilityService(std::shared_ptr& json_utility_service); + + /** + * @private + * Helper to get the PlatformServices SystemInfoService + * @param system_info_service The returned SystemInfoService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformServices is not available, true otherwise. + */ + bool GetPlatformSystemInfoService(std::shared_ptr& system_info_service); + + /** + * @private + * Helper to get the PlatformService FileSystemService + * @param file_system_service The returned FileSystemService. May be nullptr if the PlatformServices + * have gone away. + * @return false if the PlatformService is unavailable, true otherwise. + */ + bool GetFileSystemService(std::shared_ptr& file_system_service); + + /** + * @private + * Helper to create a new EventHub::PENDING Shared State for the given event. + * + * @param version the shared state version to create + */ + void CreatePendingSharedState(int32_t version); + + /** + * @private + * Helper to update previous EventHub::PENDING shared states to + * EventHub::PREV Configuration state. Call this method to "roll-back" + * to previous config shared state when failure occurs attempting to + * load new config. + * + * @param version the shared state version to create + */ + void UpdateSharedStateToPreviousConfig(int32_t version); + + /** + * @private + * Attempts to download and register rules from remote server described in config_data. + * + * @param config_data the EventData object containing all configuration settings. + */ + void DownloadRules(const std::shared_ptr& config_data); + + /** + * @private + * Called after rules are downloaded (by DownloadRules) to uncompress and register the rules. + * + * @param cached_file the Path to the downloaded rules. + * @param url the URL that was downloaded. + */ + void OnRulesDownloaded(const std::string& cached_file, const std::string& url); + + /** + * @private + * Loads rules from the given directory. Called by OnRulesDownloaded. + * + * @param directory_path string containing the path to the directory containing the rules definitions (rules.json). + * + * @return vector of Rule objects that were parsed from the directory. + */ + std::vector> LoadRulesFromDirectory(const std::string& directory_path); + + /** + * @private + * Parses rules from the standard rules json format into a list of Rule objects. Called by LoadRulesFromDirectory. + * + * @param json_object JsonObject containing the rules to parse. + * + * @return vector of rule objects parsed from the json object. + */ + std::vector> ParseRulesFromJsonObject(const std::shared_ptr& json_object); + + /** + * @private + * Generates consequence Event objects from a JsonArray of rule consequences. Called by ParseRulesFromJsonObject + * + * @param consequences JsonArray containing a list of consequence definitions. + * + * @return vector of Event objects containing the parsed consequence events. + */ + std::vector> GenerateConsequenceEvents(const std::shared_ptr& consequences); + + /** + * @private + * Returns the configuration datastore + * @return Shared pointer to Configuration State DataStore + */ + std::shared_ptr GetDataStore(); + + /** + * @private + * This module's current configuration + */ + std::shared_ptr current_config_; + + /** + * @private + * Application defined configuration applied over the current_config_ + */ + std::shared_ptr overridden_config_; + + /** + * @private + * For queueing the configuration request identity event. + */ + std::deque> getsdkids_event_queue_; + + /** + * @private + * Mutex for synchronization of current_config_ and overridden_config_ + * + * IMPORTANT: Be very very careful when calling external functions + * while holding mutex_, especially if those functions acquire + * mutexes. Failure to do this can result in hard-to-reproduce + * deadlocks. + */ + std::mutex mutex_; + + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATION_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h new file mode 100755 index 00000000..e2fe7b0a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationConstants.h @@ -0,0 +1,128 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H + +#include + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationConstants + * + * This class holds all constant values used by the Configuration module + */ + class ConfigurationConstants { + public: + +#pragma mark - EventDataKeys + class EventDataKeys { + public: + class Configuration { + public: + static const std::string SHARED_STATE_NAME; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_APP_ID; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_FILE_PATH; + static const std::string CONFIGURATION_REQUEST_CONTENT_IS_INTERNAL_EVENT; + static const std::string CONFIGURATION_REQUEST_CONTENT_UPDATE_CONFIG; + static const std::string CONFIGURATION_REQUEST_CONTENT_RETRIEVE_CONFIG; + static const std::string RULES_REMOTE_URL; + static const std::string CONFIGURATION_RESPONSE_IDENTITY_ALL_IDENTIFIERS; + static const std::string EVENT_STATE_OWNER; + + private: + Configuration() = delete; + }; + + private: + EventDataKeys() = delete; + }; + + + class SharedStateKeys { + public: + + // Analytics shared state keys + class Analytics { + public: + static const std::string MODULE_NAME; + static const std::string ANALYTICS_ID; + private: + Analytics() = delete; + }; + + // Audience shared state keys + class Audience { + public: + static const std::string MODULE_NAME; + static const std::string DPID; + static const std::string DPUUID; + static const std::string UUID; + private: + Audience() = delete; + }; + + + // Identity shared state keys + class Identity { + public: + static const std::string MODULE_NAME; + static const std::string MID; + static const std::string VISITOR_IDS_LIST; + static const std::string ADVERTISING_IDENTIFIER; + static const std::string PUSH_IDENTIFIER; + static const std::string USER_IDENTIFIER; + + private: + Identity() = delete; + }; + + + // Configuration shared state keys + class Configuration { + public: + static const std::string MODULE_NAME; + static const std::string CONFIG_EXPERIENCE_CLOUD_ORGID_KEY; + static const std::string ANALYTICS_CONFIG_REPORT_SUITES; + private: + Configuration() = delete; + }; + + + // Target shared state keys + class Target { + public: + static const std::string MODULE_NAME; + static const std::string TNT_ID; + static const std::string THIRD_PARTY_ID; + private: + Target() = delete; + }; + + + private: + SharedStateKeys() = delete; + }; + + private: + ConfigurationConstants() = delete; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONCONSTANTS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h new file mode 100755 index 00000000..802b9e81 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationData.h @@ -0,0 +1,131 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H + +#include +#include +#include "JsonUtilityServiceInterface.h" +#include "EventData.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationData + * + */ + class ConfigurationData : public Object { + public: + + /** + * Construct new ConfigurationData object with the provided JSON parser. + * + * @param json_utilty_service JSON utility serviced used to parse JSON formatted strings into + * internal JsonObjects and vice versa + */ + explicit ConfigurationData(const std::shared_ptr& json_utilty_service); + + /** + * Add configuration data from a JSON formatted string into this object. The formatted string + * must only contain flattened key/value pairs and no nested objects or array structures. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param json_string A JSON formatted string + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::string& json_string); + + /** + * Add configuration data from a map into this object. The map must only contain + * flattended configuration key/value pairs and no nested object, array, or map structures. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param map Key/value pairs to add to this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::map>& map); + + /** + * Copy configuration data from another ConfigurationData object to this object. + * Any matching keys will overwrite existing values in this ConfigurationData object. + * + * @param configuration_data ConfigurationData to copy into this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::shared_ptr& configuration_data); + + /** + * Add configuration data from a JsonObject to this configuration object. The JsonObject must + * only contain flattened key/value paris and no nested JSON objects or JSON array structures. + * Any matching keys in the given object will overwrite existing values in this ConfigurationData object + * + * @param json_object A JsonObject whose elements to add to this object + * @return a reference to this ConfigurationData object + */ + ConfigurationData& Put(const std::shared_ptr& json_object); + + /** + * Get a pointer to a new EventData object containing this configuration data. + * + * @return A pointer to a new EventData object containting this configuration data. + */ + std::shared_ptr GetEventData() const; + + /** + * Get a JSON formatted string representation of this configuration data. + * + * @return a JSON formatted string + */ + std::string GetJsonString() const; + + /** + * Determine if there are any configuration elements. + * + * @return true if there are no configuration elements, false otherwise + */ + bool IsEmpty() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + + /** + * @private + * Internal storage of configuration data. + */ + std::map> internal_map_; + + /** + * @private + * Json Utility Service from Platform Services, passed into constructor. + * Allowed to be nullptr. Must check for nullptr before using! + */ + std::shared_ptr json_utility_service_; + }; + + +} // end namespace AdobeMarketingMobile + + +#endif //ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDATA_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h new file mode 100755 index 00000000..b8679409 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationRequestContent.h @@ -0,0 +1,45 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + + /** + * @class ConfigurationEventDispather + * Event dispatcher for the Configuration module. + */ + class ConfigurationDispatcherConfigurationRequestContent : public ModuleEventDispatcher { + + public: + + /** + * Dispatch Configuration request using App ID. Called internally by the Configuration Module. + * + * @param app_id App ID used for configuration + */ + virtual void DispatchInternalConfigureWithAppIdEvent(const std::string& app_id); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONREQUESTCONTENT_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h new file mode 100755 index 00000000..3a94c939 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseContent.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + class EventData; + + /** + * @class ConfigurationEventDispather + * Event dispatcher for the Configuration module. + */ + class ConfigurationDispatcherConfigurationResponseContent : public ModuleEventDispatcher { + + public: + + /** + * Dispatch Configuration response event with updated configuration data. + * + * @param event_data Updated configuration data as EventData + * @param pair_id A unique pairing id for the event (optional) + */ + virtual void DispatchConfigResponseWithEventData(const std::shared_ptr& event_data, + const std::string& pair_id); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSECONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h new file mode 100755 index 00000000..73d82039 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDispatcherConfigurationResponseIdentity.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H + +#include "Configuration.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationDispatcherConfigurationResponseIdentity + * Event dispatcher for the Configuration Response Identity Events. + */ + class ConfigurationDispatcherConfigurationResponseIdentity : public ModuleEventDispatcher { + + public: + + /** + * Dispatches EventType#CONFIGURATION , EventSource#RESPONSE_IDENTITY event into the EventHub + * with #sdk_identities_json string for the given #pair_id. + * + * @param sdk_identities_json A Jsonstring containing all the identities + * @param pair_id A unique pairing id for one-time listener + */ + virtual void DispatchAllIdentities(const std::string& sdk_identities_json, const std::string& pair_id); + + }; +} + + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDISPATCHERCONFIGURATIONRESPONSEIDENTITY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h new file mode 100755 index 00000000..f0de4acd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationDownloader.h @@ -0,0 +1,52 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class NetworkServiceInterface; + class RemoteFileManagerServiceInterface; + class SystemInfoServiceInterface; + + class ConfigurationDownloader : public Object { + public: + ConfigurationDownloader(const std::shared_ptr& remote_file_service, + const std::string& url); + + virtual std::string DownloadConfig(); + + virtual std::string LoadCachedConfig(); + + const std::string GetUrl() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + const std::string url_; + std::shared_ptr manager_; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONDOWNLOADER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h new file mode 100755 index 00000000..6844b85c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerBootEvent.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerBootEvent + * Listener for EventHub BOOTED events. + */ + class ConfigurationListenerBootEvent : public ModuleEventListener { + public: + /** + * Callback for EventHub BOOTED events to the Configuration Module. + * + * @param event an EventHub BOOTED. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERBOOTEVENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h new file mode 100755 index 00000000..d4b4f074 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerHubSharedState.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerHubSharedState + * Listener for shared state change events. + */ + class ConfigurationListenerHubSharedState : public ModuleEventListener { + public: + /** + * Callback for shared state change events. + * + * @param event HUB SHARED_STATE event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERHUBSHAREDSTATE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h new file mode 100755 index 00000000..314d66e9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerLifecycleResponseContent.h @@ -0,0 +1,41 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H + +#include "Configuration.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerLifecycleResponseContent + * Listener for Configuration lifecycle response events. + */ + class ConfigurationListenerLifecycleResponseContent : public ModuleEventListener { + public: + /** + * Callback for Configuration retrieval request events. + * + * @param event Configuration retrieval request event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERLIFECYCLERESPONSECONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h new file mode 100755 index 00000000..dd3168ba --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestContent.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerRequestContent + * Listener for Configuration update events. + */ + class ConfigurationListenerRequestContent : public ModuleEventListener { + public: + /** + * Callback for Configuration update request events. + * + * @param event Configuration request content event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTCONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h new file mode 100755 index 00000000..9f33397a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ConfigurationListenerRequestIdentity.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H +#define ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H + +#include "Configuration.h" +#include "Event.h" +#include "ModuleEventListener.h" + +namespace AdobeMarketingMobile { + /** + * @class ConfigurationListenerRequestIdentity + * Listener for Configuration Request Identity events. + */ + class ConfigurationListenerRequestIdentity : public ModuleEventListener { + public: + /** + * Callback for Configuration Request Identity events. + * + * @param event Configuration Request Identity event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + + +#endif /* ADOBEMOBILE_CONFIGURATION_CONFIGURATIONLISTENERREQUESTIDENTITY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ContextData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ContextData.h new file mode 100755 index 00000000..4b529b91 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ContextData.h @@ -0,0 +1,49 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_CONTEXTDATA_H_ +#define ADOBEMOBILE_UTIL_CONTEXTDATA_H_ + +#include +#include +#include + +namespace AdobeMarketingMobile { + + class ContextData { + + public: + static std::map DecodeContextData(const std::string& context_data_string); + static std::string EncodeContextData(const std::map& cdata); + static std::string CleanKey(const std::string& key); + static std::map CleanDictionaryKeys(const std::map& raw_dictionary); + + private: + std::map sub_items_; + std::string value_; + + static std::vector Split(const std::string& str, const char delim); + static void EncodeValueIntoMap(const std::string& value, std::map& destination_map, + const std::vector& keys, size_t index = 0); + static std::string SerializeToURLFormat(std::map& encoded_data); + static std::string Flatten(const std::vector& path, const std::string& end = ""); + }; +} + +#endif diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Core.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Core.h new file mode 100755 index 00000000..390c8742 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Core.h @@ -0,0 +1,297 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_CORE_H +#define ADOBEMOBILE_CORE_CORE_H + +#include +#include +#include +#include +#include +#include +#include + +#include "Common.h" +#include "Configuration.h" +#include "Core.h" +#include "CryptoServiceInterface.h" +#include "Event.h" +#include "EventBuilder.h" +#include "EventData.h" +#include "EventHub.h" +#include "EventSource.h" +#include "EventType.h" +#include "ExternalModuleInterface.h" +#include "InternalModule.h" +#include "Log.h" +#include "MobilePrivacyStatus.h" +#include "Module.h" +#include "ModuleEventDispatcher.h" +#include "ModuleEventDispatcherBase.h" +#include "ModuleEventListener.h" +#include "ModuleEventListenerBase.h" +#include "ModuleEventProcessor.h" +#include "ModuleEventProcessorBase.h" +#include "Object.h" +#include "ObjectInterface.h" +#include "OneTimeListener.h" +#include "PlatformServicesInterface.h" +#include "RandomUtil.h" +#include "SdkError.h" +#include "StringUtils.h" +#include "Variant.h" +#include "VariantKind.h" + +namespace AdobeMarketingMobile { + + /** + * @class Core + * + * @brief Core is the API surface used by the top-level native API. + * + * The native API layer instantiates and calls into the Core to implement most API functionality. + * This design allows the native API layer implementation to mostly consist of bindings to the native language. + * + * Internally, the Core takes care of EventHub registration and cleanup. + */ + class Core : public Object { + public: + std::shared_ptr event_hub; ///< the event hub instance + + std::shared_ptr platform_services; ///< the platform services instance + + /** + * @name Creation and Disposal + */ + ///@{ + + /** + * @brief Creates the Core. + * + * @param platform_services - the platform services to use + * @param event_hub - the event hub to use (for mocking). If `nullptr`, a new EventHub instance is created and + * registers all required modules. If passing an EventHub instance, no modules are + * registered. + * + * @note Make sure to cleanup after the returned Core by calling Dispose(). + * + * @returns a new Core with the given platform services. + */ + static std::shared_ptr Create(const std::shared_ptr& platform_services, + const std::shared_ptr& event_hub = nullptr); + + /** + * @brief Destructor + */ + ~Core(); + + /** + * @brief Cleans up after this + * + * Calls Dispose with a reasonable default wait time. + * + * @see bool Dispose(std::chrono::milliseconds max_wait_duration) + * + * @return true if clean up completed before the wait time elapsed. + */ + bool Dispose(); + + /** + * @brief Cleans up after this + * + * Clean up is asynchronous and this call may block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if clean up completed before the wait time elapsed. + */ + bool Dispose(std::chrono::milliseconds max_wait_duration); + + ///@} + + /** + * @name Module Registration + */ + ///@{ + + /** + * @brief Creates and registers a module of the specified type. + * + * `TModule` is the module class to register, must be a subclass of `Module`. + */ + template + void RegisterModule(); + + ///@} + + /** + * @name Configuration + */ + ///@{ + + /** + * @brief Loads remote configuration specified by given application ID. + * + * Configure the SDK by downloading the remote configuration file hosted on Adobe servers + * specified by the given application ID. The configuration file is cached once downloaded + * and used in subsequent calls to this API. If the remote file is updated after the first + * download, the updated file is downloaded and replaces the cached file. + * + * On failure to download the remote configuration file, the SDK is configured using the cached + * file if it exists, or if no cache file exists then the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * UpdateConfiguration() or SetPrivacyStatus(). Configuration updates made using UpdateConfiguration() + * and SetPrivacyStatus() are always applied on top of configuration changes made using this API. + * + * @param app_id a unique identifier assigned to the app instance by the Adobe Mobile Services. It is automatically + * added to the ADBMobile JSON file when downloaded from the Adobe Mobile Services UI and can be + * found in Manage App Settings. A value of empty string has no effect. + */ + void ConfigureWithAppId(const std::string& app_id) const; + + /** + * @brief Loads configuration from local file. + * + * Configure the SDK by reading a local file containing the JSON configuration. + * + * On failure to read the file or parse the JSON contents, the existing configuration remains unchanged. + * + * Calls to this API will replace any existing SDK configuration except those set using + * UpdateConfiguration() or SetPrivacyStatus(). Configuration updates made using UpdateConfiguration() + * and SetPrivacyStatus() are always applied on top of configuration changes made using this API. + * + * @param file_path absolute path to a local configuration file. A value of empty string has no effect. + */ + void ConfigureWithFileInPath(const std::string& file_path) const; + + /** + * @brief Update specific configuration parameters. + * + * Update the current SDK configuration with specific key/value pairs. Keys not found in the current + * configuration are added. Configuration updates are preserved and applied over existing or new + * configurations set by calling ConfigureWithAppId() or ConfigureWithFileInPath(). + * + * Using nullptr values is allowed and effectively removes the configuration parameter from the + * current configuration. + * + * @param config_map configuration key/value pairs to be updated or added. A value of empty map has no effect. + * @see EventDataKeys + */ + void UpdateConfiguration(const std::map>& config_map) const; + + /** + * @brief Set the Adobe Mobile Privacy status. + * + * Sets the MobilePrivacyStatus for this SDK. The set privacy status is preserved + * and applied over any new configuration changes from calls to ConfigureWithAppId() or ConfigureWithFileInPath(). + * + * @param privacy_status MobilePrivacyStatus to be set to the SDK + * @see MobilePrivacyStatus + * @see UpdateConfiguration() + */ + void SetPrivacyStatus(MobilePrivacyStatus privacy_status) const; + + /** + * @brief Get the current Adobe Mobile Privacy Status. + * + * Gets the currently configured MobilePrivacyStatus and passes it as a parameter + * to the given void function. + * + * @param callback method invoked with the configured privacy status as a parameter + * @see MobilePrivacyStatus + */ + void GetPrivacyStatus(const std::function& callback) const; + + /** + * Retrieve all identities stored by/known to the SDK in a JSONString format. + * + * Dispatches an EventType#CONFIGURATION - EventSource#REQUEST_IDENTITY Event. + * Returns an empty string if the SDK is unable to retrieve any identifiers. + * + * @param callback method which is invoked with all the known identifier in JSONString format + * @see AdobeCallback + */ + void GetSDKIdentities(const std::function& callback) const; + + /** + * @name External Module + */ + ///@{ + + /** + * @brief Register an external module. + * + * @param external_module The interface to the applications external module implementation. + * @param error_callback A callback called if errors occur during registration. + */ + void RegisterExternalModule(const std::shared_ptr& external_module, + std::function error_callback); + + ///@} + + /** + * @name Rules Engine Module + */ + ///@{ + + /** + * Called from the platform to force redownload rules. + *

+ * Rules Engine attempts to redownload rules from the already defined url provided in the configuration. + * Dispatches {@code EventType#RULES_ENGINE} - {@code EventSource.REQUEST_CONTENT} {code Event} to refresh rules. + */ + void DownloadRules(); + + ///@} + + private: + /** + * @private + * + * Default constructor, part of 2-phase initialization. + */ + Core(); + + /** + * @private + * + * Initializes this, part of 2-phase initialization. + */ + void Init(const std::shared_ptr& new_platform_services, + const std::shared_ptr& new_event_hub); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + void Core::RegisterModule() { + if (event_hub) { + event_hub->RegisterModule(); + } + } +} + +#endif //ADOBEMOBILE_CORE_CORE_H + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h new file mode 100755 index 00000000..5fd87f8b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CoreConstants.h @@ -0,0 +1,71 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_CORECONSTANTS_H +#define ADOBEMOBILE_CORE_CORECONSTANTS_H + +#include + +namespace AdobeMarketingMobile { + class CoreConstants { + public: + static const std::string CORE_VERSION; + +#pragma mark - Event Data Keys + class EventDataKeys { + public: + static const std::string SHARED_STATE_OWNER; + + class Configuration { + public: + static const std::string SHARED_STATE_NAME; + static const std::string GLOBAL_CONFIG_PRIVACY; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_APP_ID; + static const std::string CONFIGURATION_REQUEST_CONTENT_JSON_FILE_PATH; + static const std::string CONFIGURATION_REQUEST_CONTENT_UPDATE_CONFIG; + static const std::string CONFIGURATION_REQUEST_CONTENT_RETRIEVE_CONFIG; + static const std::string CONFIGURATION_RESPONSE_IDENTITY_ALL_IDENTIFIERS; + private: + Configuration() = delete; + }; + + class RulesEngine { + public: + static const std::string CONSEQUENCE_TRIGGERED; + static const std::string CONSEQUENCES_LOADED; + static const std::string CONSEQUENCE_ID; + static const std::string CONSEQUENCE_TYPE; + static const std::string CONSEQUENCE_DETAIL; + static const std::string CONSEQUENCE_ASSETS_PATH; + static const std::string RULES_REQUEST_CONTENT_DOWNLOAD_RULES; + private: + RulesEngine() = delete; + }; + + private: + EventDataKeys() = delete; + }; + + + private: + CoreConstants() = delete; + }; +} + +#endif /* ADOBEMOBILE_CORE_CORECONSTANTS_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h new file mode 100755 index 00000000..dc6e9645 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/CryptoServiceInterface.h @@ -0,0 +1,66 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class UuidInterface : public virtual ObjectInterface { + public: + /** + * Get ASCII string representation of a random 128-bit UUID (Universally Unique Identifier) + * The generated UUID must conform to RFC 4122 version 4 ( https://tools.ietf.org/html/rfc4122 ) + * Random UUID ASCII string example: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + */ + virtual std::string GetString() const = 0; + + /** + * Get UUID bytes + * + * @param uuid_bytes 16 byte buffer + */ + virtual void GetBytes(unsigned char* uuid_bytes) const = 0; + }; + + class CryptoServiceInterface : public virtual ObjectInterface { + public: + /** + * Generate a random 128-bit UUID (Universally Unique Identifier) + * The generated UUID must conform to RFC 4122 version 4 ( https://tools.ietf.org/html/rfc4122 ) + * Random UUID ASCII string example: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + * + * @return UuidInterface shared_ptr + */ + virtual std::shared_ptr GetRandomUuid() const = 0; + + /** + * Get SHA-1 hash value for string ( https://tools.ietf.org/html/rfc3174 ) + * SHA-1 hash example: + * input: "5DCD537D-A351-408E-92D7-EBCBC69FEF44" + * output: "3ed187dcf5662d135760654b9d8f061dc18822d0" + * + * @return string representation of sha-1 hash value + */ + virtual std::string GetSha1Hash(const std::string& str) const = 0; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_CRYPTOSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h new file mode 100755 index 00000000..df73a97f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitBase.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITBASE_H +#define ADOBEMOBILE_SHARED_DATABASEHITBASE_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + /** + * DatabaseHitBase + * + * Abstract Base class that should be implemented by any class that represents a "Hit" which will be + * stored in a local database + */ + class DatabaseHitBase : public Object { + public: + + std::string identifier; ///< unique identifier for the database record + std::chrono::seconds timestamp; ///< created timestamp in seconds since jan 1, 1970 + }; +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h new file mode 100755 index 00000000..803303b1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchema.h @@ -0,0 +1,95 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H +#define ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H + +#include +#include "DatabaseHitSchemaBase.h" +#include "DatabaseHitBase.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + /** + * DatabaseHitSchema + * + * Abstract Base class that should be implemented by any class that will create a new database table + */ + template + class DatabaseHitSchema : public DatabaseHitSchemaBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + + public: + /** + * GenerateHit must be implemented by classes that implement DatabaseHitSchema. + * + * @return a DatabaseHitBase object generated off the provided QueryResult parameter. + */ + virtual std::shared_ptr GenerateHit(const std::shared_ptr& query_result) = 0; + + /** + * Overrides DatabaseHitSchemaBase::GenerateHitBase to call GenerateHit and return the proper data type + */ + std::shared_ptr GenerateHitBase(const std::shared_ptr& query_result) override; + + /** + * GenerateDataMap must be implemented by classes that implement DatabaseHitSchema. + * + * @return a DatabaseHitBase object generated off the provided QueryResult parameter. + */ + virtual std::map> GenerateDataMap(const std::shared_ptr& hit) = 0; + + /** + * Overrides DatabaseHitSchemaBase::GenerateDataMapBase to call GenerateDataMap and accept the proper data type parameter + */ + std::map> GenerateDataMapBase(const std::shared_ptr& hit) + override; + + protected: + /** + * Constructor. + * For use by subclasses. + */ + DatabaseHitSchema(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + DatabaseHitSchema::DatabaseHitSchema() {} + + template + std::shared_ptr + DatabaseHitSchema::GenerateHitBase(const std::shared_ptr& query_result) { + return GenerateHit(query_result); + } + + template + std::map> + DatabaseHitSchema::GenerateDataMapBase(const std::shared_ptr& hit) { + return GenerateDataMap(std::dynamic_pointer_cast(hit)); + } +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITSCHEMA_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h new file mode 100755 index 00000000..152040bf --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseHitSchemaBase.h @@ -0,0 +1,115 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H +#define ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H + +#include +#include +#include +#include "DatabaseServiceInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + + /** + * DatabaseHitSchemaBase + * + * Abstract Base class that should be implemented by any class that will create a new database table + */ + class DatabaseHitSchemaBase : public Object { + + public: + /** + * @returns table_name_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::string GetTableName(); + + /** + * @returns database_name_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::string GetDatabaseName(); + + /** + * @returns column_names_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector GetColumnNames(); + + /** + * @returns column_data_types_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector GetColumnDataTypes(); + + /** + * @returns column_constraints_ + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector> GetColumnConstraints(); + + /** + * GenerateHit must be implemented by classes that implement DatabaseHitSchemaInterface. + * This method returns a DatabaseHit object generated off the provided QueryResult parameter. + */ + virtual std::shared_ptr GenerateHitBase(const std::shared_ptr& query_result) = 0; + + /** + * GenerateDataMap must be implemented by classes that implement DatabaseHitSchemaInterface. + * This method returns a map of string-variants generated off the provided DatabaseHit parameter. + */ + virtual std::map> GenerateDataMapBase(const std::shared_ptr& hit) + = 0; + + protected: + /** + * Constructor. + * For use by subclasses. + */ + DatabaseHitSchemaBase(); + + /** + * table_name_ name of the database table represented by this class + */ + std::string table_name_; + + /** + * database_name_ name of the database file to be created + */ + std::string database_name_; + + /** + * column_names_ is a vector of strings defining the names for the database columns + * represented by this class + */ + std::vector column_names_; + + /** + * column_data_types_ is a vector of data types, in order, for the database columns + * represented by this class + */ + std::vector column_data_types_; + + /** + * column_constraints_ is a vector of vectors, representing column contraints for each column + * represented by this class + */ + std::vector> column_constraints_; + }; +} + +#endif /* ADOBEMOBILE_SHARED_DATABASEHITSCHEMABASE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h new file mode 100755 index 00000000..9278d97d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/DatabaseServiceInterface.h @@ -0,0 +1,252 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* DATABASE_OPEN_ERROR = "database.open_error"; ///< Database open error occurred. + constexpr static const char* DATABASE_QUERY_EXEC_ERROR = + "database.query_exec_error"; ///< A database query execution error occurred. + constexpr static const char* DATABASE_QUERYRESULT_INDEX_ERROR = + "database.queryresult_index_error"; ///< Error occurred in the index of the query result. + constexpr static const char* DATABASE_QUERYRESULT_ALREADY_CLOSED = + "database.queryresult_already_closed"; ///< Query result is already closed. + } + + /** + * Interface defining methods for reading query results from a database + */ + class QueryResultInterface : public virtual ObjectInterface { + public: + /** + * Get total number of rows in the result + * + * @return int32_t number of rows in the QueryResult + */ + virtual int32_t GetCount() const = 0; + + /** + * Get the value of the requested column as an integer + * + * @param column_index zero-based index of the target column + * @return int32_t the value of the column as an int32_t + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual int32_t GetInt(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a double + * + * @param column_index zero-based index of the target column + * @return double the value of the column as a double + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual double GetDouble(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a float + * + * @param column_index zero-based index of the target column + * @return float the value of the column as a float + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual float GetFloat(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a long + * + * @param column_index zero-based index of the target column + * @return the value of the column as int64_t + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual int64_t GetLong(uint32_t column_index) const = 0; + + /** + * Get the value of the requested column as a string + * + * @param column_index zero-based index of the target column + * @return std::string the value of the column as a string + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual std::string GetString(uint32_t column_index) const = 0; + + /** + * Check if the value of the requested column is null + * + * @param column_index zero-based index of the target column + * @return bool indicating whether the column value is null + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool IsNull(uint32_t column_index) const = 0; + + /** + * Move to the first row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToFirst() = 0; + + /** + * Move to the last row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToLast() = 0; + + /** + * Move to the next row in the QueryResult + * + * @return bool indicating whether the move was successful + * @throws DATABASE_QUERYRESULT_ALREADY_CLOSED if the QueryResult is already closed, or DATABASE_QUERYRESULT_INDEX_ERROR if index is not available + */ + virtual bool MoveToNext() = 0; + + /** + * Close this QueryResult + */ + virtual void Close() = 0; + + }; + /** + * Interface defining relational database operations + */ + + class Query; + class DatabaseInterface : public virtual ObjectInterface { + public: + /** + * Allowed data types for database columns + */ + enum class ColumnDataType : int32_t { + INTEGER = 0, + REAL, + TEXT + }; + + /** + * Allowed constraints for database columns + */ + enum class ColumnConstraint : int32_t { + NOT_NULL = 0, + UNIQUE, + PRIMARY_KEY, + AUTOINCREMENT + }; + + /** + * Create a table if it doesn't exist + * + * @param name the table name + * @param column_names list of column names + * @param column_data_types list of column data types + * @param column_constraints a list of lists containing column constraints for each table column + * @return bool indicating whether the create table operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool CreateTable(const std::string& name, const std::vector& column_names, + const std::vector& column_data_types, + const std::vector>& column_constraints) = 0; + + /** + * Insert a row into a table in the database + * + * @param table name of the table to insert the row into + * @param values map containing the initial column values for the row. The keys should be the column names and the values the column values. + * @return bool indicating whether the insert operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Insert(const std::string& table, const std::map>& values) = 0; + + /** + * Query a table in the database + * + * @param query the query to execute + * @return QueryResult the result of this query, positioned at the first row + */ + virtual std::shared_ptr RunQuery(const std::shared_ptr& query) = 0; + + /** + * Update rows for a table in the database + * + * @param table name of the table to update + * @param values a map from column names to new column values. Empty string is a valid value. + * @param where_clause the optional WHERE clause to apply when updating. Passing empty string will update all rows + * @param where_args A list of arguments for where clause. You may include ?s in the where clause, which will be replaced by the values from where_args. The values will be bound as strings + * @return bool indicating whether the update operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Update(const std::string& table, + const std::map>& values, + const std::string& where_clause, + const std::vector& where_args) = 0; + + /** + * Delete rows from a table in the Database + * + * @param table name of the table to delete rows from + * @param where_clause the optional WHERE clause to apply when deleting. Passing empty string will delete all rows + * @param where_args A list of arguments for where clause. You may include ?s in the where clause, which will be replaced by the values from where_args. The values will be bound as strings + * @return bool indicating whether the delete operation was successful + * @throw ErrorCodes::DATABASE_OPEN_ERROR if database cannot open, or ErrorCodes::DATABASE_QUERY_EXEC_ERROR if query is not executable. + */ + virtual bool Delete (const std::string& table, + const std::string& where_clause, + const std::vector& where_args) = 0; + + /** + * Close this database + */ + virtual void Close() = 0; + + }; + + class DatabaseServiceInterface : public virtual ObjectInterface { + public: + /** + * Opens a database if it exists, otherwise creates a new one with the specified name. + * + * @param db_name the database name + * @return a Database instance, or null if error occurs + */ + virtual std::shared_ptr OpenDatabase(const std::string& db_name) = 0; + + /** + * Delete database if it exists + * + * @param db_name the database name + * @return bool indicating whether the database file delete operation was successful + */ + virtual bool DeleteDatabase(const std::string& db_name) = 0; + }; + +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_DATABASESERVICEINTERFACE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h new file mode 100755 index 00000000..c3a68877 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EncodingServiceInterface.h @@ -0,0 +1,31 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class EncodingServiceInterface : public virtual ObjectInterface { + public: + virtual std::string Base64Decode(const std::string& encoded_string) const = 0; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_ENCODINGSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Event.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Event.h new file mode 100755 index 00000000..19132ecd --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Event.h @@ -0,0 +1,195 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENT_H +#define ADOBEMOBILE_CORE_EVENT_H + +#include +#include +#include "Object.h" +#include "EventType.h" +#include "EventSource.h" + +namespace AdobeMarketingMobile { + class EventBuilder; + class EventData; + + /** + * @class Event + * + * @brief An Event indicates that something notable happened and includes relevant information about what happened. + * + * Creating Events + * ---------------- + * + * Events are created using EventBuilder: + * + * auto event = EventBuilder{"the_event_name", EventType::ANALYTICS, EventSource::REQUEST_CONTENT}.Build(); + * + * Events can also be created via cloning using Event::Copy(): + * + * auto event2 = event.Copy(); + * + * Event Properties + * ---------------- + * Events carry the following pieces of information: + * - _Name_ is a descriptive string for an individual event. Primarily used for logging. + * - _Type_ is an EventType that identifies what happened. + * - _Source_ is an EventSource that identifies the origin of the event. + * - _Pairing ID_ is a string that, when set, uniquely identifies this event. A one-time listener can register on this + * pairing id for 1:1 communication. + * - _Response Pairing ID_ is relevant for events that follow a response-request pattern. When set, identifies the + * pairing ID that should be used for responses to this event. + * - _Number_ is an integer sequence number. Used primarily for debugging. + * - _Data_ is an EventData, an associative map of string keys to values of various types. Used to convey additional + * information. + * - _Timestamp_ is the time at which the event was generated. + * + * Dispatching, Processing, and Listening for Events + * ------------------------------------------------- + * To dispatch events, a module will typically subclass ModuleEventDispatcher and invoke EventHub::Dispatch(). + * + * To listen for events, a module will typically subclass ModuleEventListener. + * + * To process (change) events, module will typically subclass ModuleEventProcessor. + */ + class Event : public Object { + public: + // TODO: (AMSDK-5832) Some methods should return const& + + friend class EventBuilder; + + /** + * @brief Convenience event for retrieving the oldest shared state + **/ + static const std::shared_ptr SHARED_STATE_OLDEST; + + /** + * @brief Convenience event for retrieving the newest shared state + **/ + static const std::shared_ptr SHARED_STATE_NEWEST; + + /** + * @brief Copies this event. + * @return a copy of this event + */ + std::shared_ptr Copy() const; + + /** + * @brief Gets the name of this event. + * @return the name of this event + */ + std::string GetName() const; + + /** + * @brief Gets the source of this event. + * @return the source of this event + */ + const std::shared_ptr& GetEventSource(); + + /** + * @brief Gets the type of this event. + * @return the type of this event + */ + const std::shared_ptr& GetEventType(); + + /** + * @brief Gets the pairing id of this event. + * @return the pairing id of this event, or empty string if there is no pairing id + */ + std::string GetPairID() const; + + /** + * @brief Gets the response pairing id of this event. + * @return the response pairing id of this event, or empty string if there is no response pairing id + */ + std::string GetResponsePairID() const; + + /** + * @brief Gets the additional data for this event. + * @return the data for this event + */ + std::shared_ptr GetData(); + + /** + * @brief Gets the timestamp of this event. + * @return the time at which this event was generated, expressed as milliseconds since the UNIX epoch + */ + std::chrono::milliseconds GetTimestamp() const; // ms since epoch of std::chrono::steady_clock + + /** + * @brief Gets the number of this event. + * @return a sequence number for the event + */ + int32_t GetEventNumber() const; + + // TODO: (AMSDK-5834) Make SetEventNumber only accessible to EventHub + /** + * @brief Sets sequence number for the event. + * + * Intended for use by EventHub. + * + * @param number - the new event number + */ + void SetEventNumber(int32_t number); + + // TODO: (AMSDK-5833) Possibly remove GetError() + /** + * @brief Returns an error descriptor for this event. + * @return event error descriptor (generally only populated on error events) + */ + std::string GetError() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + /** + * @private + * Constructor. Intended for use by EventBuilder. + */ + explicit Event(const std::string& name, const std::shared_ptr& type, + const std::shared_ptr& source); + + /** + * @private + * Constructor. Only used by creating oldest and latest event constant. + */ + explicit Event(int32_t event_number); + + std::string name_; ///< @private the name of this event + std::shared_ptr source_; ///< @private the source of this event + std::shared_ptr type_; ///< @private the type of this event + std::string pair_id_; ///< @private the pairing id of this event + std::string response_pair_id_; ///< @private the response pairing id of this event + std::shared_ptr data_; ///< @private the additional data for this event + std::string error_; ///< @private the error message + + /** + * @private + * the time at which this event was generated, expressed as milliseconds since the UNIX epoch + */ + std::chrono::milliseconds timestamp_; + + int32_t event_number_; ///< @private sequence number for the event. + }; +} + +#endif //ADOBEMOBILE_CORE_EVENT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h new file mode 100755 index 00000000..9025be1f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventBuilder.h @@ -0,0 +1,126 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTBUILDER_H +#define ADOBEMOBILE_CORE_EVENTBUILDER_H + +#include +#include +#include + +namespace AdobeMarketingMobile { + class Event; + class EventData; + class EventSource; + class EventType; + + /** + * @class EventBuilder + * + * @brief EventBuilder is the builder class for creating instances of Event. + * + * EventBuilder is a POD class and should only be created on the stack. + * + * Example: + * + * std::shared_ptr event = EventBuilder{"the_event_name", + * EventType::ANALYTICS, + * EventSource::REQUEST_CONTENT} + * .SetPairID("1234") // methods can be chained + * .Build(); // when complete, call Build() to construct the Event + */ + class EventBuilder { + public: + /** + * @brief Constructs the builder for an event with the given name, type, and source. + */ + explicit EventBuilder(const std::string& name, const std::shared_ptr& type, + const std::shared_ptr& source); + + /* EventBuilder is not copyable or movable */ + EventBuilder(const EventBuilder&) = delete; + EventBuilder& operator=(const EventBuilder&) = delete; + EventBuilder(EventBuilder&&) = delete; + EventBuilder&& operator=(EventBuilder&&) = delete; + + /** + * @brief Sets the pair id for the event. + */ + EventBuilder& SetPairID(const std::string& pairId); + + /** + * @brief Sets the response pair id for the event. + */ + EventBuilder& SetResponsePairID(const std::string& responsePairId); + + // TODO: (AMSDK-5833) Is this used? + /** + * @brief Sets the error for the event. + */ + EventBuilder& SetError(const std::string& error); + + /** + * @brief Sets the timestamp for the event. + * If not explicitly set, the timestamp would be set to the number of milliseconds since Unix Epoch. + */ + EventBuilder& SetTimestamp(std::chrono::milliseconds timestamp); + + /** + * @brief Sets the data for the event. + * + * For efficiency reasons, the event's data will be set to the instance provided by the `data` argument. + * Do not modify the `data` instance after passing the instance to `SetData()` + */ + EventBuilder& SetData(const std::shared_ptr& data); + + /** + * @brief Sets the data for the event to a copy of the given EventData. + */ + EventBuilder& CopyData(const std::shared_ptr& data); + + /** + * @brief Sets the number of the event. + * + * Most users will not need to call this method directly, as the event number is typically set by the EventHub. + */ + EventBuilder& SetEventNumber(int32_t number); + + /** + * @brief Builds the specified event. + * + * Calling this method twice will result in an error. + * + * @returns the newly created event. + */ + std::shared_ptr Build(); + + private: + /** + * @private + * + * Throws an exception if this was already built. + */ + void ThrowIfAlreadyBuilt(); + + std::shared_ptr event_; ///< @private the underlying event + + bool did_build_; ///< @private true iff `Build()` was already called + }; +} + +#endif //ADOBEMOBILE_CORE_EVENTBUILDER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventData.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventData.h new file mode 100755 index 00000000..7f737526 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventData.h @@ -0,0 +1,763 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTDATA_H +#define ADOBEMOBILE_CORE_EVENTDATA_H + +#include +#include +#include +#include "Expected.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + enum class VariantKind : int32_t; + + + /** + * @class EventData + * + * @brief EventData is data that can be included with events or shared states. + * + * At the top-level, EventData is a map of `string` keys to `Variant` values. + * + * @note When making changes to the interface/implementation of EventData, any information stored in EventData + * MUST be convertible to JSON. If it can't be expressed as JSON, it shouldn't be stored in EventData. + * + * Constructing an EventData + * ------------------------- + * To construct an empty EventData, use `std::make_shared`: + * + * auto event_data = std::make_shared(); + * + * Adding key-value pairs to an EventData + * -------------------------------------- + * The `Put` methods can be used to add/modify EventData key-value pairs: + * + * auto event_data = std::make_shared(); + * event_data->PutString("a string", "some value"); + * event_data->PutInteger("a number", 42); + * + * EventData supports storing any values that Variant supports. + * + * Inspecting EventData + * -------------------- + * The `Get` methods can be used to retrieve key-value pairs: + * + * std::string value; + * if (event_data->GetString("a string", value)) { + * // the value associated with "a string" will be put into value + * } else { + * // event_data does not contain "a string" or it is not convertible to std::string + * } + * + * The `Opt` methods retrieve key-value pairs, returning a default value if the key was not found: + * + * auto value = event_data->OptString("a string", "value if missing"); + * + * Additonal methods such as EventData::ContainsKey(), EventData::IsEmpty(), EventData::Size(), + * EventData::GetKind() allow inspection of the underlying map. + * + * Cloning an EventData + * -------------------- + * EventData::Copy() can be used to (deep) clone an EventData instance: + * + * auto event_data_1 = std::make_shared(); + * event_data_1.PutString("flavor", "sour"); + * event_data_1.PutString("color, "blue"); + * + * auto event_data_2 = event_data_1->Copy(); + * event_data_2.PutString("color", "green"); + * + * // event_data_1 contains { "flavor" : "sour", "color" : "blue" } + * // event_data_2 contains { "flavor" : "sour", "color" : "green" } + * + * Converting an EventData to/from std::map + * ---------------------------------------- + * Constructors exist to construct EventData from `std::map` and + * `std::map>`. + * + * EventData::AsMapCopy() or can be used to (deep) copy the EventData contents into a map. + * + */ + class EventData : public Object { + public: + /** + * @brief Constructs an empty EventData + */ + EventData(); + + /** + * @brief Constructs an EventData with the given key-value pairs + */ + explicit EventData(const std::map>& map); + + /** + * @brief Constructs an EventData with the given key-value pairs + */ + explicit EventData(const std::map& map); + + /** + * @brief Deep copies this + * @returns a deep copy of this + */ + std::shared_ptr Copy() const; + + /** + * @brief Copies this to a `std::map` + * @returns a copy of this, as a `std::map` + */ + std::map> AsMapCopy() const; + + /** + * @brief Checks if the EventData contains the given key + * @returns true iff the EventData contains the given key + */ + bool ContainsKey(const std::string& key); + + /** + * @brief Checks if the EventData contains no keys + * @returns true iff there EventData contains no keys + */ + bool IsEmpty() const; + + /** + * @brief Gets the number of key-value pairs in this + * @returns the number of key-value pairs in this + */ + size_t Size() const; + + /** + * @brief Gets the kind of value for a given key + * @returns the kind of value that the specific key of EventData holds. EVENT_DATA_NO_SUCH_KEY if no such key. + */ + Expected GetKind(const std::string& key) const; + + /** + * @brief Sets the value for key to a copy of the given string. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromString(value)); + * + * @returns `*this` + */ + EventData& PutString(const std::string& key, const std::string& value); + + /** + * @brief Sets the value for key to the given `int32_t`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromInteger(value)); + * + * @returns `*this` + */ + EventData& PutInteger(const std::string& key, int32_t value); + + /** + * @brief Sets the value for key to the given `int64_t`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromLong(value)); + * + * @returns `*this` + */ + EventData& PutLong(const std::string& key, int64_t value); + + /** + * @brief Sets the value for key to the given `double`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromDouble(value)); + * + * @returns `*this` + */ + EventData& PutDouble(const std::string& key, double value); + + /** + * @brief Sets the value for key to the given `bool`. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromBoolean(value)); + * + * @returns `*this` + */ + EventData& PutBoolean(const std::string& key, bool value); + + /** + * @brief Sets the value for key to the given variant. + * + * @returns `*this` + */ + EventData& PutVariant(const std::string& key, const std::shared_ptr& value); + + /** + * @brief Sets the value for key to a copy of the given vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromVariantVector(value)); + * + * @returns `*this` + */ + EventData& PutVariantVector(const std::string& key, const std::vector>& value); + + /** + * @brief Sets the value for key to a copy of the given string map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromStringMap(value)); + * + * @returns `*this` + */ + EventData& PutStringMap(const std::string& key, const std::map& value); + + /** + * @brief Sets the value for key to a copy of the given map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromVariantMap(value)); + * + * @returns `*this` + */ + EventData& PutVariantMap(const std::string& key, const std::map>& value); + + /** + * @brief Sets the value for key to a serialization of the given object to a variant. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedObject(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedObject(const std::string& key, const TObject* value); + + /** + * @brief Sets the value for key to a serialization of the given object to a variant. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedObject(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedObject(const std::string& key, const TObject* value, + const std::shared_ptr>& s); + + /** + * @brief Sets the value for key to a serialization of the given vector to a variant vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedVector(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedVector(const std::string& key, std::vector> value); + + /** + * @brief Sets the value for key to a serialization of the given vector to a variant vector. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedVector(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedVector(const std::string& key, std::vector> value, + const std::shared_ptr>& s); + + /** + * @brief Sets the value for key to a serialization of the given map to a variant map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedMap(value)); + * + * @returns `*this` + */ + template + EventData& PutTypedMap(const std::string& key, std::map> value); + + /** + * @brief Sets the value for key to a serialization of the given map to a variant map. + * + * Equivalent to: + * + * return this->PutVariant(Variant::FromTypedMap(value, s)); + * + * @returns `*this` + */ + template + EventData& PutTypedMap(const std::string& key, std::map> value, + const std::shared_ptr>& s); + + /** + * @brief Assigns `value` to a copy of the string value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetString(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a string + */ + bool GetString(const std::string& key, std::string& value) const; + + /** + * @brief Assigns `value` to the `int32_t` value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetInteger(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to an `int32_t` + */ + bool GetInteger(const std::string& key, int32_t& value) const; + + /** + * @brief Assigns `value` to the `int64_t` value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetLong(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to an `int64_t` + */ + bool GetLong(const std::string& key, int64_t& value) const; + + /** + * @brief Assigns `value` to the double value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetDouble(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `double` + */ + bool GetDouble(const std::string& key, double& value) const; + + /** + * @brief Assigns `value` to the boolean value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetBoolean(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `bool` + */ + bool GetBoolean(const std::string& key, bool& value) const; + + /** + * @brief Assigns `value` to the value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetBoolean(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present + */ + bool GetVariant(const std::string& key, std::shared_ptr& value) const; + + /** + * @brief Assigns `value` to the vector value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetVariantVector(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `vector` + */ + bool GetVariantVector(const std::string& key, std::vector>& value) const; + + /** + * @brief Assigns `value` to the string map value associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetStringMap(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a `vector` + */ + bool GetStringMap(const std::string& key, std::map& value) const; + + /** + * @brief Assigns `value` to a copy of the variant map associated with `key`. + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetVariantMap(value); + * } else { + * return false; + * } + * + * @returns true iff the key was present and was convertible to a variant map + */ + bool GetVariantMap(const std::string& key, std::map>& value) const; + + /** + * @brief Assigns `value` to an object deserialization of the variant associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedObject(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected> GetTypedObject(const std::string& key) const; + + /** + * @brief Assigns `value` to an object deserialization of the variant associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedObject(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected> GetTypedObject(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Assigns `value` to an object vector deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedVector(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedVector(const std::string& key) const; + + + /** + * @brief Assigns `value` to an object vector deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedVector(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedVector(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Assigns `value` to an object map deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedMap(); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedMap(const std::string& key) const; + + /** + * @brief Assigns `value` to an object map deserialization of the value associated with key, + * + * Equivalent to: + * + * std::shared_ptr variant_value; + * if (this->GetVariant(key, variant_value)) { + * return variant_value->GetTypedMap(s); + * } else { + * return { EVENT_DATA_NO_SUCH_KEY }; + * } + * + * @returns the value as a TObject or EVENT_DATA_NO_SUCH_KEY if the key was not present + */ + template + Expected>> GetTypedMap(const std::string& key, + const std::shared_ptr>& s) const; + + /** + * @brief Gets the string value associated with the given key, or a default + * + * Equivalent to: + * + * std::string v; + * if (this->GetString(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a string if the key was present and convertible to a string, otherwise `fallback` + */ + std::string OptString(const std::string& key, const std::string& fallback); + + /** + * @brief Gets the `int32_t` value associated with the given key, or a default + * + * Equivalent to: + * + * int32_t v; + * if (this->GetInteger(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as an `int32_t` if the key was present and convertible to an `int32_t`, otherwise `fallback` + */ + int32_t OptInteger(const std::string& key, int32_t fallback); + + /** + * @brief Gets the `int64_t` value associated with the given key, or a default + * + * Equivalent to: + * + * int64_t v; + * if (this->GetLong(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as an `int64_t` if the key was present and convertible to an `int64_t`, otherwise `fallback` + */ + int64_t OptLong(const std::string& key, int64_t fallback); + + /** + * @brief Gets the `double` value associated with the given key, or a default + * + * Equivalent to: + * + * double v; + * if (this->GetDouble(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a `double` if the key was present and convertible to a `double`, otherwise `fallback` + */ + double OptDouble(const std::string& key, double fallback); + + /** + * @brief Gets the `bool` value associated with the given key, or a default + * + * Equivalent to: + * + * bool v; + * if (this->GetBoolean(key, v)) { + * return v; + * } else { + * return fallback; + * } + * + * @returns the value as a `bool` if the key was present and convertible to a `bool`, otherwise `fallback` + */ + bool OptBoolean(const std::string& key, bool fallback); + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + std::map> internal_map_; ///< @private the internal map representation + }; + + namespace ErrorCodes { + constexpr static const char* EVENT_DATA_NO_SUCH_KEY = "event_data.no_such_key"; ///< no such key exists in the EventData + } + + template + EventData& EventData::PutTypedObject(const std::string& key, const TObject* value) { + return PutVariant(key, Variant::FromTypedObject(value)); + } + + template + EventData& EventData::PutTypedObject(const std::string& key, const TObject* value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedObject(value, s)); + } + + template + EventData& EventData::PutTypedVector(const std::string& key, std::vector> value) { + return PutVariant(key, Variant::FromTypedVector(value)); + } +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + EventData& EventData::PutTypedVector(const std::string& key, std::vector> value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedVector(value, s)); + } + + template + EventData& EventData::PutTypedMap(const std::string& key, std::map> value) { + return PutVariant(key, Variant::FromTypedMap(value)); + } + + template + EventData& EventData::PutTypedMap(const std::string& key, std::map> value, + const std::shared_ptr>& s) { + return PutVariant(key, Variant::FromTypedMap(value, s)); + } + + template + Expected> EventData::GetTypedObject(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedObject(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected> EventData::GetTypedObject(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedObject(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedVector(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedVector(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedVector(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedVector(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedMap(const std::string& key) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedMap(); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } + + template + Expected>> EventData::GetTypedMap(const std::string& key, + const std::shared_ptr>& s) const { + std::shared_ptr variant_value; + if (GetVariant(key, variant_value)) { + return variant_value->GetTypedMap(s); + } + return { SdkError(ErrorCodes::EVENT_DATA_NO_SUCH_KEY, "key error") }; + } +} + +#endif //ADOBEMOBILE_CORE_EVENTDATA_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h new file mode 100755 index 00000000..1530486f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventDataFlattener.h @@ -0,0 +1,122 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H +#define ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H + +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class FlatDictionaryInterface; + class EventData; + class Variant; + + class EventDataFlattener : public Object { + + public: + + /** + * Construct an instance of EventDataFlattener + * + * @param event_data The EventData to flatten + */ + EventDataFlattener(const std::shared_ptr& event_data); + + /** + * Returns a `Map` which has been flattened in the following way: + * + * The Keys are of the format "eventdataKey"."nestedMapKeyOrFlatDictionaryKey".... + * So For example, an event data in the following format: + * + * [mapKey][key1]=value1 + * [mapKey][key2]=value2 + * + * will be flattened to + * + * [mapKey.key1]=value1 + * [mapKey.key1]=value2 + * + * @return flattened values as `std::map>` + */ + std::map> GetFlattenedDataMap() const; + + private: + + /** + * @private + * Inserts the value into a Map by flattening the value if needed. + * + * If the value is a Map it will be flattened (the namespaced key will be prefixed to the nested keys). + * If the value is a {@link FlatDictionary}, the result of {@link FlatDictionary::GetFlatDictionary()} + * will be inserted (the namespaced key will be prefixed to the keys). + * Else, the value will be inserted as is with the key being the {@code namespaced key} + * + * @param nameSpacedKey The key (which has been appropriately namespaced) that will be used as the key for the + * value inserted. + * If the value is further flattened for inserting into the returned map, then the key will + * be used as the + * prefix for the keys in the flattened representation. + * @param value The Object that will be inserted into the map after flattening (if needed) + * @param out The flattened map result. + */ + void Flatten(const std::string& namespaced_key, const std::shared_ptr& value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the map_value. It is done by recursively calling + * {@link ::Flatten(std::string, std::shared_ptr)} + * + * @param key_prefix The string that will be prefixed to the map keys. + * @param map_value The map that will be flattened. + * @param out The flattened map result. + */ + void Flatten(const std::string& key_prefix, const std::map>& map_value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the map_value. + * + * @param key_prefix The string that will be prefixed to the map keys. + * @param map_value The map to be flattened. + * @param out the flattended map result. + */ + void Flatten(const std::string& key_prefix, const std::map& map_value, + std::map>& out) const; + + /** + * @private + * Returns a map after flattening the flat_dictionary. + * + * @param key_prefix The string that will be prefixed to the {@code flat_dictionary} keys. + * @param flat_dictionary The {@link FlatDictionary} instance, that will be inserted (after prefixing the {@code + * key_prefix}) + * @out The flattened map result. + */ + void Flatten(const std::string& key_prefix, const std::shared_ptr& flat_dictionary, + std::map>& out) const; + + std::map> data_; // the data to flatten + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_EVENTDATAFLATTENER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventHub.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventHub.h new file mode 100755 index 00000000..23037e17 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventHub.h @@ -0,0 +1,524 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTHUB_H +#define ADOBEMOBILE_CORE_EVENTHUB_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include "Object.h" +#include "Event.h" +#include "TaskExecutor.h" + +namespace AdobeMarketingMobile { + class Rule; + class Module; + class ModuleEventListenerBase; + class ModuleEventProcessorBase; + class PlatformServicesInterface; + class TaskExecutor; + class EventHubData; + enum class EventHubState : int32_t; + class ExternalModuleInterface; + + // declaration of global shared state variables + extern const std::shared_ptr + SHARED_STATE_PENDING; ///< state that is "on the way" and will eventually be resolved. + extern const std::shared_ptr + SHARED_STATE_PREV; ///< special "marker" state that indicates that this state is equal to the previous state. + extern const std::shared_ptr + SHARED_STATE_NEXT; ///< special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + extern const std::shared_ptr + SHARED_STATE_INVALID; ///< special state that indicates that the state is not valid. + + /** + * @class EventHub + * + * Core event loop for SDK activity. The EventHub manages module lifetime, dispatches events, dispatches + * callbacks, and manages the necessary threading. + * + * Starting an EventHub + * ==================== + * EventHub::Create() can be used to create and start the event hub. + * After calling RegisterModule for all modules, EventHub::FinishModuleRegistration() + * should be called to complete the startup process. This method will dispatch a HUB BOOTED event. + * + * Stopping an EventHub + * ==================== + * EventHub::Dispose() should be called to clean up after an event hub. Disposal will occur asynchronously. + * EventHub::IsFullyDisposed() can be polled to determine whether the EventHub disposal is complete. The + * destructor of EventHub will also initiate a Dispose(). + * + * Failure to dispose of an EventHub will result in resource leaks. + * + * Registering and Unregistering Modules + * ===================================== + * EventHub::RegisterModule() can be called to register modules with an EventHub. @see Module + * + * Module::UnregisterModule() can be called to unregister modules. @see Module + * + * Threading + * ========= + * All public EventHub or Module methods can be safely invoked from any thread. + * + * For a given module, the OnRegistered and OnUnregistered callbacks of a module and its processors, + * listeners, and dispatchers, as well as ModuleEventProcessor::Process and ModuleEventListener::Hear can often + * be treated as if they operated on a single thread. These methods will never get invoked concurrently for + * a given module. + * + * This allows most modules to be written without the use of synchronization primitives. + * + * An additional consideration for implementers is that callbacks should not perform long-running operations, + * as these may block the system as a whole. + * + * Threading in Detail + * =================== + * This section covers the current implementation, which may change in the future, but may be informative for + * module implementers. + * + * Upon creation, the EventHub starts a background thread (known as the EventHub thread). + * + * Some EventHub and Module methods require callbacks to be invoked. For example, Module::RegisterListener must + * invoke the callback ModuleEventListener::OnRegistered after registration completes. In these cases, callbacks are + * added to a callback queue. For example, after performing registration Module::RegisterListener will add + * ModuleEventListener::OnRegistered to the callback queue. The EventHub thread monitors the callback queue. + * When new callbacks are added to the queue, the EventHub thread empties the callback queue and executes the + * callbacks synchronously on the background thread. + * + * Similarly, when Dispatch(event) is called, an event is placed on an event queue. After processing any callbacks, + * the EventHub thread removes next event from the event queue then: + * - Invokes any registered processors. Processors are invoked in no particular order and are invoked + * synchronously, in-series. + * - Invoke registered listeners in parallel. Asynchronous jobs are started for each listener. Before + * moving on to the next event or callback, the EventHub waits for the asynchronous jobs to complete. + * + * Finally, upon disposal, all modules (and their child listeners, dispatchers, and processors) are unregistered + * and thread is terminated. + */ + class EventHub : public Object { + friend class Module; + friend class RuleTokenParser; + friend class EventHubMethods; // For testing + + public: + + /** + * Creates and returns a new EventHub. + * + * When the EventHub is no longer needed, EventHub::Dispose() must be called to free up resources used by the EventHub. + * + * @param name - the name of the EventHub to be created - for logging purposes + * @param platform_services - instance of PlatformServices class to provide platform-specific functionality + */ + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& platform_services); + + /** + * This method should be called after all modules are registered. + * This will trigger the dispatch of a booted event. + */ + virtual void FinishModulesRegistration() = 0; + + /** + * Dispatches an event onto the event queue. + * + * Most modules should not call this method directly and should instead define a + * subclass of ModuleEventDispatcher. + * + * @param event - the event to be added to the queue + * @see ModuleEventDispatcher + */ + virtual void Dispatch(const std::shared_ptr& event) = 0; + + /** + * Creates and registers a module of the specified type. + * + * TModule must a subclass of Module. + * + * Example: + * + * class MyModule : public Module { ... }; + * + * void RegisterMyModule(const std::shared_ptr& event_hub) { + * event_hub->RegisterModule(); + * } + */ + template + void RegisterModule(); + + /** + * Creates and registers an ExternalModule + * + * Example: + * + * std::shared_ptr& mod; // created by the Core + * RegisterExternalModule(mod); + */ + virtual void RegisterExternalModule(const std::shared_ptr& external_module) = 0; + + /** + * Check whether the name matches a module in the currently active modules list. + */ + virtual bool IsRegisteredModule(const std::string& name) = 0; + + /** + * Registers a one-time listener to modules of the specified type. + * + * TModule must be a subclass of Module. + * + * Example: + * + * class MyModule : public Module { ... }; + * + * void RegisterOneTimeListenerToMyModule(const std::shared_ptr& event_hub + * EventType event_type, EventSource event_source, const std::string& pair_id, + * const std::function&)>& listener_block) { + * event_hub->RegisterOneTimeListener(event_type, event_source, pair_id, listener_block); + * } + * + * @param event_type - the EventType of an event to listen for + * @param event_source - the EventSource of an event to listen for + * @param pair_id - pairID to listen for + * @param listener_block - the block to call when the event is heard + */ + template + void RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block); + + template + void RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::function&)>& listener_block); + + /** + * Calls Dispose with a reasonable default wait time. + */ + virtual bool Dispose() = 0; + + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * After calling Dispose(), most EventHub methods will have no effect. + * + * Calling Dispose() first triggers clean up to occur asynchronously. A number of actions will occur: + * - Events will stop firing, but a few events may still fire after Dispose() is called due to race conditions. + * - Modules, listeners, processors, and dispatchers will be unregistered. + * - Threads and other resources used by the EventHub will be terminated. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @see IsFullyDisposed() + * + * @return true if the event hub is fully disposed (background thread shut down, + * and all modules unregistered in background thread). + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + protected: + EventHub() {} + + /** + * @private + * + * Calls Module::OnEventHubRegisteredModule() + */ + static void CallModuleOnEventHubRegisteredModule(const std::shared_ptr& module, + const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services, + const std::shared_ptr& task_executor); + + /** + * @private + * + * Calls Module::Idle() + */ + static void CallModuleIdle(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::ProcessEvent() + */ + static bool CallModuleProcessEvent(const std::shared_ptr& module, + const std::shared_ptr& event, + std::shared_ptr& processed_event); + + /** + * @private + * + * Calls Module::NotifyListeners() + */ + static void CallModuleNotifyListeners(const std::shared_ptr& module, + const std::shared_ptr& event); + + /** + * @private + * + * Calls Module::GetSharedStateName(); + */ + static std::string CallModuleGetSharedStateName(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::UnregisterModule(); + */ + static void CallModuleUnregisterModule(const std::shared_ptr& module); + + /** + * @private + * + * Calls Module::RegisterOneTimeListenerBlock(); + */ + static void CallModuleRegisterOneTimeListener(const std::shared_ptr& module, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block); + + private: + /** + * @private + * + * Register a module after creation. Intended for use by RegisterModule(...). + */ + virtual void RegisterModule(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Register a rule for a given module. Intended for use by RegisterRule(...). + */ + virtual void RegisterRule(const std::shared_ptr& module, const std::shared_ptr& rule) = 0; + + /** + * @private + * + * Unregisters all rules for a given module, Intended for use by UnregisterRules(...). + */ + virtual void UnregisterAllRules(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Perform book-keeping after a Module is unregistered. Intended for use by Module. + */ + virtual void OnModuleUnregistered(const std::shared_ptr& module) = 0; + + /** + * @private + * + * Register a one-time listener to the module who's type id matches the given hash. + * Intented to be called by RegisterOneTimeListener(...). + */ + virtual void RegisterOneTimeListener(const size_t module_type_hash, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id, + const std::function&)>& listener_block) = 0; + + /** + * @private + * + * Creates a shared state object for the given module versioned at the current event for this hub. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param version int32_t containing the version that this shared state should be begin to be valid for + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * Updates an existing EventHub::PENDING shared state for the given module and version + * + * Only for use by Module. + * + * @param module Module to update the shared state for + * @param version int32_t version version of the existing shared state to replace + * @param state new state to replace with existing state. Must be data, EventHub::PENDING, EventHub::INVALID, + * EventHub::NEXT, or EventHub::PREV. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void UpdateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * + * Creates or updates a shared state object for the given module and version. + * If no shared state exists for the module at the given version, then one is created with the given state. + * If a shared state already exists for the module at the given version and the state + * is EventHub::PENDING, then the state is updated with the given state. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param version int32_t version version of the existing shared state to add or replace + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID + * when creating or data, EventHub::PENDING, EventHub::INVALID, EventHub::NEXT, or EventHub::PREV when updating + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateOrUpdateSharedState(const std::shared_ptr& module, + int32_t version, + const std::shared_ptr& state) = 0; + + /** + * @private + * + * Creates a shared state object for the given module at the next event number for this hub. + * + * Only for use by Module. + * + * @param module Module that owns this shared state + * @param state EventData object containing the state to share. Must be data, EventHub::PENDING, or EventHub::INVALID. + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void CreateOrUpdateSharedState(const std::shared_ptr& module, + const std::shared_ptr& state) = 0; + + /** + * @private + * Clears all the shared states for the given module. + * + * Only for use by Module. + * + * @param module Module to clear the shared states for + * + * @throws ErrorCodes::INVALID_ARGUMENT if the provided module is nullptr + **/ + virtual void ClearSharedStates(const std::shared_ptr& module) = 0; + + /** + * @private + * Retrieves shared state by name that is valid for the given event + * + * Only for use by Module. + * + * @param state_name String identifier for the module that shared the state + * @param event Event to retrieve state for + * @param calling_module the module calling this method + * + * @return EventData object containing the valid state, EventHub::PENDING, or EventHub::INVALID + * @throws ErrorCodes::INVALID_ARGUMENT if given event is nullptr + **/ + virtual std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event, + const std::shared_ptr& calling_module) = 0; + + /** + * @private + * Determine if there are any shared states for the specified module. + * A module is considered to have a valid shared state if any state is data or EventHub::PENDING. + * States EventHub::INVALID, EventHub::NEXT, and EventHub::PREV are not considered valid. + * + * Only for use by Module. + * + * @param state_name String identifier for the module that shared the state + * @return true if the specified module has shared a valid state + */ + virtual bool HasSharedEventState(const std::string& state_name) = 0; + + /** + * @private + * + * Requests that Idle() be called soon. Intended for use by Module. + * + * This method may be called from any thread. + */ + virtual void RequestIdle() = 0; + + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + void EventHub::RegisterModule() { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterModule is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + // module registration is spread across multiple functions and threads + // to find all the steps, search for "module registration step" + + // module registration step 1: construct the module + auto module = std::make_shared(); + + // module registration step 2: pass it to the non-templated RegisterModule + RegisterModule(module); + } + + template + void EventHub::RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, const std::string& pair_id, + const std::function&)>& listener_block) { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterOneTimeListener is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + size_t type_hash = typeid(TModule).hash_code(); + + RegisterOneTimeListener(type_hash, event_type, event_source, pair_id, listener_block); + } + + template + void EventHub::RegisterOneTimeListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::function&)>& listener_block) { + + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterOneTimeListener is a subclass of Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + size_t type_hash = typeid(TModule).hash_code(); + + RegisterOneTimeListener(type_hash, event_type, event_source, "", listener_block); + } +} + +#endif //ADOBEMOBILE_CORE_EVENTHUB_H + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventSource.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventSource.h new file mode 100755 index 00000000..dfa0194d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventSource.h @@ -0,0 +1,81 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTSOURCE_H +#define ADOBEMOBILE_CORE_EVENTSOURCE_H + +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * EventSource encapsulates the source of an Event. + */ + class EventSource : public Object { + public: + static const std::shared_ptr NONE; + static const std::shared_ptr OS; + static const std::shared_ptr REQUEST_CONTENT; + static const std::shared_ptr REQUEST_IDENTITY; + static const std::shared_ptr REQUEST_PROFILE; + static const std::shared_ptr REQUEST_RESET; + static const std::shared_ptr RESPONSE_CONTENT; + static const std::shared_ptr RESPONSE_IDENTITY; + static const std::shared_ptr RESPONSE_PROFILE; + static const std::shared_ptr SHARED_STATE; + static const std::shared_ptr BOOTED; + static const std::shared_ptr WILDCARD; + + /* + * @return Return prefix used for all Adobe event types + */ + static std::string GetAdobePrefix(); + + /* + * @brief Return source if found in known sources, otherwise add new source to the map and return. + * @param source_name the name of the EventSource to return + * @return an EventSource from the known_sources_ table + */ + static std::shared_ptr Get(const std::string& source_name); + + /** + * @returns a string representation of this + */ + const std::string& GetName(); + + protected: + explicit EventSource(const std::string& source_name); + + private: + std::string name_; ///< underlying string holding the name of the EventSource + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& value, const ToStringOptions& options); + +} + +#endif //ADOBEMOBILE_CORE_EVENTSOURCE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventType.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventType.h new file mode 100755 index 00000000..afec74e6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/EventType.h @@ -0,0 +1,85 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_EVENTTYPE_H +#define ADOBEMOBILE_CORE_EVENTTYPE_H + +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * EventType encapsulates the source of an Event. + */ + class EventType : public Object { + public: + static const std::shared_ptr ACQUISITION; + static const std::shared_ptr ANALYTICS; + static const std::shared_ptr AUDIENCE_MANAGER; + static const std::shared_ptr CONFIGURATION; + static const std::shared_ptr CUSTOM; + static const std::shared_ptr HUB; + static const std::shared_ptr IDENTITY; + static const std::shared_ptr LIFECYCLE; + static const std::shared_ptr LOCATION; + static const std::shared_ptr PII; + static const std::shared_ptr PLACES; + static const std::shared_ptr RULES_ENGINE; + static const std::shared_ptr SIGNAL; + static const std::shared_ptr SYSTEM; + static const std::shared_ptr TARGET; + static const std::shared_ptr USER_PROFILE; + static const std::shared_ptr WILDCARD; + + /* + * @return Return prefix used for all Adobe event types + */ + static std::string GetAdobePrefix(); + + /* + * @brief Return type if found in known types, otherwise add new type to the map and return. + * @param type_name the name of the EventType to return + * @return an EventType from the known_types_ table + */ + static std::shared_ptr Get(const std::string& type_name); + + /** + * @returns a string representation of this + */ + const std::string& GetName(); + + protected: + explicit EventType(const std::string& type_name); + + private: + std::string name_; ///< @private underlying string holding the name of the EventSource + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& value, const ToStringOptions& options); +} + +#endif //ADOBEMOBILE_CORE_EVENTTYPE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Expected.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Expected.h new file mode 100755 index 00000000..7da56d04 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Expected.h @@ -0,0 +1,215 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_EXPECTED_H +#define ADOBEMOBILE_UTIL_EXPECTED_H + +#include +#include "Object.h" +#include "SdkError.h" + +namespace AdobeMarketingMobile { + + /** + * Expected<> is a template class that can contain either a Value type or an Error type which defaults to SdkError. + * The name is taken from a talk by Andrei Alexandrescu here: + * https://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C + * although the implementation is very different. This can be used to avoid having to throw exceptions or have out + * params in many situations. This class also avoids the extra allocation overhead of using std::shared_ptr while + * providing for a richer error. + * + * Notes about usage: + * * Value type (V) cannot be the same as the Error type (E) + * * std::exception (and derived classes) may not work for Error type (E) without further work + * + * EXAMPLE USAGE: + * + * Expected> GetFile(const std::string& url); + * ... + * if (auto result = GetFile(url)) { + * auto file = result.Value(); // type is const std::shared_ptr& + * ... + * } + * else { + * auto error = result.Error(); // type is const SdkError& + * ... + * } + * + */ + template + class Expected { + public: + Expected() = default; + + Expected(const V& value) : initialized_(true), has_value_(true) { + new (&data_) V(value); + } + + Expected(const E& error) : initialized_(true), has_value_(false) { + new (&data_) E(error); + } + + Expected(const Expected& exp) : initialized_(exp.initialized_), has_value_(exp.has_value_) { + if (has_value_) { + new (&data_) V(exp.ConstValue()); + } else if (initialized_) { + new (&data_) E(exp.Error()); + } + } + + Expected& operator=(const Expected& exp) { + Expected temp(exp); + initialized_ = std::move(temp.initialized_); + has_value_ = std::move(temp.has_value_); + data_ = std::move(temp.data_); + temp.initialized_ = false; // Ensure temp destruction does NOT call Value or Error destructors + return *this; + } + + ~Expected() { + if (initialized_) { + if (has_value_) { + V* value = reinterpret_cast(&data_); + value->~V(); + } else { + E* error = reinterpret_cast(&data_); + error->~E(); + } + } + } + + explicit operator bool() const { + return has_value_; + } + + bool operator!() const { + return !has_value_; + } + + V& Value() { + if (!initialized_ || !has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Value type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + const V& ConstValue() const { + if (!initialized_ || !has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Value type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + const E& Error() const { + if (!initialized_ || has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Error type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + private: + static constexpr const std::size_t DATA_SIZE{ sizeof(V) > sizeof(E) ? sizeof(V) : sizeof(E) }; + static constexpr const std::size_t DATA_ALIGNMENT{ alignof(V) > alignof(E) ? alignof(V) : alignof(E) }; + typename std::aligned_storage::type data_; + bool initialized_ = false; + bool has_value_ = false; + }; + + /** + * Expected is a template class that can contain only an SdkError type. There is no Value. + * + * EXAMPLE USAGE: + * + * Expected GetFile(const std::string& url) { + * if(success) { return {}; } + * else { return { SdkError("bad news") }; } + * } + * ... + * if (auto result = GetFile(url)) { + * ... + * } + * else { + * auto error = result.Error(); // type is const SdkError& + * ... + * } + * + */ + template <> + class Expected { + public: + Expected() : initialized_(true), has_value_(true) { + } + + Expected(const SdkError& error) : initialized_(true), has_value_(false) { + new (&data_) SdkError(error); + } + + Expected(const Expected& exp) : initialized_(exp.initialized_), has_value_(exp.has_value_) { + if (initialized_ && !has_value_) { + new (&data_) SdkError(exp.Error()); + } + } + + Expected& operator=(const Expected& exp) { + Expected temp(exp); + initialized_ = std::move(temp.initialized_); + has_value_ = std::move(temp.has_value_); + data_ = std::move(temp.data_); + temp.initialized_ = false; // Ensure temp destruction does NOT call Value or Error destructors + return *this; + } + + ~Expected() { + if (initialized_) { + if (!has_value_) { + SdkError* error = reinterpret_cast(&data_); + error->~SdkError(); + } + } + } + + explicit operator bool() const { + return has_value_; + } + + bool operator!() const { + return !has_value_; + } + + const SdkError& Error() const { + if (!initialized_ || has_value_) { + ADOBE_THROW(ErrorCodes::STD_BAD_CAST, "Error type not available."); + } + + return *(reinterpret_cast(&data_)); + } + + private: + static constexpr const std::size_t DATA_SIZE{ sizeof(SdkError) }; + static constexpr const std::size_t DATA_ALIGNMENT{ alignof(SdkError) }; + typename std::aligned_storage::type data_; + bool initialized_ = false; + bool has_value_ = false; + }; + +} /* end of namespace AdobeMarketingMobile */ + +#endif /*ADOBEMOBILE_UTIL_EXPECTED_H*/ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h new file mode 100755 index 00000000..1aa2312c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModule.h @@ -0,0 +1,124 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_H +#define ADOBEMOBILE_EXTERNALMODULE_H + +#include +#include + +#include "Common.h" +#include "InternalModule.h" +#include "ExternalModuleInterface.h" + +namespace AdobeMarketingMobile { + class Event; + class ExternalModuleServicesImpl; + class ExternalModuleListenerInterface; + class ExternalModuleProcessorInterface; + class ExternalModuleDispatcher; + + class ExternalModule : public InternalModule { + public: + ExternalModule(); + + explicit ExternalModule(const std::string& log_prefix, const std::shared_ptr& interface); + + std::string GetLogPrefix() { + return log_prefix_; + } + + ADOBE_VIRTUAL_FOR_TESTS std::string GetSharedStateName() override; + + ADOBE_VIRTUAL_FOR_TESTS void HandleUnexpectedError(SdkError& e); + + /* + * Interface methods called by the ExternalModuleServicesImpl + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_RegisterListener(const std::shared_ptr& + event_listener, + const std::string& event_type, + const std::string& event_source); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_RegisterProcessor(const std::shared_ptr& + event_processor); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_DispatchEvent(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_SetSharedEventState(const std::string& state, + const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_ClearSharedEventStates(); + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr ExternalServices_GetSharedEventState(const std::string& name, + const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalServices_UnregisterModule(); + + /* + * Interface methods called by the ExternalModuleListener + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_OnRegistered(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_Hear(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalListener_OnUnregistered(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + /* + * Interface methods called by the ExternalModuleProcessor + */ + + ADOBE_VIRTUAL_FOR_TESTS void ExternalProcessor_OnRegistered(); + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr ExternalProcessor_Process(const std::shared_ptr& event); + ADOBE_VIRTUAL_FOR_TESTS void ExternalProcessor_OnUnregistered(); + + protected: + ADOBE_VIRTUAL_FOR_TESTS void OnRegistered() override; + ADOBE_VIRTUAL_FOR_TESTS void OnUnregistered() override; + + private: + std::shared_ptr GetDispatcher(); + + std::shared_ptr FindListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + std::shared_ptr GetProcessor(); + + // Prefix for all logging messages + std::string log_prefix_; + + // Used for locking access to the private members + std::mutex mutex_; + + // The internal module uses this to call the external module + std::shared_ptr interface_; + + // The external module uses this to call the internal module + std::shared_ptr services_; + + // The internal module uses this to dispatch events from the external module + std::shared_ptr dispatcher_; + + // The internal module uses this to call the external listeners + typedef std::pair, std::shared_ptr> ListenerKey; + std::map> listeners_; + + // The internal module uses this to call the external processor + std::shared_ptr processor_; + }; + +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h new file mode 100755 index 00000000..00b7cd2e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleBridge.h @@ -0,0 +1,58 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H + +/** + * @brief This header contains shared methods used for bridging module code between C++ and Obj-C. + * + */ +namespace AdobeMarketingMobile { + + class Event; + class JsonUtilityServiceInterface; + + /* + * @brief This is a list of the errors returned to external modules from the core code. + */ + namespace ErrorCodes { + constexpr static const char* EXT_MODULE_UNEXPECTED_ERROR = "external_module.unexpected"; + constexpr static const char* EXT_MODULE_BAD_NAME = "external_module.bad_module_name"; + constexpr static const char* EXT_MODULE_DUP_NAME = "external_module.dup_module_name"; + constexpr static const char* EXT_MODULE_EVENT_TYPE_NOT_SUPPORTED = "external_module.event_type_not_supported"; + constexpr static const char* EXT_MODULE_EVENT_SOURCE_NOT_SUPPORTED = "external_module.event_source_not_supported"; + constexpr static const char* EXT_MODULE_EVENT_DATA_NOT_SUPPORTED = "external_module.event_data_not_supported"; + } + + std::shared_ptr CreateBroadcastEvent(const std::shared_ptr json_utility_service, + const std::string& event_name, + const std::string& event_type, + const std::string& event_source, + const std::string& event_data); + + std::string GetEventTypeAsString(const std::shared_ptr& event); + + std::string GetEventSourceAsString(const std::shared_ptr& event); + + std::string GetEventDataAsString(const std::shared_ptr& event, + const std::shared_ptr json_utility_service); + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEBRIDGE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h new file mode 100755 index 00000000..0303792c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleDispatcher.h @@ -0,0 +1,46 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H + +#include "ExternalModule.h" +#include "ModuleEventDispatcher.h" + +namespace AdobeMarketingMobile { + + class Event; + + /** + * @class ExternalModuleDispatcher + * Event dispatcher for all events from the ExternalModule module. + * + */ + class ExternalModuleDispatcher : public ModuleEventDispatcher { + + public: + /** + * Dispatches a externally generated event onto the EventHub + * @param event The event to dispatch + * + */ + virtual void Dispatch(const std::shared_ptr& event); + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEDISPATCHER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h new file mode 100755 index 00000000..825fe5c5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleInterface.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H + +#include "Object.h" +#include "ExternalModuleServicesInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Interface providing access to ADBModule for the event hub. + * + */ + class ExternalModuleInterface : public virtual ObjectInterface { + public: + virtual std::string GetModuleName() = 0; + virtual std::string GetModuleVersion() = 0; + virtual void OnRegister(const std::shared_ptr& services) = 0; + virtual void OnUnexpectedError(SdkError& e) = 0; + virtual void OnUnregister() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h new file mode 100755 index 00000000..614e8f4e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListener.h @@ -0,0 +1,41 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H + +#include "ModuleEventListener.h" +#include "ExternalModule.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + /** + * @class ExternalModuleListener + * Listener registered by an external module for various event types and sources + */ + class ExternalModuleListener : public ModuleEventListener { + public: + void Hear(const std::shared_ptr& event) override; + protected: + void OnRegistered() override; + void OnUnregistered() override; + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENER_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h new file mode 100755 index 00000000..3d95d7a9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleListenerInterface.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H + +#include "Object.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Wrapper used to call the ADBModuleListenerInterface provided by the external module + * + */ + class ExternalModuleListenerInterface : public virtual ObjectInterface { + public: + virtual void OnRegistered() = 0; + virtual void Hear(const std::shared_ptr& event) = 0; + virtual void OnUnregistered() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULELISTENERINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h new file mode 100755 index 00000000..9011eab0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessor.h @@ -0,0 +1,42 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H + +#include "ModuleEventProcessor.h" +#include "ExternalModule.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + /** + * @class ExternalModuleProcessor + * Listener registered by an external module for various event types and sources + */ + class ExternalModuleProcessor : public ModuleEventProcessor { + public: + std::shared_ptr Process(const std::shared_ptr& event) override; + protected: + void OnRegistered() override; + void OnUnregistered() override; + }; +} + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSOR_H */ + + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h new file mode 100755 index 00000000..5836b8f0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleProcessorInterface.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H + +#include "Object.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Wrapper used to call the ADBModuleProcessorInterface provided by the external module + * + */ + class ExternalModuleProcessorInterface : public virtual ObjectInterface { + public: + virtual void OnRegistered() = 0; + virtual std::shared_ptr Process(const std::shared_ptr& event) = 0; + virtual void OnUnregistered() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULEPROCESSORINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h new file mode 100755 index 00000000..06a9bc01 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ExternalModuleServicesInterface.h @@ -0,0 +1,58 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULESERVICES_H +#define ADOBEMOBILE_EXTERNALMODULE_EXTERNALMODULESERVICES_H + +#include "Object.h" +#include "Event.h" +#include "SdkError.h" +#include "ExternalModuleListenerInterface.h" +#include "ExternalModuleProcessorInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @brief Interface providing access to event hub for the ADBModule. + * + */ + class ExternalModuleServicesInterface : public virtual ObjectInterface { + public: + virtual void RegisterListener(const std::shared_ptr& event_listener, + const std::string& event_type, + const std::string& event_source) = 0; + + virtual void RegisterProcessor(const std::shared_ptr& event_processor) = 0; + + virtual void DispatchEvent(const std::shared_ptr& event) = 0; + + virtual void SetSharedEventState(const std::string& state, + const std::shared_ptr& event) = 0; + + virtual void ClearSharedEventStates() = 0; + + virtual std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event) = 0; + + virtual void UnregisterModule() = 0; + }; + +} // AdobeMarketingMobile namespace + +#endif /* ADOBEMOBILE_EXTERNALMODULESERVICES_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h new file mode 100755 index 00000000..d09c21c6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FileSystemServiceInterface.h @@ -0,0 +1,219 @@ +/* ************************************************************************ +* +* ADOBE CONFIDENTIAL +* ___________________ +* +* Copyright 2017 Adobe Systems Incorporated +* All Rights Reserved. +* +* NOTICE: All information contained herein is, and remains +* the property of Adobe Systems Incorporated and its suppliers, +* if any. The intellectual and technical concepts contained +* herein are proprietary to Adobe Systems Incorporated and its +* suppliers and are protected by trade secret or copyright law. +* Dissemination of this information or reproduction of this material +* is strictly forbidden unless prior written permission is obtained +* from Adobe Systems Incorporated. +**************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H + +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A filesystem error occurred. + */ + constexpr static const char* FILESYSTEM_ERROR = "filesystem"; + } + + class FileHandlerInterface : public virtual ObjectInterface { + public: + /** + * Return the size of the file pointed to, if it exists. + * This is a synchronous call. + * + * @return size of file if exists, -1 otherwise. + */ + virtual int64_t Size() = 0; + + /** + * Return the last-modified date of the file pointed to, if it exists. + * This is a synchronous call. + * + * @return `time_point` representing last-modified date of file if exists, otherwise `time_point` containing 0. + */ + virtual std::chrono::time_point LastModified() = 0; + + /** + * Open the file referenced for reading only. + * This is a synchronous call. + * + * @return true if file was opened, false otherwise + */ + virtual bool OpenForReading() = 0; + + /** + * Open the file reference for writing. Creates if needed, and truncates existing file at this path. + * This is a synchronous call. + * + * @return true if file was opened, false otherwise + */ + virtual bool OpenForWriting() = 0; + + /** + * Move the read/write head for file to the offset. The offset passed must be less than reported Size(). + * This is a synchronous call. + * + * @param file_offset the offset from the beginning of the file + * @return true if file read/write head was moved, false if an error occurred + */ + virtual bool MoveToOffset(uint64_t file_offset) = 0; + + /** + * Write some data to the file. The file must have been opened for writing first, or no bytes will be read. + * This is a synchronous call. + * + * @param bytes_to_write the number of bytes to write to the file + * @param write_buffer the buffer to write to the file + * @return the number of bytes written to the file + */ + virtual uint32_t Write(uint32_t bytes_to_write, uint8_t* write_buffer) = 0; + + /** + * Read some data from the file. The file must have been opened for reading first, or no bytes will be read. + * This is a synchronous call. + * + * @param bytes_to_read the number of bytes to read from the file + * @param read_buffer the buffer to read into + * @return the number of bytes read from the file + */ + virtual uint32_t Read(uint32_t bytes_to_read, uint8_t* read_buffer) = 0; + + /** + * Close the file. After this call, no more reading or writing is allowed unless the file is opened again. + * This is a synchronous call. + * + * @return true if file was closed, false if an error occurred + */ + virtual bool Close() = 0; + }; + + class FileSystemServiceInterface : public virtual ObjectInterface { + public: + /** + * Make a new file handler at the given path. The path passed does not need to point to an existing file, + * but creation will *fail* if path points to an existing directory. + * + * @param path the full path to the file, either absolute or relative + * @return ptr to new FileHandlerInterface if created successfully, nullptr otherwise + */ + virtual std::shared_ptr CreateFileHandler(const std::string& path) = 0; + + /** + * Make a new directory at the given path. Creates a single directory. + * It is not assumed creating nonexistent parent directories is supported. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory was created successfully, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool MakeDirectory(const std::string& path) = 0; + + /** + * Delete the directory denoted by the given path. The directory must be empty in order + * to be deleted. + * + * @param path the directory pathname, either absolute or relative + * @return bool indicating the directory deletion was successful + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DeleteDirectory(const std::string& path) = 0; + + /** + * Delete the file denoted by the given path. + * + * @param path the file pathname, either absolute or relative + * @return bool indicating the file deletion was successful + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DeleteFile(const std::string& path) = 0; + + /** + * Determines if the given pathname denotes a directory. + * + * @param path a filesystem pathname, either absolute or relative + * @return true if the pathname is a directory, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual bool IsDirectory(const std::string& path) const = 0; + + /** + * Determines if the given directory path exists on the filesystem. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory exists on the filesystem, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual bool DirectoryExists(const std::string& path) const = 0; + + /** + * Determines if the given directory path is writable by the application. + * + * @param path the directory pathname, either absolute or relative + * @return true if the directory is writable by the application, false otherwise + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer + */ + virtual bool DirectoryIsWritable(const std::string& path) const = 0; + + /** + * Get all file and directory abstract pathnames contained within the given directory path. + * + * @param path the directory pathname, either absolute or relative + * @return list of all file and directory abstract pathnames contained within the given directory + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::vector GetDirectoryContents(const std::string& path) const = 0; + + /** + * Get all file abstract pathnames contained within the given directory path. + * + * @param path the directory pathname, either absolute or relative + * @return list of all file abstract pathnames contained within the given directory + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::vector GetDirectoryFiles(const std::string& path) const = 0; + + /** + * Read the contents of the given file and return as a string. + * The filepath may be relative or absolute, or this platform's specific file URI scheme. + * + * @param filepath the file pathname + * @return contents of the file pointed to by filepath as a string + * @throws FILESYSTEM_ERROR if an error is caught by the platform layer. + */ + virtual std::string ReadStringFromFile(const std::string& filepath) const = 0; + + /** + * Get the filesystem specific path separator character. + * + * @return path separator character + */ + virtual char GetPathSeparatorChar() const = 0; + + /** + * Get the filesystem specific path separator as a string. + * + * @return path separator character as a string + */ + virtual std::string GetPathSeparator() const = 0; + }; + +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_FILESYSTEMSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h new file mode 100755 index 00000000..8abfd58f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/FlatDictionaryInterface.h @@ -0,0 +1,46 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H +#define ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * @class FlatDictionary + * + * Interface used for redefining complex objects as map of {string, variants} + */ + class FlatDictionaryInterface : public virtual ObjectInterface { + public: + /** + * Returns the internal state of the class in a flat KV map. + * The key is of string type, namespaced with periods if required, + * and the value is a Variant, with no nesting. + * + * @param out the flattened dictionary result + * @return true if a flat dictionary was correctly set to out, false if the operation failed. + */ + virtual bool GetFlatDictionary(std::map>& out) const = 0; + }; +} //namespace + + +#endif /* ADOBEMOBILE_RULESENGINE_FLATDICTIONARY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h new file mode 100755 index 00000000..7a0ce549 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitDatabaseBase.h @@ -0,0 +1,132 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITDATABASEBASE_H +#define ADOBEMOBILE_SHARED_HITDATABASEBASE_H + +#include + +#include "Object.h" +#include "DatabaseHitBase.h" +#include "DatabaseHitSchema.h" +#include "DatabaseServiceInterface.h" + +namespace AdobeMarketingMobile { + + enum class DatabaseStatus : int32_t { + OK = 0, + FATALERROR + }; + + /* + * @class HitDatabaseBase + * Base class for hit data base management + */ + class HitDatabaseBase : public Object { + friend class HitQueueBaseMethods; ///< for testing + + public: + HitDatabaseBase() {} ///< makes mocking easier + + /** + * Opens the database with \p database_name_, if that exists or creates a new one if doesn't exist. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool OpenOrCreateDatabase(); + + /** + * Create a table in the database with \p table_name_. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool InitializeDatabase() = 0; + + virtual void PostReset(); + + /** + * Delete all items in the database table. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteAllHits(); + + /** + * Delete the database table. + * Logs an error if create/open operation failed. + * + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteTable(); + + /** + * Attempts to remove the hit with given identifier from database. It resets the database and returns false if the + * deleteAllHits operation fails, true otherwise. + * + * @param identifier the ID of the hit that we want to remove + * @return true if operation succeeds, false otherwise + */ + virtual bool DeleteHitWithIdentifier(const std::string& identifier); + + /** + * Returns the count of current hits in database. It logs an error message when query fails + * + * @return number of rows if table exists, 0 if no entries or query has failed + */ + virtual int32_t GetSize(); + + /** + * Resets database (usually as a result of an unrecoverable exception) - it will remove the existing database and create + * a new one with the same filename and structure + */ + virtual void Reset(); + + protected: + std::string table_name_; ///< hit database table name + + std::shared_ptr database_; ///< DatabaseInterface + + DatabaseStatus database_status_ = DatabaseStatus::OK; ///< DatabaseStatus for database processing after throwing + + /** + * @protected + * @brief Constucts a HitDatabaseBase with database_service and database_hit_schema + */ + explicit HitDatabaseBase(const std::shared_ptr& database_service, + const std::shared_ptr& database_hit_schema); + + + private: + static const std::string LOG_PREFIX; ///< Logging prefix + + std::shared_ptr database_service_; ///< DatabaseServiceInterface + + std::string database_name_; ///< hit database name + + /** + * @private + * @brief Close the database + */ + void CloseDatabase(); + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITDATABASEBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h new file mode 100755 index 00000000..06987807 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessor.h @@ -0,0 +1,64 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITPROCESSOR_H +#define ADOBEMOBILE_SHARED_HITPROCESSOR_H + +#include +#include "DatabaseHitBase.h" +#include "HitProcessorBase.h" + +namespace AdobeMarketingMobile { + + /* + * @class HitProcessor + * This class needs to be implemented and passed as a parameter to a HitQueue object. + */ + template + class HitProcessor : public HitProcessorBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + + public: + /** + * Process the hit that is retrieved from database. The return value of this method will decide whether + * or not the hit will be removed from the database. + * + * @param hit the hit retrieved from the database. + * @return a RetryType enum. Return RetryType::NO to remove the processed hit from the database. + */ + virtual RetryType Process(const std::shared_ptr& hit) = 0; + RetryType ProcessBase(const std::shared_ptr& hit) override; + + protected: + HitProcessor() : HitProcessorBase() {} ///< makes mocking easier + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + template + RetryType HitProcessor::ProcessBase(const std::shared_ptr& hit) { + return Process(std::dynamic_pointer_cast(hit)); + } +} + +#endif /* ADOBEMOBILE_SHARED_HITPROCESSOR_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h new file mode 100755 index 00000000..1531393c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitProcessorBase.h @@ -0,0 +1,53 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITPROCESSORBASE_H +#define ADOBEMOBILE_SHARED_HITPROCESSORBASE_H + +#include "Object.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + + /** + * RetryType is used to let the database know whether or not it should remove a database entry on a failed + * network request. + */ + enum class RetryType : int32_t { + RetryTypeNo = 0, + RetryTypeYes + }; + + class HitProcessorBase : public Object { + public: + /** + * Process the hit that is retrieved from database. The return value of this method will decide whether + * or not the hit will be removed from the database. + * + * @param hit the hit retrieved from the database. + * @return a RetryType enum. Return RetryType::NO to remove the processed hit from the database. + */ + virtual RetryType ProcessBase(const std::shared_ptr& hit) = 0; + + protected: + HitProcessorBase() {} ///< makes mocking easier + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITPROCESSORBASE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueue.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueue.h new file mode 100755 index 00000000..a353dec1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueue.h @@ -0,0 +1,147 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITQUEUE_H +#define ADOBEMOBILE_SHARED_HITQUEUE_H + +#include +#include "DatabaseHitBase.h" +#include "DatabaseHitSchema.h" +#include "HitQueueBase.h" +#include "HitProcessor.h" +#include "PlatformServicesInterface.h" +#include "Query.h" +#include "Common.h" + +namespace AdobeMarketingMobile { + + /** + * @class HitQueue + * + * Main class to be used by a module's database class to interface with the database + * provided by platform services. + */ + template + class HitQueue : public HitQueueBase { + // If you get an error on the following line, you need to make sure that TDatabaseHit is a type derived from DatabaseHitBase. + static_assert(std::is_base_of::value, + "Type of TDatabaseHit must be derived from DatabaseHitBase."); + // If you get an error on the following line, you need to make sure that TDatabaseHitSchema is a type derived from DatabaseHitSchema. + static_assert(std::is_base_of, TDatabaseHitSchema>::value, + "Type of TDatabaseHitSchema must be derived from DatabaseHitSchema."); + // If you get an error on the following line, you need to make sure that THitProcessor is a type derived from HitProcessor. + static_assert(std::is_base_of, THitProcessor>::value, + "Type of THitProcessor must be derived from HitProcessor."); + + public: + /** + * Constructor + * =================== + * Initialize a HitQueueBase object and set properties for the provided parameters. + * + * @param platform_services platform services reference, needed to access the database service. + * @param hit_schema the hit schema defining the database object to be used. + * @param hit_processor processor to handle the hits. + */ + explicit HitQueue(const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor); + + /** + * Get the first hit that matches the provided query. + * + * Deliberately hides HitQueueBase::QueryHit() + * + * @param query Query object defining the query that should run. + * @returns the first hit to match the provided query. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr QueryHit(const std::shared_ptr& query); + + /** + * Allows the caller to insert a DatabaseHitBase object into the database. + * + * Deliberately hides HitQueueBase::Queue() + * + * @param hit database hit to queue. + * @returns true if the hit was successfully inserted into the database. + */ + ADOBE_VIRTUAL_FOR_TESTS bool Queue(const std::shared_ptr& hit); + + /** + * Get the oldest hit (according to timestamp) from the table defined in the hit_schema. + * + * Deliberately hides HitQueueBase::SelectOldestHit() + * + * @returns the oldest hit in the database table. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr SelectOldestHit(); + + /** + * Update the hit data to db. Use the identifier property of the hit as the index key. + * + * Deliberately hides HitQueueBase::UpdateHit() + * + * @param hit the hit to be updated to db. + */ + ADOBE_VIRTUAL_FOR_TESTS bool UpdateHit(const std::shared_ptr& hit); + + protected: + HitQueue() : HitQueueBase() {} ///< makes mocking easier + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// +namespace AdobeMarketingMobile { + // ctor + template + HitQueue::HitQueue( + const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor) : + HitQueueBase(platform_services, hit_schema, hit_processor) + { } + + // public methods + template + std::shared_ptr + HitQueue::SelectOldestHit() { + return std::dynamic_pointer_cast(HitQueueBase::SelectOldestHit()); + } + + template + std::shared_ptr + HitQueue::QueryHit(const std::shared_ptr& + query) { + return std::dynamic_pointer_cast(HitQueueBase::QueryHit(query)); + } + + template + bool HitQueue::UpdateHit(const std::shared_ptr& hit) { + return HitQueueBase::UpdateHit(hit); + } + + template + bool HitQueue::Queue(const std::shared_ptr& hit) { + return HitQueueBase::Queue(hit); + } +} + + +#endif /* ADOBEMOBILE_SHARED_HITQUEUE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h new file mode 100755 index 00000000..22824f02 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HitQueueBase.h @@ -0,0 +1,218 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_HITQUEUEBASE_H +#define ADOBEMOBILE_SHARED_HITQUEUEBASE_H + +#include +#include +#include "HitDatabaseBase.h" + +namespace AdobeMarketingMobile { + class DatabaseHitBase; + class DatabaseHitSchemaBase; + class HitProcessorBase; + class PlatformServicesInterface; + class SystemInfoServiceInterface; + class TaskExecutor; + class Variant; + + /** + * @class HitQueueBase + * + * You should not inherit from this class. If you need a HitQueue in your module, add a HitQueue property. + */ + class HitQueueBase : public HitDatabaseBase { + friend class HitQueueBaseMethods; ///< for testing + + public: + /** + * Constructor + * =================== + * Initialize a HitQueueBase object and set properties for the provided parameters. + * + * @param platform_services platform services reference, needed to access the database service. + * @param hit_schema the hit schema defining the database object to be used. + * @param hit_processor processor to handle the hits. + */ + HitQueueBase(const std::shared_ptr& platform_services, + const std::shared_ptr& hit_schema, + const std::shared_ptr& hit_processor); + + ~HitQueueBase(); + + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration); + + /** + * Indicates to the HitQueue that it should resume its background thread and process any queued hits. + */ + virtual void BringOnline(); + + /** + * Creates the database and table based on the provided hit_schema in the constructor. + * @returns true if successful + */ + virtual bool InitializeDatabase() override; + + /** + * Get the first hit that matches the provided query. + * + * @param query Query object defining the query that should run. + * @returns the first hit to match the provided query. + */ + std::shared_ptr QueryHit(const std::shared_ptr& query); + + /** + * Allows the caller to insert a DatabaseHitBase object into the database. + * + * @param hit database hit to queue. + * @returns true if the hit was successfully inserted into the database. + */ + bool Queue(const std::shared_ptr& hit); + + /** + * Get the oldest hit (according to timestamp) from the table defined in the hit_schema. + * + * @returns the oldest hit in the database table. + */ + std::shared_ptr SelectOldestHit(); + + /** + * Suspend the HitQueue. + * New hit can still be queued, processing will not resume until BringOnline is called. + */ + virtual void Suspend(); + + /** + * Update all the hits in the table with new values provided by parameters. + * + * @param parameters new values represented as {columnName}{value} pairs. + * @returns true if hits are successfully updated + */ + virtual bool UpdateAllHits(const std::map>& parameters); + + /** + * Update the hit data to db. Use the identifier property of the hit as the index key. + * + * @param hit the hit to be updated to db. + * @returns true if hit is successfully updated + */ + bool UpdateHit(const std::shared_ptr& hit); + + protected: + HitQueueBase() : HitDatabaseBase(), is_suspended_{false} {} ///< Makes mocking easier + + std::shared_ptr background_executor_; ///< Executor used to run tasks on separate threads + + std::mutex background_mutex_; ///< Mutex used to block access to background thread + + /** + * @protected + * Amount of time to wait until retry when there is a network connection failure + */ + static const int32_t DEFAULT_NETWORK_CONNECTION_FAIL_DELAY; + + /** + * @protected + * DatabaseHitSchema that defines the table to be used by this hit queue + */ + std::shared_ptr hit_schema_; + + /** + * @protected + * HitProcessorInterface used to process a hit. + */ + std::shared_ptr hit_processor_; + + bool is_suspended_; ///< Maintains status for hit queue suspension + + static const std::string LOG_TAG; ///< Tag used for logging + + std::shared_ptr platform_service_; ///< Reference to platform services + + std::shared_ptr system_info_service_; ///< Reference to system info services + + /** + * Get the function that can be used with the TaskExecutor to do our work on a controlled background thread. + * + * @returns function pointer whose implementation defines the work to be done to process a database hit + */ + std::function WorkerThread(); + + /** + * @protected + * Check the status of is_suspended_. + * + * @return true is \p is_suspended is true, false otherwise. + */ + bool IsSuspended(); + + private: + bool was_dispose_called_; ///< was Dispose() called? + + std::condition_variable worker_alarm_; ///< condition variable to wake up worker thread + + /** + * Helper for Dispose(). + * + * Non-virtual implementation of Dispose(). + */ + bool DisposeNonVirtualImpl(std::chrono::milliseconds max_wait_duration); + + /** + * Helper for WorkerThread(). + * + * Returns whether the worker thread should continue processing hits. + * + * Acquires background mutex during the body of this call. + * + * @returns whether the worker thread should continue processing hits + */ + bool ShouldWorkerContinue(); + + /** + * Helper for WorkerThread(). + * + * Version of ShouldWorkerContinue() that does not acquire background mutex. The caller of this function + * should hold background mutex for the duration of this call. + */ + bool ShouldWorkerContinueNoLock(); + + /** + * Helper for WorkerThread(). + * + * Pauses after processing a hit fails. + */ + void PauseBeforeRetrying(); + }; +} + +#endif /* ADOBEMOBILE_SHARED_HITQUEUEBASE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h new file mode 100755 index 00000000..928149aa --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/HttpConnectionConstants.h @@ -0,0 +1,110 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H +#define ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H + +#include +#include + +namespace AdobeMarketingMobile { + + class HttpConnectionConstants { + + public: + /** + * http status code 200: ok + */ + static const int32_t HTTP_OK; + + /** + * http status code 404: not found + */ + static const int32_t HTTP_NOT_FOUND; + + /** + * http status code 408: request timeout. + */ + static const int32_t HTTP_CLIENT_TIMEOUT; + + /** + * http status code 416: range not satisfiable. + */ + static const int32_t HTTP_REQUESTED_RANGE_NOT_SATISFIABLE; + + /** + * http status code 504: gateway timeout. + */ + static const int32_t HTTP_GATEWAY_TIMEOUT; + + /** + * http status code 503: service unavailable. + */ + static const int32_t HTTP_UNAVAILABLE; + + + private: + HttpConnectionConstants() = delete; + + }; + + class HttpConnectionHeaderConstants { + + public: + /** + * Content-Type header is used to indicate the media type of the resource. + */ + static const std::string HTTP_HEADER_KEY_CONTENT_TYPE; + + /** + * HTTP header advertises which languages the client is able to understand, and which locale variant is preferred. + */ + static const std::string HTTP_HEADER_KEY_ACCEPT_LANGUAGE; + + /** + * The Accept request HTTP header advertises which content types, expressed as MIME types, the client is able + * understand. + */ + static const std::string HTTP_HEADER_KEY_ACCEPT; + + /** + * The MIME media type for JSON text. The default encoding is UTF-8 + */ + static const std::string HTTP_HEADER_CONTENT_TYPE_JSON_APPLICATION; + + /** + * Headers for HTTP POST request. Here the body of the HTTP message sent to the server is essentially one giant + * query string -- name/value pairs are separated by the ampersand (&), and names are separated from values by the + * equals symbol (=) + */ + static const std::string HTTP_HEADER_CONTENT_TYPE_WWW_FORM_URLENCODED; + + /** + * Indicates you would only get HTML as a valid responses + */ + static const std::string HTTP_HEADER_ACCEPT_TEXT_HTML; + + + private: + HttpConnectionHeaderConstants() = delete; + }; + +} + +#endif /* ADOBEMOBILE_UTIL_HTTPCONNECTIONCONSTANTS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/InternalModule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/InternalModule.h new file mode 100755 index 00000000..b025515d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/InternalModule.h @@ -0,0 +1,60 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_INTERNALMODULE_H +#define ADOBEMOBILE_CORE_INTERNALMODULE_H + +#include "Module.h" + +namespace AdobeMarketingMobile { + /** + * @class InternalModule + * + * Base class for internal (Adobe only) defined modules. Calling Module::GetPlatformServices() on an + * InternalModule allows access to platform-specific functionality in the environment owning the Module. + */ + class InternalModule : public Module { + protected: + /** + * Constructor. + * + * Subclasses should call this constructor to initialize the InternalModule. + * + * @param log_prefix - the name of the module + */ + explicit InternalModule(const std::string& log_prefix); + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + * + * =================================================== + * Example override + * =================================================== + * + * std::string Audience::GetSharedStateName() { + * return EventDataKeys::Audience::SHARED_STATE_NAME; + * } + * + **/ + virtual std::string GetSharedStateName() = 0; + }; +} + +#endif //ADOBEMOBILE_CORE_INTERNALMODULE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h new file mode 100755 index 00000000..a797abd3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonArraySerializer.h @@ -0,0 +1,45 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H + +#include +#include +#include "Expected.h" +#include "SdkError.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + class JsonArray; + class JsonUtilityServiceInterface; + /** + * @brief Serializer for JsonArray objects + */ + class JsonArraySerializer : public Object, public virtual VariantSerializerInterface { + public: + explicit JsonArraySerializer(const std::shared_ptr& json_utility_service); + + Expected> Deserialize(const Variant& value) const override; + + std::shared_ptr Serialize(const JsonArray& o) const override; + private: + std::shared_ptr json_utility_service_; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONARRAYSERIALIZER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h new file mode 100755 index 00000000..8765b47c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonObjectSerializer.h @@ -0,0 +1,47 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H + +#include +#include +#include "Expected.h" +#include "SdkError.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + class JsonObject; + class JsonUtilityServiceInterface; + /** + * @brief Serializer for JsonObject objects + */ + class JsonObjectSerializer : public Object, public virtual VariantSerializerInterface { + public: + explicit JsonObjectSerializer(const std::shared_ptr& json_utility_service); + + Expected> Deserialize(const Variant& value) const override; + + std::shared_ptr Serialize(const JsonObject& o) const override; + private: + std::shared_ptr json_utility_service_; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONOBJECTSERIALIZER_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h new file mode 100755 index 00000000..d9f444ec --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/JsonUtilityServiceInterface.h @@ -0,0 +1,694 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H + +#include +#include +#include +#include "EventData.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + namespace ErrorCodes { + // Platform shim errors + /** + * A json error occurred. Key is not found; + */ + constexpr static const char* JSON_KEY_NOT_FOUND = "json.key_not_found"; + /** + * A json error occurred. Index is not found. + */ + constexpr static const char* JSON_INDEX_NOT_FOUND = "json.index_not_found"; + /** + * A json error occurred. JsonObject is null. + */ + constexpr static const char* JSON_JSONOBJECT_IS_NULL = "json.jsonobject_is_null"; + /** + * A json error occurred. JsonArray is null. + */ + constexpr static const char* JSON_JSONARRAY_IS_NULL = "json.jsonarray_is_null"; + /** + * A json error occurred. Value is not of string type. + */ + constexpr static const char* JSON_VALUE_NOT_STRING_TYPE = "json.value_not_string_type"; + /** + * A json error occurred. Value is not of numeric type. + */ + constexpr static const char* JSON_VALUE_NOT_NUMERIC_TYPE = "json.value_not_numeric_type"; + /** + * A json error occurred. Value is not of boolean type. + */ + constexpr static const char* JSON_VALUE_NOT_BOOLEAN_TYPE = "json.value_not_boolean_type"; + /** + * A json error occurred. Value is not of array type. + */ + constexpr static const char* JSON_VALUE_NOT_ARRAY_TYPE = "json.value_not_array_type"; + /** + * A json error occurred. Value is not of dictionary type. + */ + constexpr static const char* JSON_VALUE_NOT_OBJECT_TYPE = "json.value_not_object_type"; + /** + * A json error occurred. Value is not of dictionary, array, numeric, boolean, string type. + */ + constexpr static const char* JSON_OBJECT_UNKNOWN = "json.object_unknown"; + /** + * A json serialization error occurred. + */ + constexpr static const char* JSON_SERIALIZATION_ERROR = "json.serialization_error"; + } + + enum class JsonType : int32_t { + NUMERIC = 0, + BOOLEAN, + STRING, + ARRAY, + OBJECT, + UNKNOWN + }; + + /** + * JSON objects are surrounded by curly braces {}. + * JSON objects are written in key/value pairs. + * Keys must be strings, and values must be a valid JSON data type (string, number, object, array, boolean or null). + * Keys and values are separated by a colon. + * Each key/value pair is separated by a comma. + */ + class JsonArray; + class JsonObject : public virtual ObjectInterface { + public: + /** + * Returns a TYPE for the key specified + * + * @param name the key name + * @return the JsonType + * @throws ErrorCodes::JSON_OBJECT_UNKNOWN if JsonObject is not valid, ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual JsonType GetType(const std::string& name) const = 0; + + /** + * Returns a JsonObject value for the key specified + * + * @param name the key name + * @return the JsonObject + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if JsonObject value is null, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present, or + * ErrorCodes::JSON_VALUE_NOT_OBJECT_TYPE if the value for the key \p name is not a JsonObject + */ + virtual std::shared_ptr GetJsonObject(const std::string& name) const = 0; + + /** + * Returns a JsonArray value for the key specified + * + * @param name the key name + * @return the JsonArray + * @throws ErrorCodes::JSON_JSONARRAY_IS_NULL if JsonArray value is not null, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present, or + * ErrorCodes::JSON_VALUE_NOT_ARRAY_TYPE if the alue for the key \p name is not a JsonArray + */ + virtual std::shared_ptr GetJsonArray(const std::string& name) const = 0; + + /** + * Returns a int32_t value for the key specified + * + * @param name the key name + * @return the int32_t value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual int32_t GetInt(const std::string& name) const = 0; + + /** + * Returns a int64_t value for the key specified + * + * @param name the key name + * @return the int64_t value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual int64_t GetLong(const std::string& name) const = 0; + + /** + * Returns a double value for the key specified + * + * @param name the key name + * @return the double value + * @throws ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE If the value is not numeric, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual double GetDouble(const std::string& name) const = 0; + + /** + * Returns a std::string value for the key specified + * + * @param name the key name + * @return the std::string value + * @throws ErrorCodes::JSON_VALUE_NOT_STRING_TYPE If the value is not a std::string, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual std::string GetString(const std::string& name) const = 0; + + /** + * Returns a boolean value for the key specified + * + * @param name the key name + * @return the bool value + * @throws ErrorCodes::JSON_VALUE_NOT_BOOLEAN_TYPE If the value is not a boolean, or ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + virtual bool GetBoolean(const std::string& name) const = 0; + + /** + * Insert a JsonObject value + * + * @param name std::string the key name + * @param value value the JsonObject + * @return JsonObject this object + */ + virtual std::shared_ptr PutJsonObject(const std::string& name, + const std::shared_ptr& value) = 0; + + /** + * Insert a JsonArray value + * + * @param name std::string the key name + * @param value value the JsonArray value + * @return JsonObject this object + */ + virtual std::shared_ptr PutJsonArray(const std::string& name, const std::shared_ptr& value) = 0; + + /** + * Insert an int32_t value + * + * @param name std::string the key name + * @param value int32_t the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutInt(const std::string& name, int32_t value) = 0; + + /** + * Insert a int64_t value + * + * @param name std::string the key name + * @param value int64_t the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutLong(const std::string& name, int64_t value) = 0; + + /** + * Insert a double value + * + * @param name std::string the key name + * @param value double the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutDouble(const std::string& name, double value) = 0; + + /** + * Insert a std::string value + * + * @param name std::string the key name + * @param value std::string the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutString(const std::string& name, const std::string& value) = 0; + + /** + * Insert a boolean value + * + * @param name std::string the key name + * @param value boolean the value + * @return JsonObject this object + */ + virtual std::shared_ptr PutBoolean(const std::string& name, bool value) = 0; + + /** + * Returns a JsonObject if a mapping exists, null otherwise. + * + * @param name the key name + * @return JsonObject, if mapping exists, null otherwise + */ + virtual std::shared_ptr OptJsonObject(const std::string& name) const = 0; + + + /** + * Returns a JsonArray if a mapping exists, null otherwise. + * + * @param name Key name + * @return JsonArray, if mapping exists, null otherwise + */ + virtual std::shared_ptr OptJsonArray(const std::string& name) const = 0; + + /** + * Returns the int32_t value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return int32_t value if a valid mapping exists, default_value otherwise. + */ + virtual int32_t OptInt(const std::string& name, int32_t default_value) const = 0; + + /** + * Returns the int64_t value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return int64_t value if a valid mapping exists, default_value otherwise. + */ + virtual int64_t OptLong(const std::string& name, int64_t default_value) const = 0; + + /** + * Returns the double value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return double value if a valid mapping exists, default_value otherwise. + */ + virtual double OptDouble(const std::string& name, double default_value) const = 0; + + /** + * Returns the String value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return String value if a valid mapping exists, default_value otherwise. + */ + virtual std::string OptString(const std::string& name, const std::string& default_value) const = 0; + + /** + * Returns the boolean value, if a valid mapping exists. + * + * @param name Key name + * @param default_value Value to be returned if a valid mapping does not exist. + * @return boolean value if a valid mapping exists, default_value otherwise. + */ + virtual bool OptBoolean(const std::string& name, bool default_value) const = 0; + + + /** + * Returns an iterator of the String keys in this object. + * + * @param keys list of the std::string keys + */ + virtual void Keys(std::vector& keys) const = 0; + + + /** + * Returns the number of mappings in this object + * + * @return The number of mappings + */ + virtual size_t Length() const = 0; + + /** + * Removes the specifed key and its value from the JSONObject + * + * @param name key that will be removed from the JSONObject + */ + virtual void Remove(const std::string& name) = 0; + + /** + * Convert this JsonObject to std::string + * + * @return std::string the string + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::string ToString() const = 0; + + }; + + class JsonArray : public virtual ObjectInterface { + public: + /** + * Returns a TYPE for the key specified + * + * @param index the uint32_t index + * @return the TYPE + * @throws ErrorCodes::JSON_JSONARRAY_IS_NULL or ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid. + */ + virtual JsonType GetType(uint32_t index) const = 0; + + /** + * Append a JsonObject value to the end of this array + * + * @param json_object JsonObject the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonObject(const std::shared_ptr& json_object) = 0; + + /** + * Sets the value at index to json_object, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param json_object JsonObject the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonObject(uint32_t index, const std::shared_ptr& json_object) = 0; + + /** + * Append a JsonArray to the end of this array + * + * @param json_array JsonArray the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonArray(const std::shared_ptr& json_array) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param json_array JsonArray the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutJsonArray(uint32_t index, const std::shared_ptr& json_array) = 0; + + /** + * Append an int32_t value to the end of this array + * + * @param value int32_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutInt(int32_t value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value int32_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutInt(uint32_t index, int32_t value) = 0; + + /** + * Append an int64_t value to the end of this array + * + * @param value int64_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutLong(int64_t value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value int64_t the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutLong(uint32_t index, int64_t value) = 0; + + /** + * Append a double value to the end of this array + * + * @param value double the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutDouble(double value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value double the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutDouble(uint32_t index, double value) = 0; + + /** + * Append a std::string value to the end of this array + * + * @param value std::string the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutString(const std::string& value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced. + * + * @param index the uint32_t index + * @param value std::string the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutString(uint32_t index, const std::string& value) = 0; + + /** + * Append a boolean value to the end of this array + * + * @param value bool the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutBoolean(bool value) = 0; + + /** + * Sets the value at index to value, null padding this array to the required length if necessary. + * If a value already exists at index, it will be replaced + * + * @param index the uint32_t index + * @param value bool the value + * @return JsonArray this array + */ + virtual std::shared_ptr PutBoolean(uint32_t index, bool value) = 0; + + /** + * Returns the JsonObject value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonObject + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid + */ + virtual std::shared_ptr GetJsonObject(uint32_t index) const = 0; + + /** + * Returns the JsonArray value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonArray + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, + ErrorCodes::JSON_VALUE_NOT_ARRAY_TYPE the value at index is not an array. + */ + virtual std::shared_ptr GetJsonArray(uint32_t index) const = 0; + + /** + * Returns the int32_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return int32_t value + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual int32_t GetInt(uint32_t index) const = 0; + + /** + * Returns the int64_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return int64_t + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual int64_t GetLong(uint32_t index) const = 0; + + /** + * Returns the double value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return double + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a number. + */ + virtual double GetDouble(uint32_t index) const = 0; + + /** + * Returns the std::string value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return String + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_NUMERIC_TYPE the value at index is not a std::string. + */ + virtual std::string GetString(uint32_t index) const = 0; + + /** + * Returns the boolean value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return boolean + * @throws ErrorCodes::JSON_INDEX_NOT_FOUND if the index is invalid, ErrorCodes::JSON_VALUE_NOT_BOOLEAN_TYPE the value at index is not a boolean. + */ + virtual bool GetBoolean(uint32_t index) const = 0; + + /** + * Returns the JsonObject value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonObject value at the index if exists and valid, null otherwise. + */ + virtual std::shared_ptr OptJsonObject(uint32_t index) const = 0; + + /** + * Returns the JsonArray value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @return JsonArray value at the index, if exists and valid, null otherwise. + */ + virtual std::shared_ptr OptJsonArray(uint32_t index) const = 0; + + /** + * Returns the int32_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return int32_t value at the index if exists and valid, default_value otherwise. + */ + virtual int32_t OptInt(uint32_t index, int32_t default_value) const = 0; + + /** + * Returns the int64_t value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return int64_t value at the index if exists and valid, default_value otherwise. + */ + virtual int64_t OptLong(uint32_t index, int64_t default_value) const = 0; + + /** + * Returns the double value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return double value at the index if exists and valid, default_value otherwise. + */ + + virtual double OptDouble(uint32_t index, double default_value) const = 0; + + /** + * Returns the std::string value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return String value at the index if exists and valid, default_value otherwise. + */ + virtual std::string OptString(uint32_t index, const std::string& default_value) const = 0; + + /** + * Returns the boolean value if a valid value is present at the index specified. + * + * @param index The index into the JsonArray + * @param default_value Value to be returned if a valid value does not exist at index. + * @return boolean value at the index if exists and valid, default_value otherwise. + */ + virtual bool OptBoolean(uint32_t index, bool default_value) const = 0; + + /** + * Returns the number of values in the array + * + * @return Number of values in the array. + */ + virtual size_t Length() const = 0; + + /** + * Convert this JsonArray to std::string + * + * @return std::string the string + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::string ToString() const = 0; + }; + + class JsonUtilityServiceInterface : public virtual ObjectInterface { + public: + /** + * Parse a Json string provided as input into a JsonObject instance, if the JSON string has the JSON object as + * the root element. + * + * @param json The json string to parse. + * @return A valid JsonObject if parse was successful + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::shared_ptr CreateJsonObject(const std::string& json) = 0; + /** + * Create a JsonObject from a Map + * + * @param map Map to create a JsonObject from + * @return A valid JsonObject if parse was successful, null otherwise + */ + virtual std::shared_ptr CreateJsonObject(const std::map>& map) = 0; + + /** + * Create a JsonObject from a String StringMap + * + * @param map Map to create a JsonObject from + * @return A valid JsonObject if parse was successful, null otherwise + */ + virtual std::shared_ptr CreateJsonObject(const std::map& map) = 0; + + /** + * Creates a valid empty JsonObject. + * + * @return An empty JsonObject. + */ + virtual std::shared_ptr CreateEmptyJsonObject() = 0; + + /** + * Parse a Json string provided as input into a JsonArray instance, if the JSON string has the JSON array as + * the root element. + * + * @param json The json string to parse + * @return A valid JsonArray if parse was successful + * @throws ErrorCodes::JSON_SERIALIZATION_ERROR if there is error + */ + virtual std::shared_ptr CreateJsonArray(const std::string& json) = 0; + + /** + * Creates a JsonArray from a variant vector + * + * @param vector variant vector to create the JsonArray from + * @return A valid JsonArray if parse was successful, nullptr otherwise + */ + virtual std::shared_ptr CreateJsonArray(const std::vector>& vector) = 0; + + /** + * Creates a valid empty JsonArray. + * + * @return An empty JsonArray. + */ + virtual std::shared_ptr CreateEmptyJsonArray() = 0; + + /** + * Parse a JsonObject and return the converted std::map of that object + * + * @param json_data The JsonObject to parse + * @return A valid string map if parse was successful, empty string map otherwise + */ + virtual std::map MapFromJsonObject( const std::shared_ptr& json_data) = 0; + + /** + * Parse EventData and deserialize the underlying variant map to JsonObject. + * + * @param data The EventData to parse + * @return Valid JsonObject if successful, nullptr otherwise + */ + virtual Expected> EventDataToJsonObject(const std::shared_ptr& data); + /** + * Parse a JsonObject and convert it to EventData by serializing to a variant map + * + * @param json_data The JsonObject to parse + * @return Valid EventData if successful, nullptr otherwise + */ + virtual Expected> JsonObjectToEventData(const std::shared_ptr& json_data); + }; + +} //namespace + +#endif /* ADOBEMOBILE_PLATFORMSHIM_JSONUTILITYSERVICEINTERFACE_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LaunchType.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LaunchType.h new file mode 100755 index 00000000..a1ea7ab8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LaunchType.h @@ -0,0 +1,32 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_LAUNCHTYPE_H +#define ADOBEMOBILE_SHARED_LAUNCHTYPE_H + +namespace AdobeMarketingMobile { + + enum class LaunchType { + LAUNCH = 0, + INSTALL, + UPGRADE + }; + +} + +#endif /* ADOBEMOBILE_SHARED_LAUNCHTYPE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h new file mode 100755 index 00000000..2b2974c9 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LocalStorageServiceInterface.h @@ -0,0 +1,202 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Interface for the DataStore object containing persistent key-value pairs + */ + class DataStoreInterface : public virtual ObjectInterface { + public: + /** + * Set or update an int value + * + * @param key std::string key name + * @param value int value + */ + virtual void SetInt(const std::string& key, int32_t value) = 0; + + /** + * Get int value for key + * + * @param key std::string key name + * @param default_value int the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual int32_t GetInt(const std::string& key, int32_t default_value) const = 0; + + /** + * Set or update a std::string value for key + * + * @param key std::string key name + * @param value std::string The string value to store + */ + virtual void SetString(const std::string& key, const std::string& value) = 0; + + /** + * Get String value for key + * + * @param key std::string key name + * @param default_value std::string the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual std::string GetString(const std::string& key, const std::string& default_value) const = 0; + + /** + * Set or update a double value for key + * + * @param key std::string key name + * @param value The double value to store + */ + virtual void SetDouble(const std::string& key, double value) = 0; + + /** + * Get double value for key + * + * @param key std::string key name + * @param default_value double the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual double GetDouble(const std::string& key, double default_value) const = 0; + + /** + * Set or update a long value for key + * + * @param key std::string key name + * @param value The long value to store + */ + virtual void SetLong(const std::string& key, int64_t value) = 0; + + /** + * Get long value for key + * + * @param key std::string key name + * @param default_value long the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual int64_t GetLong(const std::string& key, int64_t default_value) const = 0; + + /** + * Set or update a float value for key + * + * @param key std::string key name + * @param value The float value to store + */ + virtual void SetFloat(const std::string& key, float value) = 0; + + /** + * Get float value for key + * + * @param key std::string key name + * @param default_value float the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual float GetFloat(const std::string& key, float default_value) const = 0; + + /** + * Set or update a boolean value for key + * + * @param key std::string key name + * @param value The bool value to store + */ + virtual void SetBoolean(const std::string& key, bool value) = 0; + + /** + * Get boolean value for key + * + * @param key std::string key name + * @param default_value boolean the default value to return if key does not exist + * @return persisted value if it exists, default_value otherwise + */ + virtual bool GetBoolean(const std::string& key, bool default_value) const = 0; + + /** + * Set or update a Vector value for key + * + * @param key std::string key name + * @param value Vector to set or update + */ + virtual void SetVector(const std::string& key, const std::vector& value) = 0; + + /** + * Get Vector value for key + * + * @param key std::string key name + * @return persisted value if it exists, an empty vector otherwise + */ + virtual std::vector GetVector(const std::string& key) const = 0; + + /** + * Set or update a Map value for key + * + * @param key std::string key name + * @param value Map to set or update + */ + virtual void SetMap(const std::string& key, const std::map& value) = 0; + + /** + * Get Map value for key + * + * @param key std::string key name + * @return persisted value if it exists, an empty map otherwise + */ + virtual std::map GetMap(const std::string& key) const = 0; + + /** + * Check if the DataStore contains key + * + * @param key std::string key name + * @return true if key exists, false otherwise + */ + virtual bool Contains(const std::string& key) const = 0; + + /** + * Remove persisted value for key + * + * @param key std::string key name + */ + virtual void Remove(const std::string& key) = 0; + + /** + * Remove all key-value pairs from this DataStore + */ + virtual void RemoveAll() = 0; + }; + + class LocalStorageServiceInterface : public virtual ObjectInterface { + public: + /** + * Get a DataStore containing persistent key-value pairs + * + * @param data_store_name name of the DataStore + * @return DataStore object containing persisted data for dataStoreName. A new DataStore will be created if it doesn't exist + */ + virtual std::shared_ptr GetDataStore(const std::string& data_store_name) = 0; + }; + + +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOCALSTORAGESERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Log.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Log.h new file mode 100755 index 00000000..777f347b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Log.h @@ -0,0 +1,263 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOG_H +#define ADOBEMOBILE_PLATFORMSHIM_LOG_H + +#include "LoggingServiceInterface.h" +#include "LoggingMode.h" +#include "StringUtils.h" + +namespace AdobeMarketingMobile { + + class Log : public Object { + public: + /** + * Sets the platform specific logging service to use for log output + * + * @param logging_service LoggingService to use for log output + * + * @see LoggingService + */ + static void SetLoggingService(const std::shared_ptr& logging_service); + + /** + * @returns the current logging service + */ + static std::shared_ptr GetLoggingService(); + + /** + * Sets the log level to operate at + * + * @param logging_mode LoggingMode to use for log output + * + * @see LoggingMode + */ + static void SetLogLevel(LoggingMode logging_mode); + + /** + * Gets the log level that the SDK is currently operating at + * + * @return LoggingMode describing the current level of logging. + */ + static LoggingMode GetLogLevel(); + + /** + * Gets the probable log level that the SDK is currently operating at, + * this may differ from the actual log level, but this call is very fast + * and does not acquire mutexes. To know the actual log level, call GetLogLevel(). + * + * This call is useful for preventing expensive log-related operations, but should + * be used sparingly. Example: + * + * if(GetLogLevelHint() >= LoggingMode::DEBUG_LOG) { + * std::string serialization = SomeExpensiveSerializationOperation(); + * Log::Debug("foo", "the serialization: %s", serialization); + * } + * + * @return LoggingMode describing the current level of logging. + */ + static LoggingMode GetLogLevelHint(); + + /** + * Used to print more verbose information. Info logging is expected to follow end-to-end every method an event hits. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Trace(const std::string& source, const char* format, const TArgs& ... args); + template + static void Trace(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the debug method should contain high-level details about the data being processed. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE, DEBUG + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Debug(const std::string& source, const char* format, const TArgs& ... args); + template + static void Debug(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the warning method indicates that a request has been made to the SDK, but the SDK + * will be unable to perform the requested task. An example is catching an expected or unexpected but + * recoverable exception. + * Prints information to the console only when the SDK is in LoggingMode: VERBOSE, DEBUG, WARNING + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Warning(const std::string& source, const char* format, const TArgs& ... args); + template + static void Warning(const char* source, const char* format, const TArgs& ... args); + + /** + * Information provided to the error method indicates that there has been an unrecoverable error. + * Prints information to the console regardless of current LoggingMode of the SDK. + * + * @param source the source of the information to be logged + * @param format the string to be logged, @see StringUtils::FormatString() + * @param args the formatting arguments, @see StringUtils::FormatString() + * + * @see LoggingMode + */ + template + static void Error(const std::string& source, const char* format, const TArgs& ... args); + template + static void Error(const char* source, const char* format, const TArgs& ... args); + + private: + Log() {} + + static std::mutex mutex; ///< @private a mutex to protect logging vars + + static LoggingMode current_mode; ///< @private the current logging mode, synchronized on mutex + + /** + * @private the current logging service, protected by mutex + */ + static std::shared_ptr current_service; + + /** + * @private + * a hint about current_service (might be wrong in sometimes). + * true if current_service is not nullptr. + * accessible without mutex. + */ + static bool hint_service; + + /** + * @private + * a hint about current_mode (might be wrong in sometimes). + * accessible without mutex. + */ + static LoggingMode hint_mode; + + /** + * @private + * + * @returns true if there is probably a logging service and the mode is probably greater than mode. + * + * this function is fast and does not acquire mutexes. before logging, the actual service and mode should be + * checked. + */ + static bool Precheck(LoggingMode mode); + + /** + * @private + * @returns the current logging service if current_mode is >= mode. synchronized. + */ + static std::shared_ptr GetLoggingServiceIfModeGreq(LoggingMode mode); + + /** + * @private + * Non-generic part of Trace() implementation. + */ + static void TraceImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Debug() implementation. + */ + static void DebugImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Warning() implementation. + */ + static void WarningImpl(const char* source, const std::string& s); + + /** + * @private + * Non-generic part of Error() implementation. + */ + static void ErrorImpl(const char* source, const std::string& s); + }; +} //namespace + + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + template + void Log::Trace(const std::string& source, const char* format, const TArgs& ... args) { + Trace(source.c_str(), format, args...); + } + + template + void Log::Trace(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::VERBOSE_LOG)) { + TraceImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Debug(const std::string& source, const char* format, const TArgs& ... args) { + Debug(source.c_str(), format, args...); + } + + template + void Log::Debug(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::DEBUG_LOG)) { + DebugImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Warning(const std::string& source, const char* format, const TArgs& ... args) { + Warning(source.c_str(), format, args...); + } + + template + void Log::Warning(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::WARNING_LOG)) { + WarningImpl(source, StringUtils::FormatString(format, args...)); + } + } + + template + void Log::Error(const std::string& source, const char* format, const TArgs& ... args) { + Error(source.c_str(), format, args...); + } + + template + void Log::Error(const char* source, const char* format, const TArgs& ... args) { + if (Precheck(LoggingMode::WARNING_LOG)) { + ErrorImpl(source, StringUtils::FormatString(format, args...)); + } + } +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOG_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h new file mode 100755 index 00000000..15c73704 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingMode.h @@ -0,0 +1,33 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H + +namespace AdobeMarketingMobile { + + enum class LoggingMode : int32_t { + ERROR_LOG = 0, + WARNING_LOG = 1, + DEBUG_LOG = 2, + VERBOSE_LOG = 3, + + }; +} //namespace + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOGGINGMODE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h new file mode 100755 index 00000000..3c382f6c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/LoggingServiceInterface.h @@ -0,0 +1,56 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H + +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + class LoggingServiceInterface : public virtual ObjectInterface { + public: + /** + * Information provided to the debug method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Debug(const std::string& tag, const std::string& message) const = 0; + /** + * Information provided to the warning method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Warning(const std::string& tag, const std::string& message) const = 0; + /** + * Information provided to the error method should contain high-level details about the data being processed. + * + * @param tag the class or method tag associated with the message + * @param message the string to be logged + * + */ + virtual void Error(const std::string& tag, const std::string& message) const = 0; + }; +} //namespace + + +#endif /* ADOBEMOBILE_PLATFORMSHIM_LOGGINGSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Matchers.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Matchers.h new file mode 100755 index 00000000..fd1b0790 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Matchers.h @@ -0,0 +1,312 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_MATCHER_H +#define ADOBEMOBILE_RULESENGINE_MATCHER_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonObject; + class Variant; + + /** + * Base Matcher class. Matcher classes evaluate given values to values mapped to a given key. Derived Matcher + * classes specialize in the match operation used to evaluate the values. + */ + class Matcher : public Object { + friend class RuleConditionMatcher; + public: + + std::string key; ///< the key to which this Matcher evaluates values against + std::vector> values; ///< the values for this Matcher which will evaluate to true + + /** + * Creates a Matcher instance based on the given JSON Object. + * Searches the JSON object for a matcher operator, key, and values and returns a Matcher instance + * populated with those values. Returns `nullptr` if an error occurs creating the Matcher instance. + * + * @param dictionary a JSON object containing the definition for a Matcher instance + * @returns a new Matcher instance, or `nullptr` if a Matcher could not be created. + */ + static std::shared_ptr MatcherWithJsonObject(const std::shared_ptr& dictionary); + + protected: + + /** + * ctor. + */ + Matcher() = default; + + /** + * Searches the JSON object for matcher values and adds them to the given Matcher object. + * Logs a warning if no values are found. + * + * @param dictionary the JSON object containing a matcher values array + * @param matcher the Matcher instance to add the found values + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if key is not present. + */ + static void SetMatcherValuesFromJson(const std::shared_ptr& dictionary, + const std::shared_ptr& matcher); + + /** + * Searches the JSON object for a matcher key and adds it to the given Matcher object. + * Logs a warning if the key is not found or if a JSON error occurs. + * + * @param dictionary the JSON object containing the matcher key + * @param matcher the Matcher instance to add the found key + */ + static void SetMatcherKeyFromJson(const std::shared_ptr& dictionary, + const std::shared_ptr& matcher); + + /** + * Evaluates the given \p value against this Matcher's values for this Matcher type's operation. + * + * @param value the value to match + * @returns true if the value matches against this Matcher's values, false otherwise. + */ + virtual bool Matches(const std::shared_ptr& value) const; + + /** + * Compares two values as doubles. The given Variant values are converted to doubles before being passed + * to the given comparison function. Converting the values to doubles allows for comparision between different + * numeric types and strings. + * + * @param value the value to compare + * @param match the Matcher's value to compare + * @param compare_func the comparison function + * @returns true if both values are able to be converted to double types and \p compare_func evaluates to true, + * false otherwise. + */ + static bool CompareAsDoubles(const std::shared_ptr& value, const std::shared_ptr& match, + std::function compare_func); + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + /** + * Helper class to perform common ToString formatting. + * + * @param options ToStringOptions used in formatting the result string + * @param description a simple description for this Matcher + * @returns a formatted string describing this Matcher + */ + std::string ToStringImplHelper(const ToStringOptions& options, const std::string& description) const; + + private: + + /** + * Gets a new Matcher instance of type represented by the given \p type string. + * + * @param type a string representation of a Matcher class + * @returns new Matcher instance of type defined by \p type, or `nullptr` if \p type does not define + * a valid Matcher class. + */ + static std::shared_ptr InitializeMatcherTypeDictionary(const std::string& type); + + }; + + class MatcherContains : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is contained within any of this Matcher's values. + * @param value the value to evaluate + * @returns true if the value is contained within any of this Matcher's values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherEndsWith : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value ends with any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value ends with any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherEquals : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherExists : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if this Matcher's \p key exists in any of the given \p maps. + * @param value the value to evaluate + * @returns true if this Matcher's \p key exists in any of the given \p maps, false otherwise. + */ + bool Matches(const std::shared_ptr& value) const override; + + }; + + class MatcherGreaterThan : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is greater than any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is greater than any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + + }; + + class MatcherGreaterThanOrEqual : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is greater than or equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is greater than or equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherLessThan : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is less than any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is less than any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherLessThanOrEqual : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is less than or equal to any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is less than or equal to any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotContains : public MatcherContains { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value is not contained within any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value is not contained within any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotEquals : public MatcherEquals { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value does not equal any of this Matcher's \p values. + * @param value the value to evaluate + * @returns true if the value does not equal any of this Matcher's \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherNotExists : public MatcherExists { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if this Matcher's \p key exists in any of the given \p maps. + * @param value the value to evaluate + * @returns true if this Matcher's \p key exists in any of the given \p maps, false otherwise. + */ + bool Matches(const std::shared_ptr& value) const override; + }; + + class MatcherStartsWith : public Matcher { + public: + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + protected: + /** + * Verifies if the given value starts with any of the Matcher's string \p values. + * @param value the value to evaluate + * @returns true if the value starts with any of this Matcher's string \p values, false otherwise + */ + bool Matches(const std::shared_ptr& value) const override; + }; + +} + +#endif /* ADOBEMOBILE_RULESENGINE_MATCHER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h new file mode 100755 index 00000000..c5e848ba --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobileIdentities.h @@ -0,0 +1,169 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE:All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any.The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H +#define ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H + +#include "Configuration.h" +#include "Event.h" + +namespace AdobeMarketingMobile { + + class MobileIdentities { + public: + /** + * Collects all the identities in the given string format from various modules. + * + * @param json_utility_service A JsonUtilityService instance from PlatformServices for creating a JSON string + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the shared state information + * @return A string with all available identities in json format + */ + static std::string GetAllIdentifiers(const std::shared_ptr& json_utility_service, + const std::shared_ptr& event, const std::shared_ptr& module); + + /** + * Verifies none of the shared states required for the GetSDKIdentities API are in PENDING State. + * The required shared states are: + * 1.Analytics + * 2.Audience + * 3.Configuration + * 4.Identity + * 5.Target + * + *Returns true, if the all the above shared state are valid. + *Returns false, if any one of the above shared state is in EventHub#SHARED_STATE_PENDING. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the shared state + * @return A boolean indicating the availability of the required module shared state + */ + static bool AreAllSharedStateReady(const std::shared_ptr& event, const std::shared_ptr& module); + + private: + /** + * Gets the required identities from Audience Module. + * A List of map in the following format will be appended depending the availability of the Audience shared state. + * + * [{ "namespace" : "0", "value" : "AAM_UUID", "type" : "namespaceId" }, + * { "namespace" : "AAM_DPID", "value" : "AAM_DPUUID", "type" : "namespaceId" }] + * + * An empty list will be returned if the Audience shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Audience shared state + * @return List containing Audience Identities + */ + static std::vector> GetAudienceIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the required identities from Analytics Module. + * A List of map in the following format will be appended depending the availability of theAnalytics} shared state. + * + * [ { "namespace" : "avid", "value" : "AID", "type" : "integrationCode" }, + * { "namespace" : "vid", "value" : "VID", "type" : "analytics", "rsids" : [ "rsid1", "rsid2", ... ] }] + * + * An empty list will be returned if the Analytics shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Analytics shared state + * @return List containing Analytics Identities + */ + static std::vector> GetAnalyticsIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the required identities from Identity Module. + * + * A List of map in the following format will be appended depending the availability of theIdentity shared state. + * [ { "namespace" : "INTEGRATION CODE", "value" : "ID", "type" : "integrationCode" }, + *{ "namespace" : "4", "value" : "MCID", "type" : "namespaceId" }, + *{ "namespace" : "20919", "value" : "PUSHID", "type" : "integrationCode" }, + *{ "namespace" : "DSID_20914","value" : "ADID", "type" : "integrationCode" }, + * ] + * + * An empty list will be returned if the Identity shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Identity shared state + * @return List containing Visitor Identities + */ + static std::vector> GetVisitorIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + + /** + * Gets the required identities from Target Module. + * + * A List of map in the following format will be appended depending the availability of the Target shared state. + * + * [{ "namespace" : "tntid", "value" : "TNTID", "type" : "target" }, + * { "namespace" : "3rdpartyid", "value" : "TNT3RDPARTYID", "type" : "target" }] + * + * An empty list will be returned if the Target shared state is invalid or null. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Target shared state + * @return List containing Target Identities + */ + static std::vector> GetTargetIdentifiers(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Gets the company context map in the following format. + * + *"companyContexts": [ + * { "namespace": "imsOrgID", "value": "ORGID" } + *] + * + * Returns null if the Configuration shared state is invalid or null. + * Returns null if the Configuration shared state is valid and marketingCloudID cannot be found + * inConfiguration shared state. + * + * @param event An Event generated by the GetSdkIdentities API + * @param module An Module instance to retrieve the Identity shared state + * @return List representing company context + */ + static std::vector> GetCompanyContext(const std::shared_ptr& event, + const std::shared_ptr& module); + + /** + * Helper method to create a userID Map. + * + * @param name_space A String representing namespace + * @param value An String representing value + * @param type An String representing type + * @return An UserIDMap + */ + static std::map> CreateUserIdMap(const std::string& name_space, + const std::string& value, + const std::string& type); + + /** + * Verifies if the given shared state is valid. + * Returns false, if the give provided sharedState is invalid or pending. True otherwise. + * + * @param shared_state An EventData representing a shared state + * @return boolean value representing the validity of the shared state + */ + static bool IsSharedStateValid(const std::shared_ptr& shared_state); + }; +} + +#endif /* ADOBEMOBILE_CONFIGURATION_MOBILEIDENTITIES_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h new file mode 100755 index 00000000..e8727735 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/MobilePrivacyStatus.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H +#define ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H + +#include +#include + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + enum class MobilePrivacyStatus : int32_t { + OPT_IN = 0, + OPT_OUT, + UNKNOWN + }; + + /** + * Converts a string to its respective MobilePrivacyStatus enum representation + * + * If not match is found, returns MobilePrivacyStatus::UNKNOWN + */ + MobilePrivacyStatus StringToMobilePrivacyStatus(const std::string& privacy_string); + + /** + * Converts a MobilePrivacyStatus enum to its respective string representation + * + * If not match is found, returns "optunknown" + */ + std::string MobilePrivacyStatusToString(MobilePrivacyStatus privacy_status); + + /** + * Used for logging + */ + void ToStringImpl(std::ostream& the_stream, MobilePrivacyStatus value, const ToStringOptions& options); +} + +#endif /* ADOBEMOBILE_SHARED_MOBILEPRIVACYSTATUS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Module.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Module.h new file mode 100755 index 00000000..cc14294c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Module.h @@ -0,0 +1,862 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULE_H +#define ADOBEMOBILE_CORE_MODULE_H + +#include +#include +#include +#include +#include +#include "Common.h" +#include "EventType.h" +#include "EventSource.h" +#include "Expected.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class EventData; + class EventHub; + class Rule; + class InternalModule; + class ModuleEventDispatcherBase; + class ModuleEventListenerBase; + class ModuleEventProcessorBase; + class ModuleTaskOptions; + class PlatformServicesInterface; + class TaskExecutorInterface; + enum class ModuleState : int32_t; + + // TODO: (AMSDK-5893) does InternalModule make sense anymore given our current external module design? + + /** + * @class Module + * + * Module is the base class for modules. + * + * Quick Start + * =========== + * To create a module, derive from `Module` or `InternalModule` (for modules created internally): + * + * class MyModule : public Module { + * public: + * // Subclasses must have a default constructor: + * MyModule() : Module{ "MyModule" } {} // "MyModule" is the log prefix + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * }; + * + * To register a module, call EventHub::RegisterModule(): + * + * std::shared_ptr event_hub = ...; + * event_hub->RegisterModule(); + * + * Module Registration and Initialization + * ====================================== + * EventHub::RegisterModule() can be used to register a module. + * + * Registration completes asynchronously. After EventHub::RegisterModule(), the following occurs: + * + * 1) The event hub constructs an instance of the module using its default constructor + * (i.e. `MyModule::MyModule()`). During the constructor, the module is not yet registered with the EventHub + * and therefore cannot register listeners, dispatchers, or processors. + * + * 2) The event hub invokes `Module::OnRegistered()` on the event hub thread. During `Module::OnRegistered()`, + * subclasses may register listeners, dispatchers, or processors. + * + * The following is an example of a module that performs some initialization: + * + * class MyModule : public Module { + * public: + * MyModule() : Module{ "MyModule" }, + * some_variable_{42} { + * // Some initialization can happen this method, BUT: + * // + * // Do not call RegisterProcessor/RegisterListener/CreateDispatcher from the constructor. If called + * // during the constructor, these methods will throw since the module does not have a reference to + * // the EventHub yet. The same holds true for any calls that require an EventHub. + * } + * + * void OnRegistered() override { + * // During this method, you will typically perform the bulk of your initialization. + * RegisterListener(...); + * RegisterProcessor(...); + * + * // You can also perform additional initialization in this method. HOWEVER, this method is invoked + * // in the eventloop and therefore should not perform long-running, synchronous operations. + * } + * + * private: + * int32_t some_variable_; + * }; + * + * Unregistering Modules + * ===================== + * To register a module with EventHub, call `Module::UnregisterModule()`. + * + * After calling Module::UnregisterModule(), the following occurs: + * + * 1) The module drops pending, unstarted tasks and stops accepting new tasks. If a task was already started, it + * will be completed prior to invoking `Module::OnUnregistered()`. To schedule tasks that will be executed + * during unregistration (in order to peform blocking unregistration tasks) see Module::AddTaskToQueue(). + * + * 2) The module unregisters all listeners, processors, and dispatchers and stops accepting new listeners, + * processors and dispatchers. As usual, the event hub invokes `OnUnregistered()` on the event hub thread for + * listeners, processors, and dispatchers registered by the module. + * + * 3) The event hub invokes `Module::OnUnregistered()` on the eventhub thread. + * + * 4) All remaining tasks (required for unregistartion) are completed and the background task thread is terminated. + * + * 5) The event hub and module release their references to eachother. At this time, the EventHub and Module + * may get destructed. + * + * Threading + * ========= + * Module/listener/dispatcher/processor callbacks such as `OnRegistered()`, `OnUnregistered()`, + * `ModuleEventListener::Hear()` and `ModuleEventProcessor::Process()` are called synchronously from the + * event hub thread. + * + * This has a few consequences: + * + * 1) These methods will never be called concurrently and can be implemented as if they were executing on a single + * thread. + * + * 2) These callbacks must NEVER perform blocking operations, as those will block the event hub. + * + * Additional details: + * - Callbacks MAY be called concurrently for different Module instances. + * - Modules should not expect that callbacks will be called from a specific thread or always be + * called from the same thread. The event hub may invoke these callbacks from any actual thread so long as + * the callbacks are invoked as if they originated from the same thread. + */ + class Module : public Object { + friend class EventHub; // EventHub should only access private methods marked for use by EventHub. + friend class ModuleMethods; // For testing + + public: + /** + * Determines whether a module is currently registered. + * + * This method is thread-safe. + * + * NOTE: The result of this call be used as a hint. For threading reasons, it is possible + * to become unregistered after IsRegistered() has already returned true. + * + * @returns true if this module is currently registered with an EventHub, false otherwise. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsRegistered(); + + /** + * Determines whether a module is an InternalModule. + * + * This method is thread-safe. + * + * @returns true if this module is an InternalModule, false otherwise. + */ + bool IsInternal(); + + /** + * Get the name of this module + * + * @returns name of this module + */ + std::string GetModuleName() const { + return log_prefix_; + } + + protected: + /** + * For convenience, a ModuleTaskOptions with `required_for_unregistration` set to true. + */ + static const ModuleTaskOptions REQUIRED_FOR_UNREGISTRATION; + + /** + * Constructor. + * + * Subclasses should call this constructor to initialize the InternalModule. + * + * @param log_prefix - the name of the module + */ + explicit Module(const std::string& log_prefix); + + /** + * Creates, registers, and returns an event dispatcher for this module. + * + * TDispatcher is the class of the dispatcher to create. TDispatcher should extend ModuleEventDispatcher, + * where TDispatcher is the type of the current module. In rare cases, TDispatcher may extend ModuleEventDispatcherBase + * directly. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * This method is thread-safe. + * + * @return a TDispatcher registered with the current module and eventhub + * + * @see ModuleEventDispatcher + */ + template + std::shared_ptr CreateDispatcher(); + + /** + * This method is invoked shortly after the Module is registered. + * + * Subclasses may override this method to perform initialization tasks. Methods that require + * an event hub (i.e. `RegisterListener()`) may be safely invoked during this method. + * + * Threading + * ========= + * Do not perform blocking operations during this method. Consider moving these operations to a + * background thread. + * + * @see Module for additional threading information. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after EventHub::RegisterModule() + * is called. This call is guaranteed to occur prior to Module::OnUnregistered, ModuleEventListener callbacks, + * and ModuleEventProcessor callbacks. + */ + virtual void OnRegistered(); + + + /** + * This method is invoked shortly before the Module is fully unregistered. + * + * Subclasses may override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * Do not perform blocking operations during this method. Consider moving these operations to a + * background thread. + * + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This function is guaranteed to be called after pending Module callbacks, ModuleEventListener callbacks, + * and ModuleEventProcessor callbacks. All pending tasks are guaranteed to be complete or cancelled before this + * function is called (except tasks scheduled with `options.required_for_unregistration` set to true, which + * may complete after this function is called). After calling this method, Module and its child objects will + * receive no additional callbacks, and the EventHub will release any references to the Module and its child + * objects. + */ + virtual void OnUnregistered(); + + /** + * Registers an event processor for this module. + * + * Processors can process all events, not only events destined for the registering module + * + * TProcessor is the class of the processor to create. TProcessor should extend ModuleEventProcessor, + * where TProcessor is the type of the current module. In rare cases, TProcessor may extend ModuleEventProcessorBase + * directly. + * + * This method is thread-safe. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * @see ModuleEventProcessor + */ + template + void RegisterProcessor(); + + /** + * Registers an event listener for this module. + * + * Only one listener per type/source pair is allowed per module. Any collisions will be resolved by replacing + * the existing listener with the new listener. + * + * TListener is the class of the listener to create. TListener should extend ModuleEventListener, + * where TModule is the type of the current module. In rare cases, TListener may extend ModuleEventListenerBase + * directly. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for existing listeners on event_type/event_source to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override ModuleEventListener::OnUnregistered + * and ModuleEventListener::OnRegistered. + * + * @param event_type - EventType to listen for + * @param event_source - EventSource to listen for + * + * @see ModuleEventListener + */ + template + void RegisterListener(const std::shared_ptr& event_type, const std::shared_ptr& event_source); + + /** + * Registers a wild card event listener for this module. + * + * The wild card listener will receive all events that are dispatched by the event hub. + * Internally, this method uses the {@link #registerListener(EventType, EventSource, Class)} to register an event listener + * for {@link EventType#WILDCARD} and {@link EventSource#WILDCARD}. + * + */ + template + void RegisterWildCardListener(); + + /** + * Registers a one-time block with the parent event hub. + * + * A one-time block is an event handler that will cease to function after it sucessfully 'hears' one event. + * + * This method will only have an effect while the Module is registered. Calling this method before + * the Module is registered or after it is unregistered will be a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for existing listeners on event_type/event_source to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override ModuleEventListener::OnUnregistered + * and ModuleEventListener::OnRegistered. + * + * @param type - the EventType of an event to listen for + * @param source - the EventSource of an event to listen for + * @param pair_id - optional pairID to listen for -- this is primarily used for request/response events + * @param block - the block to call when the event is heard + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterOneTimeListenerBlock(const std::shared_ptr& type, + const std::shared_ptr& source, + const std::string& pair_id, + const std::function&)>& block); + + /** + * Unregisters this module from the parent event hub. + * + * This method is thread-safe. + * + * Due to threading, it is possible for listeners and processors to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override OnUnregistered. + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterModule(); + + /** + * Unregisters a listener that matches the provided type/source + * + * Threading + * ========= + * This method is thread-safe. + * + * Due to threading, it is possible (but rare) for removed listeners to get invoked slightly after + * calling this function. For stricter ordering guarantees, Modules should override + * ModuleEventListener::OnUnregistered. + * + * @param type - event type of listener to unregister + * @param source - event source of listener to unregister + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterListener(const std::shared_ptr& type, + const std::shared_ptr& source); + + /** + * Unregisters a wild card listener that was registered earlier. + * + * @see {@link RegisterWildcardListener} + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterWildCardListener(); + + /** + * Add a task to the module's thread pool that will be executed asynchronously. + * + * Equivalent to: + * + * this->AddTaskToQueue(task_name, task_callback, ModuleTaskOptions{}); + * + * @see `void AddTaskToQueue(const std::string& task_name, std::function task_callback, const ModuleTaskOptions& options )` + */ + ADOBE_VIRTUAL_FOR_TESTS void AddTaskToQueue(const std::string& task_name, + std::function task_callback); + + /** + * Add a task to the module's thread pool that will be executed asynchronously. + * + * Calling this method during a Module's constructor is a noop. + * + * Threading + * ========= + * This method is thread-safe. + * + * This method will capture a reference to the calling Module to keep it alive while running the task. + * + * Tasks from a given Module will be started and completed in FIFO order. For example: + * + * AddTaskToQueue("a", [=] { Log::Debug("hello"); }); + * AddTaskToQueue("b", [=] { Log::Debug("world"); }); + * + * The above code will always print "hello" then "world". Task "b" will not start until task "a" completes. + * + * Unregistration + * ============== + * By default, pending, unstarted tasks will be cancelled when `Module::UnregisterModule()` is called. + * If a task is in progress at the time `Module::UnregisterModule()` was called, it will be completed prior + * to calling `Module::OnUnregistered`. + * + * To schedule tasks that can execute during/after unregistration, set `options.required_for_unregistration` to + * true. Tasks scheduled in this manner will not be cancelled when `Module::UnregisterModule()` is called. Thus, + * such tasks can execute after `Module::UnregisterModule()` and `Module::OnUnregistered()`. + * + * After `Module::OnUnregistered()` is called, no additional tasks may be scheduled regardless of the value of + * `options.required_for_unregistration`. However, pending unregistration tasks that were scheduled prior to + * `Module::OnUnregistered()` will be allowed to complete before fully unregistering the module and may + * start and/or complete after `Module::OnUnregistered()`. + * + * @param task_name - the name of task to execute (can be empty) + * @param task_callback - the task to execute + * @param options - additional options for this task + */ + ADOBE_VIRTUAL_FOR_TESTS void AddTaskToQueue(const std::string& task_name, + std::function task_callback, + const ModuleTaskOptions& options); + + /** + * Creates a shared state for this module versioned at the current event count of the registering hub + * + * @param state EventData object containing the state to save (can be nullptr) + * @param version int containing the version that this shared state should be begin to be valid for + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Updates an existing shared state for this module + * + * @param version version of the existing shared state to replace + * @param state new state to replace with existing state + **/ + ADOBE_VIRTUAL_FOR_TESTS void UpdateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Creates or updates a shared state for this module versioned at the current event count of the registering hub. + * + * @param state EventData object containing the state to save (can be nullptr) + * @param version version this shared state will be valid for + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateOrUpdateSharedState(int32_t version, const std::shared_ptr& state); + + /** + * Creates a shared state for this module versioned at the next event count of the registering hub + * + * @param state EventData object containing the state to save (can be nullptr) + **/ + ADOBE_VIRTUAL_FOR_TESTS void CreateOrUpdateSharedState(const std::shared_ptr& state); + + /** + * Clear all the shared states that exist for this module + * + **/ + ADOBE_VIRTUAL_FOR_TESTS void ClearSharedStates(); + + /** + * Retrieves the named shared state that is valid for the given event + * + * @param state_name name of the shared state to retrieve + * @param event event to retrieve named state + * + * @return EventData object containing the valid state + **/ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetSharedEventState(const std::string& state_name, + const std::shared_ptr& event); + + /** + * Determines if the named module contains any valid shared states. + * + * @param state_name name of the module to query for valid states + * + * @return true if the named module contains any valid shared states + **/ + ADOBE_VIRTUAL_FOR_TESTS bool HasSharedEventState(const std::string& state_name); + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + * + * =================================================== + * Example override + * =================================================== + * + * std::string Audience::GetSharedStateName() { + * return EventDataKeys::Audience::SHARED_STATE_NAME; + * } + * + **/ + virtual std::string GetSharedStateName() = 0; + + /** + * Gets the platform services. + * + * @return the platform services instance only if this is an internal module and is currently registered. + * otherwise, returns nullptr. + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetPlatformServices(); + + /** + * Registers a rule to be executed by the eventhub + * + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterRule(const std::shared_ptr& rule); + + /** + * Unregisters all previously registered rules + * + */ + ADOBE_VIRTUAL_FOR_TESTS void UnregisterAllRules(); + + private: + + /** + * @private + * + * Called by EventHub to complete registration of this module. Called with the event hub lock held. + */ + ADOBE_VIRTUAL_FOR_TESTS void OnEventHubRegisteredModule(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services, + const std::shared_ptr& task_executor); + + /** + * @private + * + * Called by EventHub to performs idle time operations (including invoking pending callbacks). + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void Idle(); + + /** + * @private + * + * Called by EventHub to synchronously invoke event processors. + * + * @return true if the event was processed and sets processed_event to the processed event. + * @return false if the event was not processed and does not change the value of processed_event. + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS bool ProcessEvent(const std::shared_ptr& event, std::shared_ptr& processed_event); + + /** + * @private + * + * Called by EventHub to synchronously invoke event listeners. + * + * THREADING: Idle(), ProcessEvent(), and NotifyListeners() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void NotifyListeners(const std::shared_ptr& event); + + /** + * @private + * + * Called by EventHub to synchronously invoke wildcard event listeners. + * + * THREADING: Idle(), ProcessEvent(), and NotifyWildCardListener() should not be called concurrently. + */ + ADOBE_VIRTUAL_FOR_TESTS void NotifyWildCardListener(const std::shared_ptr& event); + + /** + * Register a listener after creation. Intended for use by RegisterListener<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterListener(const std::shared_ptr& listener, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source, + const std::string& pair_id); + + /** + * @private + * + * Register a dispatcher after creation. Intended for use by CreateDispatcher<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterDispatcher(const std::shared_ptr& dispatcher); + + /** + * @private + * + * Register a processor after creation. Intended for use by RegisterProcessor<>(...). + */ + ADOBE_VIRTUAL_FOR_TESTS void RegisterProcessor(const std::shared_ptr& processor); + + /** + * @private + * + * Enqueues a callback for execution in Idle(), ProcessEvent(), or NotifyListeners(). + * After enqueing a callback, EventHub::RequestIdle() should typically be called. + * + * @param guard - a lock that refers to mutex_. The method will acquire mutex_ if needed and upon exit, guard will hold mutex_. + * @param callback - the callback to queue up + */ + void EnqueueCallback(std::unique_lock& guard, const std::function& callback); + + /** + * @private + * + * Helper for DoCommonEventHubThreadWork(). + * + * If unregistration was initiated, completes it (in the eventhub thread). Acquires and releases mutex_. + */ + void CompleteUnregistrationIfNeeded(); + + /** + * @private + * + * Helper for CompleteUnregistration() + */ + void CompleteUnregistrationIfNeeded_UNREGISTERING(); + + /** + * @private + * Helper for CompleteUnregistration() + */ + void CompleteUnregistrationIfNeeded_DISPOSING_EXECUTOR(); + + /** + * @private + * Helper for CompleteUnregistrationIfNeeded() + */ + void CompleteUnregistrationIfNeeded_COMPLETING_NORMAL_TASKS(); + + /** + * @private + * + * This method performs common work that should happen during Idle(), ProcessEvent(), + * and NotifyListeners(). + * + * It does the following: + * - executes pending callbacks + * - if needed, performs unregistration work + * + * When this function exits with `true`, + * - `out_guard` will hold mutex_ + * - the Module is not unregistering and not unregistered + * - `pending_callbacks_` will be empty + * - the caller may continue normally + * + * When this function exits with `false`, + * - the Module is unregistering or unregistered + * - `out_guard` is unchanged + * - `pending_callbacks_` will be empty + * - the caller should return immediately since + * + * @param guard - on input, should be a default constructed `std::unique_lock` + */ + bool DoCommonEventHubThreadWork(std::unique_lock& guard); + + /** + * @private + * + * Main mutex for synchronization of Module. + * + * IMPORTANT: Be very very careful when calling external functions + * while holding mutex_, especially if those functions acquire + * mutexes. Failure to do this can result in hard-to-reproduce + * deadlocks. + * + * The following are known mutex orderings of this class: + * - EventHub::mutex_ BEFORE Module::mutex_ + */ + std::mutex mutex_; + + /** + * @private + * the log prefix for this module's logs + */ + std::string log_prefix_; + + /** + * @private + * + * The current state (registered, etc) of this. + * + * Synchronized on mutex_. + */ + ModuleState state_; + + /** + * @private + * + * the parent event hub. + * + * while the module is registered, this value should be non-null. this means that the parent event hub + * is kept alive as along as this module is registered. this is done deliberately to allow the module + * and child objects to make use of the event hub's background thread for callbacks. the reference cycle + * is broken after the module is unregistered. + * + * synchronized on mutex_. + */ + std::shared_ptr parent_hub_; + + /** + * the currently registered dispatchers. + * this variable ensures that ModuleEventDispatchers stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::vector> dispatchers_; + + /** + * the currently registered processors. + * this variable ensures that ModuleEventProcessors stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::vector> processors_; + + /** + * the currently registered listeners, may contain nullptr entries. + * + * using a shared_ptr value ensures that ModuleEventListeners stay alive as long as their module is registered. + * + * synchronized on mutex_. + */ + std::map, std::shared_ptr> listeners_; + + /** + * the platform services instance. + * may be null if the event hub was destructed or the module is unregistered. + * + * synchronized on mutex_. + */ + std::weak_ptr platform_services_; + + /** + * a queue of callbacks that need to be executed in Idle(), ProcessEvent(), or NotifyListeners(). + * + * synchronized on mutex_. + */ + std::deque> pending_callbacks_; + + /** + * @private + * + * Task executor for this module. + * + * synchronized on mutex_. + */ + std::shared_ptr task_executor_; + + /** + * @private + * + * Is a task with `options.required_for_unregistration` set to false currently executing? + * + * synchronized on mutex_. + */ + bool normal_task_is_executing_; + }; + + + + /** + * Options for Module::AddTaskToQueue(). POD class. + * + * @see Module::AddTaskToQueue() + */ + class ModuleTaskOptions { + public: + /** + * If true, this task can execute after UnregisterModule() has been called. + * If false, this task will be cancelled after UnregisterModule() (if it has not already started + * and/or completed). + * + * @see Module::AddTaskToQueue() + */ + bool required_for_unregistration = false; + }; + + /** + * Namespace that contains SdkError codes. @see SdkError + */ + namespace ErrorCodes { + constexpr static const char* MODULE_INVALID_STATE = + "module.invalid_state"; ///< Module is in an invalid state to perform the desired operation + } + +} + + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + std::shared_ptr Module::CreateDispatcher() { + // If you get an error on the following line, you need to make sure the type you pass + // into CreateDispatcher is a subclass of ModuleEventDispatcherBase. + static_assert(std::is_base_of::value, + "Type of TDispatcher must be derived from ModuleEventDispatcherBase."); + + static_assert(std::is_default_constructible::value, "TDispatcher must be default constructible."); + auto instance = std::make_shared(); + RegisterDispatcher(instance); + return instance; + } + + template + void Module::RegisterProcessor() { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterProcessor is a subclass of ModuleEventProcessorBase. + static_assert(std::is_base_of::value, + "Type of TProcessor must be derived from ModuleEventProcessorBase."); + + static_assert(std::is_default_constructible::value, "TProcessor must be default constructible."); + RegisterProcessor(std::make_shared()); + } + + template + void Module::RegisterListener(const std::shared_ptr& event_type, + const std::shared_ptr& event_source) { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterListener is a subclass of ModuleEventListenerBase. + static_assert(std::is_base_of::value, + "Type of TListener must be derived from ModuleEventListenerBase."); + + static_assert(std::is_default_constructible::value, "TListener must be default constructible."); + RegisterListener(std::make_shared(), event_type, event_source, std::string{}); + } + + template + void Module::RegisterWildCardListener() { + // If you get an error on the following line, you need to make sure the type you pass + // into RegisterListener is a subclass of ModuleEventListenerBase. + static_assert(std::is_base_of::value, + "Type of TListener must be derived from ModuleEventListenerBase."); + + static_assert(std::is_default_constructible::value, "TListener must be default constructible."); + RegisterListener(std::make_shared(), EventType::WILDCARD, EventSource::WILDCARD, std::string{}); + } + +} + +#endif //ADOBEMOBILE_CORE_MODULE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h new file mode 100755 index 00000000..6ca2046a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcher.h @@ -0,0 +1,139 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H +#define ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H + +#include "ModuleEventDispatcherBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventDispatcher + * + * ModuleEventDispatcher is the base class for event dispatchers. ModuleEventDispatchers transform + * module-specific data into Events and dispatch them on the event hub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a dispatcher, derive from ModuleEventDispatcher: + * + * class MyDispatcher : public ModuleEventDispatcher { + * public: + * MyDispatcher() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * // a module-specific method + * void SendMyEvent() { + * auto event = EventBuilder{"Configure with AppId", EventType::CONFIGURATION, EventSource::REQUEST_CONTENT} + * .Build(); + * Dispatch(event); + * } + * }; + * + * To register a dispatcher, call Module::CreateDispatcher(): + * + * class MyModule : public Module { + * std::shared_ptr my_dispatcher_; + * + * void OnRegistered() override { + * my_dispatcher_ = CreateDispatcher(); + * my_dispatcher_->SendMyEvent(); + * } + * }; + * + * Registration + * ============ + * Module::CreateDispatcher() can be used to create a dispatcher. + * + * Registration completes asynchronously. After Module::CreateDispatcher() is called, + * ModuleEventDispatcher::OnRegistered() will be called asynchronously to notify the dispatcher that it is + * registered. Subclasses should perform initialization within this method. + * + * Unregistration + * ============== + * A dispatcher can be unregistered in several different ways: + * + * - If a module is unregistered via Module::UnregisterModule(), all dispatchers for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their dispatchers will be unregistered + * + * Unregistration completes asynchronously. ModuleEventDispatcher::OnUnregistered() will be called asynchronously + * to notify the dispatcher that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventDispatcher::OnRegistered() and + * ModuleEventDispatcher::OnUnregistered(), will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many listeners can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventDispatcher : public ModuleEventDispatcherBase { + // If you get an error on the following line, you need to make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventDispatcherBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventDispatcher(); + }; +} + + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventDispatcher::ModuleEventDispatcher() {} + + template + std::shared_ptr + ModuleEventDispatcher::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventDispatcherBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTDISPATCHER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h new file mode 100755 index 00000000..94f72ef3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventDispatcherBase.h @@ -0,0 +1,162 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class EventHub; + class Module; + + /** + * Base class for all event dispatchers. In most cases, subclasses should derive from + * ModuleEventDispatcher instead of deriving from this class directly. + */ + class ModuleEventDispatcherBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventDispatcherMethods; // For testing + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventDispatcherBase(); + + /** + * Dispatches an event to the associated EventHub. + * + * @param event - the Event to dispatch + */ + ADOBE_VIRTUAL_FOR_TESTS void Dispatch(const std::shared_ptr& event); + + /** + * This method is invoked shortly after the dispatcher is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::CreateDispatcher() + * is called. This call is guaranteed to occur after Module::OnRegistered. + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the dispatcher is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This call is guaranteed to occur before Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(std::shared_ptr parent_module, + const std::shared_ptr& event_hub); + + /** + * @private + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * the parent module's event hub + */ + std::weak_ptr event_hub_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTDISPATCHERBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h new file mode 100755 index 00000000..f72c9e19 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListener.h @@ -0,0 +1,148 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H +#define ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H + +#include "ModuleEventListenerBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventListener + * + * ModuleEventListener is the base class for event listeners. ModuleEventListeners hear and react to Events + * that are dispatched through the EventHub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a listener, derive from ModuleEventListener: + * + * class MyListener : public ModuleEventListener { + * public: + * MyListener() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * void Hear(const std::shared_ptr& event) override { + * // do something when event occurs + * } + * }; + * + * To register a listener, call Module::RegisterListener(): + * + * class MyModule : public Module { + * void OnRegistered() override { + * RegisterListener(EventSource::SOME_VALUE, EventType::SOME_VALUE); + * } + * }; + * + * Registration + * ============== + * Module::RegisterListener() can be used to register a listener for a given event type or event source. + * + * Registration completes asynchronously. After Module::RegisterListener() is called, + * ModuleEventListener::OnRegistered() will be called asynchronously to notify the listener that it is + * registered. Subclasses should perform initialization within this method. + * + * A module may only have a single listener for a given event type and source. + * + * Alternatively, one time listeners can be registered to react once to a single, specific event. + * @see Module::RegisterOneTimeListenerBlock. + * + * Responding to Events + * ==================== + * When an event is dispatched, any registered listeners will receive notification that the event occurred + * via ModuleEventListenerBase::Hear(). Subclasses should override this method to react appropriately to + * Events. + * + * Unregistration + * ============== + * A listener can be unregistered in several different ways: + * + * - Explicitly, via Module::UnregisterListener() + * + * - If a different listener is registered for the same event type and source, the old listener will be + * unregistered prior to registering the new listener. + * + * - If a module is unregistered via Module::UnregisterModule(), all listeners for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their listeners will be unregistered + * + * Unregistration completes asynchronously. ModuleEventListener::OnUnregistered() will be called asynchronously + * to notify the listener that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventListener::OnRegistered(), ModuleEventListener::OnUnregistered(), + * and ModuleEventListener::Hear() will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many listeners can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventListener : public ModuleEventListenerBase { + // If you get an error on the following line, make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + public: + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventListenerBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventListener(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventListener::ModuleEventListener() {} + + template + std::shared_ptr + ModuleEventListener::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventListenerBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h new file mode 100755 index 00000000..813ecb47 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventListenerBase.h @@ -0,0 +1,215 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class Module; + class EventType; + class EventSource; + + /** + * Base class for all event listeners. In most cases, subclasses should derive from + * ModuleEventListener instead of deriving from this class directly. + * + * @see ModuleEventListener + */ + class ModuleEventListenerBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventListenerMethods; // For testing + + public: + /** + * @returns the event type this listener is listening for + */ + ADOBE_VIRTUAL_FOR_TESTS const std::shared_ptr& GetEventType(); + + /** + * @returns the event source this listener is listening for + */ + ADOBE_VIRTUAL_FOR_TESTS const std::shared_ptr& GetEventSource(); + + /** + * Called when an event matching the EventType and EventSource of this listener is + * received on the EventHub that this listener is registered with. + * + * @param event - the event that was received. + */ + virtual void Hear(const std::shared_ptr& event) = 0; + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventListenerBase(); + + /** + * This method is invoked shortly after the listener is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * THREADING + * ========= + * @see Module for threading guarantees. + * + * ORDERING + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::RegisterListener() + * is called. This call is guaranteed to occur after Module::OnRegistered + * and before the ModuleEventListenerBase::Hear(...) is called + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the listener is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * THREADING + * ========= + * @see Module for threading guarantees. + * + * ORDERING + * ======== + * This method is guaranteed to be called once, asynchronously, after the listener is + * unregistered via Module::UnregisterListener(), Module::RegisterListener(), or + * Module::UnregisterModule() is called. This call is guaranteed to occur before + * Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + * Made public for testing listener in isolation. In production treat as private access. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(const std::shared_ptr& parent_module, + const std::shared_ptr& event_type, + const std::shared_ptr& event_source); + + /** + * @private + * + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + /** + * @private + * + * @returns true if this is a one time listener + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsOneTime(); + + /** + * @private + * + * Actual implementation of GetParentModule, present and virtual to enable mocking. + * + * @returns the parent module + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * + * the event type this listener is listening for + */ + std::shared_ptr event_type_; + + /** + * @private + * + * the event source this listener is listening for + */ + std::shared_ptr event_source_; + + /** + * @private + * + * is this a one time listener? + */ + bool is_one_time_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENERBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h new file mode 100755 index 00000000..29c9d269 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessor.h @@ -0,0 +1,139 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTPROCESSOR_H +#define ADOBEMOBILE_CORE_MODULEEVENTPROCESSOR_H + +#include "ModuleEventProcessorBase.h" + +namespace AdobeMarketingMobile { + + /** + * @class ModuleEventProcessor + * + * ModuleEventProcessor is the base class for event processors. ModuleEventProcessors can transform + * or can events that are dispatched through the EventHub. + * + * The template argument, TModule, is the type of the Module. TModule must be a subclass of Module. + * + * Quick Start + * =========== + * To create a processor, derive from ModuleEventProcessor: + * + * class MyModuleEventProcessor : public ModuleEventProcessor { + * public: + * MyModuleEventProcessor() = default; // Subclasses must have a default constructor + * + * void OnRegistered() override { + * // ... perform initialization ... + * } + * + * void OnUnregistered() override { + * // ... perform cleanup ... + * } + * + * std::shared_ptr Process(const std::shared_ptr& event) override { + * // do something when event occurs + * // this example just forwards the event: + * return event + * } + * }; + * + * To register a processor, call Module::RegisterProcessor(): + * + * class MyModule : public Module { + * void OnRegistered() override { + * RegisterProcessor(); + * } + * }; + * + * Registration + * ============ + * Module::RegisterProcessor() can be used to register a processor for a given event type or event source. + * + * Registration completes asynchronously. After Module::RegisterProcessor() is called, + * ModuleEventProcessor::OnRegistered() will be called asynchronously to notify the processor that it is + * registered. Subclasses should perform initialization within this method. + * + * Processing Events + * ================= + * When an event is dispatched, any registered processors will receive a chance to intercept and replace, + * transform the event via ModuleEventProcessorBase::Process(). Subclasses should override this method. + * + * Unregistering a Processor + * ======================== + * A processor can be unregistered in several different ways: + * + * - If a module is unregistered via Module::UnregisterModule(), all processors for that module will be + * unregistered. + * + * - If EventHub::Dispose() is called, all modules and their processors will be unregistered + * + * Unregistration completes asynchronously. ModuleEventProcessor::OnUnregistered() will be called asynchronously + * to notify the processor that it is unregistered. Subclasses should perform cleanup within this method. + * + * Threading + * ========= + * As with most module-related methods, ModuleEventProcessor::OnRegistered(), ModuleEventProcessor::OnUnregistered(), + * and ModuleEventProcessor::Process() will never be invoked concurrently with eachother or with other callbacks + * for the same Module. Therefore, many processors can be implemented as if they operated on a single thread. + * + * @see Module for additional threading information. + * + */ + template + class ModuleEventProcessor : public ModuleEventProcessorBase { + // If you get an error on the following line, you need to make sure that TModule is a type derived from Module. + static_assert(std::is_base_of::value, "Type of TModule must be derived from Module."); + + public: + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + * + * Deliberately hides ModuleEventProcessorBase::GetParentModule(). + */ + std::shared_ptr GetParentModule(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventProcessor(); + }; +} + +///////////////////////////////// +// template/inline definitions // +///////////////////////////////// + +namespace AdobeMarketingMobile { + template + ModuleEventProcessor::ModuleEventProcessor() {} + + template + std::shared_ptr + ModuleEventProcessor::GetParentModule() { + return std::dynamic_pointer_cast(ModuleEventProcessorBase::GetParentModule()); + } +} + +#endif //ADOBEMOBILE_CORE_MODULEEVENTLISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h new file mode 100755 index 00000000..e5c41040 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ModuleEventProcessorBase.h @@ -0,0 +1,149 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_MODULEEVENTPROCESSORBASE_H +#define ADOBEMOBILE_CORE_MODULEEVENTPROCESSORBASE_H + +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class Event; + class Module; + + /** + * Base class for all event procesors. In most cases, subclasses should derive from + * ModuleEventProcessor instead of deriving from this class directly. + */ + class ModuleEventProcessorBase : public Object { + friend class Module; // Module should only access private methods marked for use by Module. + friend class ModuleEventProcessorMethods; // For testing + + public: + virtual std::shared_ptr Process(const std::shared_ptr& event) = 0; + + /** + * @returns the parent module or nullptr if the parent module was destructed or unregistered. + * + * NOTE: In rare cases where this function is called concurrently with UnregisterModule, it is + * possible for GetParentModule() to return a non-nullptr to an unregistered module. + */ + std::shared_ptr GetParentModule(); + + /** + * @return true once this is registered and OnRegistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyRegistered(); + + /** + * @return true once this is unregistered and OnUnregistered() is called. + */ + ADOBE_VIRTUAL_FOR_TESTS bool IsFullyUnregistered(); + + protected: + /** + * Constructor. + * For use by subclasses. + */ + ModuleEventProcessorBase(); + + /** + * This method is invoked shortly after the processor is registered. + * + * Subclasses should override this method to perform initialization tasks. Subclasses should + * minimize the amount of initialization performed in the constructor and should instead prefer to + * perform initialization in OnRegistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::RegisterProcessor() + * is called. This call is guaranteed to occur after Module::OnRegistered. + */ + virtual void OnRegistered(); + + /** + * This method is invoked shortly before the processor is fully unregistered. + * + * Subclasses should override this method to perform cleanup tasks. Subclasses should + * minimize the amount of cleanup performed in the destructor and should instead prefer to + * perform cleanup in OnUnregistered(). + * + * Threading + * ========= + * @see Module for threading guarantees. + * + * Ordering + * ======== + * This method is guaranteed to be called once, asynchronously, after Module::UnregisterModule() + * is called. This call is guaranteed to occur before Module::OnUnregistered. + */ + virtual void OnUnregistered(); + + private: + /** + * @private + * Called during creation to finish 2-phase initialization of this. + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void Init(const std::shared_ptr& parent_module); + + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetParentModuleImpl(); + + /** + * @private + * Calls OnRegistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnRegistered(); + + /** + * @private + * Calls OnUnregistered. + * + * For use by Module only. + */ + ADOBE_VIRTUAL_FOR_TESTS void CallOnUnregistered(); + + /** + * @private + * the parent module + */ + std::weak_ptr parent_module_; + + /** + * @private + * + * Set to true once this is fully registered (OnRegistered called). + */ + std::atomic is_fully_registered_; + + /** + * @private + * + * Set to true once this is fully unregistered (OnUnregistered called). + */ + std::atomic is_fully_unregistered_; + }; +} + +#endif //ADOBESDK_CORE_MODULEEVENTPROCESSORBASE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h new file mode 100755 index 00000000..5768e351 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkConnectionUtil.h @@ -0,0 +1,78 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ +#define ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ + +#include +#include +#include +#include "HttpConnectionConstants.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class NetworkConnectionUtil : public Object { + public: + /** + * Searches through RECOVERABLE_NETWORK_ERROR_CODES to find the given error_code + * + * @param error_code error code to check for recoverability + * @returns true if error_code is a recoverable network error + */ + static bool IsRecoverableNetworkError(int32_t error_code); + + /** + * Returns the default headers for connection: Accept-Language(locale), Content-Type, User-Agent + * @param locale active locale from platform + * @param content_type the custom content type string + * @return map with the specified keys and values + */ + static std::map GetHeaders(const std::string& locale, + const std::string& content_type = ""); + /** + * Get the name of the given locale in a string format suitable for HTTP's Accept-Language header. + * The returned format is - where is two or three lowercase characters and + * is two uppercase characters. + * + * Reference: https://www.w3.org/International/articles/language-tags/ + * + * @param locale the active locale object + * @return Locale as string + */ + static std::string GetLocaleString(const std::locale& locale); + + protected: + + /** + * Get the name of the given locale in a string format suitable for HTTP's Accept-Language header. + * The returned format is - where is two or three lowercase characters and + * is two uppercase characters. + * + * Reference: https://www.w3.org/International/articles/language-tags/ + * + * @param locale as a string object + * @return Locale as string + */ + static std::string GetLocaleString(const std::string& locale); + + private: + static const std::vector RECOVERABLE_NETWORK_ERROR_CODES; + }; +} +#endif /* ADOBEMOBILE_UTIL_NETWORKCONNECTIONUTIL_H_ */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h new file mode 100755 index 00000000..06eee7be --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/NetworkServiceInterface.h @@ -0,0 +1,151 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* NETWORK_UNSUPPORTED_HTTP_COMMAND_TYPE = + "network.unsupported_http_command_type"; ///< Unsupported http command type + } + + /** + * Currently supported command types are GET/POST + **/ + enum class HttpCommandType : int32_t { + GET, + POST + }; + + class HttpConnectionDataInterface : public virtual ObjectInterface { + public: + /** + * Returns application server response as raw data from the connection, if available + * + * @param bytes_to_read the number of bytes that need to be read in the buffer + * @param output_buffer allocated buffer where the response raw data will be copied + * @return the number of bytes that were written in the read_buffer + */ + virtual uint64_t GetData(uint64_t bytes_to_read, uint8_t* output_buffer) const = 0; + + /** + * Returns application server response raw data size + * + * @return the size to be read + */ + virtual uint64_t GetSize() const = 0; + }; + + class HttpConnectionInterface : public virtual ObjectInterface { + public: + /** + * Returns application server response as string from the connection, if available. + * + * @return std::string Network response + */ + virtual std::string GetResponse() const = 0; + + /** + * Returns application server response as HttpConnectionDataInterface from the connection + * + * @return HttpConnectionDataInterface containing the network response + */ + virtual std::shared_ptr GetResponseRawData() const = 0; + + /** + * Returns the connection attempt responseCode for the connection request. + * @return int32_t The status code + */ + virtual int32_t GetResponseCode() const = 0; + + /** + * Returns a connection attempt response message, if available. + * @returns std::string The status code string + */ + virtual std::string GetResponseMessage() const = 0; + + /** + * Returns a value for the response property key that might have been set when a connection was made to the resource pointed to by the Url. + * + * This is protocol specific. For example, HTTP urls could have properties like "last-modified", or "ETag" set. + * + * @param response_property_key Any additional property key sent in response when requesting a connection to the url. This will be dependent on the protocol used. + * @return std::string corresponding to the response property value for the key specified, or empty string, if the key does not exist. + */ + virtual std::string GetResponsePropertyValue(const std::string& response_property_key) const = 0; + + /** + * Close this connection + */ + virtual void Close() const = 0; + }; + + class NetworkServiceInterface : public virtual ObjectInterface { + public: + /** Connect to a url + * + * @param url The full url for connection + * @param command Http command. For example "POST", "GET" etc. + * @param connect_payload Payload to send to the server + * @param request_property Any additional key value pairs to be used while requesting a + * connection to the url. This will be dependent on the protocol used. + * @param connect_timeout timeout value in seconds. + * @param read_timeout The timeout that will be used to wait for a read to finish after a successful connect. + * + * @return A HttpConnectionInterface instance, representing a connection attempt. + */ + virtual std::shared_ptr ConnectUrl(const std::string& url, + const HttpCommandType& command, + const std::string& connect_payload, + const std::map& request_property, + const std::chrono::seconds connect_timeout, + const std::chrono::seconds read_timeout) = 0; + + /** + * Async variation of the ConnectUrl api, that will deliver the result through the callback. + * + * @param url The full url for connection + * @param command Http command. For example "POST", "GET" etc. + * @param connect_payload Payload to send to the server + * @param request_property Any additional key value pairs to be used while requesting a + * connection to the url. This will be dependent on the protocol used. + * @param connect_timeout timeout value in seconds. + * @param read_timeout The timeout that will be used to wait for a read to finish after a successful connect. + * @param result_callback Callback that will receive the HttpConnectionInterface instance after the connection has been made. + * + */ + virtual void ConnectUrlAsync(const std::string& url, + const HttpCommandType& command, + const std::string& connect_payload, + const std::map& request_property, + const std::chrono::seconds connect_timeout, + const std::chrono::seconds read_timeout, + const std::function&)>& result_callback) = 0; + + }; +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_NETWORKSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Object.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Object.h new file mode 100755 index 00000000..0428605c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Object.h @@ -0,0 +1,148 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_OBJECT_H +#define ADOBEMOBILE_CORE_OBJECT_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + /** + * @class Object + * Object is the root base class for most classes in the SDK. + * + * WHEN TO DERIVE FROM OBJECT + * -------------------------- + * + * Most classes in the SDK should be derived from Object (either directly or via a base class). Generally, if a class is not an interface, + * enum class, or a POD class, it should derive from Object. + * + * More formally, the following classes must be derived from Object: + * - Any class that has any data members, except POD classes. A POD class is a struct with no inheritance or virtual members. + * - Any class that is intended to be used as a base class, except pure virtual classes (interfaces). Pure virtual classes should + * be derived from ObjectInterface. + * + * HOW TO DERIVE FROM OBJECT + * ------------------------- + * + * When defining a direct subclass of Object, public non-virtual inheritance must be used: + * + * class MyClass : public Object { + * }; + * + * The same is true for descendent classes: + * + * class A : public Object {}; + * class B : public A {}; // <-- public non-virtual inheritance + * + * Subclasses must derive from Object exactly once. That is, multiple inheritance from Object is not allowed: + * + * class A : public Object {}; + * class B : public Object {}; + * class C : public A, public B {}; // <-- NOT ALLOWED!!! + * + * WHY DERIVE FROM OBJECT + * ---------------------- + * + * Object provides subclasses a number of benefits: + * - Objects are compatible with ObjectToSharedPtr, which retrieves a shared_ptr from a raw ptr in a safe way. + * - Objects get all the benefits of Object Interface, including: + * - Preventing common C++ errors. Subclasses automatically have a virtual destructor and do not generate the copy and move functions. + * - Allows instances to be treated polymorphically, which allows instances to be stored into maps and other data structures. + * + * + * CREATING AND PASSING AROUND OBJECTS + * ----------------------------------- + * + * Objects are typically created on the heap, using std::make_shared: + * + * class A : public Object { + * public: + * A(); + * SomeMethod(); + * }; + * + * void foo() { + * auto anInstanceOfA = std::make_shared(); + * anInstanceOfA->SomeMethod(); + * } + * + * Some classes may provide factory functions to create instances. + * + * Objects are intended be passed by pointer or reference: + * + * class A : public Object { + * public: + * A(); + * SomeMethod(); + * }; + * + * void foo() { + * auto anInstanceOfA = std::make_shared(); + * bar(*anInstanceOfA); + * } + * + * void bar(A& anInstanceOfA) { + * anInstanceOfA->SomeMethod(); + * } + * + * CONVERTING REFERENCES AND RAW PTRS TO SHARED PTRS + * ------------------------------------------------- + * + * To convert an Object pointer or reference to a std::shared_ptr, use ObjectToSharedPtr: + * + * class A : public Object {}; + * + * void example1(A* a) { + * auto aSharedPtr = ObjectToSharedPtr(*a); // aSharedPtr is a std::shared_ptr + * } + * + * void example2(A& a) { + * auto aSharedPtr = ObjectToSharedPtr(a); // aSharedPtr is a std::shared_ptr + * } + * + * EQUALITY + * -------- + * AdobeMarketingMobile::IsEqual(...) can be used to check if two objects are equal. Subclasses + * can override Object::Equals to provide a custom definiton of equality. See ObjectInterface. + */ + class Object : + public std::enable_shared_from_this, + public virtual ObjectInterface { + public: + Object() {} + + /** + * @see ObjectInterface + */ + bool Equals(const ObjectInterface& right) const override; + + /** + * @see ObjectInterface + */ + std::shared_ptr SharedPtrToThisObjectInterface() override final; + + /** + * @see StringUtils::ToString() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; +} + +#endif //ADOBEMOBILE_CORE_OBJECT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h new file mode 100755 index 00000000..9398f230 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ObjectInterface.h @@ -0,0 +1,311 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_OBJECTINTERFACE_H +#define ADOBEMOBILE_CORE_OBJECTINTERFACE_H + +#include + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * @class ObjectInterface + * ObjectInterface is the root base class for pure virtual interfaces (Java-style interfaces) in the SDK. + * + * HOW TO IMPLEMENT AN INTERFACE + * ----------------------------- + * + * When implementing an interface, PUBLIC VIRTUAL inheritance must be used for interface: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual ObjectInterface {}; + * class ABImplementation : + * public Object, // <-- Object inheritance is public non-virtual + * public virtual AInterface, // <-- interface inheritance is public virtual + * public virtual BInterface // <-- interface inheritance is public virtual + * {} + * + * WHEN TO DERIVE FROM OBJECT INTERFACE + * ------------------------------------ + * + * All pure virtual classes should be derived from Object (either directly or via a base class). + * + * Pure virtual classes may not have any data members. A class that defines data members should be derived + * from Object or be a POD class. See Object for additional details. + * + * HOW TO DERIVE FROM OBJECT INTERFACE + * ----------------------------------- + * + * When defining a direct subclass of ObjectInterface, PUBLIC VIRTUAL inheritance must be used: + * + * Example: + * + * class MyInterface : public virtual ObjectInterface { + * }; + * + * The same is true for descendent classes: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual AInterface {}; // <-- public virtual inheritance + * + * Multiple inheritance from Object Interface is allowed, but again must be public virtual: + * + * Example: + * + * class AInterface : public virtual ObjectInterface {}; + * class BInterface : public virtual ObjectInterface {}; + * class CInterface : public virtual AInterface, public virtual BInterface {}; // <-- public virtual inheritance + * + * WHY DERIVE FROM OBJECT INTERFACE + * -------------------------------- + * + * ObjectInterface provides subclasses a number of benefits: + * - ObjectInterface prevents common C++ errors. Subclasses automatically have a virtual destructor and do not generate the copy and move functions. + * - Subclasses are automatically compatible with ObjectToSharedPtr, which lets you get a shared_ptr from a raw ptr in a safe way. + * - Instances can be treated polymorphically, which allows them to be stored into maps and other data structures. + * + * PASSING AROUND INSTANCES + * ------------------------ + * + * ObjectInterfaces are intended be passed by pointer or reference. + * + * CONVERTING REFERENCES AND RAW PTRS TO SHARED PTRS + * ------------------------------------------------- + * + * To convert an ObjectInterface pointer or reference to a std::shared_ptr, use ObjectToSharedPtr: + * + * class AInterface : public virtual ObjectInterface {}; + * + * void example1(AInterface* a) { + * auto aSharedPtr = ObjectToSharedPtr(*a); // aSharedPtr is a std::shared_ptr + * } + * + * void example2(AInterface& a) { + * auto aSharedPtr = ObjectToSharedPtr(a); // aSharedPtr is a std::shared_ptr + * } + * + * EQUALITY + * -------- + * AdobeMarketingMobile::IsEqual(...) can be used to check if two interface instances are equal. See + * ObjectInterface::Equals(...) and AdobeMarketingMobile::IsEqual(...). + */ + class ObjectInterface { + public: + virtual ~ObjectInterface() {} + + /** + * ObjectInterfaces are not copyable, as they should be passed by pointer or reference. + * Subclasses that need copy functionality should add a method to the subclass that will perform the copy. + */ + ObjectInterface(const ObjectInterface&) = delete; + ObjectInterface& operator=(const ObjectInterface&) = delete; + + /** + * ObjectInterfaces are not movable, as they should be passed by pointer or reference. + * Subclasses that need move functionality should add a method to the subclass that will perform the move. + */ + ObjectInterface(ObjectInterface&&) = delete; + ObjectInterface&& operator=(ObjectInterface&&) = delete; + + /** + * Instead of calling this function directly, since IsEqual checks for null. + * + * Subclasses can override this to provide a custom definition of equality. When implementing Equals, it is + * suggested that implementers: + * - Make sure that the operation is order independent: `this.Equals(someObject) == someObject.Equals(*this);` + * - If necessary, check the type of right using `dynamic_cast(right)` and comparing against nullptr. + * + * The default implementation of Object::Equals is true only if both objects are the same instance. + * + * Example: + * + * class Person : public Object { + * public: + * explicit Person(const std::string& name) : name_{ name } {} + * + * bool Equals(const ObjectInterface& right) override { + * const Person* rightPerson = dynamic_cast(right); + * return right != nullptr && // right must be a Person + * rightPerson.name_ == name; // right must have the same name as this + * } + * }; + */ + virtual bool Equals(const ObjectInterface& right) const = 0; + + /** + * Internal use only. See ObjectToSharedPtr for a method that will convert raw ptrs to smart ptrs. + * Returns a std::shared_ptr to this. + */ + virtual std::shared_ptr SharedPtrToThisObjectInterface() = 0; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this)`. + * + * @return a string respresentation of this + * + * @see StringUtils::ToString() + */ + std::string ToString() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this, options)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString(const ToStringOptions& options) const; + + /** + * Called by StringUtils::ToString() to actually convert this object to a string. Only subclasses and + * StringUtils::ToString() should invoke this method. Others should not invoke this method directly, and instead + * call StringUtils::ToString() to conver this object to a string. + * + * Subclasses can override this method to provide a custom string representation. To get the superclass string + * representation implementations should invoke ToStringImpl on their base class directly. Objects are + * encouraged to format their representations as JSON. + * + * @see StringUtils::ToString() + * + * @param options - options for the string representation + * + * @return a string representation of this + */ + virtual std::string ToStringImpl(const ToStringOptions& options) const = 0; + + protected: + ObjectInterface() {} + }; + + /** + * Converts an instance to a std::shared_ptr. Useful for converting this or other raw ptrs to shared_ptrs. + * + * Argument must be an instance derived from Object or Object Interface. See Object Interface. + */ + template + std::shared_ptr ObjectToSharedPtr(T& o); + template<> + std::shared_ptr ObjectToSharedPtr(ObjectInterface& o); + + /** + * bool IsEqual(left, right) compares two Objects (or ObjectInterfaces) and returns true if left.Equals(right). + * + * See ObjectInterface for information on how to correctly implement Object::Equals. + * + * IsEqual accepts multiple different types for left and right. left and right can be: + * - Object/ObjectInterface instances (or subclasses), + * - shared_ptrs to Objects/ObjectInterfaces (or subclasses) + * - raw pointers to Objects/ObjectInterfaces (or subclasses) + * + * If left and right are pointers or shared_ptrs, nullptr values will be treated specially. If both left and right are nullptr, + * IsEqual returns true. If only one of left or right is nullptr, IsEqual returns false. + * + * Examples: + * + * class Person : public Object { + * public: + * explicit Person(const std::string& name) : name_{ name } {} + * + * bool Equals(const ObjectInterface& right) override { + * const Person* rightPerson = dynamic_cast(right); + * return right != nullptr && // right must be a Person + * rightPerson.name_ == name; // right must have the same name as this + * } + * }; + * + * void AnExampleUsage() { + * std::shared_ptr fred1 = std::make_shared("fred"); + * std::shared_ptr fred2 = std::make_shared("fred"); + * std::shared_ptr susan = std::make_shared("susan"); + * std::shared_ptr rock = std::make_shared(); + * std::shared_ptr nullPointer; + * + * IsEqual(fred1, fred1); // true + * IsEqual(fred1, susan); // false + * IsEqual(fred1, rock); // false + * IsEqual(fred1, fred2); // returns true because IsEqual compares by name + * IsEqual(fred1, nullPointer); // false + * IsEqual(nullPointer, nullPointer); // true + * + * // you can also pass in Object instances directly + * IsEqual(*fred1, *fred2); // false + * IsEqual(*fred1, *rock); // false + * + * // ... or raw ptrs to Objects + * IsEqual(fred1.get(), fred2.get()); // false + * IsEqual(fred1.get(), rock.get()); // false + * IsEqual(fred1.get(), nullptr); // false + * } + */ + template + bool IsEqual(const std::shared_ptr& left, const std::shared_ptr& right); + template + bool IsEqual(const TLeft* left, const std::shared_ptr& right); + template + bool IsEqual(const std::shared_ptr& left, const TRight* right); + bool IsEqual(const ObjectInterface* left, const ObjectInterface* right); + bool IsEqual(const ObjectInterface& left, const ObjectInterface& right); + + /** + * @private + * + * `ToStringImpl` for `ObjectInterface`. + */ + void ToStringImpl(std::ostream& the_stream, const ObjectInterface& value, const ToStringOptions& options); +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + template + std::shared_ptr ObjectToSharedPtr(T& o) { + static_assert(std::is_base_of::value, "Type of o must be derived from ObjectInterface."); + return std::dynamic_pointer_cast(o.SharedPtrToThisObjectInterface()); + } + + template + bool IsEqual(const std::shared_ptr& left, const std::shared_ptr& right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left.get(), right.get()); + } + + template + bool IsEqual(const TLeft* left, const std::shared_ptr& right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left, right.get()); + } + + template + bool IsEqual(const std::shared_ptr& left, const TRight* right) { + static_assert(std::is_base_of::value, "Type of left must be derived from ObjectInterface."); + static_assert(std::is_base_of::value, "Type of right must be derived from ObjectInterface."); + return IsEqual(left.get(), right); + } +} + +#endif //ADOBEMOBILE_CORE_OBJECTINTERFACE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h new file mode 100755 index 00000000..8707a9c5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/OneTimeListener.h @@ -0,0 +1,59 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_ONETIMELISTENER_H +#define ADOBEMOBILE_CORE_ONETIMELISTENER_H + +#include +#include "ModuleEventListenerBase.h" + +namespace AdobeMarketingMobile { + class Module; + + /** + * @class OneTimeListener + * Used to wrap a Module.OneTimeListenerBlock in an EventListener so it can be added to an EventHub. + * + * Do not use directly. @see Module::RegisterOneTimeListenerBlock. + */ + class OneTimeListener : public ModuleEventListenerBase { + friend class Module; + + public: + /** + * @see ModuleEventListenerBase::Hear + */ + void Hear(const std::shared_ptr& event) override final; + + private: + /** + * @private + * Constructor. + * For use by Module only. + */ + explicit OneTimeListener(const std::function&)>& block); + + /** + * @private + * the block this listener should execute. + */ + std::function&)> block_; + }; +} + +#endif //ADOBEMOBILE_CORE_ONETIMELISTENER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h new file mode 100755 index 00000000..2486c97b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PeripheralServiceInterface.h @@ -0,0 +1,36 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H +/** + * Peripheral Service (callback) Interface definition in C++ + * This defined a callback interface for the peripheral services +**/ +namespace AdobeMarketingMobile { + class PeripheralServiceInterface: public virtual ObjectInterface { + + // public: + // enum class PeripheralType : int { + // BLUETOOTH, + // }; + // // callback function + // virtual int cbCallbackFunction(int) = 0; + }; +} //namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_PERIPHERALSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h new file mode 100755 index 00000000..f8d2023b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/PlatformServicesInterface.h @@ -0,0 +1,191 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H + +#include +#include +#include "ObjectInterface.h" +#include "Expected.h" + +namespace AdobeMarketingMobile { + + class LoggingServiceInterface; + class NetworkServiceInterface; + class DatabaseServiceInterface; + class SystemInfoServiceInterface; + class UIServiceInterface; + class JsonUtilityServiceInterface; + class FileSystemServiceInterface; + class LocalStorageServiceInterface; + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class EncodingServiceInterface; + class URLServiceInterface; + class CompressedFileServiceInterface; + + /** + * This is part of what defines the SDK's platform agnostic interface APIs to the native language services + **/ + class PlatformServicesInterface : public virtual ObjectInterface { + public: + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + /** + * Returns the Logging service implementation from the Platform. + * + * @return LoggingService implementation, if the platform provides any. null otherwise. + * + * @see LoggingService + */ + virtual std::shared_ptr GetLoggingService() const = 0; + + /** + * Returns the Network service implementation from the Platform. + * + * @return NetworkService implementation, if the platform provides any. null otherwise. + * + * @see NetworkService + */ + virtual std::shared_ptr GetNetworkService() const = 0; + + /** + * Returns the Local Storage Service implementation from the Platform. + * + * @return LocalStorageService implementation, if the platform provides any. null otherwise. + * + * @see LocalStorageService + */ + virtual std::shared_ptr GetLocalStorageService() const = 0; + + /** + * Returns the Structured Data Service implementation from the Platform. + * + * @return DatabaseService implementation, if the platform provides any. null otherwise. + * + * @see DatabaseService + */ + virtual std::shared_ptr GetDatabaseService() const = 0; + + /** + * Returns the System Information service implementation from the Platform. + * + * @return SystemInfoService implementation, if the platform provides any. null otherwise. + * + * @see SystemInfoService + */ + virtual std::shared_ptr GetSystemInfoService() const = 0; + + /** + * Returns the UI Service implementation from the Platform. + * + * @return UIService implementation, if the platform provides any. null otherwise. + * + * @see UIService + */ + virtual std::shared_ptr GetUIService() const = 0; + + /** + * Returns the Json Utility service implementation from the Platform. + * + * @return JsonUtilityService implementation, if the platform provides any. null otherwise. + * + * @see JsonUtilityService + */ + virtual std::shared_ptr GetJsonUtilityService() const = 0; + + /** + * Returns the File System service from the Platform. The File System Service contains + * utility methods for dealing with directory manipulations. + * + * @return FileSystemService implementation if the platform provides any. Null otherwise. + * @see FileSystemService + */ + virtual std::shared_ptr GetFileSystemService() const = 0; + + /** + * Returns the Remote File Manager service from the Platform. + * The Remote File Manager Service replace the old RemoteDownloader+CacheManager functionality/ + * + * @return ptr to RemoteFileManagerServiceInterface or SdkError + * @see RemoteFileManagerService + */ + virtual Expected> GetRemoteFileManagerService() const = 0; + + /** + * Returns the Crypto Service service implementation from the Platform. + * + * @return CryptoService implementation, if the platform provides any. null otherwise. + * + * @see CryptoService + */ + virtual std::shared_ptr GetCryptoService() const = 0; + + /** + * Returns the Encoding Service implementation from the Platform. + * + * @return EncodingService implementation, if the platform provides any. null otherwise. + * + * @see EncodingService + */ + virtual std::shared_ptr GetEncodingService() const = 0; + + /** + * Returns the URL Service implementation from the Platform. + * + * @return URL implementation, if the platform provides any. null otherwise. + * + * @see URLService + */ + virtual std::shared_ptr GetURLService() const = 0; + + /** + * Returns the CompressedFileService implementation from the Platform. + * + * @return CompressedFileService implementation, if the platform provides any. null otherwise. + * + * @see CompressedFileService + */ + virtual std::shared_ptr GetCompressedFileService() const = 0; + + }; + + namespace ErrorCodes { + constexpr static const char* MISSING_PLATFORM_SERVICES = + "platform_services.missing_service"; ///< A missing platform service exception + + } + +} //namespace + + +#endif /* ADOBEMOBILE_PLATFORMSHIM_PLATFORMSERVICESINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Query.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Query.h new file mode 100755 index 00000000..cd52fba3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Query.h @@ -0,0 +1,167 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_QUERY_H +#define ADOBEMOBILE_PLATFORMSHIM_QUERY_H + +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class Query; + + /** + * QueryBuilder class is POD type and is used to build a Query object. + */ + class QueryBuilder { + public: + /** + * Create a QueryBuilder object with required Query parameters + * + * @param table The table name to compile the query against + * @param columns A list of columns to return. Passing empty vector will return all columns + */ + explicit QueryBuilder(const std::string& table, const std::vector& columns); + + QueryBuilder(const QueryBuilder&) = delete; ///< delete default copy constructor + QueryBuilder& operator=(const QueryBuilder&) = delete; ///< delete assignment operator + QueryBuilder(QueryBuilder&&) = delete; ///< delete move constructor + QueryBuilder&& operator=(QueryBuilder&&) = delete; ///< delete move assignment operator + + /** + * Query selection + * + * @param selection A filter declaring which rows to return, formatted as an SQL WHERE clause (excluding the WHERE itself). Passing empty string will return all rows for the given table + * @param selection_args A list of selection args. You may include ?s in selection, which will be replaced by the values from selection_args, in order that they appear in the selection. The values will be bound as std::string + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Selection(const std::string& selection, const std::vector& selection_args); + + /** + * Group query result + * + * @param group_by A filter declaring how to group rows, formatted as an SQL GROUP BY clause (excluding the GROUP BY itself). Passing empty string will cause the rows to not be grouped + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& GroupBy(const std::string& group_by); + + /** + * Having clause for this query + * + * @param having A filter declaring which row groups to include in the cursor, if row grouping is being used, formatted as an SQL HAVING clause (excluding the HAVING itself). Passing empty string will cause all row groups to be included, and is required when row grouping is not being used + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Having(const std::string& having); + + /** + * Order result rows for this query's result + * + * @param order_by Indicates how to order the rows, formatted as an SQL ORDER BY clause (excluding the ORDER BY itself). Passing empty string will use the default sort order, which may be unordered + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& OrderBy(const std::string& order_by); + + /** + * Limit the number of rows in the query result + * + * @param limit Limits the number of rows returned by the query, formatted as LIMIT clause. Passing empty string denotes no LIMIT clause + * @return QueryBuilder this QueryBuilder object + */ + QueryBuilder& Limit(const std::string& limit); + + /** + * Build the Query object + * + * @return the Query object + */ + std::shared_ptr Build(); + + private: + void ThrowIfAlreadyBuilt(); + + std::shared_ptr query_; + bool did_build_; + + }; + + class Query : public Object { + friend class QueryBuilder; + public: + /** + * @return table name in this query + */ + std::string GetTable() const; + + /** + * @return table column names in this query + */ + std::vector GetColumns() const; + + /** + * @return SELECT clause in this query + */ + std::string GetSelection() const; + + /** + * @return SELECT clause arguments in this query + */ + std::vector GetSelectionArgs() const; + + /** + * @return GROUP BY clause in this query + */ + std::string GetGroupBy() const; + + /** + * @return HAVING clause in this query + */ + std::string GetHaving() const; + + /** + * @return ORDER BY clause in this query + */ + std::string GetOrderBy() const; + + /** + * @return LIMIT clause in this query. It can be used to constrain the number of rows returned. + */ + std::string GetLimit() const; + + private: + /** + * @private + * Constructor. Intended for use by QueryBuilder. + */ + Query() {} + + std::string table_; + std::vector columns_; + std::string selection_; + std::vector selection_args_; + std::string group_by_; + std::string having_; + std::string order_by_; + std::string limit_; + + }; + +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_QUERY_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h new file mode 100755 index 00000000..d8ad72d6 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/QueryStringBuilder.h @@ -0,0 +1,72 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H +#define ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H + +#include +#include "Object.h" +#include "DatabaseServiceInterface.h" + +namespace AdobeMarketingMobile { + + class QueryStringBuilder : public Object { + public: + /** + * Builds a query string to create table with the given column names, data types and constraints. + * + * @param name table name + * @param column_names list of column names in the table + * @param column_data_types list of column data types for the table columns + * @param column_constraints list of column contrainsts for the table columns + * @return create table query string + */ + static std::string PrepareCreateTableQueryString(const std::string& name, + const std::vector& column_names, + const std::vector& column_data_types, + const std::vector>& column_constraints); + + private: + QueryStringBuilder(); ///< Private Constructor + + /** + * @private + * Fetches the list of column data types. + * + * @param column_data_types list of column data types + * @return column data types list with data types expressed as string + */ + static std::vector GetColumnDataTypes(const std::vector& + column_data_types); + + /** + * @private + * Fetches the list of column constraints. + * + * @param column_constraints list of column constraints + * @return column constraints list with constraints expressed as string + */ + static std::vector GetColumnConstraints(const std::vector>& + column_constraints); + + static const std::map COLUMN_DATA_TYPE_MAP; + static const std::map COLUMN_CONSTRAINT_MAP; + + }; +} +#endif /* ADOBEMOBILE_PLATFORMSHIM_QUERYSTRINGBUILDER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h new file mode 100755 index 00000000..a5341172 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RandomUtil.h @@ -0,0 +1,43 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_RANDOMUTIL_H +#define ADOBEMOBILE_UTIL_RANDOMUTIL_H + +namespace AdobeMarketingMobile { + class RandomUtil { + public: + + /** + * Produces random integer values, uniformly distributed on the closed interval [0, n], it uses + * std::uniform_int_distribution + * + * @param n the upper bound for the distribution + * @return the generated random integer as string + */ + static std::string Rand(const uint64_t n); + + /** + * @see RandomUtil::Rand(int64_t) Distribution used is [0, UINT64_MAX] + */ + static std::string Rand(); + }; +} + +#endif /* ADOBEMOBILE_UTIL_RANDOMUTIL_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h new file mode 100755 index 00000000..344e0828 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RangedResolver.h @@ -0,0 +1,318 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_RANGEDRESOLVER_H +#define ADOBEMOBILE_CORE_RANGEDRESOLVER_H + +#import +#import +#import "Log.h" +#import "Object.h" + +namespace AdobeMarketingMobile { + + /** + * @note This class is not thread-safe. It is strongly recommended to implement a locking scheme when calling any of these class methods. + * + * States will always be one of the following: + * + * - A `DATA` state is a normal, valid shared state. + * - The `PENDING` state is a state that is "on the way" and will eventually be resolved. + * - The `INVALID` state is a special state that indicates that the state is not valid. + * - The `NEXT` state is a special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + * - The `PREV` state is a special "marker" state that indicates that this state is equal to the previous state. + * + * Modules will be able to perform the following operations: + * + * - Create can insert a `DATA`, `PENDING`, or `INVALID` state. + * - Update can change a PENDING state to a... + * + DATA state upon successful asynchronous operations. + * + INVALID state for asynchronous operations that invalidate the shared state. + * + NEXT state for asynchronous operations that should return the next state. + * + PREV state for asynchronous operations that should revert to the previous state. + * - Get for a version v should... + * + If the state at version *v* is DATA, PENDING, or INVALID, return it. + * + If the state at version *v* is NEXT, return the first state after *v* that is either DATA, PENDING, or INVALID. + * + If there are no such states after *v*, return PENDING. + * + If the state at version *v* is PREV, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v* that is either DATA, PENDING, INVALID, or NEXT. + * + If there are no such states before *v*, return PENDING. + * + If no state has exactly version *v*, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v*. + * + If there are no such states before *v*, return PENDING. + * + * Notice that: + * - Get(*v*) will always return DATA, PENDING, or INVALID. + * - Only PENDING states can be updated. + * - Once a state is DATA or INVALID, Gets for that state will always return the same value. This prevents history from changing. + * + * Under this solution, asynchronous operations would typically follow this process: + * - Create(version, PENDING) + * - Initiate the operation + * - When the operation completes, + * + If the operation succeeds, Update(version, ) + * + Else (the operation failed): + * + If state should use the previous valid shared state, Update(version, PREV) + * + If state should use the next valid shared state, Update(version, NEXT) + * + If state should be invalid, Update(version, INVALID) + */ + template + class RangedResolver : public Object { + + public: + + /** + * @brief Creates a new Ranged Resolver instance. + * + * Creates a new RangedResolver instance using the given special marker objects. The special state markers + * must be unique with each other and should be unique within your system. + * + * @param pending_state a unique marker object indicating a state will eventuall be resolved + * @param invalid_state a unique marker object indication a state is not valid + * @param next_state a unique marker object indicating the state is equal to the next valid state + * @param previous_state a unique marker object indicating the state is equal to the previous valid state + */ + RangedResolver(const std::shared_ptr& pending_state, + const std::shared_ptr& invalid_state, + const std::shared_ptr& next_state, + const std::shared_ptr& previous_state); + + /** + * Deconstructs this Ranged Resolver. Clears the list of states. + */ + ~RangedResolver(); + + /** + * @brief Add new state for a specific version. + * + * Adds a new shared state to the list for the given version. + * Only adds the state if the version is greater than the previous state's version. + * Only adds the state if it is equal to DATA, PENDING, or INVALID. + * + * @param version the version of this state to add + * @param state the state to add + * @returns true if the state was added + */ + bool Add(const int32_t version, const std::shared_ptr& state); + + /** + * @brief Update an existing state. + * + * Update an existing PENDING state at the specified version. + * @note Only existing PENDING states may be updated. + * + * @param version the version of the state to update + * @param state the state to replace the existing state + * @returns true if the state was updated + */ + bool Update(const int32_t version, const std::shared_ptr& state); + + /** + * @brief Resolves the given version to a shared state. + * + * Resolves the given version by traversing the list of shared states, returning the appropriate state. + * + If the state at version *v* is DATA, PENDING, or INVALID, return it. + * + If the state at version *v* is NEXT, return the first state after *v* that is either DATA, PENDING, or INVALID. + * + If there are no such states after *v*, return PENDING. + * + If the state at version *v* is PREV, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v* that is either DATA, PENDING, INVALID, or NEXT. + * + If there are no such states before *v*, return PENDING. + * + If no state has exactly version *v*, return Get(*v_prev*) where *v_prev* is the version of the first state with version < *v*. + * + If there are no such states before *v*, return PENDING. + * + * @param version the version to resolve to a state + * @returns a state of either EventData, RangedResolver::PENDING, or RangedResolver::INVALID + */ + const std::shared_ptr& Get(const int32_t version); + + /** + * @brief Determines if there are any valid states contained within this RangedResolver. + * + * A valid state is any value other than INVALID, NEXT, or PREV. + * A PENDING state is considered valid as it is the expectation of data. + * + * @return true if this RangedResolver constains any value which is not INVALID, NEXT, or PREV + */ + bool ContainsValidState() const; + + private: + const std::shared_ptr& PENDING; ///< state that is "on the way" and will eventually be resolved. + const std::shared_ptr& + INVALID; ///< special "marker" state that indicates that this state is equal to the previous state. + const std::shared_ptr& + NEXT; ///< special "marker" state that indicates that this state is equal to the next DATA/PENDING/INVALID state. + const std::shared_ptr& PREV; ///< special state that indicates that the state is not valid. + + typedef typename std::map>::iterator states_it; ///< iterator type over states map + + /** + * Iterate over the map of states starting at the given states iterator to find the first valid state. + * Returns the state value (DATA, PENDING, or INVALID). + * If the state is equal to the end of the states map, returns PENDING. + * + * @param it an iterator + * @returns state value of DATA, PENDING, or INVALID + */ + const std::shared_ptr& Resolve(states_it it) const; + + std::map> states_; ///< map of state version and data + }; + +} + +////////////////////////////////// +// Template Method Definitions +///////////////////////////////// + +namespace AdobeMarketingMobile { + + template + RangedResolver::RangedResolver(const std::shared_ptr& pending_state, + const std::shared_ptr& invalid_state, + const std::shared_ptr& next_state, + const std::shared_ptr& previous_state) : + PENDING{pending_state}, + INVALID{invalid_state}, + NEXT{next_state}, + PREV{previous_state} { + + if (PENDING == INVALID + || PENDING == NEXT + || PENDING == PREV + || INVALID == NEXT + || INVALID == PREV + || PREV == NEXT) { + Log::Warning("RangedResolver", "Found equality between marker states! Pending(%p) Invalid(%p) Next(%p) Previous(%p)", + PENDING, INVALID, NEXT, PREV); + } + + // Add initial NEXT state at beginning of map + // May be replaced when adding a state to version 0 + states_.emplace(-1, NEXT); + } + + template + RangedResolver::~RangedResolver() { + states_.clear(); + } + + template + bool RangedResolver::Add(const int32_t version, const std::shared_ptr& state) { + // only add states of DATA, PENDING, or INVALID + if (state == NEXT || state == PREV) { + return false; + } + + if (version > states_.rbegin()->first) { + // Only add higher versions. + states_.emplace(version, state); + return true; + } + + return false; + } + + template + bool RangedResolver::Update(const int32_t version, const std::shared_ptr& state) { + // Update may only update PENDING states. + // Return false for updating PENDING with PENDING so it does not trigger a state change event. + if (state == PENDING) { + return false; + } + + auto it = states_.find(version); + + // Only allow updates to PENDING states + if (it != states_.end() && it->second == PENDING) { + it->second = state; + return true; + } + + return false; + } + + template + const std::shared_ptr& RangedResolver::Get(const int32_t version) { + + // returns an iterator to the first element not less than the given key (ie equal to or greater than) + auto it = states_.lower_bound(version); + + // didn't find state with given version number, return latest state (which is less than given version) + if (it == states_.end()) { + if (it != states_.begin()) { + return Resolve(std::prev(it)); // greatest shared state (version < event version) + + } else { + // found no shared states in module map of shared states (iterator equals both end() and begin()) + // this should not occur as the map is created with an initial value + return PENDING; + } + } + + // found state but but not exact match + if (it->first != version) { + if (it != states_.begin()) { + // given version doesn't have shared state, return state not higher than requested for version + return Resolve(std::prev(it)); + } + // only found states with higher versions than requested + } + + return Resolve(it); // exact match to event state or no lower states + + } + + template + bool RangedResolver::ContainsValidState() const { + auto it = states_.begin(); + + while (it != states_.end()) { + if (it->second != INVALID && it->second != NEXT && it->second != PREV) { + return true; // state is either DATA or PENDING + } + it = std::next(it); + } + + return false; // reached end with no valid entries + } + + template + const std::shared_ptr& RangedResolver::Resolve(states_it it) const { + // sanity check + if (it == states_.end()) { + return PENDING; + } + + // trace back through states + while (it->second == PREV) { + it = std::prev(it); + } + // trace forward through states. once we move forward we don't go back. + while ( it != states_.end() && (it->second == NEXT || it->second == PREV)) { + it = std::next(it); + } + + // off end of list and found no valid value + if (it == states_.end()) { + return PENDING; + } + + return it->second; + } + +} + + +#endif /* ADOBEMOBILE_CORE_RANGEDRESOLVER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h new file mode 100755 index 00000000..f71d62a8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RemoteFileManagerServiceInterface.h @@ -0,0 +1,154 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H + +#include +#include +#include "ObjectInterface.h" +#include "Expected.h" + +namespace AdobeMarketingMobile { + + /* forward declaration */ + class NetworkServiceInterface; + + /* + * Errors specific to the RemoteFileManagerService Interface + */ + namespace ErrorCodes { + // Platform shim errors + constexpr static const char* REMOTEFILEMANAGER_SERVICES_FAILURE{"remotefilemanager.services_failed"}; ///< One or more of the required services are not available. + constexpr static const char* REMOTEFILEMANAGER_REQUEST_FAILURE{"remotefilemanager.request_failed"}; ///< Network failure when requesting file. Response code available. + constexpr static const char* REMOTEFILEMANAGER_CACHE_FAILURE{"remotefilemanager.cache_failed"}; ///< File system failure when requesting file. File system error available. + } + + /* + * Helper class for returning remote file contents. + */ + class RemoteFileInterface : public virtual ObjectInterface { + public: + + /** + * Get local path to cached copy of remote file as a URI. + * This must be accessible to the HTML renderer we are using (e.g. for Messages). + * + * @return path to local cached file + */ + virtual std::string ToUri() = 0; + + /** + * Get the contents of the remote file as a JSON string. + * + * @return JSON data + */ + virtual std::string ReadJsonStringFromFile() = 0; + }; + + + /* + * This interface is intended to replace the current usage of RemoteDownloader and CacheManager. + * This higher level interface will be more flexible when porting cross-platform. + * + * Current usage patterns: + * 1. RemoteDownloader --> startDownload --> getFileForCachedURL --> onDownloadComplete --> readFromFile (and then convert to JSON) + * 2. RemoteDownloader --> startDownloadSync --> getFileForCachedURL --> readJSONFromFile + * 3. CacheManager --> getFileForCachedURL --> readJSONFromFile + * 4. CacheManager --> getFileForCachedURL --> getURL --> downloadAssetCollection --> HTML Renderer + * 5. RemoteDownloaded --> syncRemoteAssets --> deleteCachedUrlsNotInList + * + * You may encounter the following errors: + * HTTP response errors (e.g. something besides HTTP/200 OK) + * OS networking errors (e.g. network timeout) + * OS filesystem errors (e.g. someone deleted the cached file out from under us) + * + */ + class RemoteFileManagerServiceInterface : public virtual ObjectInterface { + public: + /** + * Frees resources used by this, waiting up to `max_wait_duration` for the operation to complete. + * + * Calling Dispose() triggers clean up to occur asynchronously. + * + * After triggering the asynchronous disposal, this call will block for up to `max_wait_duration` for the + * operation to complete. + * + * @param max_wait_duration - the maximum duration to block this call while waiting for cleanup to complete. + * A `0` time indicates that we will return immediately. + * + * @return true if this was fully disposed + */ + virtual bool Dispose(std::chrono::milliseconds max_wait_duration) = 0; + + /** + * Asynchronously get the file corresponding to the url passed. + * If file was cached and we could not get an updated file, return the cached file. + * If file was NOT cached and we could not get the file, return an error. + * WARNING! The file may be returned on a different thread than the calling thread. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the remote file url. Schemes supported: https, http(?) + * @param completed - callback function called when download has completed or failed + */ + virtual void GetFileAsync(const std::string& cache_subfolder, + const std::string& url, + const std::function>&)>& completed) = 0; + + /** + * Synchronously get the file corresponding to the url passed. + * If file was cached and we could not get an updated file, return the cached file. + * If file was NOT cached and we could not get the file, return an error. + * WARNING! This call will block until the file is fully downloaded or errors out. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the url to look for the remote file at. Schemes supported: https, http(?) + * @return ptr to RemoteFileInterface or SdkError + */ + virtual Expected> GetFileSync(const std::string& cache_subfolder, + const std::string& url) = 0; + + /** + * Get a file from the cache using the url as the lookup key. Optionally ignore partially downloaded files. + * If file was not cached, return an error. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param url - the remote file url. Schemes supported: https, http(?) + * @param ignore_partial_downloads - ignore files which are still being downloaded + * @return ptr to RemoteFileInterface or SdkError + */ + virtual Expected> GetFileFromCache(const std::string& cache_subfolder, + const std::string& url, + bool ignore_partial_downloads) = 0; + + /** + * Delete all urls from the cache that are not found in the list passed. + * If list is empty, all urls in the cache will be removed. + * If none of the urls in the list are in the cache, all urls in the cache will be removed. + * + * @param cache_subfolder - Sub-folder that remote file should be cached in. Use empty string for root folder. + * @param urls_to_retain - the remote file url. Schemes supported: https, http(?) + */ + virtual void DeleteCachedDataNotInList(const std::string& cache_subfolder, + const std::deque& urls_to_retain) = 0; + + }; + +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_REMOTEFILEMANAGERSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Rule.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Rule.h new file mode 100755 index 00000000..d8d0fa6b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Rule.h @@ -0,0 +1,94 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULE_H +#define ADOBEMOBILE_RULESENGINE_RULE_H + +#include +#include +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class RuleCondition; + class RuleTokenParser; + class Event; + + /** + * @class Rule + * + * This class is the concrete rule implementation that encapsulates the rule conditions and consequences for each rule. + * + * This class holds all the necessary component instances to represent a rule in memory. + */ + class Rule : public Object { + + public: + + /** + * Creates an instance of a Rule. + * + * @param condition a RuleCondition object describing the conditional requirements of this rule. + * @param consequenceEvents a vector of Event objects to be published when the rule conditions are met. + */ + explicit Rule(const std::shared_ptr& condition, + const std::vector>& consequenceEvents); + + /** + * Evaluate the rule based on the condition data input. + * + * For example, consider the rule is configured with a matcher ("key1 = value1"). + * In this case, if the condition data contains a KV pair {"key", "value1"}, then this + * function will evaluate to true. + * + * @param rule_token_parser RuleTokenParser will be run through the evaluation matchers. + * @param event Event to be evaluated with the rule + * @return True, if the KV pairs contain data that match the rule matchers as configured. + */ + ADOBE_VIRTUAL_FOR_TESTS + bool EvaluateCondition(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const; + + /** + * Get all consequence events associated for the rule. + * @returns a vector of Event objects for this rule. + */ + ADOBE_VIRTUAL_FOR_TESTS + const std::vector>& GetConsequenceEvents() const; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + protected: + Rule() {}; // for mocking :( + + private: + + static const std::string RULE_JSON_CONDITIONS_KEY; + static const std::string RULE_JSON_CONSEQUENCES_KEY; + + std::vector> consequenceEvents_; ///< Events to publish when this rule evaluates to true + std::shared_ptr condition_; ///< the conditions which this rule applies (non-null) + + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h new file mode 100755 index 00000000..7cc7ebe0 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConditions.h @@ -0,0 +1,210 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULECONDITION_H +#define ADOBEMOBILE_RULESENGINE_RULECONDITION_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonObject; + class Matcher; + class Variant; + class Event; + class RuleTokenParser; + + // ================================================================================ + // RuleCondition + // ================================================================================ + /** + * Base class for a Rule's condition, which are a set of conditions used to evaluate a rule. + */ + class RuleCondition : public Object { + public: + static const std::string RULE_CONDITION_TYPE_KEY_JSON; + static const std::string RULE_CONDITION_TYPE_GROUP_JSON; + static const std::string RULE_CONDITION_TYPE_MATCHER_JSON; + static const std::string RULE_CONDITION_DEFINITION_KEY_JSON; + + /** + * Evaluate the condition and return true if the condition holds, with the data that is supplied. + * + * @param rule_token_parser The {@link RuleTokenParser} for token expansion. + * @param event {@link Event} associated with the rule condition + * @return True, if the condition holds. False otherwise. + */ + virtual bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const = 0; + + /** + * Instantiate a Rule condition class. The condition types supported are "group" (Condition Group) and "matcher" (Condition Matcher). + * + * @param condition_json The json representing the rule condition. + * @return A {@link RuleCondition} instance. + * + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + */ + static std::shared_ptr RuleConditionFromJson(const std::shared_ptr& condition_json); + + }; + + // ================================================================================ + // RuleConditionGroup + // ================================================================================ + /** + * Base class for a group of rule conditions. + */ + class RuleConditionGroup : public RuleCondition { + public: + static const std::string RULE_CONDITIONS_JSON_KEY; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC_AND; + static const std::string RULE_CONDITION_JSON_DEFINITION_LOGIC_OR; + + /** + * Instantiate a Rule condition group. + * + * @param condition_json The JsonObject + * @return RuleConditionGroup + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + **/ + static std::shared_ptr RuleConditionGroupFromJson( + const std::shared_ptr& condition_json); + + /** + * Retrieve the rule conditions in this group. + * @return list of RuleConditions in this group + **/ + const std::vector>& GetConditions() const; + + protected: + RuleConditionGroup(const std::vector>& conditions); + + std::vector> conditions_; + }; + + + // ================================================================================ + // RuleConditionOrGroup + // ================================================================================ + /** + * Concrete class for an OR group rule condition. If any condition in this group evaluates + * to `true`, then the entire group evaluates to `true`. + */ + class RuleConditionOrGroup : public RuleConditionGroup { + public: + /** + * Constructs a RuleConditionOrGroup instance. + * @param conditions the conditions in this RuleConditionOrGroup + */ + explicit RuleConditionOrGroup(const std::vector>& conditions); + + /** + * Evaluate the \p data against the conditions in this rule condition group. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion + * @param event event {@link Event} to be evaluated with the rule + * @returns true if any condition in this group evaluates to true, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; + + + // ================================================================================ + // RuleConditionAndGroup + // ================================================================================ + /** + * Concrete class for an AND group rule condition. If all conditions in this group evaluate + * to `true`, then the entire group evaluates to `true`. + */ + class RuleConditionAndGroup : public RuleConditionGroup { + public: + /** + * Constructs a RuleConditionAndGroup instance. + * @param conditions the conditions in this RuleConditionAndGroup + */ + explicit RuleConditionAndGroup(const std::vector>& conditions); + + /** + * Evalute the \p data against the conditions in this rule condition group. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion. + * @param event event {@link Event} to be evaluated with the rule + * @returns true if all conditions in this group evaluate to true, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + }; + + // ================================================================================ + // RuleConditionMatcher + // ================================================================================ + /** + * Rule condition matcher class which evaluates a specific rule condition. + */ + class RuleConditionMatcher : public RuleCondition { + public: + /** + * Constructs a RuleConditionMatcher instance. + * @param matcher the condition matcher + */ + explicit RuleConditionMatcher(const std::shared_ptr& matcher); + + /** + * Create a new RuleConditionMatcher instance from a json file. + * + * @param condition_json the JSON file containing the definition of a RuleConditionMatcher + * @throws ErrorCodes::JSON_JSONOBJECT_IS_NULL if the JsonObject is nullptr + * @throws ErrorCodes::JSON_KEY_NOT_FOUND if there is an error reading the json file + */ + static std::shared_ptr RuleConditionMatcherFromJson(const std::shared_ptr& + condition_json); + + /** + * Evaluate \p data against that condition matcher. + * @param rule_token_parser The {@link RuleTokenParser} for token expansion + * @param event event {@link Event} to be evaluated with the rule + * @returns true if \p data validates against the matcher, false otherwise. + */ + bool Evaluate(const std::shared_ptr& rule_token_parser, + const std::shared_ptr& event) const override; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + private: + std::shared_ptr matcher_; + }; + +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULECONDITION_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h new file mode 100755 index 00000000..39079c26 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleConsequence.h @@ -0,0 +1,114 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H +#define ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H + +#include +#include +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class JsonUtilityServiceInterface; + class JsonObject; + class EventData; + class Variant; + class JsonObject; + class JsonArray; + + /** + * @class RuleConsequence + * This class is a base class representing a generic rule consequence. + */ + class RuleConsequence : public Object { + public: + + + /** + * Parse the supplied json object and instantiate the concrete consequence class. + * + * @param consequence_json The json object for the consequence. + * + * @return A RuleConsequence instance. Could be null if the consequence type in the json is not supported, or due to a json + * error. + * + * @throws when the json format is not correct. + */ + static std::shared_ptr ConsequenceFromJson(const std::shared_ptr& consequence_json); + + /** + * Creates an Map containing the consequence information. + *

+ * The Map contains the following information about the consequence. + *

    + *
  • The id in key EventDataKeys#RulesEngine#CONSEQUENCE_ID.
  • + *
  • The consequence_type in key EventDataKeys#RulesEngine#CONSEQUENCE_TYPE.
  • + *
  • The detail in key EventDataKeys#RulesEngine#CONSEQUENCE_DETAIL.
  • + *
  • The provided asset_path in key EventDataKeys#RulesEngine#CONSEQUENCE_ASSETS_PATH.
  • + *
+ * + * @param asset_path A valid String asset path for the consequence + * @return Map representing a consequence + */ + std::map> GenerateConsequenceMap(const std::string& asset_path); + + /** + * Returns {@link EventData} populated with the data the Consequence would like to broadcast to the Core. The data + * should be sufficient for the Core to perform the requested consequences. Assume that core will expand + * any tokens required. + * + * @return An instance of EventData. + * + * @see EventDataKeys.RulesEngine + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GenerateEventData(); + + /** + * Convert and flatten JsonObject into a Variant map + * @param json_object The JsonObject + * @return the Variant map + */ + static std::map> ParseJsonObjectIntoMap(const std::shared_ptr& + json_object); + /** + * Convert and flatten JsonArray into a string map + * @param json_array The JsonArray + * @return the string map + */ + static std::vector> ParseJsonArrayIntoList(const std::shared_ptr& json_array); + + /** + * @return the map with consequence detail + */ + std::map> GetConsequenceDetail(); + + /** + * @return the string consequence id + */ + std::string GetConsequenceId(); + + private: + std::string id_; + std::string type_; + std::map> detail_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULECONSEQUENCE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h new file mode 100755 index 00000000..44e2993e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RuleTokenParser.h @@ -0,0 +1,242 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H +#define ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H + +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + class EventHub; + class RulesEngine; + class PlatformServicesInterface; + class Event; + class Variant; + /** + * @class RuleTokenParser + * + * The V5 SDK should support token expansions on the static endpoint, to allow for injection of properties, prefixes replacement. + * + */ + + class RuleTokenParser : public Object { + friend class EventHub; + public: + + // ======================================================== + // Constructor + // ======================================================== + + /** + * RuleTokenParser Constructor + * + * @param parent_hub parent EventHub module instance + */ + explicit RuleTokenParser(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services); + + /** + * Sets triggering Event instance to be used by this RuleTokenParser. + * + * @param event triggering Event instance + */ + void SetEvent(const std::shared_ptr& event); + + /** + * Returns the value for the key provided as input. + *

+ * If the key is a special key recognized by SDK, the value is determined based on incoming Event, + * or EventHub#ModuleSharedStates data. Otherwise the key is searched in the current Event's Eventdata + * and the corresponding value is returned. + * + * @param key std::string containing the key whose value needs to be determined + * @param event triggering Event instance + * + * @return Variant containing value to be substituted for the key + */ + std::shared_ptr ExpandKey(const std::string& key, const std::shared_ptr& event); + + /** + * Finds and expands the tokens in the sourceString. + *

+ * The token format is as follows {@literal {%key%}}, valid characters for key include [a-zA-Z0-9~_.] + *

+ * If the token contains special key recognized by SDK, the value is determined based on incoming Event, + * or EventHub#ModuleSharedStates data. Otherwise the key contained in the token is searched in the current Event's + * data and the corresponding value is used. + * + * @param source_string input std::string containing tokens to be replaced + * @param event triggering Event instance + * + * @return std::string containing source_string with the valid tokens replaced with the corresponding values + */ + std::string ExpandTokensForString(const std::string& source_string, const std::shared_ptr& event); + + private: + // ======================================================== + // private methods + // ======================================================== + + /** + * Returns the value for shared state key specified by the key. + *

+ * The key is provided in the format {@literal ~state.valid_shared_state_name/key} + * For example: {@literal ~state.com.adobe.marketing.mobile.Identity/mid} + * + * @param key std::string containing the key to search for in EventHub#ModuleSharedStates + * + * @return Variant containing the value for the shared state key if valid, null otherwise + */ + std::shared_ptr GetSharedStateKey(const std::string& key); + + /** + * Extracts the key from passed token. + *

+ * For example, key extracted from a token of the given format {@literal {%myKey%}} shall be myKey + * + * @param token std::string containing the token + * @param url_encode true if token requires url_encode + * + * @return std::string containing the key in the passed token + */ + std::string GetKeyFromToken(const std::string& token, bool url_encode = false); + + + /** + * Finds and returns all the valid tokens in the provided input. + *

+ * A valid token follows the regex {@literal {%[a-zA-Z0-9_~.]*?%}} + * + * @param input the input String containing tokens to be parsed + * + * @return std::vector of valid tokens contained in the input string + */ + std::vector FindTokens(const std::string& input); + + // ======================================================== + // package-protected methods + // ======================================================== + + /** + * Returns the event type from the triggering event. + * + * @return std::string containing the event type name + * @see EventType + */ + std::string GetEventType() const; + + /** + * Returns the event source from the triggering event. + * + * @return std::string containing the event source name + * @see EventSource + */ + std::string GetEventSource() const; + + /** + * Returns the current device time in epoch format (seconds since epoch). + * + * @return std::string value of the number of seconds since epoch + * @see TimeUtil#getUnixTime() + */ + std::string GetTimestamp(); + + /** + * Returns the current SDK version string. + * + * @return std::string indicating the current version of SDK + * @see SystemInfoService#getSdkVersion() + */ + std::string GetSdkVersion(); + + /** + * Generates and returns a random number to be used for cache-busting purposes. + * + * @return std::string value of the random number + */ + std::string GetCachebust(); + + /** + * Returns a std::string containing all data in the triggering Event object encoded in url format. + * + * @return std::string containing url encoded key-value pairs in Event data + */ + std::string GetAllUrl(); + + /** + * Returns a std::string containing all data in the triggering Event object encoded in json format. + * + * @return std::string containing json data + */ + std::string GetAllJson(); + + /** + * Returns value for the key stored in module shared state with name sharedStateName. + *

+ * This method invokes Module#GetSharedEventState(std::string, Event) to get the shared state key. + * + * @param shared_state_name std::string containing name of the module shared state + * @param key std::string containing name of the key in the module shared state + * + * @return Variant containing the value for given shared state key + */ + std::shared_ptr GetSharedStateKey(const std::string& shared_state_name, const std::string& key); + + private: + /** + * @brief Variant containing a mapping of rule condition special key types to their getter + */ + std::shared_ptr ReturnKeyType(const std::string& key); + + /** + * Find all the occurrance of a string pattern inside of the input string and replace them in place. + * + * @param data the input std::string containing keywords + * @param to_search the search pattern + * @param replace_str the replacement to the matched pattern + */ + void FindAndReplaceAll(std::string& data, const std::string& to_search, const std::string& replace_str); + + private: + static const int32_t RANDOM_INT_BOUNDARY; + static const std::string KEY_PREFIX; + static const std::string SHARED_STATE_KEY_DELIMITER; + static const int32_t MIN_TOKEN_LEN; + static const std::string KEY_EVENT_TYPE; + static const std::string KEY_EVENT_SOURCE; + static const std::string KEY_TIMESTAMP_UNIX; + static const std::string KEY_SDK_VERSION; + static const std::string KEY_CACHEBUST; + static const std::string KEY_ALL_URL; + static const std::string KEY_ALL_JSON; + static const std::string KEY_SHARED_STATE; + static const std::string KEY_URL_ENCODE; + static const std::string KEY_URL_ENCODE_PREFIX; + static const std::string KEY_URL_ENCODE_SUFFIX; + static const unsigned long MIN_URL_ENC_TOKEN_LEN; + + std::weak_ptr parent_hub_; ///< parent module to get shared event data + std::weak_ptr platform_services_; ///< platform services provide access to sdk version + std::shared_ptr event_; ///< event associated with the rule token parser + + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULETOKENPARSER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h new file mode 100755 index 00000000..fc51916d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesBundleNetworkProtocolHandler.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H +#define ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H + +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + /** + * This is the contract for a concrete implementation that would support + * processing a Rules Engine bundle downloaded from the configured end-point + * + * The interface allows the handling of the actual file type downloaded to be changed / plugged -in/out. + * The implementation is responsible for processing the downloaded bundle (file) + */ + class RulesBundleNetworkProtocolHandler : virtual ObjectInterface { + + /** + * Process the file that was downloaded by the RulesDownloader. + * + * The implementation is free to process the file as it wishes. The processed contents should be stored in the + * #output_path path. + * + * @param downloaded_bundle The file that was downloaded by the RulesDownloader + * @param output_path The absolute path of the output folder. The implementation is free to create sub-folders underneath. + * + * @return Indication of whether the processing was successful + */ + virtual bool ProcessDownloadedBundle(const std::string& downloaded_bundle, + const std::string& output_path) = 0; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULESBUNDLENETWORKPROTOCOLHANDLER_H */ + + + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h new file mode 100755 index 00000000..66565920 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesDownloader.h @@ -0,0 +1,87 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H +#define ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H + +#include +#include "Common.h" +#include "Object.h" + +namespace AdobeMarketingMobile { + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class FileSystemServiceInterface; + class CompressedFileServiceInterface; + class ZipBundleHandler; + + class RulesDownloader : public Object { + public: + + /** + * Create RulesDownloader for the given URL. + * + * @param platform_services an instance of PlatformServicesInterface + * @param cache_folder a string containing the subfolder to use for caching of downloaded urls + * @param bundle_ready_callback a callback function to be called when the download is completed + * @throws ErrorCodes::MISSING_PLATFORM_SERVICES if the RemoteFileManagerService is not available. + */ + explicit RulesDownloader(const std::shared_ptr& platform_services, + const std::string& cache_folder, + const std::function& bundle_ready_callback); + + /** + * Start asynchronous download of rules. Once finished, triggers completed callback function + * passing URI to local cached file. + * + * @param url the remote url to download the rule configuration + */ + ADOBE_VIRTUAL_FOR_TESTS + void StartDownload(const std::string& url); + + /** + * Processes the downloaded file and returns the destination path + * + * @param downloaded_file_path The file that was downloaded by this + * @return The destination path where the processed file contents were stored, + * null if the processing failed + */ + std::string ProcessBundle(const std::string& downloaded_file_path); + + private: + /** + * @private + * Called when rules have been downloaded from the server and the content url is passed in + * + * @param file_path The path to the downloaded rules zip file + */ + void OnDownloadComplete(const std::string& file_path); + + void RulesBundleDownloaded(const std::string& bundlePath, const std::string& url); + + std::shared_ptr manager_; + std::shared_ptr file_system_service_; + std::shared_ptr crypto_service_; + std::shared_ptr zip_bundle_handler_; + std::function bundle_ready_callback_; + std::string url_; + std::string cache_folder_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_RULESDOWNLOADER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h new file mode 100755 index 00000000..f3fdec97 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/RulesEngine.h @@ -0,0 +1,127 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_RULESENGINE_H +#define ADOBEMOBILE_RULESENGINE_RULESENGINE_H + +#include +#include +#include +#include +#include +#include "InternalModule.h" + +namespace AdobeMarketingMobile { + class JsonUtilityServiceInterface; + class FileSystemServiceInterface; + class RemoteFileManagerServiceInterface; + class CryptoServiceInterface; + class CompressedFileServiceInterface; + class Rule; + class RuleConsequence; + class RulesConfiguration; + class RulesDownloader; + class RulesDispatcherRulesResponseContent; + class RulesEngineState; + class Variant; + class RuleTokenParser; + + /** + * @class RulesEngine + * RulesEngine module is responsible for evaluation of configured rules upon receiving a specific trigger event, + * and if a rule evaluates to true, then perform the associated rule consequence. + * + * The module downloads, parses and stores the concrete rule implementations in-memory for evaluation when a trigger event is received. + */ + class RulesEngine: public Object { + friend class EventHub; + + public: + + static const std::string LOG_PREFIX; + /** + * Create a new instance of a RulesEngine Module. + */ + RulesEngine(const std::shared_ptr& parent_hub, + const std::shared_ptr& platform_services); + + /** + * Add a rule for the given module + * + * @param module module to add rule to (needed for RemoveRulesForModule to work) + * @param rule rule object to add for the given module + */ + ADOBE_VIRTUAL_FOR_TESTS void AddRule(const std::shared_ptr& module, const std::shared_ptr& rule); + + /** + * Remove all rules for the given module + * + * @param module module to remove all rules for + */ + ADOBE_VIRTUAL_FOR_TESTS void RemoveRulesForModule(const std::shared_ptr& module); + + /** + * Evaluate the current rules against the shared states the module is aware of, along with any additional data + * that may have been provided. + * Rules that belong to the eventType passed in along with the rules that belong to RuleEventType::ANY + * are evaluated for matches. + * + * @param event triggering Event to be processed and evaluated by the rules + */ + ADOBE_VIRTUAL_FOR_TESTS + std::vector> ProcessRules(const std::shared_ptr& event); + + private: + + /** + * Returns the original map with tokens (if any) expanded with the appropriate values. + * + * If the map contains a map or a list then this function will recursively expand tokens within them. + * If the map contains any other data types apart from primitive data type then it will be returned as is. + * + * @param map_with_tokens The map with more zero or more tokens + * @param event The Event that will be used to expand tokens + * @return A map with all the tokens expanded + */ + ADOBE_VIRTUAL_FOR_TESTS std::map> GetTokenExpandedMap(const + std::map>& map_with_tokens, + const std::shared_ptr event); + + /** + * Returns the original list with tokens (if any) expanded with the appropriate values. + * + * If the list contains a map or a list then this function will recursively expand tokens within them. + * If the list contains any other Object apart from primitive data type containers, or collections, then it will be returned as is. + * + * @param list_with_tokens The list with more zero or more tokens + * @param event The Event that will be used to expand tokens + * @return A list with all the tokens expanded + */ + ADOBE_VIRTUAL_FOR_TESTS std::vector> GetTokenExpandedList(const + std::vector> list_with_tokens, + const std::shared_ptr event); + + std::shared_ptr rule_token_parser_; + + // governs access to rules_module_map_ + std::mutex rules_mutex_; + // maintains the list of rules registered, attached to the module that registered them + std::map, std::vector>> rule_module_map_; + }; +} +#endif /* ADOBEMOBILE_RULESENGINE_RULESENGINE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SdkError.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SdkError.h new file mode 100755 index 00000000..b0dd5bbc --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SdkError.h @@ -0,0 +1,598 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_SDKERROR_H +#define ADOBEMOBILE_CORE_SDKERROR_H + +#include +#include +#include +#include "Common.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + /** + * A POD that encapsulates debugging information. + */ + class DebugInfo { + public: + DebugInfo() = default; + DebugInfo(const DebugInfo& right) = default; + DebugInfo& operator=(const DebugInfo& right) = default; + DebugInfo(DebugInfo&& right) = default; + DebugInfo& operator=(DebugInfo&& right) = default; + + /** + * Constructs a DebugInfo with the given field values + */ + DebugInfo(const std::string& file, + int32_t line_number, + const std::string& stack_trace); + /** + * The file name where an error occurred. + * Empty string if unavailable. + */ + std::string file; + + /** + * The line number where an error occurred. + * -1 if unavailable. + */ + int32_t line_number = -1; + + /** + * The stack trace for the error. + * Empty string if unavailable. + */ + std::string stack_trace; + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const DebugInfo& debug_info, const ToStringOptions& options); + + namespace GetCurrentDebugInfoPrivate { + // this namespace is only intended for use by the ADOBE_GET_CURRENT_DEBUG_INFO() macro + // it is present to prevent unintended usage of this function + + /** + * @private + * @return the current stack trace + */ + std::string GetCurrentStackTrace(); + } + + /** + * DebugInfo ADOBE_GET_CURRENT_DEBUG_INFO() + * + * @returns a DebugInfo object populated with the current line number and stack trace. + */ +#define ADOBE_GET_CURRENT_DEBUG_INFO() AdobeMarketingMobile::DebugInfo{ __FILE__, __LINE__, GetCurrentDebugInfoPrivate::GetCurrentStackTrace() } + + /** + * @class SdkError + * An SdkError represents an error signaled by the SDK. It is also the base class for all exceptions thrown from the SDK. + * + * Best Practices + * -------------- + * 1) Throw SdkError to signal uncommon, fatal errors. Return `Expected<...>` if errors are common. + * + * 2) When throwing, code should almost always throw SdkError: + * + * - Internal SDK functions (accessible only within Adobe) may bubble up + * std::exception, but should not explicitly throw std::exception. + * + * - Public SDK functions (accessible to customers) should only throw/return SdkError. + * In this case, std::exception and other exception types should be wrapped + * in SdkError. + * + * 3) Prefer using ADOBE_THROW() to a native throw. + * + * 4) Prefer the TrySwallow(), TryCatch(), TryCatchFinally(), TryFinally() methods to + * hand-rolled try catch blocks. + * + * 5) Be specific with your errors. If you need a new error code, add one. + * + * 6) If you must write your own try-catch block, always catch by reference: + * + * try { + * ... + * } catch(SdkError& e) { // <- non-const reference + * ... + * } + * + * Why is this class useful? + * ------------------------- + * SdkError provides a standard way for errors to be thrown, caught, and returned in the SDK. + * It provides an error code and stack trace to ease analysis. + * + * How to create and throw SdkError + * -------------------------------- + * Use SdkErrorconstructors to create an SdkError. SdkError::From can also be used to create + * SdkError from std::exception or std::exception_ptr. SdkError are typically created on stack + * (do not new SdkError). + * + * Use ADOBE_THROW() to throw SdkError. ADOBE_THROW() will add a stack trace and line number information + * to the SdkError (if available on the current platform). + * + * When an exception needs to be rethrown, use std::rethrow_exception. + * + * Examples: + * + * void SimpleExample() { + * if(SomeOtherErrorCondition()) { + * SdkError error{ ErrorCodes::MY_ERROR_CODE, "something crazy happened" }; // constructs an exception + * Throw(error); // throws it, canonical form + * } + * if(SomeErrorCondition()) { + * Throw(ErrorCodes::MY_ERROR_CODE, "something crazy happened"); // convenience form + * } + * } + * + * void RethrowExample() { + * TryCatch([&]{ + * DoSomething(); + * }, [&](SdkError& e) { + * if(e.GetCode() == ErrorCodes::AN_ERROR_I_CAN_RECOVER_FROM) { + * recover(); + * } else { + * std::rethrow_exception(std::current_exception()); // <- rethrow + * } + * }); + * } + * + * How to catch SdkError + * --------------------- + * Use TrySwallow(), TryCatch(), TryCatchFinally(), TryFinally() to catch and handle exceptions. These + * provide a number of benefits over hand-rolled try-catch blocks: + * + * - Catch/Swallow functions will catch all exception types (including std::exception and unrecognized + * exception classes), convert exceptions to SdkError, and invoke the catch block. + * + * - Try functions make sure code always catches by reference (to avoid slicing of exceptions). + * + * - Finally functions provide java-like finally blocks. + * + * Examples: + * + * void Example1() { + * TryCatch([&]{ + * DoSomething(); + * }, [&](SdkError& e) { + * if(e.CodeIs(ErrorCodes::AN_ERROR_I_CAN_RECOVER_FROM)) { + * DoSomethingToRecover(); + * } else { + * DoSomethingOnFail(); + * } + * }); + * } + * + * void Example2() { + * TrySwallow([&]{ + * DoSomething(); + * }); + * } + * + * + * Understanding error codes + * ------------------------- + * Each SdkError has a string error code that indicates what happened. Error code values can be found in + * the ErrorCodes namespace. The core provides a set of default error codes and modules can + * add custom error codes. + * + * Use CodeIs() To check if error codes match: + * + * void Example() { + * SdkError error1{ErrorCodes::SOME_ERROR, "some description"}; // assume SOME_ERROR is "my_module.some_error" + * SdkError error2{ErrorCodes::ANOTHER_ERROR, "some description"}; // assume ANOTHER_ERROR is "my_module.another_error" + * std::cout << error1.CodeIs(ErrorCodes::SOME_ERROR) << std::endl; // prints true + * std::cout << error1.CodeIs(ErrorCodes::ANOTHER_ERROR) << std::endl; // prints false + * } + * + * Error codes are hierarchical. For example, if PEAR_ERROR is "fruit.pear" and FRUIT_ERROR is + * "fruit", a PEAR_ERROR is a FRUIT_ERROR. CodeIs() takes this into consideration: + * + * void Example() { + * SdkError pear_error{ErrorCodes::PEAR_ERROR, "some description"}; // assume PEAR_ERROR is "fruit.pear" + * SdkError fruit_error{ErrorCodes::FRUIT_ERROR, "some description"}; // assume FRUIT_ERROR is "fruit" + * std::cout << pear_error.CodeIs(ErrorCodes::PEAR_ERROR) << std::endl; // prints true + * std::cout << pear_error.CodeIs(ErrorCodes::FRUIT_ERROR) << std::endl; // prints true + * std::cout << fruit_error.CodeIs(ErrorCodes::PEAR_ERROR) << std::endl; // prints false + * } + * + * Hierarchical error codes allow new error codes to be specialized without breaking backward compatibility. + * + * Defining new error codes + * ------------------------ + * New error codes should typically be added to the ErrorCodes namespace. Error code string values should consist + * of lowercase alphanumeric or underscore characters separated by periods. + * + * Module-specific error code values should typically be prefixed with a module-specific token. The identifier + * should also be prefixed with a module-specific prefix. + * + * Examples: + * + * namespace AdobeMarketingMobile { + * namespace ErrorCodes { + * constexpr static const char* MYMODULE_CAMERA_UNAVAILABLE = "my_module.camera_unavailable"; + * } + * } + * + * Inner errors + * ------------ + * An SdkError may contain a nested error for additional information. @see HasInner(), GetInner(). + */ + class SdkError { + public: + /** + * Default constructor. + * + * The SdkError will be initialized with code ErrorCodes::NOTHING, no inner + */ + SdkError(); + + SdkError(const SdkError& right) = default; + SdkError& operator=(const SdkError& right) = default; + SdkError(SdkError&& right) = default; + SdkError& operator=(SdkError&& right) = default; + + /** + * Copies the given SdkError, replacing its debug information with the + * given debug_info. + * + * @param right - the error to copy + * @param debug_info - the new debug_info for the error + */ + explicit SdkError(const SdkError& right, + const DebugInfo& debug_info); + + /** + * Constructs an SdkError with the given error code and description. + * @param code - the error code + * @param message - a description of the error + * @param debug_info - (optional) debug information for the error + */ + explicit SdkError(const std::string& code, + const std::string& message, + const DebugInfo& debug_info = DebugInfo()); + + /** + * Constructs an SdkError with the given error code, description, and inner error. + * @param code - the error code + * @param message - a description of the error + * @param inner - the inner error + * @param debug_info - (optional) debug information for the error + */ + explicit SdkError(const std::string& code, + const std::string& message, + const SdkError& inner, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Converts a std::exception to an SdkError. + * + * Converted exceptions will a STD_ error codes. + * + * @param e - the std::exception to convert + * @param debug_info - (optional) debug information for the error + */ + static SdkError From(const std::exception& e, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Converts any exception to an SdkError. + * + * Converted std::exceptions will a STD_ error codes. + * Converted SdkErrors will be unchanged. + * Other errors will be converted to UNKNOWN_EXCEPTION. + * + * @param e - the exception to convert + * @param debug_info - (optional) debug information for the error + */ + static SdkError From(const std::exception_ptr& e, + const DebugInfo& debug_info = DebugInfo{}); + + /** + * Compares the error code of this against another error code, factoring in hierarchical codes. + * + * @return true if this' error code matches error_code + */ + bool CodeIs(const std::string& error_code) const; + + /** + * @return the error code. Consider using CodeIs() instead of this function. + */ + std::string GetCode() const; + + /** + * @return true if the error has a nested error + */ + bool HasInner() const; + + /** + * Obtains the nested error, if there is one. + * + * @param value - (out) if there is a nested error, value will be set to the nested error. + * + * @return true if the error has a nested error, false otherwise. + */ + bool GetInner(SdkError& value) const; + + /** + * @return a description of the error + */ + std::string GetMessage() const; + + /** + * @return the stack trace for a thrown exception + */ + const DebugInfo& GetDebugInfo() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString() const; + + /** + * Converts this to a string. Equivalent to calling `StringUtils::ToString(*this, options)`. + * + * @return a string representation of this + * + * @see StringUtils::ToString() + */ + std::string ToString(const ToStringOptions& options) const; + + /** + * @private + * + * For use by AdobeMarketingMobile::ToStringImpl(). + */ + void ToStringImpl(std::ostream& the_stream, const ToStringOptions& options) const; + + private: + std::string code_; ///<@private the error code from ErrorCodes namespace + std::shared_ptr inner_; ///<@private the inner exception, const to enable fast, shared copies + std::string message_; ///<@private the error description + DebugInfo debug_info_; ///<@private the stack trace + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, const SdkError& error, const ToStringOptions& options); + + /** + * Helper to swallow and log exceptions. + * + * Invokes f(), catching and logging any exceptions thrown by f(). This function + * is designed to work with C++ lambdas. + * + * Examples: + * + * void Foo(bool try_throw) { + * TrySwallow([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(ErrorCodes::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", then "foo" + * Foo(true); // prints "try", the exception, then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TrySwallow(const std::function& f) noexcept; + + /** + * Simple replacement for try-catch. Converts all exceptions to SdkError so a single catch block can be + * used. This function is designed to work with C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are converted to SdkError + * and catch_block() is called with the exception. + * + * Exceptions thrown from catch_block() are rethrown. They are not converted or translated to + * SdkError. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryCatch([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(ErrorCodes::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [&](SdkError& e) { + * std::cout << "catch" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", then "foo" + * Foo(true); // prints "try", "catch", then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryCatch(const std::function& try_block, + const std::function& catch_block); + + + /** + * Simple replacement for try-catch that adds a java-like finally. Converts all exceptions to + * SdkError so a single catch block can be used. This function is designed to work with + * C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are converted to SdkError + * and catch_block() is called with the exception. Before returning, the function always calls + * finally_block(). + * + * Exceptions thrown from catch_block() or finally_block() are rethrown. They are not converted + * to SdkErrors. If catch_block() throws an exception, finally_block() will still be invoked. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryCatchFinally([&] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(SdkErrorCode::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [&](SdkError& e) { + * std::cout << "catch" << std::endl; + * }, [&]() { + * std::cout << "finally" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", "finally", then "foo" + * Foo(true); // prints "try", "catch", "finally", then "foo" + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryCatchFinally(const std::function& try_block, + const std::function& catch_block, + const std::function& finally_block); + + /** + * C++ version of a java-like finally. This function is designed to work with C++ lambdas. + * + * Invokes try_block(), if any exceptions are thrown they are bubbled up (unconverted). + * Before exiting, the function always calls finally_block(). + * + * Exceptions thrown from finally_block() are rethrown. They are not converted to SdkExceptions. + * + * Examples: + * + * void Foo(bool try_throw) { + * TryFinally([=] { + * std::cout << "try" << std::endl; + * if(try_throw) { + * Throw(SdkErrorCode::UNEXPECTED, "try threw"); + * } + * std::cout << "try complete" << std::endl; + * }, [=]() { + * std::cout << "finally" << std::endl; + * }); + * std::cout << "foo" << std::endl; + * } + * + * void Bar() { + * Foo(false); // prints "try", "try complete", "finally", then "foo" + * Foo(true); // prints "try", "finally", then throws + * } + * + * Remember that returning from a C++11 lamba only exits the lambda, not the enclosing function. + */ + void TryFinally(const std::function& try_block, + const std::function& finally_block); + + /** + * Throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(SdkError error)); + + /** + * Creates and throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(const std::string& code, const std::string& message)); + + /** + * Creates and throws an SdkError, setting the stack trace if available. + * + * Deprecated. Use ADOBE_THROW instead. + */ + [[noreturn]] + ADOBE_DEPRECATED(void Throw(const std::string& code, const std::string& message, const SdkError& inner)); + + /** + * ADOBE_THROW(const SdkError& error) + * ADOBE_THROW(const std::string& code, const std::string& message) + * ADOBE_THROW(const std::string& code, const std::string& message, const SdkError& inner) + * + * Throws an SdkError setting the stack trace and providing line number information when available. + */ +#define ADOBE_THROW(...) \ + do { \ + throw AdobeMarketingMobile::SdkError{__VA_ARGS__, ADOBE_GET_CURRENT_DEBUG_INFO()}; \ + } while(false) + + /** + * Namespace that contains SdkError codes. @see SdkError + */ + namespace ErrorCodes { + constexpr static const char* NOTHING = ""; ///< Special error code for default constructed SdkErrors. Do not use + constexpr static const char* OK = "general.ok"; ///< The operation completed successfully. + constexpr static const char* INVALID_ARGUMENT = "general.invalid_argument"; ///< A function was called with bad argument + constexpr static const char* UNEXPECTED = "general.unexpected"; ///< An error that should never occur occurred + constexpr static const char* UNSUPPORTED = "general.unsupported"; ///< The desired functionality is not supported + constexpr static const char* UNKNOWN_EXCEPTION = "general.unknown_exception"; ///< An unrecognized exception was thrown + + // Standard library errors + constexpr static const char* STD_ERROR = "std"; ///< A standard library error occurred. + constexpr static const char* STD_LOGIC_ERROR = "std.logic_error"; ///< A std::logic_error occurred. + constexpr static const char* STD_DOMAIN_ERROR = "std.logic_error.domain_error"; ///< A std::domain_error occurred. + constexpr static const char* STD_INVALID_ARGUMENT = + "std.logic_error.invalid_argument"; ///< A std::invalid_argument occurred. + constexpr static const char* STD_LENGTH_ERROR = "std.logic_error.length_error"; ///< A std::length_error occurred. + constexpr static const char* STD_OUT_OF_RANGE = "std.logic_error.out_of_range"; ///< A std::out_of_range occurred. + constexpr static const char* STD_FUTURE_ERROR = "std.logic_error.future_error"; ///< A std::future_error occurred. + constexpr static const char* STD_RUNTIME_ERROR = "std.runtime_error"; ///< A std::runtime_error occurred. + constexpr static const char* STD_SYSTEM_ERROR = "std.runtime_error.system_error"; ///< A std::system_error occurred. + constexpr static const char* STD_RANGE_ERROR = "std.runtime_error.range_error"; ///< A std::range_error occurred. + constexpr static const char* STD_OVERFLOW_ERROR = + "std.runtime_error.overflow_error"; ///< A std::overflow_error occurred. + constexpr static const char* STD_UNDERFLOW_ERROR = + "std.runtime_error.underflow_error"; ///< A std::underflow_error occurred. + constexpr static const char* STD_BAD_CAST = "std.bad_cast"; ///< A std::bad_cast occurred. + constexpr static const char* STD_BAD_TYPEID = "std.bad_typeid"; ///< A std::bad_typeid occurred. + constexpr static const char* STD_BAD_EXCEPTION = "std.bad_exception"; ///< A std::bad_exception occurred. + constexpr static const char* STD_BAD_ALLOC = "std.bad_alloc"; ///< A std::bad_alloc occurred. + constexpr static const char* STD_BAD_ARRAY_NEW_LENGTH = + "std.bad_alloc.bad_array_new_length"; ///< A std::bad_array_new_length occurred. + constexpr static const char* STD_BAD_WEAK_PTR = "std.bad_weak_ptr"; ///< A std::bad_weak_ptr occurred. + constexpr static const char* STD_BAD_FUNCTION_CALL = + "std.bad_function_call"; ///< A std::bad_function_call occurred. + } +} + +#endif //ADOBEMOBILE_CORE_SDKERROR_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/StringUtils.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/StringUtils.h new file mode 100755 index 00000000..b4f6d319 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/StringUtils.h @@ -0,0 +1,1204 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_STRINGUTILS_H +#define ADOBEMOBILE_UTIL_STRINGUTILS_H + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "Object.h" + +namespace AdobeMarketingMobile { + + class ToStringOptions; + + class StringUtils { + public: + static const std::string LOG_PREFIX; + + // Do not reference these directly unless you need the default values. + // Instead, use the values from an instance of ToStringOptions + static const size_t DEFAULT_MAX_DEPTH; ///< @private the maximum nesting level of ToString + static const size_t DEFAULT_MAX_ELEMENTS; ///< @private the maximum number of collection elements to print + static const size_t DEFAULT_MAX_STRING_LENGTH; ///< @private the maximum number of string characters to print + + /** + * Split string into a word vector using regex delimiter and a limit + * This is specifically to emulate the String.Split call in Java. + * Limit parameter can have three effects depending on value: + * + * limit > 1 : The pattern will be applied at most limit-1 times and the output vector size will not be + * more than n. The output vectors last entry will contain all input beyond last matched pattern. + * + * limit = 1 : The input string is returned. + * + * limit = 0 : The pattern will be applied as many times as possible and the output vector can be of any size. + * Empty vector elements are discarded. + * + * limit < 0 : The pattern will be applied as many times as possible and the output vector can be of any size. + * + * @param str string to split + * @param regex_delim regex string delimiter used to split into words + * @param limit the number of results to return + * @return vector containing word strings + */ + static std::vector SplitWithLimit(const std::string& str, + const std::string& regex_delim, + size_t limit); + + /** + * Split string into a word vector using regex delimiter + * + * @param str string to split + * @param regex_delim regex string delimiter used to split into words + * @return vector containing word strings + */ + static std::vector Split(const std::string& str, + const std::string& regex_delim); + + /** + * Searches through a string and replaces occurances of old_string with new_string + * + * @param base_string the initial string to search through + * @param old_string the string to search for in the base_string + * @param new_string if old_string is found, new_string will replace it + * @return string with replaced strings + */ + static std::string Replace(const std::string& base_string, + const std::string& old_string, + const std::string& new_string); + + + /** + * Check if a string ends with suffix + * + * @param str string to check suffix + * @param suffix the suffix string + * @return bool whether the string str ends with the suffix + */ + static bool EndsWith(const std::string& str, const std::string& suffix); + + /** + * Read contents of a file. The "file://" prefix will be removed if present + * + * @param filename full path to file to read + * @return string containing the contents of the file + * @throws STD_SYSTEM_ERROR if an error occurs reading the file + */ + static std::string FileToString(const std::string& filename); + + /* @private + * Not porting this method from Java. String empty check is simple enough without added method call. + * If using std::string, know that it cannot be nullptr. + * std::string msg; + * if (msg.empty()) { ... } // true if empty + * If using C style string (rare) check for null then check for zero terminator. + * char* msg; + * if (msg && msg[0]) { ... } // true if nullptr or empty string + */ + //static bool IsNullOrEmpty(const char* msg); + + /** + * Generates a locale instance with en_US.UTF-8, if it fails then return the default locale. + * + * @return a locale object with en_US.UTF-8 if it is valid on the platform, otherwise the default locale + */ + static std::locale GetLocale(); + + /** + * Convert all characters in the given std::string to lowercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::string to convert to lowercase characters + * @param loc The locale rules to use for lowercase conversion + * @return std::string as lowercase + */ + static std::string ToLower(const std::string& str, const std::locale& loc); + + /** + * Convert all characters in the given std::wstring (wide string) to lowercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::wstring (wide string) to convert to lowercase characters + * @param loc The locale rules to use for lowercase conversion + * @return std::wstring as lowercase + */ + static std::wstring ToLower(const std::wstring& str, const std::locale& loc); + + /** + * Convert all characters in the given std::string to lowercase according to + * the US English (en_US) locale. This is a convenience method for internal processing or + * normalization of strings. + * Do not use this method for strings returned back to the application. Instead, prefer to + * use ToLower by passing in the application defined locale object. + * + * @param str The std::string to convert to lowercase characters + * @return std::wstring as lowercase + */ + static std::string ToLower(const std::string& str); + + /** + * Convert all characters in the given std::string to uppercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::string to convert to uppercase characters + * @param loc The locale rules to use for uppercase conversion + * @return std::string as uppercase + */ + static std::string ToUpper(const std::string& str, const std::locale& loc); + + /** + * Convert all characters in the given std::wstring (wide string) to uppercase according to the rules defined + * by the given std::locale. + * Note, for unicode characters, the given std::locale must support unicode (ie en_US.UTF-8) + * + * @param str The std::wstring (wide string) to convert to uppercase characters + * @param loc The locale rules to use for uppercase conversion + * @return std::wstring as uppercase + */ + static std::wstring ToUpper(const std::wstring& str, const std::locale& loc); + + /** + * Convert all characters in the given std::string to uppercase according to + * the US English (en_US) locale. This is a convenience method for internal processing or + * normalization of strings. + * Do not use this method for strings returned back to the application. Instead, prefer to + * use ToUpper by passing in the application defined locale object. + * + * @param str The std::string to convert to uppercase characters + * @return std::wstring as uppercase + */ + static std::string ToUpper(const std::string& str); + + /** + * Check if given string is a valid URL. + * + * @param url string to check + * @return true if the string is a valid URL, false otherwise + */ + static bool StringIsUrl(const std::string& url); + + /** + * Replaces the tokens present in the input string with the values present in the tokens + * + * @param inputString the string in which the tokens has to be replaced + * @param tokens the token map which has the values to be replaced. + * @return final string with replaced tokens + */ + static std::string ExpandTokens(const std::string& inputString, const std::map& tokens); + + + /** + * find all the valid tokens contained in the string, the regex for a valid token is '\{([a-zA-Z0-9_.%])+\}' + * + * @param input_string the input string + * @return the list of valid tokens contained in the input string + */ + static std::vector FindTokensForExpansion(const std::string& input_string); + + /** + * Equivalent to calling `StringUtils::Quotify(s, MAX_STRING_LENGTH)`; + */ + static std::string Quotify(const std::string& s); + + /** + * Wraps s in quotes, escaping special characters. + * + * The following characters are escaped: + * - newline as "\n" + * - horizontal tab as "\t" + * - vertical tab as "\v" + * - backspace as "\b" + * - carriage return as "\r" + * - form feed as "\f" + * - alert as "\a" + * - backslash as "\\" + * - single quote as "\'" + * - double quote as "\"" + * - characters with ascii values < ' ', as hex prefixed by `\x` + * - characters with ascii values > '~', as hex prefixed by `\x` + * + * @param s - the string to enclose in quotes + * @param max_string_length - the maximum string length to output. `max_string_length` characters of `s` will be + * included in the output. if the length of `s` exceeds `max_string_length`, the + * returned string will end with `..."`. if `max_string_length` is 0, all characters + * of `s` will included in the output. + * + * @return s surrounded by quotes, with special characters escaped. + */ + static std::string Quotify(const std::string& s, size_t max_string_length); + + /** + * Equivalent to `ToString(value, ToStringOptions{})`. + */ + template + static std::string ToString(const T& value); + + /** + * Converts value to a `std::string`. + * + * @param value - the value to convert + * @param options - options for serialization + * + * @returns value, converted to a `std::string` + * + * Introduction + * ------------ + * + * This function is a better version of std::to_string and iostreams. + * + * It improves upon iostream in the following ways: + * - ToString(...) supports collection types, pointers, and a few other types not supported by ostream. + * - ToString(...) detects re-entrancy and will stop infinite recursion. + * - ToString(...) can accept a formatting string. + * - ToString(...) can accept a additional, custom flags, as needed. + * + * ToString() also allows us to maintain strict control over the behavior of ToString(...). + * + * ToString() is used by the logging framework. Specifically, ToString() is used by StringUtils::FormatString(), + * which is used by the logging macros (ADOBE_LOG_DEBUG, etc). + * + * Example: + * + * std::cout << ToString + * + * Supported Types + * --------------- + * + * The following types for value are supported by default: + * - Standard library collection types: `vector`, `list`, `deque`, `map`, `multimap`, `set`, `multiset`, + * `unordered_map`,`unordered_multimap`, `unordered_set`, `unordered_multiset`, `pair`, `tuple` + * - Standard library smart pointers: `unique_ptr`, `shared_ptr`, `weak_ptr` + * - Raw pointers + * - Classes derived from `Object` or `ObjectInterface` + * - Primitives: `bool`, `char`, `unsigned char`, `int`, `unsigned int`, `long`, `unsigned long`, `long long`, + * `unsigned long long`, `float`, `double` + * - Strings: `const char*`, `string` + * - `std::chrono::milliseconds` + * + * Customizing String Output for Objects + * ------------------------------------- + * + * To provide a custom string representation for classes that derive from `Object` or `ObjectInterface`, + * override `ToStringImpl`. + * + * Example: + * + * namespace AdobeMarketingMobile { + * class MyObject : public Object { + * public: + * void ToStringImpl(std::ostream& the_stream, const ToStringOptions& options) const override { + * // the impl can be whatever string you feel is appropriate, but by convention, Objects + * // use a JSON-like structure + * the_stream << "MyObjectType {"; + * + * // Invoke the superclass implementation. + * // When invoking superclass, be sure to invoke Object::ToStringImpl directly, since + * + * the_stream << " super: "; + * Object::ToStringImpl(the_stream, options); + * + * the_stream << "}"; + * }; + * }; + * + * Customizing String Output for Other Types + * ----------------------------------------- + * + * To provide a custom string representation for other types, define an overload of `ToStringImpl`. + * + * The overload should belong to the `AdobeMarketingMobile` namespace and have the following signature: + * + * namespace AdobeMarketingMobile { + * void ToStringImpl(std::ostream& the_stream, const MyType& value, const ToStringOptions& options); + * } + * + * Where `MyType` is the type you would like to serialize. The string representation of `value` should be + * appended to `the_stream`. You may optionally choose to change the representation based on `options`. + * + * Example: + * + * namespace AdobeMarketingMobile { + * class MyType {}; + * + * void ToStringImpl(std::ostream& the_stream, const MyType& value, const ToStringOptions& options) { + * the_stream << "my custom serialization"; + * } + * } + * + */ + template + static std::string ToString(const T& value, + const ToStringOptions& options); + + /** + * Appends the string representation of `value` to the given `std::ostream`. + * + * @see ToString() + */ + template + static void ToString(std::ostream& the_stream, const T& value); + + /** + * Appends the string representation of `value` to the given `std::ostream` using the provided `options`. + * + * @see ToString() + */ + template + static void ToString(std::ostream& the_stream, const T& value, const ToStringOptions& options); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const char* format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const ToStringOptions& options, const char* format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const std::string& format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + static std::string FormatString(const ToStringOptions& options, const std::string& format); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const char* format, const TArgTypes& ... args); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const ToStringOptions& options, const char* format, const TArgTypes& ... args); + + /** + * Returns a formatted version of the given string. + * + * This function is used by the `Log` functions to format the output. + * + * Motivation + * ---------- + * This function was added instead of using sprintf or ostream for a few reasons: + * - It uses the same format as Java, which eases porting. + * - It will not causes crashes or corruption when invalid format strings are passed in. + * - It is extensible. + * - Under the covers, this function uses StringUtils::ToString() and gains all the benefits thereof: + * - Infinite recursion detection (a common string formatting error) + * - Support for collection types like `vector` and `map`. + * - Support for custom formatting options + * - Support for pointer types + * - Easy serialization of `Object` subclasses + * + * The Format String + * ----------------- + * The `format` string should follow the conventions of + * [Java's Formatter class](https://docs.oracle.com/javase/7/docs/api/java/util/Formatter.html). This is by + * design, as it allows for easier porting of Java code. The implementation does not implement all of the + * formatting options that are supported by the Java version, but has the capability to do so in the future. + * If an option is not supported, the default formatting for the argument will be used. Currently, the only + * option supported is argument indices. + * + * HOW CAN I CUSTOMIZE HOW MY OBJECT IS SERIALIZED? + * ------------------------------------------------ + * @see ToString() + * + * @param format - the format string + * @param args - the arguments for the foramt string + * + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const std::string& format, const TArgTypes& ... args); + + /** + * @returns a formatted version of the given string. + * + * @see FormatString() + */ + template + static std::string FormatString(const ToStringOptions& options, const std::string& format, const TArgTypes& ... args); + + private: + static std::mutex current_depths_mutex; ///< @private mutex that protects current_depths, do not let this mutex escape + + static std::map current_depths; ///< @private thread id to nesting level map + + static size_t GetCurrentDepth(); ///< @private @returns the current nesting level of ToString + + static void SetCurrentDepth(size_t depth); ///< @private sets the current nesting level of ToString + + static bool IsTokenValid(const std::string& + token); ///< @private Check whether the token is valid. A valid token should only contain characters [a-zA-Z0-9_.%] + }; + + /** + * Options for `ToString()`. `ToStringImpl` support for all options is optional. + */ + class ToStringOptions { + public: + ToStringOptions() = default; + ToStringOptions(const ToStringOptions&) = default; + ToStringOptions& operator=(const ToStringOptions&) = default; + ToStringOptions(ToStringOptions&&) = default; + ToStringOptions& operator=(ToStringOptions&&) = default; + + /** + * @returns a ToStringOptions with pretty set to true + */ + static ToStringOptions Pretty(); + + bool pretty = false; ///< if true, strings should be "pretty" + std::string pretty_indent; ///< the indent for newlines in pretty strings, each new level should be 4 spaces + bool quotify_strings = false; ///< if true, strings should be enclosed in quotes + std::string format; ///< if non-empty, the format that should be used for the value + size_t max_depth = StringUtils::DEFAULT_MAX_DEPTH; ///< the maximum nesting level of ToString + size_t max_elements = StringUtils::DEFAULT_MAX_ELEMENTS; ///< the maximum number of collection elements to print + size_t max_string_length = StringUtils::DEFAULT_MAX_STRING_LENGTH; ///< the maximum number of string characters to print + }; +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + + /** + * @private + * + * `ToStringImpl` for `std::chrono::milliseconds`. + */ + void ToStringImpl(std::ostream& the_stream, const std::chrono::milliseconds& the_duration, + const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `std::string`. + */ + void ToStringImpl(std::ostream& the_stream, const std::string& value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `const char*`. + */ + void ToStringImpl(std::ostream& the_stream, const char* value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `bool`. + */ + void ToStringImpl(std::ostream& the_stream, bool value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `char`. + */ + void ToStringImpl(std::ostream& the_stream, char value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned char` (and `uint8_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned char value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int` (and `int32_t`). + */ + void ToStringImpl(std::ostream& the_stream, int value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned int` (and `uint32_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned int value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long` (and `int64_t`). + */ + void ToStringImpl(std::ostream& the_stream, long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned long` (and `uint64_t`). + */ + void ToStringImpl(std::ostream& the_stream, unsigned long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long long`. + */ + void ToStringImpl(std::ostream& the_stream, long long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `unsigned long long`. + */ + void ToStringImpl(std::ostream& the_stream, unsigned long long value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `float`. + */ + void ToStringImpl(std::ostream& the_stream, float value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `double`. + */ + void ToStringImpl(std::ostream& the_stream, double value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `long double`. + */ + void ToStringImpl(std::ostream& the_stream, long double value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `uint16_t`. + */ + void ToStringImpl(std::ostream& the_stream, uint16_t value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int8_t`. + */ + void ToStringImpl(std::ostream& the_stream, int8_t value, const ToStringOptions& options); + + /** + * @private + * + * `ToStringImpl` for `int16_t`. + */ + void ToStringImpl(std::ostream& the_stream, int16_t value, const ToStringOptions& options); + + /** + * @private + * + * Default `ToStringImpl` for enum classes that derive from numeric types. + */ + template + typename std::enable_if::value, void>::type + // ^this confusing line matches this template only for enum classes that inherit from a numeric type + ToStringImpl(std::ostream& the_stream, TEnum value, const ToStringOptions& options) { + typedef typename std::underlying_type::type EnumUnderlyingNumericType; + ToStringImpl(the_stream, static_cast(value), options); + } + + /** + * @private + * + * Default `ToStringImpl` for raw pointers. + */ + template + void ToStringImpl(std::ostream& the_stream, const T* pointer, const ToStringOptions& options) { + if (pointer == nullptr) { + the_stream << "null"; + } else { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, *pointer, options); + } + } + + /** + * @private + * + * Default `ToStringImpl` for `shared_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::shared_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.get(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `weak_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::weak_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.lock(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `unique_ptr`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unique_ptr& pointer, const ToStringOptions& options) { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, pointer.get(), options); + } + + /** + * @private + * + * Default `ToStringImpl` for `pair`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::pair& the_pair, const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; // quotify strings + + the_stream << "[ "; + StringUtils::ToString(the_stream, the_pair.first, element_options); + the_stream << ", "; + StringUtils::ToString(the_stream, the_pair.second, element_options); + the_stream << " ]"; + } + + namespace StringUtilsInternal { + /** + * @private + * + * Helper for tuple Impl. Metaprogramming construct to append tuple elements to a stream. + * This is a very rare instance where metaprogramming is necessary. + */ + template < typename TTuple, size_t I = std::tuple_size::value - 1 > + struct AppendTupleElementsToStream { + static void Call(std::ostream& the_stream, const TTuple& the_tuple, const ToStringOptions& element_options) { + AppendTupleElementsToStream < TTuple, I - 1 >::Call(the_stream, the_tuple, element_options); + the_stream << ", "; + StringUtils::ToString(the_stream, std::get(the_tuple), element_options); + } + }; + + /** + * @private + * + * Stopping condition for the above metaprogramming. + */ + template + struct AppendTupleElementsToStream { + static void Call(std::ostream& the_stream, const TTuple& the_tuple, const ToStringOptions& element_options) { + the_stream << StringUtils::ToString(std::get<0>(the_tuple), element_options); + } + }; + } + + /** + * @private + * + * Default `ToStringImpl` for `tuple`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::tuple& the_tuple, + const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; // quotify strings + + the_stream << "[ "; + StringUtilsInternal::AppendTupleElementsToStream>::Call(the_stream, the_tuple, + element_options); + the_stream << " ]"; + } + + + + namespace StringUtilsInternal { + /** + * @private + * + * Actual implementation of `ToStringImpl` for collection types that are like arrays. + */ + template + void CollectionToStringImpl(std::ostream& the_stream, const T& collection, const ToStringOptions& options) { + ToStringOptions element_options{options}; + element_options.quotify_strings = true; + + the_stream << "["; + size_t element_index = 0; + + for (auto& element : collection) { + if (element_index == 0) { + the_stream << " "; + } else { + the_stream << ", "; + } + + if (element_index >= options.max_elements) { + the_stream << "..."; + break; + } + + the_stream << StringUtils::ToString(element, element_options); + + ++element_index; + } + + if (element_index > 0) { + the_stream << " "; + } + + the_stream << "]"; + } + } + + /** + * @private + * + * `ToStringImpl` for `vector`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::vector& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `list`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::list& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `deque`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::deque& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `map`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::map& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::multimap& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::set& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `multiset`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::multiset& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_map`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_map& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_multimap`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_multimap& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_set`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_set& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + /** + * @private + * + * `ToStringImpl` for `unordered_multiset`. + */ + template + void ToStringImpl(std::ostream& the_stream, const std::unordered_multiset& collection, + const ToStringOptions& options) { + StringUtilsInternal::CollectionToStringImpl(the_stream, collection, options); + } + + template + std::string StringUtils::ToString(const T& value) { + return ToString(value, ToStringOptions{}); + } + + template + std::string StringUtils::ToString(const T& value, const ToStringOptions& options) { + std::ostringstream the_stream; + ToString(the_stream, value, options); + return the_stream.str(); + } + + template + void StringUtils::ToString(std::ostream& the_stream, const T& value) { + ToString(the_stream, value, ToStringOptions{}); + } + + template + void StringUtils::ToString(std::ostream& the_stream, const T& value, const ToStringOptions& options) { + size_t current_depth = GetCurrentDepth(); + + if (current_depth >= options.max_depth) { + // infinite recursion guard + the_stream << "..."; + return; + } + + SetCurrentDepth(++current_depth); + + try { + // If you get an error on the following line, it means the type you passed in for value is not + // supported. See the doxygen for ToString(). + ToStringImpl(the_stream, value, options); + } catch (...) { + the_stream << "ERROR"; + } + + SetCurrentDepth(--current_depth); + } + + namespace StringUtilsInternal { + + /** + * @private + * + * Helper for FormatString. + * + * GenericFormatArgs and PolymorphicFormatArgs are used to represent the args to FormatString in a polymorphic + * manner. PolymorphicFormatArgs is the interface, and GenericFormatArgs is the implementation. + * + * See implementation of FormatString() for details. + */ + class PolymorphicFormatArgs { + public: + /** + * @private + * + * Destructor + */ + virtual ~PolymorphicFormatArgs() {} + + /** + * @private + * + * @return the number of arguments. + */ + virtual size_t GetSize() const = 0; + + /** + * @private + * + * Invokes ToString(...) on argument at the specified index. + */ + virtual void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const = 0; + }; + +#ifndef ADOBE_DOXYGEN + // doxygen cannot handle these templates + + /** + * @private + * + * Helper for FormatString. + * + * GenericFormatArgs and PolymorphicFormatArgs are used to represent the args to FormatString in a polymorphic + * manner. PolymorphicFormatArgs is the interface, and GenericFormatArgs is the implementation. + * + * See implementation of FormatString() for details. + */ + template + class GenericFormatArgs : public GenericFormatArgs { + public: + typedef GenericFormatArgs Super; + + /** + * @private + * + * Constructor + */ + explicit GenericFormatArgs(const TCurrentArg& current_arg, const TMoreArgs& ...more_args) : + Super{more_args...}, // template recurse, without first arg + current_arg_{current_arg} {} // save a ref to the first arg + + /** + * @private + * + * Impl of PolymorphicFormatArgs::GetSize + */ + size_t GetSize() const override { + // Deep C++: + // https://stackoverflow.com/questions/12024304/c11-number-of-variadic-template-function-parameters + return sizeof...(TMoreArgs) + 1; + } + + /** + * @private + * + * Impl of PolymorphicFormatArgs::CallToString + */ + void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const override { + if (index == 0) { + // 0 always refers to current arg + StringUtils::ToString(the_stream, current_arg_, options); + } else { + // template recursion. + // By subtracting 1 from index, we're basically performing a shift + // Stopping condition is + Super::CallToString(index - 1, the_stream, options); + } + } + + private: + const TCurrentArg& current_arg_; + }; + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + */ + template + class GenericFormatArgs : public PolymorphicFormatArgs { + public: + /** + * @private + * + * Constructor + */ + explicit GenericFormatArgs(const TCurrentArg& current_arg) : + current_arg_{current_arg} {} // save a ref to the first arg + + size_t GetSize() const override { + return 1; + } + + /** + * @private + * + * Impl of PolymorphicFormatArgs::CallToString + */ + void CallToString(size_t index, std::ostream& the_stream, const ToStringOptions& options) const override { + // Stopping condition + if (index == 0) { + // 0 always refers to current arg + StringUtils::ToString(the_stream, current_arg_, options); + } else { + // indices beyond size are noops + } + } + + private: + const TCurrentArg& current_arg_; + }; +#endif + + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + * + * Defined in StringUtils.cpp + */ + std::string PolymorphicFormatString(const ToStringOptions& options, const char* format, + const PolymorphicFormatArgs& args); + + /** + * @private + * + * Helper for FormatString. See implementation of FormatString() for explanation. + */ + template + std::string GenericFormatString(const ToStringOptions& options, const char* format, const TArgs& ...args) { + return PolymorphicFormatString(options, format, GenericFormatArgs {args...}); + } + } + + template + std::string StringUtils::FormatString(const ToStringOptions& options, const std::string& format, + const TArgs& ... args) { + return FormatString(options, format.c_str(), args...); + } + + template + std::string StringUtils::FormatString(const std::string& format, const TArgs& ... args) { + return FormatString(ToStringOptions{}, format.c_str(), args...); + } + + template + std::string StringUtils::FormatString(const char* format, const TArgs& ... args) { + return FormatString(ToStringOptions{}, format, args...); + } + + template + std::string StringUtils::FormatString(const ToStringOptions& options, const char* format, const TArgs& ... args) { + // This implementation is very confusing, but necessarily so, due to variadic templates. + // + // This implementation uses C++ features that are discouraged by our coding guidelines. This is OK in this case, + // since there is no other way to implement this function, minimize unnecessary memory allocations, and + // minimize binary size. + // + // To understand the C++ behind this implementation, you need to understand: + // - Variadic Templates: http://eli.thegreenplace.net/2014/variadic-templates-in-c/ + // - Template specialization + // - Polymorphic types vs. Generic types + // + // SHORT VERSION OF HOW THIS FUNCTION WORKS: + // + // - Through C++ magic, a call to FormatString(...) eventually becomes a call to PolymorphicFormatString(...). + // - PolymorphicFormatString is defined in StringUtils.cpp. + // + // LONG VERSION OF HOW THIS FUNCTION WORKS: + // + // 1) For clarity, FormatString() is a wrapper around GenericFormatString(). + // + // 2) GenericFormatString() is a generic (template) function. + // + // 3) We do not we do not want to duplicate code for every FormatString instantiation. To achieve this, + // we need to: + // + // - Convert args to a polymorphic (non-template) class. That's the hard part. The polymorphic + // class we eventually will convert to is PolymorphicFormatArgs. + // + // - Call a polymorphic function that has the real implementation and pass it the PolymorphicFormatArgs. + // That function is PolymorphicFormatString, which is defined in StringUtils.cpp. + // + // 4) GenericFormatArgList is a subclass of PolymorphicFormatArgs. Basically, it is a bridge that + // lets us treat our template arg list polymorphically. GenericFormatList works as follows: + // + // - GenericFormatArgList uses recursive templates. GenericFormatArgList is a subclass of + // GenericFormatArgList. GenericFormatArgList is a subclass of + // GenericFormatArgList. GenericFormatArgList is a subclass of PolymorphicFormatArgs + // (via template specialialization). + // + // - GenericFormatArgList::CallToString accepts an index, an ostream, and options and invokes ToString for + // the given argument at the given index. Because of our use of recursive templates, this function is also + // recursive. GenericFormatArgList<> is a noop, our stopping condition. + // + // 5) In GenericFormatString, we instantiate a GenericFormatArgList then pass it to PolymorphicFormatString + // (as a PolymorphicFormatArgs). + // + // 6) In PolymorphicFormatString, we do the actual work of parsing the string, formatting the args, and + // calling ToString() (indirectly via PolymorphicFormatArgs::CallToString). + // + // Whew. + return StringUtilsInternal::GenericFormatString(options, format, args...); + } +} + +#endif /* ADOBEMOBILE_UTIL_STRINGUTILS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h new file mode 100755 index 00000000..5e07662f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/SystemInfoServiceInterface.h @@ -0,0 +1,245 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H + +#include +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + class DisplayInformationInterface : public virtual ObjectInterface { + public: + /** + * Returns absolute width of the available display size in pixels. + * + * @return width in pixels if available. -1 otherwise. + */ + virtual int32_t GetWidthPixels() const = 0; + + /** + * Returns absolute height of the available display size in pixels. + * + * @return height in pixels if available. -1 otherwise. + */ + virtual int32_t GetHeightPixels() const = 0; + + /** + * Returns the screen dots-per-inch + * + * @return dpi if available. -1 otherwise. + */ + virtual int32_t GetDensityDpi() const = 0; + + }; + + class SystemInfoServiceInterface : public virtual ObjectInterface { + public: + enum class ConnectionStatus : int32_t { + CONNECTED = 0, + DISCONNECTED, + UNKNOWN + }; + + static constexpr const uint32_t MAX_THREAD_NAME_LEN{15}; + + /** + * Returns the currently selected / active locale value (as set by the user on the system). + * + * @return Locale value. + */ + virtual std::locale GetActiveLocale() const = 0; + + /** + * Returns the directory which can be used as a application data directory. + * + * @return A directory path string representing the application data directory + */ + virtual std::string GetApplicationBaseDir() const = 0; + + /** + * Returns the application specific cache directory. The application will be able to read and write to the + * directory, but there is no guarantee made as to the persistence of the data (it may be deleted by the system + * when storage is required). + * + * @return A directory path string representing the application cache directory. + */ + virtual std::string GetApplicationCacheDir() const = 0; + + /**x + * Returns the application name. + * + * @return Application name or empty if not available. + */ + virtual std::string GetApplicationName() const = 0; + + /** + * Returns the application version. + * + * @return Application version or empty if not available. + */ + virtual std::string GetApplicationVersion() const = 0; + + /** + * Returns the application version code as a string. + * + * @return Application version code formatted as string using the active locale, or empty if not available. + */ + virtual std::string GetApplicationVersionCode() const = 0; + + /** + * Return the contents of the asset file as a string. The given filename is a relative path to the + * application's assets folder. The application must have read access to the assets folder. + * + * @param filename relative file path of a file within the application's assets folder + * @return string contents of the assets file, or an empty string in case of an error + */ + virtual std::string GetAsset(const std::string& filename) const = 0; + + /** + * Returns a string that identifies a particular device OS build. + * + * @return Build ID string. + */ + virtual std::string GetDeviceBuildId() const = 0; + + /** + * Returns a human readable device name. + * + * @return Device name or empty if not available. + */ + virtual std::string GetDeviceName() const = 0; + + /** + * Returns information about the display hardware, as returned by the underlying OS. + * + * @see DisplayInformation + * + * @return std::shared_ptr Display information, or null if not available + */ + virtual std::shared_ptr GetDisplayInformation() const = 0; + + /** + * Returns a human readable mobile carrier name. + * + * @return A std::string representing the carrier name or empty if not available. + */ + virtual std::string GetMobileCarrierName() const = 0; + + /** + * Returns the state of the network connectivity + * + * @return SystemInfoService::ConnectionStatus. + */ + virtual SystemInfoServiceInterface::ConnectionStatus GetNetworkConnectionStatus() const = 0; + + /** + * Returns the string representation of the operating system name. + * + * @return Operating system name or empty if not available. + */ + virtual std::string GetOperatingSystemName() const = 0; + + /** + * Returns the string representation of the canonical platform name. + * + * @return Platform name string. + */ + virtual std::string GetCanonicalPlatformName() const = 0; + + /** + * @return a string with the current line number + * + * implementation is platform specific. + */ + virtual std::string GetCurrentStackTrace() const = 0; + + /** + * Returns the string representation of the operating system version. + * + * @return Operating system version or empty if not available. + */ + virtual std::string GetOperatingSystemVersion() const = 0; + + /** + * Returns the property value specific to the key from the manifest file. + * + * @param resource_key std::string key in the manifest file. + * @return A std::string value of the requested property or empty if not available. + */ + virtual std::string GetProperty(const std::string& resource_key) const = 0; + + /** + * Returns a string that identifies the SDK running mode, e.g. Application, Extension + * + * @return Running mode string + */ + virtual std::string GetRunMode() const = 0; + + /** + * Returns the version for the SDK, which is determined by the platform + * + * @return string containing the SDK version + */ + virtual std::string GetSdkVersion() const = 0; + + /** + * Returns the default platform/device user agent string + * + * @return string containing the default user agent + */ + virtual std::string GetDefaultUserAgent() const = 0; + + /** + * Set the name of the current thread + * + * @param name - Empty names are ignored and names longer than MAX_THREAD_NAME_LEN chars are truncated. + */ + virtual void SetCurrentThreadName(const std::string& name) const = 0; + + /** + * Sets the current system info service. Intended for use by Core. + */ + static void SetCurrentService(const std::shared_ptr& new_service); + + /** + * @return the current system info service + */ + static std::shared_ptr GetCurrentService(); + + private: + /** + * @private + * Lock for `current_service` + */ + static std::mutex mutex; + + /** + * @private + * The current system info service. + * Synchronized on mutex; + */ + static std::shared_ptr current_service; + }; +} + +#endif /* ADOBEMOBILE_PLATFORMSHIM_SYSTEMINFOSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h new file mode 100755 index 00000000..6ce5dc2d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutor.h @@ -0,0 +1,162 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TASKEXECUTOR_H +#define ADOBEMOBILE_CORE_TASKEXECUTOR_H + +#include "Object.h" +#include "TaskExecutorInterface.h" + +namespace AdobeMarketingMobile { + + class TaskExecutorData; + class PlatformServicesInterface; + class SystemInfoServiceInterface; + + /** + * @class TaskExecutor + * + * TaskExecutor implements a C++11 implementation of TaskExecutorInterface. + * + * TaskExecutor is a standard thread pool + task queue. See https://en.wikipedia.org/wiki/Thread_pool. + * Each TaskExecutor manages a set of worker threads and a synchronized task queue. Tasks are + * added to the back of the queue using AddTask(). The thread workers monitor the task queue. + * When tasks are added, all threads not currently running a task will wakeup and pull a task + * from the front of the queue (FIFO). Tasks are simply callable objects taking no parameters + * and returning no values. When a worker pulls a task it will immediately execute it. There + * are currently no guarantees on task start ordering. If an exception is thrown during task + * execution, the error callback (if any) will be called with the exception thrown and the + * task name (if any). When the pool needs to be closed, the owner calls Dispose() which + * flushes any remaining tasks and notifies the threads to shutdown. Each thread worker has a + * TaskExecutor reference which it retains until it terminates. + * + * Requirements + * ==================== + * - TaskExecutor must be implemented using standard C++11, nothing platform-specific. + * - TaskExecutor must be a standalone utility class (EventHub will use TaskExecutor). + * - TaskExecutor must have a method that cleanly shuts down all threads. + * - TaskExecutor must capture exceptions thrown during task execution and report them. + * - TaskExecutor must represent task as std::function to represent the callback. + * - TaskExecutor must support multiple threads in a pool. + * - TaskExecutor must allow multiple concurrent TaskExecutors to be instantiated. + * + * Future thinking + * ==================== + * - TaskExecutor should have a way to serialize sets of tasks (e.g. virtual thread number) + * - We might need a way to grow and shrink the pool dynamically (e.g. based on external load) + * -- This may mean we need a bidirectional channel with individual threads + * + * Task ordering models + * ==================== + * #1 Any start ordering <== this is our MVP + * + * #2 Strict sequential start ordering <== this can be accomplished with #3 or #4 + * + * #3 Strict sequential start order within a set, any start ordering between sets + * + * #4 Strict sequential start order between sets, any start ordering within a set + * + * #5 Any start ordering within a set or between sets, but sets are non-overlapping + * + */ + class TaskExecutor : public Object, public virtual TaskExecutorInterface { + public: + /** + * Constants + * + */ + static constexpr const uint32_t MAX_THREADS{16}; + static constexpr const std::chrono::milliseconds MAX_NOTIFICATION_WAIT{100}; + + /** + * Instantiate a default TaskExecutor with requested number of active worker threads. + * The TaskExecutor will begin with num_thread detached threads watching the task queue. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * + * @param num_threads - number of threads in the pool must be between 1 and MAX_THREADS. + * @return A valid TaskExecutor instance + */ + static std::shared_ptr Create(uint32_t num_threads); + + /** + * Instantiate a named TaskExecutor with requested number of active worker threads. + * The TaskExecutor will begin with num_thread detached threads watching the task queue. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4, "Worker"); + * + * @param num_threads - number of threads in the pool must be between 1 and MAX_THREADS. + * @param name - Name for threads owned by this executor. Truncated to MAX_THREAD_NAME_LENGTH chars as needed. + * @param platform - platform-specific services used for setting thread name. + * @return A valid TaskExecutor instance + */ + static std::shared_ptr Create(uint32_t num_threads, + const std::string& name, + const std::shared_ptr& platform); + + static std::shared_ptr Create(uint32_t num_threads, + const std::string& name, + const std::shared_ptr& system_info); + /** + * Destructor + */ + ~TaskExecutor() override; + + protected: + /** + * @protected + * + * Called by Create(). + * + */ + TaskExecutor(); + + /** + * @see TaskExecutorInterface + */ + bool DisposeImpl(std::chrono::milliseconds wait_time) override; + + /** + * @see TaskExecutorInterface + */ + bool AddTaskImpl(std::function task_callback, + std::function error_callback, + const std::string& task_name) override; + + private: + /** + * Actual implementation of DisposeImpl, but non-virtual so it can be invoked from the destructor safely. + */ + bool DisposeNonVirtualImpl(std::chrono::milliseconds wait_time); + + /** + * @private + * + * Private data used by TaskExecutor and shared with worker threads. + * + */ + std::shared_ptr data_; + }; + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TASKEXECUTOR_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h new file mode 100755 index 00000000..0d688eb2 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TaskExecutorInterface.h @@ -0,0 +1,190 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H +#define ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H + +#include +#include +#include +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + + class SdkError; + + /** + * @class TaskExecutorInterface + * + * A TaskExecutorInterface is a standard thread pool + task queue. See https://en.wikipedia.org/wiki/Thread_pool. + * + * A TaskExecutorInterface manages a set of zero or more workers and a task queue. AddTask() adds tasks to the back + * of the queue. Workers remove tasks from the queue (in FIFO order) and execute them. If a TaskExecutor has a + * single worker, tasks must be executed in the same order in which AddTask() was called. When a TaskExecutor + * has multiple workers, there are no ordering guarantees between tasks. + * + * TaskExecutor provides a C++11 implementation of TaskExecutorInterface that suits most needs. + */ + class TaskExecutorInterface : public virtual ObjectInterface { + public: + /** + * Constants + * + */ + static const char* DEFAULT_TASK_NAME; + static const std::chrono::milliseconds NO_DISPOSE_WAIT; + static const std::chrono::milliseconds MAX_DISPOSE_WAIT; + static const std::chrono::milliseconds DEFAULT_DISPOSE_WAIT; + + /** + * @brief Cleans up resources associated with this. + * + * Equivalent to: + * + * Dispose(DEFAULT_DISPOSE_WAIT); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * + * pool->Dispose(); + */ + bool Dispose(); + + /** + * @brief Cleans up resources associated with this. + * + * Tell all workers to stop consuming tasks. Tasks already in progress will continue + * to run, but no new tasks will be started. All pending tasks will be dropped. + * + * Waits up to `wait_time` millseconds for workers to terminate cleanly. `wait_time` is capped at 10s. + * + * Example #1: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * // shutdown and wait up to 1s for threads to terminate + * + * pool->Dispose(std::chrono::milliseconds(1000)); + * + * Example #2: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * // shutdown and don't wait for threads to terminate + * + * pool->Dispose(NO_DISPOSE_WAIT); + * + * @param wait_time - maximum time to wait for threads to finish (defaults to 10ms) + * @return true if threads have actually shutdown, false otherwise + */ + bool Dispose(std::chrono::milliseconds wait_time); + + /** + * @brief Adds a task to the queue. + * + * Equivalent to: + * + * AddTask(task_callback, [](std::string, SdkError&) {}, DEFAULT_TASK_NAME); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are ignored + * }); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback); + + /** + * @brief Adds a task to the queue. + * + * Equivalent to: + * + * AddTask(task_callback, error_callback, DEFAULT_TASK_NAME); + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are handed to your callback + * }, [&](std::string name, SdkError& e){ + * // handle the failure - default name passed + * }); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @param error_callback - a callable object passed with "unique" ownership, taking string and error parameters. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback, + std::function error_callback); + + /** + * @brief Add a task to the queue. + * + * After queuing, the task will be asynchronously executed by a worker. To execute the task, the worker + * will invoke `task_callback()`. If an error occurs, `error_callback(task_name, error)` will be invoked where + * `task_name` is the passed-in task name, and `error` represents the error that occurred. + * + * A TaskExecutorInterface with a single worker will always execute tasks in the order in which AddTask() was + * called. A TaskExecutorInterface with multiple workers provides no such guarantee. + * + * Calling AddTask() after Dispose() is a noop. + * + * Example: + * + * std::shared_ptr pool = TaskExecutor::Create(4); + * ... + * pool->AddTask([&](){ + * // do some work here, thrown exceptions are handed to your callback + * }, [&](std::string name, SdkError& e){ + * // handle the failure - "sketchy_task" passed for name + * }, "sketchy_task"); + * + * @param task_callback - a callable object passed with "unique" ownership. + * @param error_callback - a callable object passed with "unique" ownership, taking string and error parameters. + * @param task_name - a name to use for identifying this task. Reported to error_callback. + * @return true if task was added, false if Dispose() was called + */ + bool AddTask(std::function task_callback, + std::function error_callback, + const std::string& task_name); + + protected: + /** + * Actual implementation of AddTask. Subclasses should override this. + */ + virtual bool AddTaskImpl(std::function task_callback, + std::function error_callback, + const std::string& task_name) = 0; + + /** + * Actual implementation of AddTask. Subclasses should override this. + */ + virtual bool DisposeImpl(std::chrono::milliseconds wait_time) = 0; + }; + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TASKEXECUTORINTERFACE_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h new file mode 100755 index 00000000..5e53ae81 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/TimeUtils.h @@ -0,0 +1,73 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_TIMEUTILS_H +#define ADOBEMOBILE_UTIL_TIMEUTILS_H + +#include +#include +#include + +namespace AdobeMarketingMobile { + + class TimeUtils { + + public: + /** + * Get current unix timestamp + * + * @return current timestamp in milliseconds + */ + static std::chrono::milliseconds GetUnixTime(); + + /** + * Get current unix timestamp + * + * @return current timestamp in seconds + */ + static std::chrono::seconds GetUnixTimeInSeconds(); + + /** + * Get the timestamp from the provided time_point + * + * @return timestamp in milliseconds + */ + static std::chrono::milliseconds GetTimeInMilliseconds(const std::chrono::time_point + time_point); + + /** + * Get the the Iso8601 formatted date string for the current date + * @return Iso8601 formatted date string + */ + static std::string GetIso8601Date(); + + /** + * Get the the Iso8601 formatted date string for the passed in date + * @param date the date to generate the string for + * @return Iso8601 formatted date string + */ + static std::string GetIso8601Date(const std::tm* date); + + private: + TimeUtils() = delete; + + }; + +} + +#endif /* ADOBEMOBILE_UTIL_TIMEUTILS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Timer.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Timer.h new file mode 100755 index 00000000..246082d5 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Timer.h @@ -0,0 +1,220 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_TIMER_H +#define ADOBEMOBILE_CORE_TIMER_H + +#include +#include +#include "Common.h" +#include "Object.h" +#include "TaskExecutor.h" + +namespace AdobeMarketingMobile { + + /** + * @class TimerTask + * + * This class represents a timed task and is stored in the task queue. + * + */ + class TimerTask { + public: + static constexpr const std::chrono::milliseconds DO_NOT_REPEAT{-1}; + + /** + * Construct a TimerTask. A negative period indicates a task that does not repeat. + * + */ + TimerTask(const std::function& task, std::chrono::milliseconds period = DO_NOT_REPEAT) : + task_callback_(task), period_(period) {} + + public: + std::function task_callback_; + std::chrono::milliseconds period_; + }; + + /** + * @class Timer + * + * This is a timed task executor that leverages the TaskExecutor class. It is designed to cover roughly + * the same use cases that the Java Timer and TimerTask classes cover. All tasks scheduled on the same Timer will + * execute in serial, according to the start time specified. + * + * Questions + * ==================== + * How should Timer handle repeating tasks that fail? Currently Timer ignores failures. Tasks must handle errors. + * + */ + class Timer : public Object { + public: + static constexpr const std::chrono::milliseconds TIMER_SHUTDOWN_MAX_WAIT{100}; + static constexpr const std::chrono::milliseconds TIMER_RUNNING_MAX_WAIT{1000}; + + /** + * Construct a Timer. + * + * Examples: + * + * std::shared_ptr timer = Timer::Create(); + * + */ + static std::shared_ptr Create(); + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& platform_services); + static std::shared_ptr Create(const std::string& name, + const std::shared_ptr& system_info_service); + + /** + * Destructor + * + */ + ~Timer(); + + /** + * Terminates this timer, discarding any currently scheduled tasks. + * Will wait a maximum of `wait_time` milliseconds. + * + * Examples: + * + * std::shared_ptr timer = std::make_shared(); + * timer->Schedule([](){...}, std::chrono::seconds(10000)); + * ... + * timer->Cancel(); + * + * @param wait_time - the time to wait for tasks to complete + * @return true if tasks completed before wait time, false otherwise + */ + ADOBE_VIRTUAL_FOR_TESTS bool Cancel(std::chrono::milliseconds wait_time = TIMER_SHUTDOWN_MAX_WAIT); + + /** + * Schedules the specified task for execution at the specified time. + * + * Examples: + * + * std::shared_ptr timer = std::make_shared(); + * timer->Schedule([](){...}, std::chrono::now() + std::chrono::seconds(10000)); + * + * @param task - a callable to execute at the appropriate time + * @param start_time - the time to execute the task + * @return true if task was scheduled, false if Timer::Cancel() was already called + */ + ADOBE_VIRTUAL_FOR_TESTS bool Schedule(const std::function& task, + std::chrono::system_clock::time_point start_time); + + /** + * Schedules the specified task for repeated fixed-rate execution, beginning at the specified time. + * + * Example: + * + * std::shared_ptr timer = std::make_shared(); + * timer->ScheduleAtFixedRate([](){...}, + * std::chrono::now() + std::chrono::seconds(100), + * std::chrono::seconds(60)); + * + * @param task - a callable to execute at the appropriate time + * @param start_time - the time to execute the task + * @param period - the period at which the task will be repeated once the loop is started + * @return true if task was scheduled, false if Timer::Cancel() was already called + */ + ADOBE_VIRTUAL_FOR_TESTS bool ScheduleAtFixedRate(const std::function& task, + std::chrono::system_clock::time_point start_time, + std::chrono::milliseconds period); + + protected: + /** + * @protected + * Called by Create(). This is not exposed because we don't want these to be created on the stack. + */ + Timer(const std::string& name, + const std::shared_ptr& system_info_service); + + /** + * @private + * Second half of two-phase Timer construction + */ + ADOBE_VIRTUAL_FOR_TESTS void StartTimerThread(); + + private: + + /** + * @private + * Mutex used to synchronize Timer with its task thread. + */ + std::mutex mutex_; + + /** + * @private + * Condition variable used to signal when new tasks are added or Cancel is called. + */ + std::condition_variable condition_; + + // TODO: (AMSDK-5892) Consider using atomic for cancel_called_ + /** + * @private + * Flag to signal to task thread that Cancel was called. + */ + bool cancel_called_; + + /** + * @private + * Thread pool. + */ + std::shared_ptr executor_; + + /** + * @private + * The queue of scheduled tasks. + */ + std::multimap tasks_; + + std::string name_; + + std::shared_ptr system_info_service_; + + bool flag_task_added; + }; + +} + +///////////////////////////////////////// +// template and inline implementations // +///////////////////////////////////////// + +namespace AdobeMarketingMobile { + /* Templated version of Schedule() for convenience */ + template + bool Schedule(const std::function& task, std::chrono::time_point start_time) { + auto start_time_system_clock = std::chrono::time_point_cast(start_time); + return Schedule(task, start_time_system_clock); + } + + /* Templated version of ScheduleAtFixedRate() for convenience */ + template + bool ScheduleAtFixedRate(const std::function& task, + std::chrono::time_point start_time, + std::chrono::duration period) { + auto start_time_system_clock = std::chrono::time_point_cast(start_time); + auto period_milliseconds = std::chrono::duration_cast(period); + return ScheduleAtFixedRate(task, start_time_system_clock, period_milliseconds); + } + + +} // end of namespace AdobeMarketingMobile + +#endif //ADOBEMOBILE_CORE_TIMER_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h new file mode 100755 index 00000000..a03dc5e7 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UIServiceInterface.h @@ -0,0 +1,269 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H + +#include +#include "Object.h" +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Enum representing application states + */ + enum class AppState : int32_t { + FOREGROUND = 0, // app is in the foreground + BACKGROUND, // app is in the background + UNKNOWN // unknown app state + }; + + /** + * Alert message event listener + */ + class AlertListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked on positive button clicks + */ + virtual void OnPositiveResponse() = 0; + + /** + * Invoked on negative button clicks + */ + virtual void OnNegativeResponse() = 0; + + /** + * Invoked when the alert is displayed + */ + virtual void OnShow() = 0; + + /** + * Invoked when the alert is dismissed + */ + virtual void OnDismiss() = 0; + }; + + /** + * UI service interface defining a fullscreen message + */ + class FullScreenMessageUiInterface : public virtual ObjectInterface { + public: + /** + * Display the fullscreen message + */ + virtual void Show() = 0; + + /** + * Open a url from this message + * + * @param url String the url to open + */ + virtual void OpenUrl(const std::string& url) = 0; + + /** + * Remove the fullscreen message from view. + */ + virtual void Remove() = 0; + }; + + /** + * Fullscreen message event listener + */ + class FullscreenListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked when the fullscreen message is displayed + * + * @param message FullscreenMessage the message being displayed + */ + virtual void OnShow(const std::shared_ptr& message) = 0; + + /** + * Invoked when the fullscreen message is dismissed + * + * @param message FullscreenMessage the message being dismissed + */ + virtual void OnDismiss(const std::shared_ptr& message) = 0; + + /** + * Invoked when the fullscreen message is attempting to load a url + * + * @param message FullscreenMessage the message attempting to load the url + * @param url String the url being loaded by the message + * + * @return True if the core wants to handle the URL (and not the fullscreen message view implementation) + */ + virtual bool OverrideUrlLoad(const std::shared_ptr& message, const std::string& url) = 0; + }; + + /** + * Listener for app state transition events + */ + class AppStateListenerInterface : public virtual ObjectInterface { + public: + /** + * invoked when the application transitions into the AppState::FOREGROUND state + */ + virtual void OnForeground() = 0; + + /** + * invoked when the application transitions into the AppState::BACKGROUND state + */ + virtual void OnBackground() = 0; + }; + + /** + * Listener for UI floating button + */ + class FloatingButtonListenerInterface : public virtual ObjectInterface { + public: + /** + * Invoked when the floating button is tapped + */ + virtual void OnTapDetected() = 0; + + /** + * Invoked when the floating button is dragged on the screen + */ + virtual void OnPanDetected() = 0; + }; + + /** + * UI service interface defining a floating button + */ + class FloatingButtonInterface : public virtual ObjectInterface { + public: + /** + * Display the floating button on the screen + */ + virtual void Display() = 0; + + /** + * Remove the floating button + */ + virtual void Remove() = 0; + }; + + /** + * Interface for displaying alerts, local notifications, and fullscreen web views + */ + class UIServiceInterface : public virtual ObjectInterface { + public: + + /** + * Display an alert + * + * @param title String alert title + * @param message String alert message + * @param positive_button_text String positive response button text. Positive button will not be displayed if this value is null or empty + * @param negative_button_text String negative response button text. Negative button will not be displayed if this value is null or empty + * @param listener AlertListener listener for alert message events + */ + virtual void ShowAlert(const std::string& title, + const std::string& message, + const std::string& positive_button_text, + const std::string& negative_button_text, + const std::shared_ptr& listener) = 0; + + + + /** + * Create a fullscreen message + * + * @param html String html content to be displayed with the message + * @param fullscreenListener FullscreenListener listener for fullscreen message events + * @return FullscreenMessage object if the html is valid, null otherwise + */ + virtual std::shared_ptr CreateFullscreenMessage(const std::string& html, + const std::shared_ptr& fullscreenListener) = 0; + /** + * Display a local notification + * + * @param identifier String unique identifier for the local notification + * @param content String notification message content + * @param sound String notification message sound + * @param category String notification message category + * @param delay_seconds int number of seconds to wait before displaying this local notification + * @param deep_link String the link to be opened on notification clickthrough + * @param fire_date number of seconds from epoch when the local notification should fire + * @param user_info String (json) additional data for the local notification + */ + virtual void ShowLocalNotification(const std::string& identifier, + const std::string& content, + const std::string& sound, + const std::string& category, + std::chrono::seconds delay_seconds, + const std::string& deep_link, + std::chrono::seconds fire_date, + const std::string& user_info) = 0; + + /** + * Triggers the \p url to be shown by the platform. + * For example, if this URL contains a http scheme, then the URL will be handled by the system http handler. + * This API does not require a specific scheme, and will do the best effort to trigger the URL on the platform. + * + * @returns true, if the url was successfully shown. + */ + virtual bool ShowUrl(const std::string& url) = 0; + + /** + * Creates and returns an instance of UIService. + * + */ + static std::shared_ptr Create(); + + /** + * Get the current application state + * + * @return AppState the current application state + */ + virtual AppState GetAppState() const = 0; + + /** + * Register application state transition listener + * + * @param listener an implementation of AppStateListener + */ + virtual void RegisterAppStateListener(const std::shared_ptr& listener) = 0; + + /** + * Unregister application state transition listener + * + * @param listener the AppStateListener to unregister + */ + virtual void UnregisterAppStateListener(const std::shared_ptr& listener) = 0; + + /** + * Creates a floating button instance + * + * @param listener used for tracking UI floating button activity (tap/drag). + */ + virtual std::shared_ptr CreateFloatingButton(const + std::shared_ptr& + listener) = 0; + + /** + * Returns true if there is another message displayed at this time, false otherwise. + * The status is collected from the platform messages monitor and it applies if either + * an alert message or a full screen message is displayed at some point. + */ + virtual bool IsMessageDisplayed() = 0; + }; +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_UISERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h new file mode 100755 index 00000000..799a4754 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/URLServiceInterface.h @@ -0,0 +1,66 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H +#define ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H + +#include "ObjectInterface.h" + +namespace AdobeMarketingMobile { + /** + * Interface for parsing URL strings + */ + class URLServiceInterface : public virtual ObjectInterface { + public: + + /** + * Extracts the query parameters as string. Any percent-encoded characters are not unescaped. + * If given URL does not conform to RFC standard, this method returns empty string. + * Example: for URL http://www.example.com/index.php?key1=value1&key2=value2, the query string is key1=value1&key2=value2 + * + * @return URL query + */ + virtual std::string GetQuery(const std::string& url) const = 0; + + /** + * Extracts the URL path, unescaped. If given URL does not conform to RFC standard, this method returns empty string. + * Example: for URL http://www.example.com/index.html, the path is /index.html + * + * @return URL path + */ + virtual std::string GetPath(const std::string& url) const = 0; + + /** + * Extracts the scheme of given URL. If given URL is invalid, it returns empty string. + * Example: for URL http://www.example.com/index.html, the scheme is http + * + * @return URL scheme + */ + virtual std::string GetScheme(const std::string& url) const = 0; + + /** + * Extracts the host of given URL. If given URL is invalid, it returns empty string. + * Example: for URL http://www.example.com/index.html, the host is www.example.com + * + * @return URL host + */ + virtual std::string GetHost(const std::string& url) const = 0; + }; + +} // namespace +#endif /* ADOBEMOBILE_PLATFORMSHIM_URLSERVICEINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h new file mode 100755 index 00000000..a57e8a30 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlBuilder.h @@ -0,0 +1,120 @@ +/**************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLBUILDER_H +#define ADOBEMOBILE_UTIL_URLBUILDER_H + +#include +#include + +namespace AdobeMarketingMobile { + + class UrlBuilder { + + public: + enum class EncodeType : int32_t { + NONE = 1, + ENCODE + }; + + /** + * constructor + */ + UrlBuilder(); + + UrlBuilder(const UrlBuilder&) = delete; + + UrlBuilder& operator=(const UrlBuilder&) = delete; + + UrlBuilder(UrlBuilder&&) = delete; + + UrlBuilder&& operator=(UrlBuilder&&) = delete; + + /** + * set whether SSL is enabled + * @param ssl_enabled the boolean flag to indicated whether SSL is enabled + * @return this + */ + UrlBuilder& EnableSsl(const bool ssl_enabled); + + /** + * set the host after converting host name to lowercase string. + * @param host host name + * @return this + */ + UrlBuilder& SetHost(const std::string& host); + + /** + * add path to the url, should not include '/' in the string + * @param path path string without '/' + * @return this + */ + UrlBuilder& AddPath(const std::string& path); + + /** + * add multiple query parameters + * @param query_parameters the map containing query parameters + * @return this + */ + UrlBuilder& AddQueryParameters(const std::map& query_parameters); + + /** + * add one query parameter with key/value pair, both key and value will be encoded + * @param key the key of the query parameter + * @param value the value of the query parameter + * @return this + */ + UrlBuilder& AddQueryParameter(const std::string& key, const std::string& value); + + /** + * add a whole string as a query in the url, the string will be encoded + * @param new_query the query string to be added to the url + * @return this + */ + UrlBuilder& AddQuery(const std::string& new_query); + + /** + * add a whole string as a query in the url + * @param new_query the query string to be added to the url + * @param encode_type encode type to be used to encode the query + * @return this + */ + UrlBuilder& AddQuery(const std::string& new_query, const EncodeType encode_type); + + /** + * build the url string based on all the data provided before + * @return the url string + */ + std::string Build(); + + private: + bool ssl_enabled_ = false; + std::string path_; + std::string host_; + std::string query_; + + std::string url_; + bool did_build_; + + void ThrowIfAlreadyBuilt(); + + }; + +} + +#endif /* ADOBEMOBILE_UTIL_URLBUILDER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h new file mode 100755 index 00000000..7f4a2b48 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlEncoder.h @@ -0,0 +1,51 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLENCODER_H +#define ADOBEMOBILE_UTIL_URLENCODER_H + +#include + +namespace AdobeMarketingMobile { + + class UrlEncoder { + public: + static std::string Encode(const std::string& raw_value); + static std::string Decode(const std::string& encoded_value); + private: + static inline unsigned char HexDecode(char c) { + if (c >= '0' && c <= '9') { + return c - '0'; + } + + if (c >= 'a' && c <= 'f') { + return c - 'a' + 10; + } + + if (c >= 'A' && c <= 'F') { + return c - 'A' + 10; + } + + return 255; + }; + }; + +} + +#endif /* ADOBEMOBILE_UTIL_URLENCODER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h new file mode 100755 index 00000000..7aad02e1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/UrlUtil.h @@ -0,0 +1,38 @@ +/*************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + * + **************************************************************************/ + +#ifndef ADOBEMOBILE_UTIL_URLUTIL_H +#define ADOBEMOBILE_UTIL_URLUTIL_H + +namespace AdobeMarketingMobile { + class UrlUtil { + public: + + /** + * Extracts the query parameters as a map from the given deep link query. If one parameter + * is null or empty or either key/value is empty, that parameter will be skipped + * + * @param deep_link_query query string extracted from the deep link/universal link + */ + static std::map ExtractQueryParameters(const std::string& deep_link_query); + }; +} + +#endif /* ADOBEMOBILE_UTIL_URLUTIL_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Variant.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Variant.h new file mode 100755 index 00000000..8e39bf1b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/Variant.h @@ -0,0 +1,454 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANT_H +#define ADOBEMOBILE_CORE_VARIANT_H + +#include +#include +#include "Object.h" +#include "Expected.h" +#include "VariantSerializerInterface.h" +#include "Common.h" + +namespace AdobeMarketingMobile { + enum class VariantKind : int32_t; + + /** + * @class Variant + * + * A variant is an Object that can contain different types of data. A variant can contain + * one of the following: + * - a std::string + * - an int32_t (referred to as an Integer) + * - an int64_t (referred to as a Long) + * - a bool + * - a std::map> (referred to as a Map or VariantMap) + * - a std::vector> (referred to as a Vector or VariantVector) + * - null + * + * CONSTRUCTING A VARIANT + * ---------------------- + * Variant::FromXyz(...) functions can be used to construct a variant: + * + * std::shared_ptr v = Variant::FromInteger(123); // constructs a variant that contains 123 + * + * INSPECTING A VARIANT + * -------------------- + * Variant::GetKind(...) and Variant::GetXyz(...) can be used to get the value of a variant: + * + * Example: + * + * std::shared_ptr v = Variant::FromLong(123L); // constructs a variant that contains 123L + * v->GetKind(); // returns VariantKind::LONG + * int64_t aLong; + * v->GetLong(aLong); // returns true and sets aLong to 123L + * std::shared_ptr anObject; + * v->GetObject(anObject); // returns false + * + * Variant::GetXyz(...) will not perform any type conversions. For example, if an int32_t is stored in a + * variant, calling GetLong(...) will not convert the int32_t to an int62_t. + * + * STORING VARIANTS IN A COLLECTION + * -------------------------------- + * The primary use of variants is to store different types of data in a single collection: + * + * Example: + * + * std::vector> aVector; + * aVector.push(Variant::FromString("hello")); + * aVector.push(Variant::FromInteger(123)); + * aVector.push(Variant::FromObject(std::make_shared())); + * + * LIMITS ON VARIANT VALUES + * -------------------------------- + * Because JSON is widely exchanged and processed on a wide range of platforms, it is practical to look at common + * limitations to avoid overflow issues. Most JSON parser implementations use a double for holding all numeric + * types. This leads to a range of [-(2**53)+1, (2**53)-1] for integers, since only that range can be accurately + * represented in a double. + * More discussion in + * RFC-7159: https://tools.ietf.org/html/rfc7159#section-6 + * ECMA-262: https://tc39.github.io/ecma262/#sec-number.min_safe_integer + */ + class Variant : public Object { + public: + static const int64_t MAX_SAFE_INTEGER = 9007199254740991; + static const int64_t MIN_SAFE_INTEGER = -9007199254740991; + + // returns a new variant with no value + static std::shared_ptr FromNull(); + + /** + * @return a new variant with the given string as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromString(const std::string& value); + + /** + * @return a new variant with the given int32 as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromInteger(int32_t value); + + /** + * @return a new variant with the given int64 as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromLong(int64_t value); + + /** + * @return a new variant with the given double as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromDouble(double value); + + /** + * @return a new variant with the given bool as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromBoolean(bool value); + + /** + * @return a new variant with the given map as its value. + * Objects will be stored by reference. + */ + static std::shared_ptr FromVariantVector(const std::vector>& value); + + /** + * @return a new variant with the given string map as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromStringMap(const std::map& out_value); + + /** + * @return a new variant with the given string vector as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromStringVector(const std::vector& value); + + /** + * @return a new variant with the given variant map as its value. + * Objects will be stored by reference. + * + * @note The variant will contain a COPY of the given string map. + */ + static std::shared_ptr FromVariantMap(const std::map>& out_value); + + // returns a new variant whose value is serialized from the given typed object + // NOTE: The variant will contain a COPY of the given object. + template + static std::shared_ptr FromTypedObject(const TObject* val); + + // returns a new variant whose value is serialized from a vector of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedObject(const TObject* val, + const std::shared_ptr>& s); + + // returns a new variant whose value is serialized from a vector of the given typed object + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedVector(const std::vector>& val); + + // returns a new variant whose value is serialized from a vector of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given vector. + template + static std::shared_ptr FromTypedVector(const std::vector>& val, + const std::shared_ptr>& s); + + // returns a new variant whose value is serialized from a map of the given typed object + // NOTE: The variant will contain a COPY of the given map. + template + static std::shared_ptr FromTypedMap(const std::map>& val); + + // returns a new variant whose value is serialized from a map of the given typed object and serializer + // NOTE: The variant will contain a COPY of the given map. + template + static std::shared_ptr FromTypedMap(const std::map>& val, + const std::shared_ptr>& s); + + /** + * @return true if variant is of INTEGER/LONG/DOUBLE kind + * @param kind - VariantKind + */ + static bool IsNumericKind(const VariantKind& kind); + + /** + * @return the kind of value that this variant stores + * @return VariantKind - the kind of variant + */ + virtual VariantKind GetKind() const = 0; + + /** + * @return if this' value is a string, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetString(std::string& out_value) const; + + /** + * @return if this' value is an integer, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetInteger(int32_t& out_value) const; + + /** + * @return if this' value is a long, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetLong(int64_t& out_value) const; + + /** + * @return if this' value is a double, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetDouble(double& out_value) const; + + /** + * @return if this' value is a boolean, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + */ + virtual bool GetBoolean(bool& out_value) const; + + /** + * @return if this' value is a variant vector, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + * + * @note This function will COPY the stored map. + */ + virtual bool GetVariantVector(std::vector>& out_value) const; + + /** + * @return if this' value is a string map, returns true and sets \p out_value to the variant's value. + * Otherwise, returns false. + * + * @note This function will COPY the stored map. + */ + bool GetStringMap(std::map& out_value) const; + + // if this' value is a variant map, returns true and sets out_value to the variant's value. + // otherwise, returns false. + // + // NOTE: This function will COPY the stored map. + virtual bool GetVariantMap(std::map>& out_value) const; + + // if typed object can be created from value, return typed object. Else return StdError. + template + Expected> GetTypedObject() const; + + // if typed object can be created from value and given serializer, return typed object. Else return StdError. + template + Expected> GetTypedObject(const std::shared_ptr>& s) const; + + // if vector of typed object can be created from value, return vector of typed object. Else return StdError. + // NOTE: This function will COPY the stored vector. + template + Expected>> GetTypedVector() const; + + // if vector of typed object can be created from value and given serializer, return vector of typed object. Else return StdError. + // NOTE: This function will COPY the stored vector. + template + Expected>> GetTypedVector(const + std::shared_ptr>& s) const; + + /** + * @return if map of typed object can be created from value, return map of typed object. Else return StdError. + * + * @note This function will COPY the stored map. + */ + template + Expected>> GetTypedMap() const; + + + /** + * @return if map of typed object can be created from value and given serializer, return map of typed object. Else return StdError. + * + * @note This function will COPY the stored map. + */ + template + Expected>> GetTypedMap(const + std::shared_ptr>& s) const; + /** + * @return a copy of this. If this' value is an object, the new variant's value will refer + * to the same object as the old variant. Otherwise, the new variant's value will be a copy + * of the old variant's value. + */ + virtual std::shared_ptr Copy() const = 0; + + // Equals is implemented by subclasses. + // Two variants are equal if all of the following are true: + // - They are both Variants + // - They are both the same kind + // - If both values are an object, the values are Equal + // - If both values are not an object, the values are == + // bool Equals(const ObjectInterface& right) const override final; + + /** + * @see ObjectInterface::ToStringImpl() + */ + std::string ToStringImpl(const ToStringOptions& options) const override; + + /** + * @return if this' value is a string or numeric type that can be converted to double, returns true and + * sets \p out_value to the converted double value. + * Otherwise, returns false. + */ + virtual bool ConvertToDouble(double& out_value) const; + + /** + * @return if this' value is a numeric type that can be converted to string, returns true and + * sets \p out_value to the converted string value. + * Otherwise, returns false. + */ + virtual bool ConvertToString(std::string& out_value) const; + + protected: + // Internal use only + Variant() {}; + }; + + + + ///////////////////////////////// + // template/inline definitions // + ///////////////////////////////// + + // Error codes specific to Variants + namespace ErrorCodes { + constexpr static const char* VARIANT_NOT_TYPE = "variant.not_type"; ///< Variant does not contain requested type + constexpr static const char* VARIANT_NOT_VECTOR = "variant.not_vector"; ///< Variant does not contain a vector + constexpr static const char* VARIANT_NOT_MAP = "variant.not_map"; ///< Variant does not contain a map + } + + template + struct GetDefaultSerializer { + using type = typename TObject::Serializer; + }; + + template + using Serializer = typename GetDefaultSerializer::type; + + template + std::shared_ptr Variant::FromTypedObject(const TObject* objptr) { + return Variant::FromTypedObject(objptr, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedObject(const TObject* objptr, + const std::shared_ptr>& s) { + if (objptr == nullptr) { + return Variant::FromNull(); + } + return s->Serialize(*objptr); + } + + template + std::shared_ptr Variant::FromTypedVector(const std::vector>& typed_vector) { + return Variant::FromTypedVector(typed_vector, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedVector(const std::vector>& typed_vector, + const std::shared_ptr>& s) { + std::vector> variant_vector; + for (auto& item : typed_vector) { + variant_vector.push_back(FromTypedObject(item.get(), s)); + } + return Variant::FromVariantVector(variant_vector); + } + + template + std::shared_ptr Variant::FromTypedMap(const std::map>& typed_map) { + return Variant::FromTypedMap(typed_map, std::make_shared>()); + } + + template + std::shared_ptr Variant::FromTypedMap(const std::map>& typed_map, + const std::shared_ptr>& s) { + std::map> variant_map; + for (auto& item : typed_map) { + variant_map.insert({ item.first, FromTypedObject(item.second.get(), s) }); + } + return Variant::FromVariantMap(variant_map); + } + + template + Expected> Variant::GetTypedObject() const { + return GetTypedObject(std::make_shared>()); + } + + template + Expected> Variant::GetTypedObject(const std::shared_ptr>& + s) const { + return s->Deserialize(*this); + } + + template + Expected>> Variant::GetTypedVector() const { + return GetTypedVector(std::make_shared>()); + } + + template + Expected>> Variant::GetTypedVector(const + std::shared_ptr>& s) const { + std::vector> variant_vector; + if (GetVariantVector(variant_vector)) { + std::vector> typed_vector; + for (auto& variant : variant_vector) { + Expected> typed_object = variant->GetTypedObject(s); + if (typed_object) { + typed_vector.push_back(typed_object.Value()); + } else { + return { typed_object.Error() }; + } + } + return { typed_vector }; + } + return { SdkError(ErrorCodes::VARIANT_NOT_VECTOR, "type conversion error") }; + } + + template + Expected>> Variant::GetTypedMap() const { + return GetTypedMap(std::make_shared>()); + } + + template + Expected>> Variant::GetTypedMap(const + std::shared_ptr>& s) const { + std::map> variant_map; + if (GetVariantMap(variant_map)) { + std::map> typed_map; + for (auto& iter : variant_map) { + Expected> typed_object = (iter.second)->GetTypedObject(s); + if (typed_object) { + typed_map.insert({ iter.first, typed_object.Value() }); + } else { + return { typed_object.Error() }; + } + } + return { typed_map }; + } + return { SdkError(ErrorCodes::VARIANT_NOT_MAP, "type conversion error") }; + } + +} + +#endif //ADOBEMOBILE_CORE_VARIANT_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantKind.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantKind.h new file mode 100755 index 00000000..3b69c2f8 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantKind.h @@ -0,0 +1,55 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANTKIND_H +#define ADOBEMOBILE_CORE_VARIANTKIND_H + +#include "StringUtils.h" + +namespace AdobeMarketingMobile { + + /** + * VariantKind indicates type of value that a variant contains. See Variant. + */ + enum class VariantKind : int32_t { + + VARIANT_NULL, ///< The variant contains no values + + STRING, ///< The variant contains a std::string + + INTEGER, ///< The variant contains an int32_t + + LONG, ///< The variant contains an int64_t + + DOUBLE, ///< The variant contains a double + + BOOLEAN, ///< The variant contains a bool + + VARIANT_VECTOR, ///< The variant contains a std::vector> + + VARIANT_MAP, ///< The variant contains a std::map> + + }; + + /** + * @see StringUtils::ToString() + */ + void ToStringImpl(std::ostream& the_stream, VariantKind value, const ToStringOptions& options); +} + +#endif //ADOBEMOBILE_CORE_VARIANTKIND_H diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h new file mode 100755 index 00000000..164ca546 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VariantSerializerInterface.h @@ -0,0 +1,96 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H +#define ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H + +#include "ObjectInterface.h" + +/** + * @brief Derive from VariantSerializerInterface for serializing class instances to and/from Variant + * For each class you would like to use with the Variant::*Typed* methods, + * you will need to implement a template specialization. An example is provided. + * + * NOTE: You should *not* use this template directly for serialization - use FromTypedObject et al instead. + * + * Reqs: + * Must be feasible to implement for types we cannot change, so we can't rely on adding methods to the type + * Must return StdError when Variant cannot be converted to the type specified + * + * Questions: + * If Variant has extra data irrelevant to type serialization, is that ok? Assume YES + * If we want to have multiple serializers, what should we do? We will add another template param + * + * Example implementation: + * + * class MyObject { + * public: + * const std::string& GetStrMember() { return str_member; } + * int GetIntMember() { return int_member; } + * private: + * std::string str_member; + * int int_member; + * }; + * + * class MyObjectSerializer : public Object, public virtual VariantSerializerInterface const { + * public: + * Expected> Deserialize(const Variant& value) { + * std::map> variant_map; + * if(value.GetVariantMap(variant_map)) { + * std::string str_member; + * if(variant_map("str_member") == variant_map() || !variant_map["str_member"]->GetString(str_member)) { + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * int int_member; + * if(variant_map("int_member") == variant_map() || !variant_map["int_member"]->GetString(int_member)) { + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * return { std::make_shared({ str_member, int_member }) }; + * } + * return { SdkError(ErrorCodes::VARIANT_NOT_TYPE, "type error") }; + * } + * + * std::shared_ptr Serialize(const MyObject& o) const { + * std::map> variant_value; + * variant_value.insert({ "str_member", Variant::FromString(o.GetStrMember()) }); + * variant_value.insert({ "int_member", Variant::FromInt(o.GetIntMember()) }); + * return Variant::FromVariantMap(variant_value); + * } + * + * }; + * + */ +namespace AdobeMarketingMobile { + class Variant; + + template + class VariantSerializerInterface : public virtual ObjectInterface { + public: + /* @brief Create a TObject from a Variant + * Implementations must handle when Variant is not a serialized TObject e.g. return error or nullptr as needed. + * @return TObject or SdkError + */ + virtual Expected> Deserialize(const Variant& variant) const = 0; + + /* @brief Create a Variant from a TObject instance + * @return heap allocated Variant + */ + virtual std::shared_ptr Serialize(const TObject& object) const = 0; + }; +} // namespace AdobeMarketingMobile +#endif /* ADOBEMOBILE_CORE_VARIANTSERIALIZERINTERFACE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorId.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorId.h new file mode 100755 index 00000000..2b79a154 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorId.h @@ -0,0 +1,62 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_VISITORID_H +#define ADOBEMOBILE_SHARED_VISITORID_H + +#include +#include "VisitorIdAuthenticationState.h" +#include "Object.h" +#include "Variant.h" + +namespace AdobeMarketingMobile { + + class VisitorIdSerializer; + /** + * This class encapsulates the visitor identity information + */ + class VisitorId : public Object { + public: + using Serializer = VisitorIdSerializer; + std::string id_origin; + std::string id_type; + std::string id; + VisitorIdAuthenticationState authentication_state; + + VisitorId() {}; + + VisitorId(const std::string& id_origin, + const std::string& id_type, + const std::string& id, + const VisitorIdAuthenticationState authentication_state) ; + + bool Equals(std::shared_ptr& right) const; + }; + + /** + * @brief Serializer for VisitorId objects + */ + class VisitorIdSerializer : public Object, public virtual VariantSerializerInterface { + public: + Expected> Deserialize(const Variant& value) const override; + std::shared_ptr Serialize(const VisitorId& o) const override; + }; + +} + +#endif /* ADOBEMOBILE_SHARED_VISITORID_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h new file mode 100755 index 00000000..2d410cc3 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/VisitorIdAuthenticationState.h @@ -0,0 +1,56 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + ****************************************************************************/ + +#ifndef ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H +#define ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H + +#include + +namespace AdobeMarketingMobile { + class ToStringOptions; + + /** + * This class describes the possible values of the visitor id authentication state parameter + */ + enum class VisitorIdAuthenticationState : int32_t { + UNKNOWN = 0, + AUTHENTICATED, + LOGGED_OUT + }; + + /** + * Converts an int to its respective authentication state enum representation. + * + * If not match is found, returns VisitorIdAuthenticationState::UNKNOWN + */ + VisitorIdAuthenticationState IntegerToVisitorIdAuthenticationState(const int32_t authentication_state); + + /** + * Returns the authentication state string value for a given VisitorIdAuthenticationState. + */ + std::string AuthenticationStateToString(const VisitorIdAuthenticationState value); + + /** + * String version of the VisitorIdAuthenticationState used for logging + */ + void ToStringImpl(std::ostream& the_stream, + const VisitorIdAuthenticationState value, + const ToStringOptions& options); +} + +#endif /* ADOBEMOBILE_SHARED_VISITORIDAUTHENTICATIONSTATE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h new file mode 100755 index 00000000..5807044e --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Headers/ZipBundleHandler.h @@ -0,0 +1,59 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H +#define ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H + +#include +#include "RulesBundleNetworkProtocolHandler.h" + +namespace AdobeMarketingMobile { + class RulesFileMetadata; + class CompressedFileServiceInterface; + class FileSystemServiceInterface; + + class ZipBundleHandler : public Object, public virtual RulesBundleNetworkProtocolHandler { + public: + + /** + * ZipBundleHandler constructor + * The FileSystemService and CompressedFileService will be used for extracting the zip file + * when ZipBundleHandler::ProcessDownloadedBundle is called. + * + * @see ZipBundleHandler::ProcessDownloadedBundle + */ + ZipBundleHandler(const std::shared_ptr& file_system_service, + const std::shared_ptr& compressed_file_service); + + /** + * Extracts the downloaded bundle in the provided output path and removes the downloaded zip after extraction. + * + * @param downloaded_bundle the path to the downloaded zip file + * @param output_path the path where the extracted zip content will be placed + * + * @see RulesBundleNetworkProtocolHandler:ProcessDownloadedBundle + */ + bool ProcessDownloadedBundle(const std::string& downloaded_bundle, + const std::string& output_path); + private: + std::shared_ptr file_system_service_; + std::shared_ptr compressed_file_service_; + }; +} + +#endif /* ADOBEMOBILE_RULESENGINE_ZIPBUNDLEHANDLER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Info.plist b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Info.plist new file mode 100755 index 00000000..6338e8e6 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Info.plist differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Modules/module.modulemap b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Modules/module.modulemap new file mode 100755 index 00000000..b2511750 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileCore.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AdobeMarketingMobileCore { + umbrella header "AdobeMarketingMobileCore.h" + + export * + module * { export * } +} diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileLifecycle b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileLifecycle new file mode 100755 index 00000000..bec99c8d Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/AdobeMarketingMobileLifecycle differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/AdobeMarketingMobileLifecycle.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/AdobeMarketingMobileLifecycle.h new file mode 100755 index 00000000..793ae02b --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/AdobeMarketingMobileLifecycle.h @@ -0,0 +1,40 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#if TARGET_OS_IOS +#import +FOUNDATION_EXPORT double AdobeMarketingMobileLifecycleVersionNumber; +FOUNDATION_EXPORT const unsigned char AdobeMarketingMobileLifecycleVersionString[]; +#else +extern double AdobeMarketingMobileLifecycleVersionNumber; +extern const unsigned char AdobeMarketingMobileLifecycleVersionString[]; +#endif + +// import headers from the core +#import + +// target headers +#import +#import +#import +#import +#import +#import +#import +#import +#import diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/Lifecycle.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/Lifecycle.h new file mode 100755 index 00000000..a8b3135d --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/Lifecycle.h @@ -0,0 +1,215 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLE_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLE_H + +#import +#include + +namespace AdobeMarketingMobile { + class LifecycleDispatcherResponseContent; + class PlatformServicesInterface; + class LocalStorageServiceInterface; + class SystemInfoServiceInterface; + class JsonUtilityServiceInterface; + class DataStoreInterface; + class Event; + class EventData; + class LifecycleSession; + + /** + * @class Lifecycle + * + * The responsibility of Lifecycle is to handle the calculation and population of a base set of data within + * the SDK. This data will consist of information about the lifecycle of the app involving launches, installs + * and upgrades. + */ + class Lifecycle : public InternalModule { + friend class TestableLifecycle; // for testing + public: + + /** + * Create a new instance of a Lifecycle Module. + */ + Lifecycle(); + + /** + * Handler for all the lifecycle request content events + * + * @param event a lifecycle request content event. + */ + ADOBE_VIRTUAL_FOR_TESTS void QueueEvent(const std::shared_ptr& event); + + /** + * Checks if event's state owner is Configuration, if so starts processing the events + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleSharedStateUpdateEvent(const std::shared_ptr& event); + + /** + * Updates the lifecycle shared state when a boot event is received + */ + ADOBE_VIRTUAL_FOR_TESTS void HandleEventHubBootEvent(const std::shared_ptr& event); + + protected: + + /** + * Called when the EventHub registers this module. + * Registers new LifecycleListenerRequestContent. + */ + ADOBE_VIRTUAL_FOR_TESTS void OnRegistered() override; + + /** + * Retrieve the unique module name for storing shared state information. + * + * @return String containing the container name for shared state for this module (can be empty string) + **/ + ADOBE_VIRTUAL_FOR_TESTS std::string GetSharedStateName() override; + + /** + * Start/resume a new lifecycle session + * + * @param event event containing lifecycle start data + * @param config_shared_state configuration shared state data + */ + ADOBE_VIRTUAL_FOR_TESTS void Start(const std::shared_ptr& event, + const std::shared_ptr& config_shared_state); + + /** + * Pause lifecycle session + * + * @param event event containing lifecycle pause data + */ + ADOBE_VIRTUAL_FOR_TESTS void Pause(const std::shared_ptr& event); + + std::shared_ptr lifecycle_session_info_dispatcher_; + + std::shared_ptr lifecycle_session_; + + private: + /** + * @private + * Starts processing all the queued events. + * Important, method accesses shared resource. Call in a thread-safe way. + * @see AddTaskToQueue + */ + ADOBE_VIRTUAL_FOR_TESTS void ProcessQueuedEvents(); + + /** + * @private + * Gets advertising identifier from the identity shared state + * + * @param event current event for which we will get the identity shared state + * @return the advertising identifier if idenity not null, empty string otherwise + */ + std::string GetAdvertisingIdentifier(const std::shared_ptr& event); + + /** + * @private + * Check for application upgrade. + */ + void CheckForApplicationUpgrade(const std::chrono::seconds timestamp); + + /** + * @private + * Gets lifecycle context data. + */ + std::map GetContextData(); + + /** + * @private + * Gets persisted lifecycle context data from local storage. + */ + ADOBE_VIRTUAL_FOR_TESTS std::map GetPersistedContextData(); + + /** + * @private + * Checks if this is a launch event (app was closed/backgrounded > lifecycle timeout) + * + * @param timestamp event timestamp + * @param timeout lifecycle timeout provided by configuration or default + * @return launch status + */ + bool IsLaunch(std::chrono::seconds timestamp, std::chrono::seconds timeout); + + /** + * @private + * Checks if this launch is an install + * + * @return install status + */ + bool IsInstall(); + + /** + * @private + * Checks if this launch is an upgrade + * + * @return upgrade status + */ + bool IsUpgrade(); + + /** + * Creates a new version for the lifecycle shared state with current context data + * + * @param event_number the shared state version + */ + void CreateLifecycleSharedState(const int32_t event_number); + + /** + * @private + * Persist lifecycle context data, last used date and last version + */ + void PersistLifecycleData(const std::chrono::seconds timestamp); + + /** + * @private + * Fetches the Data Store for Lifeycle from the PlatformServicesInterface + * + * @return @nullable DataStoreInterface for Lifecycle Data Store + */ + std::shared_ptr GetDataStore(); + + /** + * @private + * Fetches the System Info Service from PlatformServicesInterface + * + * @return @nullable SystemInfoServiceInterface + */ + std::shared_ptr GetSystemInfoService(); + + /** + * @private + * Fetches the Json Utility Service from PlatformServicesInterface + * + * @return @nullable JsonUtilityServiceInterface + */ + ADOBE_VIRTUAL_FOR_TESTS std::shared_ptr GetJsonUtilityService(); + + /** + * @private + * Queue of events to be processed in order. Queue should only grow when we don't have configuration to process + */ + std::queue> events_; + + std::map lifecycle_context_data_; + + std::map previous_session_lifecycle_context_data_; + }; +} + + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleConstants.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleConstants.h new file mode 100755 index 00000000..8daf405a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleConstants.h @@ -0,0 +1,140 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLECONSTANTS_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLECONSTANTS_H + +#include + +namespace AdobeMarketingMobile { + /** + * Lifecycle constants class holds all const values used only by the Lifecycle module + */ + class LifecycleConstants { + + public: + static const std::string LOG_PREFIX; + static const std::string DATA_STORE_NAME; + static const long MAX_SESSION_LENGTH_SECONDS; + static const int32_t DEFAULT_LIFECYCLE_TIMEOUT; + + // event data values + static const std::string CRASH_EVENT_VALUE; + static const std::string DAILY_ENG_USER_VALUE; + static const std::string INSTALL_EVENT_VALUE; + static const std::string LAUNCH_EVENT_VALUE; + static const std::string MONTHLY_ENG_USER_VALUE; + static const std::string UPGRADE_EVENT_VALUE; + + + /** + * Module datastore keys + */ + class DataStoreKeys { + public: + static const std::string LIFECYCLE_DATA; + static const std::string START_DATE; + static const std::string INSTALL_DATE; + static const std::string UPGRADE_DATE; + static const std::string LAST_USED_DATE; + static const std::string LAUNCHES_AFTER_UPGRADE; + static const std::string LAUNCHES; + static const std::string LAST_VERSION; + static const std::string PAUSE_DATE; + static const std::string SUCCESSFUL_CLOSE; + + private: + DataStoreKeys() = delete; + }; + +#pragma mark - EventDataKeys + class EventDataKeys { + public: + static const std::string STATE_OWNER; + + // lifecycle keys + class Lifecycle { + public: + static const std::string SHARED_STATE_NAME; + static const std::string ADDITIONAL_CONTEXT_DATA; + static const std::string APP_ID; + static const std::string CARRIER_NAME; + static const std::string CRASH_EVENT; + static const std::string DAILY_ENGAGED_EVENT; + static const std::string DAY_OF_WEEK; + static const std::string DAYS_SINCE_FIRST_LAUNCH; + static const std::string DAYS_SINCE_LAST_LAUNCH; + static const std::string DAYS_SINCE_LAST_UPGRADE; + static const std::string DEVICE_NAME; + static const std::string DEVICE_RESOLUTION; + static const std::string HOUR_OF_DAY; + static const std::string IGNORED_SESSION_LENGTH; + static const std::string INSTALL_DATE; + static const std::string INSTALL_EVENT; + static const std::string LAUNCH_EVENT; + static const std::string LAUNCHES; + static const std::string LAUNCHES_SINCE_UPGRADE; + static const std::string LIFECYCLE_ACTION_KEY; + static const std::string LIFECYCLE_CONTEXT_DATA; + static const std::string LIFECYCLE_PAUSE; + static const std::string LIFECYCLE_START; + static const std::string LOCALE; + static const std::string MAX_SESSION_LENGTH; + static const std::string MONTHLY_ENGAGED_EVENT; + static const std::string OPERATING_SYSTEM; + static const std::string PREVIOUS_SESSION_LENGTH; + static const std::string PREVIOUS_SESSION_PAUSE_TIMESTAMP; + static const std::string PREVIOUS_SESSION_START_TIMESTAMP; + static const std::string RUN_MODE; + static const std::string SESSION_EVENT; + static const std::string SESSION_START_TIMESTAMP; + static const std::string UPGRADE_EVENT; + private: + Lifecycle() = delete; + }; + + + // configuration keys + class Configuration { + + public: + static const std::string SHARED_STATE_NAME; + static const std::string LIFECYCLE_CONFIG_SESSION_TIMEOUT; + private: + Configuration() = delete; + }; + + // identity keys + class Identity { + public: + static const std::string SHARED_STATE_NAME; + static const std::string ADVERTISING_IDENTIFIER; + private: + Identity() = delete; + }; + + private: + EventDataKeys() = delete; + }; + + private: + LifecycleConstants() = delete; + }; +} + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLECONSTANTS_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleDispatcherResponseContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleDispatcherResponseContent.h new file mode 100755 index 00000000..b915217a --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleDispatcherResponseContent.h @@ -0,0 +1,49 @@ + +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLEDISPATCHERRESPONSECONTENT_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLEDISPATCHERRESPONSECONTENT_H + +#include "Lifecycle.h" +#import + + +namespace AdobeMarketingMobile { + + /** + * @class LifecycleDispatcherResponseContent + * Event dispatcher for Lifecycle Response Content events from the Lifecycle module. + */ + class LifecycleDispatcherResponseContent : public ModuleEventDispatcher { + + public: + /** + * Dispatches a lifecycle response event onto the EventHub containing the session info as event data + * + */ + virtual void DispatchSessionStart(const std::chrono::seconds start_timestamp_seconds, + const std::map context_data, + const std::chrono::seconds previous_session_start_seconds, + const std::chrono::seconds previous_session_pause_seconds); + }; +} + + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLEDISPATCHERRESPONSECONTENT_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerHubBooted.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerHubBooted.h new file mode 100755 index 00000000..94c45e96 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerHubBooted.h @@ -0,0 +1,42 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBBOOTED_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBBOOTED_H + +#include "Lifecycle.h" +#import + + +namespace AdobeMarketingMobile { + /** + * @class LifecycleListenerHubBooted + * Listener for EventHub Boot events + */ + class LifecycleListenerHubBooted: public ModuleEventListener { + public: + /** + * Callback for EventHub Boot events + */ + void Hear(const std::shared_ptr& event) override; + }; + +} + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBBOOTED_H */ + diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerRequestContent.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerRequestContent.h new file mode 100755 index 00000000..77aa35a1 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerRequestContent.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERREQUESTCONTENT_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERREQUESTCONTENT_H + +#include "Lifecycle.h" +#import + +namespace AdobeMarketingMobile { + /** + * @class LifecycleListenerRequestContent + * + * Listener for starting/pausing lifecycle sessions + */ + class LifecycleListenerRequestContent : public ModuleEventListener { + + public: + /** + * Callback for Lifecycle request content events. + * + * @param event Lifecycle request content event. + */ + void Hear(const std::shared_ptr& event) override; + }; +} + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERREQUESTCONTENT_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerSharedStateUpdate.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerSharedStateUpdate.h new file mode 100755 index 00000000..8f381581 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleListenerSharedStateUpdate.h @@ -0,0 +1,43 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBSHAREDSTATE_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBSHAREDSTATE_H + +#include "Lifecycle.h" +#import + + +namespace AdobeMarketingMobile { + /** + * @class LifecycleListenerSharedStateUpdate + * Listener for EventHub Shared State events + */ + class LifecycleListenerSharedStateUpdate: public ModuleEventListener { + public: + /** + * Callback for EventHub Shared State events + * + * @param event EventHub Shared State event + */ + void Hear(const std::shared_ptr& event) override; + }; + +} + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLELISTENERHUBSHAREDSTATE_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleMetricsBuilder.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleMetricsBuilder.h new file mode 100755 index 00000000..2e02f8ca --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleMetricsBuilder.h @@ -0,0 +1,194 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLEMETRICSBUILDER_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLEMETRICSBUILDER_H + +#include +#import + + +namespace AdobeMarketingMobile { + /** + * @class LifecycleMetricsBuilder + * + * The responsibility of LifecycleMetricsBuilder is to build an EventData object that contains the + * various pieces of lifecycle data. This builder has the ability to add all install, launch, and + * upgrade data to the EventData object to be built and returned. + */ + + class LifecycleMetricsBuilder { + public: + /** + * Create a new instance of a LifecycleMetricsBuilder Module. + * + * @param platform_services platform services interface to get access to System Info and Local Storage + * @param timestamp timestamp of event to be used in all calculations + */ + explicit LifecycleMetricsBuilder(const std::shared_ptr& platform_services, + std::chrono::seconds timestamp); + + LifecycleMetricsBuilder(const LifecycleMetricsBuilder&) = delete; + LifecycleMetricsBuilder& operator=(const LifecycleMetricsBuilder&) = delete; + LifecycleMetricsBuilder(LifecycleMetricsBuilder&&) = delete; + LifecycleMetricsBuilder&& operator=(LifecycleMetricsBuilder&&) = delete; + + /** + * Adds all install data key value pairs to lifecycle_event_data_ + * + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddInstallData(); + + /** + * Adds all launch data key value pairs to lifecycle_event_data_ + * + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddLaunchData(); + + /** + * Adds all generic data key value pairs to the lifecycle data map (e.g. day of week, hour of day, no of launches) + * This method also increments the no of launches, make sure that this method is called only once, when lifecycle start is called + * + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddGenericData(); + + /** + * Adds crash info to the lifecycle data map if previous_session_crash is true + * + * @param previous_session_crash specifies if there was a crash in the previous session + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddCrashData(const bool previous_session_crash); + + /** + * Adds all upgrade data key value pairs to lifecycle_event_data_ + * + * @param upgrade boolean specifying if this was an upgrade or not + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddUpgradeData(const bool upgrade); + + /** + * Adds all core data key value pairs to lifecycle_event_data_ + * + * @return pointer to the builder + */ + ADOBE_VIRTUAL_FOR_TESTS LifecycleMetricsBuilder& AddCoreData(); + + /** + * Returns the context data map that was built + * + * @return the context data map that was built + */ + ADOBE_VIRTUAL_FOR_TESTS std::map Build() const; + + private: + /** + * @private + * Creates a readable string from timestamp in format of m/d/yyy + * + * @param timestamp current timestamp for lifecycle calculations + * @return Formatted date + */ + std::string StringFromTimestamp(std::chrono::seconds timestamp); + + /** + * @private + * Converts a std::chrono::seconds to the type tm + * + * @param timestamp current timestamp for lifecycle calculations + * @return tm of the timestamp provided + */ + std::tm ConvertToTM(std::chrono::seconds timestamp); + + /** + * @private + * Calculates the number of days between two times provided + * + * @param start the starting + * @param end the end date + * @return tm of the timestamp provided + */ + int32_t CalculateDaysBetween(std::tm& start, std::tm& end); + + /** + * @private + * Generates the Application ID string from Application name and versions + * + * @param system_info_service shared pointer to SystemInfoServiceInterface for app info + * @return string representation of the Application ID + */ + std::string GetApplicationId(const std::shared_ptr& system_info_service); + + /** + * @private + * Generates the Operating System string from OS name and Version + * + * @param system_info_service shared pointer to SystemInfoServiceInterface for os info + * @return string representation of the Operating System + */ + std::string GetOperatingSystem(const std::shared_ptr& system_info_service); + + /** + * @private + * Generates the resolution string from DisplayInformationInterface + * + * @param system_info_service shared pointer to SystemInfoServiceInterface for device info + * @return string representation of the resolution + */ + std::string GetResolution(const std::shared_ptr& system_info_service); + + /** + * @private + * Retreives the active locale from system info service and replaces '_' with '-' + * + * @param system_info_service shared pointer to SystemInfoServiceInterface for device info + * @return string representation of the locale + */ + std::string GetLocale(const std::shared_ptr& system_info_service); + + /** + * @private + * Platform Services Interface, passed into constructor. + * Allowed to be nullptr. Must check for nullptr before using! + */ + std::shared_ptr platform_services_; + + /** + * @private + * Timestamp of the original event + */ + std::chrono::seconds timestamp_; + + /** + * @private + * Pointer to Lifecycle's data store + */ + std::shared_ptr lifecycle_data_store_; + + /** + * @private + * Map containing the lifecycle context data being built + */ + std::map lifecycle_data_; + }; +} +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLEMETRICSBUILDER_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecyclePublicApi.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecyclePublicApi.h new file mode 100755 index 00000000..1a77658c --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecyclePublicApi.h @@ -0,0 +1,72 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2017 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_TARGET_TARGETPUBLICAPI_H +#define ADOBEMOBILE_TARGET_TARGETPUBLICAPI_H + +#include +#include +#include +#include +#include +#include +#include "Lifecycle.h" + +namespace AdobeMarketingMobile { + class LifecyclePublicApi : public Object { + public: + + static std::shared_ptr Create(const std::shared_ptr& hub, + const std::shared_ptr& services); + + LifecyclePublicApi(); + + void Register(); + + // ------------------------------------ Lifecycle -------------------------------------- + + /** + * @name Lifecycle + */ + ///@{ + + /** + * @brief Dispatches an event to resume/start a lifecycle session + * + * @param additional_context_data context data provided through the public API + */ + void LifecycleStart(const std::map& additional_context_data); + + /** + * @brief Dispatches an event to pause/stop a lifecycle session + */ + void LifecyclePause(); + + ///@} + + + private: + + std::shared_ptr event_hub_; + + std::shared_ptr platform_services_; + + }; +} + +#endif /* ADOBEMOBILE_TARGET_TARGETPUBLICAPI_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleSession.h b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleSession.h new file mode 100755 index 00000000..583cfb3f --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Headers/LifecycleSession.h @@ -0,0 +1,102 @@ +/* ************************************************************************** + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#ifndef ADOBEMOBILE_LIFECYCLE_LIFECYCLESESSION_H +#define ADOBEMOBILE_LIFECYCLE_LIFECYCLESESSION_H +#import + +#include +#include +#include + +namespace AdobeMarketingMobile { + class DataStoreInterface; + class SessionInfo; + + /** + * Class for managing lifecycle sessions + * Persists start, pause, and end timestamps for lifecycle sessions. + * Also generates session context data for Analytics reporting + */ + class LifecycleSession : public Object { + public: + + explicit LifecycleSession(const std::shared_ptr& data_store); + + /** + * Start a new lifecycle session. + * Returns a SessionInfo object containing the previous session's data if it is a new session + * Returns null if the previous session is resumed, or if lifecycle has already run + * + * @param start_timestamp_seconds long session start time + * @param session_timeout_seconds int sessionTimeoutSeconds + * + * @return SessionInfo object containing previous session's data + */ + std::shared_ptr Start(const std::chrono::seconds start_timestamp_seconds, + const std::chrono::seconds session_timeout_seconds); + + /** + * Pause current lifecycle session + * + * @param pause_timestamp_seconds pause timestamp + */ + void Pause(const std::chrono::seconds pause_timestamp_seconds); + + /** + * Gets session length data (used for Analytics reporting) + * + * @param start_timestamp_seconds session start timestamp + * @param session_timeout_seconds session timeout + * @param previous_session_info SessionInfo object containing previous session's data + * + * @return map with session length context data + */ + std::map GetSessionData(const std::chrono::seconds start_timestamp_seconds, + const std::chrono::seconds session_timeout_seconds, + const std::shared_ptr& previous_session_info) const; + + private: + std::shared_ptr data_store_; + bool lifecycle_has_run_; + const std::string LOG_TAG = "LifecycleSession"; + }; + + /** + * Container for lifecycle session information + */ + class SessionInfo : public Object { + public: + explicit SessionInfo(const std::chrono::seconds start_timestamp, + const std::chrono::seconds pause_timestamp, + const bool is_crash); + + const std::chrono::seconds GetStartTimestamp() const; + + const std::chrono::seconds GetPauseTimestamp() const; + + const bool IsCrash() const; + + private: + std::chrono::seconds pause_timestamp_seconds_; + std::chrono::seconds start_timestamp_seconds_; + bool is_crash_; + }; +} + +#endif /* ADOBEMOBILE_LIFECYCLE_LIFECYCLESESSION_H */ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Info.plist b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Info.plist new file mode 100755 index 00000000..a758944c Binary files /dev/null and b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Info.plist differ diff --git a/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Modules/module.modulemap b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Modules/module.modulemap new file mode 100755 index 00000000..2d358410 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Frameworks/AdobeMarketingMobileLifecycle.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module AdobeMarketingMobileLifecycle { + umbrella header "AdobeMarketingMobileLifecycle.h" + + export * + module * { export * } +} diff --git a/ACPLifecycle_iOS.framework/Headers/ACPLifecycle.h b/ACPLifecycle_iOS.framework/Headers/ACPLifecycle.h new file mode 100755 index 00000000..437ddd75 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Headers/ACPLifecycle.h @@ -0,0 +1,44 @@ +// +// ACPLifecycle.h +// Adobe Digital Marketing Suite -- iOS Application Measurement Library +// +// Copyright 1996-2018. Adobe, Inc. All Rights Reserved +// +// Target Version: 1.0 + +#import + + +@interface ACPLifecycle : NSObject {} + +#pragma mark - Lifecycle ++ (void) registerAdobeLifecycleExtension; +/** + * @brief Pause/stop lifecycle session + * + * Pauses the current lifecycle session. Calling pause on an already paused session updates the paused timestamp, + * having the effect of resetting the session timeout timer. If no lifecycle session is running, then calling + * this method does nothing. + * + * A paused session is resumed if ADBMobileMarketing::lifecycleStart: is called before the session timeout. After + * the session timeout, a paused session is closed and calling ADBMobileMarketing::lifecycleStart: will create + * a new session. The session timeout is defined by the `lifecycle.sessionTimeout` configuration parameter. + * If not defined, the default session timeout is five minutes. + */ ++ (void) lifecyclePause; + +/** + * @brief Start/resume lifecycle session + * + * Start a new lifecycle session or resume a previously paused lifecycle session. If a previously paused session + * timed out, then a new session is created. If a current session is running, then calling this method does nothing. + * + * Additional context data may be passed when calling this method. Lifecycle data and any additional data are + * sent as context data parameters to Analytics, to Target as mbox parameters, and for Audience Manager they are + * sent as customer variables. Any additional data is also used by the Rules Engine when processing rules. + * + * @param additionalContextData optional additional context for this session. + */ ++ (void) lifecycleStart: (nullable NSDictionary*) additionalContextData; + +@end diff --git a/ACPLifecycle_iOS.framework/Headers/ACPLifecycle_iOS.h b/ACPLifecycle_iOS.framework/Headers/ACPLifecycle_iOS.h new file mode 100755 index 00000000..3f275054 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Headers/ACPLifecycle_iOS.h @@ -0,0 +1,29 @@ +/* ************************************************************************ + * + * ADOBE CONFIDENTIAL + * ___________________ + * + * Copyright 2018 Adobe Systems Incorporated + * All Rights Reserved. + * + * NOTICE: All information contained herein is, and remains + * the property of Adobe Systems Incorporated and its suppliers, + * if any. The intellectual and technical concepts contained + * herein are proprietary to Adobe Systems Incorporated and its + * suppliers and are protected by trade secret or copyright law. + * Dissemination of this information or reproduction of this material + * is strictly forbidden unless prior written permission is obtained + * from Adobe Systems Incorporated. + **************************************************************************/ + +#import + +//! Project version number for ACPLifecycle_iOS. +FOUNDATION_EXPORT double ACPLifecycle_iOSVersionNumber; + +//! Project version string for ACPLifecycle_iOS. +FOUNDATION_EXPORT const unsigned char ACPLifecycle_iOSVersionString[]; + +// import platform core public headers +#import + diff --git a/ACPLifecycle_iOS.framework/Info.plist b/ACPLifecycle_iOS.framework/Info.plist new file mode 100755 index 00000000..a2942de9 Binary files /dev/null and b/ACPLifecycle_iOS.framework/Info.plist differ diff --git a/ACPLifecycle_iOS.framework/Modules/module.modulemap b/ACPLifecycle_iOS.framework/Modules/module.modulemap new file mode 100755 index 00000000..0de31156 --- /dev/null +++ b/ACPLifecycle_iOS.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module ACPLifecycle_iOS { + umbrella header "ACPLifecycle_iOS.h" + + export * + module * { export * } +}