Authored by 周蓉君

device内新增afp字段,记录app安装指纹。Review by 硬币。

... ... @@ -23,5 +23,6 @@
@property (copy, nonatomic, readonly) NSString *ifv; // ifv
@property (copy, nonatomic, readonly) NSString *res; // 分辨率
@property (copy, nonatomic, readonly) NSString *mac; // Mac地址
@property (copy, nonatomic, readonly) NSString *afp; // app安装指纹(40位随机数)
@end
... ...
... ... @@ -18,6 +18,8 @@
#import "YHDevice.h"
static NSString *const kAppFingerPrint = @"com.yoho.appfingerprint";
@interface YHDevice ()
@property (copy, nonatomic) NSString *sv; // 采集数据sdk的版本
... ... @@ -29,6 +31,7 @@
@property (copy, nonatomic) NSString *ifv; // ifv
@property (copy, nonatomic) NSString *res; // 分辨率
@property (copy, nonatomic) NSString *mac; // Mac地址
@property (copy, nonatomic) NSString *afp; // app安装指纹(40位随机数)
@end
... ... @@ -66,6 +69,8 @@
self.ifa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
self.mac = [YHDevice getMacAddress];
self.afp = [YHDevice getAppFingerPrint];
}
return self;
... ... @@ -85,6 +90,7 @@
JsonKeyDeviceIFV : self.ifv ? self.ifv : @"",
JsonKeyDeviceRES : self.res ? self.res : @"",
JsonKeyDeviceMAC : self.mac ? self.mac : @"",
JsonKeyDeviceAFP : self.afp ? self.afp : @""
};
}
... ... @@ -153,4 +159,16 @@
return macAddressString;
}
+ (NSString *)getAppFingerPrint
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *fpString = [defaults objectForKey:kAppFingerPrint];
if (fpString == nil || ![fpString isKindOfClass:[NSString class]] || fpString.length != 40) {
fpString = [OpenUDID _generateFreshOpenUDID];
[defaults setObject:fpString forKey:kAppFingerPrint];
[defaults synchronize];
}
return fpString;
}
@end
... ...
... ... @@ -65,5 +65,5 @@
+ (BOOL) isNewDevice;
+ (void) setFirstLaunch;
+ (BOOL) isFirstLaunch;
+ (NSString*) _generateFreshOpenUDID;
@end
... ...
... ... @@ -77,7 +77,6 @@ static NSString * const kYohoBuyFirstLaunch = @"firstlaunch";
@interface OpenUDID (Private)
+ (void) _setDict:(id)dict forPasteboard:(id)pboard;
+ (NSMutableDictionary*) _getDictFromPasteboard:(id)pboard;
+ (NSString*) _generateFreshOpenUDID;
@end
@implementation OpenUDID
... ...
... ... @@ -86,6 +86,7 @@
#define JsonKeyDeviceIFV @"ifv" // idfv
#define JsonKeyDeviceRES @"res" // 分辨率
#define JsonKeyDeviceMAC @"mac" // Mac地址
#define JsonKeyDeviceAFP @"afp" // app安装指纹
// 状态参数
#define JsonKeyStatusAV @"av" // App版本号
... ...