Skip to content

Implement Extracting & Caching State:Store and LocationHint from Konductor responses and Attaching to subsequent requests#177

Merged
addb merged 13 commits intoadobe:consentfrom
addb:konductorConfig
Jul 25, 2024
Merged

Implement Extracting & Caching State:Store and LocationHint from Konductor responses and Attaching to subsequent requests#177
addb merged 13 commits intoadobe:consentfrom
addb:konductorConfig

Conversation

@addb
Copy link
Copy Markdown
Contributor

@addb addb commented Jul 15, 2024

Description

This PR sets foundation for the following changes and also future changes e.g: handling resetIdentities etc.

  • Added logic to extract and cache the state:store and locationHint from Konductor responses
  • Attaching state to Request body meta and locationHint to request URL whenever present
  • Updated modules to set path without "ee" which is a default prefix path for all the edge requests
  • Function buildEdgeURL now takes in LocationHint as a parameter
  • Added and updated relevant tests for all the changes
  • Updated testHelper
  • Updated tests

Note
ResetIdentities will be handled in a separate PR.

Sample payload

{
  "events": [
    {
      "data": {
        "key": "value"
      },
      "xdm": {
        "_obumobile5": {
          "page": {
            "name": "RokuSampleApp.MainScreen.sendEventWithCallback"
          }
        },
        "eventType": "page.view",
        "timestamp": "2024-07-15T20:08:36.708Z"
      }
    }
  ],
  "meta": {
    "configOverrides": {
      "com_adobe_experience_platform": {
        "datasets": {
          "event": {
            "datasetId": "6629916775078e2c9e5a28fd"
          }
        }
      }
    },
    "sdkConfig": {
      "datastream": {
        "original": "1c2dd701-655b-4330-9289-a396c9fff1f8"
      }
    },
    "state": {
      "entries": [
        {
          "key": "kndctr_972C898555E9F7BC7F000101_AdobeOrg_cluster",
          "maxAge": 1800,
          "value": "or2"
        }
      ]
    }
  },
  "xdm": {
    "identityMap": {
      "ECID": [
        {
          "authenticatedState": "ambiguous",
          "id": "25007509964775270623520733022877880683",
          "primary": false
        }
      ]
    },
    "implementationDetails": {
      "environment": "app",
      "name": "https://ns.adobe.com/experience/mobilesdk/roku",
      "version": "1.2.0"
    }
  }
}

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.

addb added 4 commits July 15, 2024 14:20
…edge requests so all the modules need to pass the path without ee. buildEdgeRequest API now also takes in locationHint to generate the URL.
…uent request URL to contain the location hint and the request body to contain the state
end if

url = _adb_buildEdgeRequestURL(configId, _adb_generate_UUID(), m._EDGE_REQUEST_PATH, edgeDomain)
url = _adb_buildEdgeRequestURL(configId, _adb_generate_UUID(), m._EDGE_REQUEST_PATH, invalid, edgeDomain)
Copy link
Copy Markdown

@praveek praveek Jul 19, 2024

Choose a reason for hiding this comment

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

nit:
You don't have to do it now but in the future, if you add any more params, I recommend switching to either a builder pattern or modifying the method to accept an object, making it more manageable.

params = {
    configId: "yourConfigId",
    requestId: "yourRequestId",
    path: "yourPath",
    locationHint: yourLocationHint,
    edgeDomain: yourEdgeDomain
}
url = _adb_buildEdgeRequestURL(params)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that sounds good.

…asses to handle locationHint and statestore. Updated tests
@addb addb requested review from kevinlind and praveek July 20, 2024 02:56
@praveek
Copy link
Copy Markdown

praveek commented Jul 23, 2024

LGTM

return
end if

m._state = state
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

When setting or retrieving the state store data, do you need to consider the maxAge field which defines how long the element should be stored?
https://github.com/adobe/aepsdk-edge-ios/blob/dev/Sources/EdgeNetworkHandlers/StoreResponsePayload.swift#L27

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I will update it to match the mobile SDK, in case we decide to persist these. I should have the changes in by today mostly.

Copy link
Copy Markdown
Contributor Author

@addb addb Jul 24, 2024

Choose a reason for hiding this comment

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

@kevinlind as per our discussion I will take this as a separate task/PR #178

@addb addb requested a review from kevinlind July 24, 2024 20:51
@addb addb merged commit 8610a5b into adobe:consent Jul 25, 2024
@addb addb deleted the konductorConfig branch September 5, 2024 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants