Skip to main content

Device

Models and methods for managing the current device's registration and metadata.

TFDevice

Represents the current device and its associated metadata.

public struct TFDevice {
public let id: String
public private(set) var name: String
public private(set) var locale: Locale?
public private(set) var pushNotificationsToken: String?
public private(set) var pushNotificationsProvider: TFPushNotificationsProvider?
public private(set) var registrationDate: Date?

public init(
id: String,
name: String,
locale: Locale? = nil,
pushNotificationsToken: String? = nil,
pushNotificationsProvider: TFPushNotificationsProvider? = nil,
registrationDate: Date? = nil
)

/// Updates the device name.
/// Throws if the name does not satisfy the length requirements.
public mutating func setName(_ name: String) throws

/// Updates the push notification token and provider.
public mutating func setPushNotifications(
token: String?,
provider: TFPushNotificationsProvider?
)

/// Updates the device locale.
public mutating func setLocale(_ locale: Locale)
}

TFPushNotificationsProvider

The push notification service used by the device.

public enum TFPushNotificationsProvider: String {
case apple
case firebase
}