| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283 |
- 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<DisconnectDomain> 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<String, dynamic> 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<String, dynamic> 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();
- }
- }
|