-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathBrazeServiceAdapter.swift
50 lines (41 loc) · 1.4 KB
/
BrazeServiceAdapter.swift
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
50
import Foundation
/**
Adapter for the Appboy iOS SDK.
# Useful links:
- https://www.braze.com/docs/developer_guide/platform_integration_guides/ios/analytics/tracking_custom_events/
# Package example:
```
// swift-tools-version: 5.10
import PackageDescription
let package = Package(
name: "Example",
dependencies: [
.package(name: "Tracker", path: "./swift-event-tracker"),
.package(url: "https://github.com/Appboy/appboy-ios-sdk", from: "4.0.0"),
],
targets: [
.target(name: "Example", dependencies: [.product(name: "Appboy_iOS_SDK", package: "appboy-ios-sdk"), "Tracker"]),
]
)
```
# Integration example:
```
import AppboyKit
import Tracker
extension Appboy: BrazeServiceAdapter {
public func setCustomAttributeWithKey(_ key: String, andStringValue value: String) {
Appboy.sharedInstance()?.user.setCustomAttributeWithKey(key, andStringValue: value)
}
public func unsetCustomAttributeWithKey(_ key: String) {
Appboy.sharedInstance()?.user.unsetCustomAttribute(withKey: key)
}
}
```
*/
// sourcery: AutoMockable
public protocol BrazeServiceAdapter: AnyObject {
func changeUser(_ userId: String)
func logCustomEvent(_ eventName: String, withProperties: [AnyHashable: Any]?)
func setCustomAttributeWithKey(_ key: String, andStringValue value: String)
func unsetCustomAttributeWithKey(_ key: String)
}