Authored by 周蓉君

在钥匙链中存储当前设备是否为旧设备,旧设备指用户登录过的设备。Review by 硬币。

... ... @@ -61,5 +61,7 @@
+ (NSString*) value;
+ (NSString*) valueWithError:(NSError**)error;
+ (void) setOptOut:(BOOL)optOutValue;
+ (void) setUsedDevice;
+ (BOOL) isNewDevice;
@end
... ...
... ... @@ -68,6 +68,7 @@ static NSString * const kOpenUDIDSlotPBPrefix = @"org.OpenUDID.slot.";
static int const kOpenUDIDRedundancySlots = 100;
static NSString * const kYohoSecretInfo = @"com.yoho.buy.secretinfo";
static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid";
static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
@interface OpenUDID (Private)
+ (void) _setDict:(id)dict forPasteboard:(id)pboard;
... ... @@ -392,4 +393,24 @@ static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid";
}
+ (void) setUsedDevice
{
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo];
if (yohoinfoKVPairs == nil) {
yohoinfoKVPairs = [NSMutableDictionary dictionary];
}
[yohoinfoKVPairs setObject:@"Y" forKey:kYohoBuyUsedDevice];
[YH_KeychainStore save:kYohoSecretInfo data:yohoinfoKVPairs];
}
+ (BOOL) isNewDevice
{
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoSecretInfo];
if (yohoinfoKVPairs == nil || yohoinfoKVPairs[kYohoBuyUsedDevice] == nil) {
return YES;
} else {
return NO;
}
}
@end
... ...