Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

project init #1

Merged
merged 14 commits into from
Oct 22, 2020
Merged

project init #1

merged 14 commits into from
Oct 22, 2020

Conversation

yangyansong-adbe
Copy link
Contributor

No description provided.

self.updateAttributes(event)
} else if event.isGetAttributesEvent {
self.getAttributes(event)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log a trace message if the event doesn't match either of the check

public func onUnregistered() {}

public func readyForEvent(_ event: Event) -> Bool {
return getSharedState(extensionName: UserProfileConstants.Configuration.NAME, event: event)?.status == .set
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need configuration shared state. Are we doing this check in v5?

/// - Parameter event: the RulesEngine response event
private func handleRulesEngineResponse(event: Event) {
guard event.isRulesConsequenceEvent, event.consequenceType == UserProfileConstants.RulesEngine.CONSEQUENCE_KEY_CSP else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process this event: not a RulesEngine response event for UserProfile extension")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't think we need this log, or make it a trace log.

/// - Parameter event: the request event
private func updateAttributes(_ event: Event) {
guard let newAttributes = event.data?[UserProfileConstants.UserProfile.EventDataKeys.UPDATE_DATA_KEY] as? [String: Any], !newAttributes.isEmpty else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process the update attributes event: not found valid event data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to process the update attributes event: invalid event data

private func getAttributes(_ event: Event) {
guard let keys = event.data?[UserProfileConstants.UserProfile.EventDataKeys.GET_DATA_ATTRIBUTES] as? [String], !keys.isEmpty else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process the get attributes event: not found valid event data")
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also dispatch a respsone event here, to invoke the one time listener

attributes.removeValue(forKey: key)
}
guard attributesCount != attributes.count else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process the remove attributes event: not found attributes for given keys - \(keys)")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to process the remove attributes event: no attributes matched with the given keys - (keys)

/// - Parameter event: the request event
private func getAttributes(_ event: Event) {
guard let keys = event.data?[UserProfileConstants.UserProfile.EventDataKeys.GET_DATA_ATTRIBUTES] as? [String], !keys.isEmpty else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process the get attributes event: not found valid event data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

invalid event data

/// - Parameter event: the request event
private func removeAttributes(event: Event) {
guard let keys = event.data?[UserProfileConstants.UserProfile.EventDataKeys.REMOVE_DATA_KEYS] as? [String], !keys.isEmpty else {
Log.debug(label: UserProfile.LOG_TAG, "Unable to process the remove attributes event: not found valid event data")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unable to process the update attributes event: invalid event data

/// - Parameters:
/// - attributeName: the attribute's key
/// - attributeValue: the attribute's value
static func updateUserAttribute(attributeName: String, attributeValue: String?) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm wondering whether we need this API and the removeUserAttribute API

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we can remove those 2 APIs, and only make them available in the Objective-C compatibility layer.

@shalehaha shalehaha merged commit 995b831 into adobe:dev Oct 22, 2020
@yangyansong-adbe yangyansong-adbe changed the title WIP: project init project init Oct 22, 2020
yangyansong-adbe referenced this pull request in yangyansong-adbe/aepsdk-userprofile-ios Nov 2, 2020
* commit '2ed7547ef954b343639806b73e3a2d7099d241e7':
  Update .swiftformat
  setup E2E (manual) testings target (adobe#17)
  Update README.md
  Update README.md
  Update readme.md (adobe#16)
  Update codecov.yml
  Update swift.yml (adobe#15)
  Response to review feedback (adobe#14)
  fix spm instructions
  Update README.md
  Update README.md
  add docs (adobe#13)
  review feedback
  WIP: project init (#1)
yangyansong-adbe added a commit that referenced this pull request Nov 2, 2020
* commit '2ed7547ef954b343639806b73e3a2d7099d241e7':
  Update .swiftformat
  setup E2E (manual) testings target (#17)
  Update README.md
  Update README.md
  Update readme.md (#16)
  Update codecov.yml
  Update swift.yml (#15)
  Response to review feedback (#14)
  fix spm instructions
  Update README.md
  Update README.md
  add docs (#13)
  review feedback
  WIP: project init (#1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants