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

Review Identity extension #271

Closed
shalehaha opened this issue Aug 27, 2020 · 5 comments
Closed

Review Identity extension #271

shalehaha opened this issue Aug 27, 2020 · 5 comments
Assignees

Comments

@shalehaha
Copy link
Contributor

part of #268

@shalehaha
Copy link
Contributor Author

@kevinlind @emdobrin can one of you help us review the Identity extension?

@kevinlind
Copy link
Contributor

@shalehaha Yes I can take a look, however we've already planned out this sprint. What is the timeline for this to be done?

@kevinlind kevinlind self-assigned this Sep 17, 2020
@kevinlind
Copy link
Contributor

kevinlind commented Sep 17, 2020

Here are my review notes of the Identity extension.

Fix CustomIdentity equality

CustomIdentity objects are currently tested for equality using the identifier however they should be considered equal if they have the same type as is done in v5.
Update the following methods to generate map keyed on CustomIdentity.type instead of identifier:

mutating func mergeAndCleanCustomerIds(_ newCustomerIds: [CustomIdentity]) {

private func idListToDict(_ ids: [CustomIdentity]?) -> [String?: CustomIdentity] {

Update CustomIdentity to check two objects for equality just from type:
extension CustomIdentity: Equatable {

Also, update test cases to validate the above. For example, with the current code I'm able to call setAdvertisingIdentifier twice and the resulting customerIds list will contain two ad id entries.

Remove Opt-out check from handleIdentityRequest:

if shouldIgnore(event: event) {

Only syncIdentifiers is aborted if privacy is opted out, however that method already checks for the privacy status. The other API calls, appendToUrl, getUrlVariables, and Identifiers request are still valid even if privacy is opted out.

Remove duplicate default server constant

static let DEFAULT_SERVER = "dpm.demdex.net"

Rename MID to ECID throughout

Even though the network calls still use mid, in v5 we've been changing the wording, especially in log entries, to use the new ECID name.

struct MID: Equatable, Codable, Hashable, CustomStringConvertible {

Execute force sync event immediately

In bootup, the forced sync event should happen before other events, however there may have been Identity requests made to the SDK which are queued in the EventHub. Consider processing force sync event immediately, by calling syncIdentifiers directly.

eventDispatcher(Event.forceSyncEvent())

In processPrivacyChange, same as with bootup, there's the possiblity of another event getting queued before this force sync. Also, and more importantly, this delay may cause issues with Target which depends on the ECID when there is a privacy change. We should really consider just calling syncIdentifiers here.
eventDispatcher(event.forceSyncEvent())

Don't use 'next version' when creating a shared state

Setting the shared state to the latest version can cause issues. This new shared state's version will be greater than the event version of any event in the Identity queue. If any of those events in the queue try to create a shared state it will fail. Instead, as was done in v5, need to add an event to the back of the Identity event queue which will create this shared state with the version of that event.

createSharedState(identityProperties.toEventData(), nil)

createSharedState(identityProperties.toEventData(), nil)

Update log entry

Update log message so it's not so dreadful. An aborted sync is common, for example when an app always sets the same Ad ID on launch. Instead try "Ignored an ID sync request because no new IDs to sync after the last request."

Log.debug(label: LOG_TAG, "sync identifiers request failed, shouldSync returned false.")

@nporter-adbe
Copy link
Contributor

nporter-adbe commented Sep 17, 2020

Comment to track the feedback from @kevinlind

@nporter-adbe
Copy link
Contributor

Closing as all feedback has been addressed. Thanks for the thoughtful feedback @kevinlind.

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

No branches or pull requests

3 participants