Skip to content

Conversation

@qmathe
Copy link

@qmathe qmathe commented Jul 18, 2018

This PR adds support for the app secret feature introduced by Adjust SDK 4.12.

Why is it needed?

The app secret consists of a secret identifier and four info fields representing the secret itself.

This app secret is verified by Adjust SDK against Adjust servers after setting it on ADJConfig. Since SEGAdjustIntegration is in charge of creating ADJConfig, there is no way to customize this config object externally without changing SEGAdjustIntegration.

What has been changed?

The main change consists of passing secret identifier and info fields as SEGAdjustAppSecret to SEGAdjustIntegrationFactory initializer, then SEGAdjustIntegration initializer. SEGAdjustIntegrationFactory caches the app secret object locally until SEGAdjustIntegration is created.

You can use the resulting API like this:

        let configuration = SEGAnalyticsConfiguration(writeKey: key)
        let secret = SEGAdjustAppSecret(
                id: 1, 
                info1: 48730982787, 
                info2: 038762324, 
                info3: 29387611267, 
                info4: 635489772
        )

        configuration.use(SEGAdjustIntegrationFactory.instance(appSecret: secret))

        SEGAnalytics.setup(with: configuration)

Notes

Initially I chose to represent the app secret as an array. However a dedicated class like SEGAdjustSecret seems like a better choice, it makes the API more explicit and eliminates conversion to NSNumber (especially when integrating with Swift where casting to [NSNumber] was required when using an array).

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

Successfully merging this pull request may close these issues.

1 participant