Skip to content

Commit

Permalink
chore: Add QA settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Ahmed-Ali committed Jun 23, 2024
1 parent d57ce83 commit 7fe98a0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 8 additions & 0 deletions ios/wrappers/utils/CioConfigUtils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,18 @@ extension Region: Decodable {}

let logLevels = Set<String>(CioLogLevel.allCases.map(\.rawValue))

struct QASettings: Decodable {
let cdnHost: String
let apiHost: String
}

struct RCTCioConfig: Decodable {
let cdpApiKey: String
let siteId: String?
let region: Region?
let trackApplicationLifecycleEvents: Bool?
let enableInApp: Bool?
let qa: QASettings?

static func from(_ json: AnyObject) throws -> Self {
let data = try JSONSerialization.data(withJSONObject: json, options: [])
Expand Down Expand Up @@ -39,6 +45,8 @@ func cioInitializeConfig(from config: RCTCioConfig, logLevel: String?) -> CioCon
ifNotNil(config.region, thenPassItTo: cdpConfigBuilder.region)
ifNotNil(config.trackApplicationLifecycleEvents, thenPassItTo: cdpConfigBuilder.trackApplicationLifecycleEvents)
ifNotNil(cioLogLevel, thenPassItTo: cdpConfigBuilder.logLevel)
ifNotNil(config.qa?.cdnHost, thenPassItTo: cdpConfigBuilder.cdnHost)
ifNotNil(config.qa?.apiHost, thenPassItTo: cdpConfigBuilder.apiHost)

var inAppConfig: MessagingInAppConfigOptions? = nil

Expand Down
4 changes: 0 additions & 4 deletions src/customer-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,13 @@ export class CustomerIO {
id?: string,
traits?: Record<string, any>
) => {
CustomerIO.assrtInitialized();
if (!id && !traits) {
throw new Error('You must provide an id or traits to identify');
}
return NativeCustomerIO.identify(id, traits);
};

static readonly clearIdentify = async () => {
CustomerIO.assrtInitialized();
return NativeCustomerIO.clearIdentify();
};

Expand Down Expand Up @@ -74,14 +72,12 @@ export class CustomerIO {
static readonly setProfileAttributes = async (
attributes: Record<string, any>
) => {
CustomerIO.assrtInitialized();
return NativeCustomerIO.setProfileAttributes(attributes);
};

static readonly setDeviceAttributes = async (
attributes: Record<string, any>
) => {
CustomerIO.assrtInitialized();
return NativeCustomerIO.setDeviceAttributes(attributes);
};

Expand Down

0 comments on commit 7fe98a0

Please sign in to comment.