...
|
...
|
@@ -70,9 +70,9 @@ static NSString * const kYohoSecretInfo = @"secretinfo"; |
|
|
static NSString * const kYohoBuyUdid = @"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";
|
|
|
static NSString * const kYohoDeviceInfo = @"deviceinfo";
|
|
|
static NSString * const kYohoBuyUsedDevice = @"useddevice";
|
|
|
static NSString * const kYohoBuyFirstLaunch = @"firstlaunch";
|
|
|
|
|
|
@interface OpenUDID (Private)
|
|
|
+ (void) _setDict:(id)dict forPasteboard:(id)pboard;
|
...
|
...
|
@@ -405,9 +405,18 @@ static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch"; |
|
|
{
|
|
|
if ([self isNewDevice]) {
|
|
|
isNew = NO;
|
|
|
NSMutableDictionary *yohoinfoKVPairs = [NSMutableDictionary dictionary];
|
|
|
[yohoinfoKVPairs setObject:@"Y" forKey:kYohoBuyUsedDevice];
|
|
|
[YH_KeychainStore save:kYohoDeviceInfo data:yohoinfoKVPairs];
|
|
|
|
|
|
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
|
|
|
NSString *deviceInfoKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoDeviceInfo];
|
|
|
NSString *usedDeviceKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoBuyUsedDevice];
|
|
|
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:deviceInfoKey];
|
|
|
if (yohoinfoKVPairs == nil) {
|
|
|
yohoinfoKVPairs = [NSMutableDictionary dictionary];
|
|
|
}
|
|
|
|
|
|
[yohoinfoKVPairs setObject:@"Y" forKey:usedDeviceKey];
|
|
|
[YH_KeychainStore save:deviceInfoKey data:yohoinfoKVPairs];
|
|
|
}
|
|
|
}
|
|
|
|
...
|
...
|
@@ -415,8 +424,12 @@ static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch"; |
|
|
{
|
|
|
static dispatch_once_t onceToken;
|
|
|
dispatch_once(&onceToken, ^{
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo];
|
|
|
if (yohoinfoKVPairs && yohoinfoKVPairs[kYohoBuyUsedDevice]) {
|
|
|
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
|
|
|
NSString *deviceInfoKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoDeviceInfo];
|
|
|
NSString *usedDeviceKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoBuyUsedDevice];
|
|
|
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:deviceInfoKey];
|
|
|
if (yohoinfoKVPairs && yohoinfoKVPairs[usedDeviceKey]) {
|
|
|
isNew = NO;
|
|
|
}
|
|
|
});
|
...
|
...
|
@@ -426,15 +439,27 @@ static NSString * const kYohoBuyFirstLaunch = @"com.yoho.buy.firstlaunch"; |
|
|
|
|
|
+ (void) setFirstLaunch
|
|
|
{
|
|
|
NSMutableDictionary *yohoinfoKVPairs = [NSMutableDictionary dictionary];
|
|
|
[yohoinfoKVPairs setObject:@"N" forKey:kYohoBuyFirstLaunch];
|
|
|
[YH_KeychainStore save:kYohoDeviceInfo data:yohoinfoKVPairs];
|
|
|
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
|
|
|
NSString *deviceInfoKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoDeviceInfo];
|
|
|
NSString *firstLaunchKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoBuyFirstLaunch];
|
|
|
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:deviceInfoKey];
|
|
|
if (yohoinfoKVPairs == nil) {
|
|
|
yohoinfoKVPairs = [NSMutableDictionary dictionary];
|
|
|
}
|
|
|
|
|
|
[yohoinfoKVPairs setObject:@"N" forKey:firstLaunchKey];
|
|
|
[YH_KeychainStore save:deviceInfoKey data:yohoinfoKVPairs];
|
|
|
}
|
|
|
|
|
|
+ (BOOL) isFirstLaunch
|
|
|
{
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:kYohoDeviceInfo];
|
|
|
if (yohoinfoKVPairs && yohoinfoKVPairs[kYohoBuyFirstLaunch]) {
|
|
|
NSString *bundleId = [[[NSBundle mainBundle] infoDictionary] objectForKey:(__bridge NSString *)kCFBundleIdentifierKey];
|
|
|
NSString *deviceInfoKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoDeviceInfo];
|
|
|
NSString *firstLaunchKey = [NSString stringWithFormat:@"%@.%@", bundleId, kYohoBuyFirstLaunch];
|
|
|
|
|
|
NSMutableDictionary *yohoinfoKVPairs = (NSMutableDictionary *)[YH_KeychainStore load:deviceInfoKey];
|
|
|
if (yohoinfoKVPairs && yohoinfoKVPairs[firstLaunchKey]) {
|
|
|
return NO;
|
|
|
} else {
|
|
|
return YES;
|
...
|
...
|
|