Code Monkey home page Code Monkey logo

aepsdk-edgeconsent-ios's Introduction

Adobe Experience Platform Consent Collection Mobile Extension

CocoaPods SPM CircleCI Code Coverage

About this project

The AEP Consent Collection mobile extension enables consent preferences collection from the mobile application when using the Adobe Experience Platform SDK and the Edge Network extension.

Requirements

  • Xcode 15 (or newer)
  • Swift 5.1 (or newer)

Installation

These are currently the supported installation options:

# Podfile
use_frameworks!

# for app development, include all the following pods
target 'YOUR_TARGET_NAME' do
    pod 'AEPEdgeConsent'
    pod 'AEPCore'
    pod 'AEPEdge'
    pod 'AEPEdgeIdentity'
end

# for extension development, include AEPCore, AEPEdgeConsent, and their dependencies
target 'YOUR_TARGET_NAME' do
    pod 'AEPEdgeConsent'
    pod 'AEPCore'
end

Replace YOUR_TARGET_NAME and then, in the Podfile directory, type:

$ pod install

To add the AEPEdgeConsent Package to your application, from the Xcode menu select:

File > Add Packages...

Note The menu options may vary depending on the version of Xcode being used.

Enter the URL for the AEPEdgeConsent package repository: https://github.com/adobe/aepsdk-edgeconsent-ios.git.

When prompted, make sure you change the branch to main. (Once the repo is public, we will reference specific tags/versions instead of a branch)

Alternatively, if your project has a Package.swift file, you can add AEPEdgeConsent directly to your dependencies:

dependencies: [
    .package(url: "https://github.com/adobe/aepsdk-edgeconsent-ios.git", .upToNextMajor(from: "5.0.0"))
],
targets: [
    .target(name: "YourTarget",
            dependencies: ["AEPEdgeConsent"],
            path: "your/path")    
]

Binaries

To generate an AEPEdgeConsent.xcframework, run the following command:

$ make archive

This generates the xcframework under the build folder. Drag and drop all the .xcframeworks to your app target in Xcode.

Development

The first time you clone or download the project, you should run the following from the root directory to setup the environment:

make pod-install

Subsequently, you can make sure your environment is updated by running the following:

make pod-update

Open the Xcode workspace

Open the workspace in Xcode by running the following command from the root directory of the repository:

make open

Command line integration

You can run all the test suites from command line:

make test

Related Projects

Project Description
AEPCore Extensions The AEPCore and AEPServices represent the foundation of the Adobe Experience Platform SDK.
AEPEdge Extension The AEPEdge extension allows you to send data to the Adobe Experience Platform (AEP) from a mobile application.
AEPEdgeIdentity Extension The AEPEdgeIdentity enables handling of user identity data from a mobile app when using the AEPEdge extension.
AEP SDK Sample App for iOS Contains iOS sample apps for the AEP SDK. Apps are provided for both Objective-C and Swift implementations.
AEP SDK Sample App for Android Contains Android sample app for the AEP SDK.

Contributing

Contributions are welcomed! Read the Contributing Guide for more information.

Licensing

This project is licensed under the Apache V2 License. See LICENSE for more information.

aepsdk-edgeconsent-ios's People

Contributors

addb avatar cacheung avatar dependabot[bot] avatar emdobrin avatar kevinlind avatar nporter-adbe avatar pravinpk avatar sbenedicadb avatar timkimadobe avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aepsdk-edgeconsent-ios's Issues

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];

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

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.