Authored by 周蓉君

在钥匙串中存储app是否是首次启动。Review by 阿达。

... ... @@ -63,5 +63,7 @@
+ (void) setOptOut:(BOOL)optOutValue;
+ (void) setUsedDevice;
+ (BOOL) isNewDevice;
+ (void) setFirstLaunch;
+ (BOOL) isFirstLaunch;
@end
... ...
... ... @@ -72,6 +72,7 @@ static NSString * const kYohoBuyUdid = @"com.yoho.buy.udid";
static BOOL isNew = YES;
static NSString * const kYohoDeviceInfo = @"com.yoho.buy.deviceinfo";
static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch";
@interface OpenUDID (Private)
+ (void) _setDict:(id)dict forPasteboard:(id)pboard;
... ... @@ -419,4 +420,21 @@ static NSString * const kYohoBuyUsedDevice = @"com.yoho.buy.useddevice";
return isNew;
}
+ (void) setFirstLaunch
{
NSMutableDictionary *yohoinfoKVPairs = [NSMutableDictionary dictionary];
[yohoinfoKVPairs setObject:@"N" forKey:kYohoBuyFirstLaunch];
[YH_KeychainStore save:kYohoDeviceInfo data:yohoinfoKVPairs];
}
+ (BOOL) isFirstLaunch
{
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo];
if (yohoinfoKVPairs && yohoinfoKVPairs[kYohoBuyFirstLaunch]) {
return NO;
} else {
return YES;
}
}
@end
... ...