Git Product home page Git Product logo

aepsdk-edgeconsent-ios's Issues

Release tvOS support for EdgeConsent

Merge changes to staging and update test targets to point to staging for other Edge dependencies

  • Remove macros like #if os(iOS) once we have tvOS supported stable branch
  • Update min version for edge, edgeIdentity wherever applicable

Release tvOS target
Update docs: current sdk versions, release notes

Refactor functional tests to use new test utils

Task description

The existing functional tests should be refactored to use the newly available common test utilities available in: https://github.com/adobe/aepsdk-testutils-ios

With the following items covered:

  1. Any changes required to the common test utils should be opened as a PR to the test utils repo, optimally in a non-breaking change manner (although before the 1.0.0 release of the test utils, larger changes should be ok)
  2. Manual dictionary/array property assertions should be refactored to use the JSON comparison tool
  3. Test utilities that exist in the test utils repo should be used over equivalent test util classes defined locally

Additional implementation details or code snippet(s)

No response

Public API Design

The Consent extension will need two APIs:

  1. An API to retrieve the current consents getConsents
  2. An API to update specific consents setConsent:

Option 1:

Public types

ConsentType

This type will represent all possible consents that the user can manually update. In the beginning, the only consent type to be available through the API will be the collect consent type. However, as more consent types are created, we can add additional consent types.

public enum ConsentType {
   case collect
}

Note: This is a stripped-down definition. The actual definition will be modified to support Objective-C.

ConsentStatus

This type represents all the possible statuses for a given consent. This will be limited to "yes" and "no".

public enum ConsentStatus {
   case yes
   case no
}

Note: This is a stripped-down definition. The actual definition will be modified to support Objective-C.

Retrieving current consents

This API allows for customers to fetch the current consent statues stored by the Consent extension.

Swift definition:

/// Returns a dictionary containing all the consents and their current statues
/// - Parameter completion: invoked with a dictionary containing the consent type mapped to the current consent status
static func getConsents(completion: @escaping ([ConsentType: ConsentStatus]?, Error?) -> Void)

Objective-C definition:

/// Returns a dictionary containing all the consents and their current statues
/// - Parameter completion: invoked with a dictionary containing the consent type mapped to the current consent status
@available (*, unavailable) // only expose this API to Obj-C
static func getConsents(completion: @escaping ([String: String]?, Error?) -> Void)

Swift usage:

Consent.getConsents { (consents, error) in
    // check error, handle consents
   guard error == nil else { return }
   let collectConsent = consents[.collect]
}

This API returns a dictionary of consents mapped to their corresponding status. This makes it easy for a customer to look up a status for a given consent quickly.

There is one catch... we are not able to bridge a dictionary that contains enums to Objective-C. In the API definition, we have a dictionary where the keys and values are enums, [ConsentType: ConsentStatus]. The workaround is to provide an API only available in Objective-C which instead returns a dictionary of type [String: String]. Where the keys are a string representation of the consent type and status. For example @{"collect": "yes"}.

Objective-C usage:

[AEPConsent getConsents:^(NSDictionary<NSString *,NSString *> * _Nullable consents, NSError * _Nullable error) {
    if (error != nil) { return; }
    NSString *consentStatus = consents[@"collect"];
}];

Updating/setting a consent

This API allows customers to set/update a given consent with a consent status. This API will either override the current status for a consent or set it for the first time.

Definition:

/// Updates a given `ConsentType` to a `ConsentStatus`
/// - Parameters:
///   - type: the `ConsentType` to be updated
///   - status: the `ConsentStatus` for `type`
@objc(setConsent:status:)
static func setConsent(type: ConsentType, status: ConsentStatus)

Swift usage:

 // set collect to yes
Consent.setConsent(type: .collect, status: .yes)

// set collect to no
Consent.setConsent(type: .collect, status: .no)

Objective-C usage:

 // set collect to yes
[AEPConsent setConsent:AEPConsentTypeCollect status:AEPConsentStatusYes];

// set collect to no
[AEPConsent setConsent:AEPConsentTypeCollect status:AEPConsentStatusNo];

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.