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

Fix authentication state when calling syncIdentifiers #649

Merged
merged 2 commits into from
Jun 15, 2021

Conversation

kevinlind
Copy link
Contributor

Description

Send authentication state as MobileVisitorAuthenticationState instead of Int in event data for syncIdentifiers API call. The Identity extension casts the authentication state as a MobileVisitorAuthenticationState when extracting from the event data. When using the raw value (Int) of the MobileVisitorAuthenticationState enum, the cast always fails and returns value .unknown. This fix will allow the user specified authentication state for the custom identifier in the syncIdentifiers call instead of all authentication states being unknown.

Internal ticket: AMSDK-11493

Related Issue

Motivation and Context

How Has This Been Tested?

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

…fiers call.

Send authentication state as MobileVisitorAuthenticationState instead of Int in event data for syncIdentifiers API call. The Identity extension casts the authentication state as a MobileVisitorAuthenticationState when extracting from the event data. When using the raw value (Int) of the MobileVisitorAuthenticationState enum, the cast always fails and returns value .unknown. This fix will allow the user specified authentication state for the custom identifier in the syncIdentifiers call instead of all authentication states being unknown.
@kevinlind kevinlind added the bug Something isn't working. Used by issue templates label Jun 15, 2021
@codecov
Copy link

codecov bot commented Jun 15, 2021

Codecov Report

Merging #649 (dab1321) into dev-v3.2.1 (1ca8d8e) will not change coverage.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           dev-v3.2.1     #649   +/-   ##
===========================================
  Coverage       85.21%   85.21%           
===========================================
  Files             105      105           
  Lines            4658     4658           
===========================================
  Hits             3969     3969           
  Misses            689      689           

@@ -112,7 +112,7 @@ import Foundation
static func syncIdentifiers(identifiers: [String: String]?, authenticationState: MobileVisitorAuthenticationState) {
var eventData = [String: Any]()
eventData[IdentityConstants.EventDataKeys.IDENTIFIERS] = identifiers
eventData[IdentityConstants.EventDataKeys.AUTHENTICATION_STATE] = authenticationState.rawValue
eventData[IdentityConstants.EventDataKeys.AUTHENTICATION_STATE] = authenticationState
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Setting the MobileVisitorAuthenticationState in the event data causes the logged event to just display the enum name instead of its value:

data:  {
    authenticationstate = "AEPIdentity.MobileVisitorAuthenticationState";
    forcesync = 0;
    issyncevent = 1;
    visitoridentifiers =     {
        idType1 = 1234567;
    };

An alternative to this fix is to continue to set the raw value in the Event but change Event+Identity to cast the value as an Int and then convert to a MobileVisitorAuthenticationState when reading the event data.

@nporter-adbe nporter-adbe merged commit 87d6cab into adobe:dev-v3.2.1 Jun 15, 2021
@kevinlind kevinlind deleted the amsdk-11493 branch March 7, 2023 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working. Used by issue templates
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants