mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various bugfixes in Hockey client
- Fix possible crash if hockey.bundle is missing - Fix daily check not working
This commit is contained in:
parent
dc631f4d7e
commit
9d80a51da5
@ -52,8 +52,7 @@
|
|||||||
|
|
||||||
NSBundle *hockeyBundle(void);
|
NSBundle *hockeyBundle(void);
|
||||||
NSString *BWmd5(NSString *str);
|
NSString *BWmd5(NSString *str);
|
||||||
|
NSString *BWHockeyLocalize(NSString *stringToken);
|
||||||
#define BWHockeyLocalize(StringToken) NSLocalizedStringFromTableInBundle(StringToken, @"Hockey", hockeyBundle(), @"")
|
|
||||||
|
|
||||||
// compatibility helper
|
// compatibility helper
|
||||||
#ifdef HOCKEYLIB_STATIC_LIBRARY
|
#ifdef HOCKEYLIB_STATIC_LIBRARY
|
||||||
|
@ -51,3 +51,11 @@ NSString *BWmd5(NSString *str) {
|
|||||||
result[14], result[15]
|
result[14], result[15]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NSString *BWHockeyLocalize(NSString *stringToken) {
|
||||||
|
if (hockeyBundle()) {
|
||||||
|
return NSLocalizedStringFromTableInBundle(stringToken, @"Hockey", hockeyBundle(), @"");
|
||||||
|
} else {
|
||||||
|
return stringToken;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -363,7 +363,8 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
requireAuthorization_ = NO;
|
requireAuthorization_ = NO;
|
||||||
authenticationSecret_= nil;
|
authenticationSecret_= nil;
|
||||||
loggingEnabled_ = NO;
|
loggingEnabled_ = NO;
|
||||||
|
lastCheck_ = nil;
|
||||||
|
|
||||||
// check if we are really not in an app store environment
|
// check if we are really not in an app store environment
|
||||||
if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
|
if ([[NSBundle mainBundle] pathForResource:@"embedded" ofType:@"mobileprovision"]) {
|
||||||
isAppStoreEnvironment_ = NO;
|
isAppStoreEnvironment_ = NO;
|
||||||
@ -395,6 +396,17 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
self.updateSetting = HockeyUpdateCheckStartup;
|
self.updateSetting = HockeyUpdateCheckStartup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ([[NSUserDefaults standardUserDefaults] objectForKey:kDateOfLastHockeyCheck]) {
|
||||||
|
// we did write something else in the past, so for compatibility reasons do this
|
||||||
|
id tempLastCheck = [[NSUserDefaults standardUserDefaults] objectForKey:kDateOfLastHockeyCheck];
|
||||||
|
if ([tempLastCheck isKindOfClass:[NSDate class]]) {
|
||||||
|
lastCheck_ = tempLastCheck;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!lastCheck_) {
|
||||||
|
lastCheck_ = [NSDate distantPast];
|
||||||
|
}
|
||||||
|
|
||||||
if ([[NSUserDefaults standardUserDefaults] objectForKey:kHockeyAllowUserSetting]) {
|
if ([[NSUserDefaults standardUserDefaults] objectForKey:kHockeyAllowUserSetting]) {
|
||||||
self.userAllowsSendUserData = [[NSUserDefaults standardUserDefaults] boolForKey:kHockeyAllowUserSetting];
|
self.userAllowsSendUserData = [[NSUserDefaults standardUserDefaults] boolForKey:kHockeyAllowUserSetting];
|
||||||
} else {
|
} else {
|
||||||
@ -406,6 +418,10 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
} else {
|
} else {
|
||||||
self.userAllowsSendUsageTime = YES;
|
self.userAllowsSendUsageTime = YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hockeyBundle()) {
|
||||||
|
NSLog(@"WARNING: Hockey.bundle is missing, make sure it is added!");
|
||||||
|
}
|
||||||
|
|
||||||
if (!isAppStoreEnvironment_) {
|
if (!isAppStoreEnvironment_) {
|
||||||
|
|
||||||
@ -695,7 +711,11 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
checkForUpdate = YES;
|
checkForUpdate = YES;
|
||||||
break;
|
break;
|
||||||
case HockeyUpdateCheckDaily:
|
case HockeyUpdateCheckDaily:
|
||||||
checkForUpdate = [[[self.lastCheck description] substringToIndex:10] compare:[[[NSDate date] description] substringToIndex:10]] != NSOrderedSame;
|
NSTimeInterval dateDiff = fabs([self.lastCheck timeIntervalSinceNow]);
|
||||||
|
if (dateDiff != 0)
|
||||||
|
dateDiff = dateDiff / (60*60*24);
|
||||||
|
|
||||||
|
checkForUpdate = (dateDiff >= 1);
|
||||||
break;
|
break;
|
||||||
case HockeyUpdateCheckManually:
|
case HockeyUpdateCheckManually:
|
||||||
checkForUpdate = NO;
|
checkForUpdate = NO;
|
||||||
@ -1142,7 +1162,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
[lastCheck_ release];
|
[lastCheck_ release];
|
||||||
lastCheck_ = [aLastCheck copy];
|
lastCheck_ = [aLastCheck copy];
|
||||||
|
|
||||||
[[NSUserDefaults standardUserDefaults] setObject:[[lastCheck_ description] substringToIndex:10] forKey:kDateOfLastHockeyCheck];
|
[[NSUserDefaults standardUserDefaults] setObject:lastCheck_ forKey:kDateOfLastHockeyCheck];
|
||||||
[[NSUserDefaults standardUserDefaults] synchronize];
|
[[NSUserDefaults standardUserDefaults] synchronize];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user