import '../../constants/configs.dart'; import 'disconnect_domain.dart'; /// 设备指纹信息 /// /// 描述用户软件、硬件设备相关信息 class Fingerprint { /// 软件产品名称 String productCode; /// 硬件平台标识符 String platform; /// 渠道标识符 String channel; /// 设备硬件ID String deviceId; /// 版本值 int appVersionCode; /// 版本名称 String appVersionName; /// 设备语言 String lang; /// 设备型号 String deviceModel; /// 设备系统类型 String deviceOs; /// 设备品牌 String deviceBrand; /// 设备宽度 int deviceWidth; /// 设备高度 int deviceHeight; /// ios 钥匙串 String keychain; /// Google Services Framework ID String gsfId; /// Google Advertising ID String googleId; /// Android ID String androidId; /// iOS IDFA String idfa; /// 设备时区 int timezoneOffset; /// installReferrer String refer; String country; /// 是否是新安装 bool isNewInstall; /// 用户UUID String userUuid; /// 是否有SIM卡 bool simReady; /// 运营商 String carrierName; /// 运营商MCC String mcc; /// 运营商MNC String mnc; /// 国家ISO String countryIso; String networkCarrierName; String networkMcc; String networkMnc; String networkCountryIso; // 手机国家码 String phoneCountryIso; /// 是否VPN bool isVpn; /// 是否连接自己的VPN bool isConnectedVpn; /// 是否是开发者模式 int adb; /// 连接不上网络的域名 List disconnectDomainList; /// 扩展数据 dynamic exData; /// 默认构造函数 Fingerprint({ required this.productCode, required this.platform, required this.channel, required this.deviceId, required this.appVersionCode, required this.appVersionName, required this.lang, required this.deviceModel, required this.deviceOs, required this.deviceBrand, required this.deviceWidth, required this.deviceHeight, this.keychain = '', this.gsfId = '', this.googleId = '', this.androidId = '', this.idfa = '', this.refer = '', required this.timezoneOffset, required this.country, this.isNewInstall = false, this.userUuid = '', this.simReady = false, this.carrierName = '', this.mcc = '', this.mnc = '', this.countryIso = '', this.networkCarrierName = '', this.networkMcc = '', this.networkMnc = '', this.networkCountryIso = '', this.phoneCountryIso = '', this.isVpn = false, this.isConnectedVpn = false, this.adb = 2, this.disconnectDomainList = const [], this.exData, }); /// 空对象构造函数 factory Fingerprint.empty() { return Fingerprint( productCode: Configs.productCode, platform: 'unknown', channel: 'unknown', deviceId: '', appVersionCode: 0, appVersionName: '', lang: 'en', deviceModel: 'unknown', deviceOs: 'unknown', deviceBrand: 'unknown', deviceWidth: 0, deviceHeight: 0, timezoneOffset: DateTime.now().timeZoneOffset.inSeconds, country: '', isNewInstall: false, userUuid: '', simReady: false, carrierName: '', mcc: '', mnc: '', countryIso: '', networkCarrierName: '', networkMcc: '', networkMnc: '', networkCountryIso: '', phoneCountryIso: '', isVpn: false, isConnectedVpn: false, adb: 2, disconnectDomainList: const [], exData: null, ); } /// 从JSON创建对象 factory Fingerprint.fromJson(Map json) { return Fingerprint( productCode: json['productCode'] ?? Configs.productCode, platform: json['platform'] ?? 'unknown', channel: json['channel'] ?? 'unknown', deviceId: json['deviceId'] ?? '', appVersionCode: json['appVersionCode'] ?? 0, appVersionName: json['appVersionName'] ?? '', lang: json['lang'] ?? 'en', deviceModel: json['deviceModel'] ?? 'unknown', deviceOs: json['deviceOs'] ?? 'unknown', deviceBrand: json['deviceBrand'] ?? 'unknown', deviceWidth: json['deviceWidth'] ?? 0, deviceHeight: json['deviceHeight'] ?? 0, keychain: json['keychain'] ?? '', gsfId: json['gsfId'] ?? '', googleId: json['googleId'] ?? '', androidId: json['androidId'] ?? '', idfa: json['idfa'] ?? '', refer: json['refer'] ?? '', timezoneOffset: json['timezoneOffset'] ?? DateTime.now().timeZoneOffset.inSeconds, country: json['country'] ?? '', isNewInstall: json['isNewInstall'] ?? false, userUuid: json['userUuid'] ?? '', simReady: json['simReady'] ?? false, carrierName: json['carrierName'] ?? '', mcc: json['mcc'] ?? '', mnc: json['mnc'] ?? '', countryIso: json['countryIso'] ?? '', networkCarrierName: json['networkCarrierName'] ?? '', networkMcc: json['networkMcc'] ?? '', networkMnc: json['networkMnc'] ?? '', networkCountryIso: json['networkCountryIso'] ?? '', phoneCountryIso: json['phoneCountryIso'] ?? '', isVpn: json['isVpn'] ?? false, isConnectedVpn: json['isConnectedVpn'] ?? false, adb: json['adb'] ?? 2, disconnectDomainList: json['disconnectDomainList'] ?? const [], exData: json['exData'], ); } /// 转换为Map Map toJson() { return { 'productCode': productCode, 'platform': platform, 'channel': channel, 'deviceId': deviceId, 'appVersionCode': appVersionCode, 'appVersionName': appVersionName, 'lang': lang, 'deviceModel': deviceModel, 'deviceOs': deviceOs, 'deviceBrand': deviceBrand, 'deviceWidth': deviceWidth, 'deviceHeight': deviceHeight, 'keychain': keychain, 'gsfId': gsfId, 'googleId': googleId, 'androidId': androidId, 'idfa': idfa, 'refer': refer, 'timezoneOffset': timezoneOffset, 'country': country, 'isNewInstall': isNewInstall, 'userUuid': userUuid, 'simReady': simReady, 'carrierName': carrierName, 'mcc': mcc, 'mnc': mnc, 'countryIso': countryIso, 'networkCarrierName': networkCarrierName, 'networkMcc': networkMcc, 'networkMnc': networkMnc, 'networkCountryIso': networkCountryIso, 'phoneCountryIso': phoneCountryIso, 'isVpn': isVpn, 'isConnectedVpn': isConnectedVpn, 'adb': adb, 'disconnectDomainList': disconnectDomainList, 'exData': exData, }; } @override String toString() { return toJson().toString(); } }