28 lines
621 B
Swift
28 lines
621 B
Swift
//
|
|
// SRDeviceId.swift
|
|
// SynthReel
|
|
//
|
|
// Created by 湖北秦九 on 2025/11/12.
|
|
// Copyright © 2025 SR. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class SRDeviceId {
|
|
|
|
static let shared = SRDeviceId()
|
|
private let key = "com.synthreel.deviceid"
|
|
|
|
// private init() {}
|
|
|
|
lazy var id: String = {
|
|
if let savedID = SRKeychain.shared.read(key: key) {
|
|
return savedID
|
|
} else {
|
|
let newID = UIDevice.current.identifierForVendor?.uuidString ?? UUID().uuidString
|
|
SRKeychain.shared.save(key: key, value: newID)
|
|
return newID
|
|
}
|
|
}()
|
|
}
|