-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathRCTConvert+Types.swift
More file actions
49 lines (41 loc) · 1.46 KB
/
RCTConvert+Types.swift
File metadata and controls
49 lines (41 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// RCTConvert+Types.swift
// sourcepoint-react-native-cmp
//
// Created by Andre Herculano on 3/5/24.
//
import Foundation
import React
import ConsentViewController
@objcMembers class SPLoadMessageParams: NSObject {
let authId: String?
init(authId: String?) {
self.authId = authId
}
}
extension RCTConvert {
@objc static func SPCampaignEnv(_ envString: String?) -> ConsentViewController.SPCampaignEnv {
switch envString {
case "Public": .Public
case "Stage": .Stage
default: .Public
}
}
@objc static func SPCampaign(_ json: NSDictionary?) -> ConsentViewController.SPCampaign? {
guard let json = json else { return nil }
return ConsentViewController.SPCampaign(
targetingParams: json["targetingParams"] as? [String: String] ?? [:],
supportLegacyUSPString: json["supportLegacyUSPString"] as? Bool ?? false
)
}
@objc static func SPCampaigns(_ json: NSDictionary) -> ConsentViewController.SPCampaigns {
ConsentViewController.SPCampaigns(
gdpr: SPCampaign(json["gdpr"] as? NSDictionary),
usnat: SPCampaign(json["usnat"] as? NSDictionary),
environment: SPCampaignEnv(json["environment"] as? String)
)
}
@objc static func SPLoadMessageParams(_ json: NSDictionary) -> SPLoadMessageParams {
sourcepoint_react_native_cmp.SPLoadMessageParams(authId: json["authId"] as? String)
}
}