Fableon/Fableon/Object/Libs/FAIap/FAWaitRestoreModel.swift
2025-10-29 10:26:27 +08:00

50 lines
1.5 KiB
Swift

//
// FAWaitRestoreModel.swift
// Fableon
//
// Created by on 2025/10/24.
//
import UIKit
class FAWaitRestoreModel: NSObject, NSSecureCoding {
var orderCode: String?
var payId: String?
var productId: String?
var receipt: String?
var buyType: FAStoreAPI.BuyType?
var transactionId: String?
required override init() { }
static var supportsSecureCoding: Bool {
get {
return true
}
}
func encode(with coder: NSCoder) {
coder.encode(orderCode, forKey: "orderCode")
coder.encode(payId, forKey: "payId")
coder.encode(productId, forKey: "productId")
coder.encode(receipt, forKey: "receipt")
coder.encode(buyType?.rawValue, forKey: "buyType")
coder.encode(transactionId, forKey: "transactionId")
}
required init?(coder: NSCoder) {
super.init()
orderCode = coder.decodeObject(of: NSString.self, forKey: "orderCode") as? String
payId = coder.decodeObject(of: NSString.self, forKey: "payId") as? String
productId = coder.decodeObject(of: NSString.self, forKey: "productId") as? String
receipt = coder.decodeObject(of: NSString.self, forKey: "receipt") as? String
transactionId = coder.decodeObject(of: NSString.self, forKey: "transactionId") as? String
if let type = coder.decodeObject(of: NSString.self, forKey: "buyType") as? String {
buyType = FAStoreAPI.BuyType(rawValue: type)
}
}
}