mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Enable JSON for App Store builds, but do not submit the UDID and don't evaluate the returned JSON.
This commit is contained in:
parent
9162b740e9
commit
ec5178919f
@ -423,8 +423,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
NSLog(@"WARNING: Hockey.bundle is missing, make sure it is added!");
|
NSLog(@"WARNING: Hockey.bundle is missing, make sure it is added!");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAppStoreEnvironment_) {
|
|
||||||
|
|
||||||
[self loadAppCache_];
|
[self loadAppCache_];
|
||||||
|
|
||||||
[self startUsage];
|
[self startUsage];
|
||||||
@ -439,12 +437,10 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
name:UIApplicationWillTerminateNotification
|
name:UIApplicationWillTerminateNotification
|
||||||
object:nil];
|
object:nil];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc {
|
- (void)dealloc {
|
||||||
if (!isAppStoreEnvironment_) {
|
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:BWHockeyNetworkBecomeReachable object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:BWHockeyNetworkBecomeReachable object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillTerminateNotification object:nil];
|
||||||
|
|
||||||
@ -452,7 +448,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||||
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
||||||
)
|
)
|
||||||
}
|
|
||||||
self.delegate = nil;
|
self.delegate = nil;
|
||||||
|
|
||||||
[urlConnection_ cancel];
|
[urlConnection_ cancel];
|
||||||
@ -540,6 +535,8 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
|
|
||||||
|
|
||||||
- (void)showCheckForUpdateAlert_ {
|
- (void)showCheckForUpdateAlert_ {
|
||||||
|
if (isAppStoreEnvironment_) return;
|
||||||
|
|
||||||
if (!updateAlertShowing_) {
|
if (!updateAlertShowing_) {
|
||||||
if ([self.app.mandatory boolValue] ) {
|
if ([self.app.mandatory boolValue] ) {
|
||||||
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:BWHockeyLocalize(@"HockeyUpdateAvailable")
|
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:BWHockeyLocalize(@"HockeyUpdateAvailable")
|
||||||
@ -704,19 +701,19 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
#pragma mark RequestComments
|
#pragma mark RequestComments
|
||||||
|
|
||||||
- (BOOL)shouldCheckForUpdates {
|
- (BOOL)shouldCheckForUpdates {
|
||||||
if (isAppStoreEnvironment_) return NO;
|
|
||||||
BOOL checkForUpdate = NO;
|
BOOL checkForUpdate = NO;
|
||||||
switch (self.updateSetting) {
|
switch (self.updateSetting) {
|
||||||
case HockeyUpdateCheckStartup:
|
case HockeyUpdateCheckStartup:
|
||||||
checkForUpdate = YES;
|
checkForUpdate = YES;
|
||||||
break;
|
break;
|
||||||
case HockeyUpdateCheckDaily:
|
case HockeyUpdateCheckDaily: {
|
||||||
NSTimeInterval dateDiff = fabs([self.lastCheck timeIntervalSinceNow]);
|
NSTimeInterval dateDiff = fabs([self.lastCheck timeIntervalSinceNow]);
|
||||||
if (dateDiff != 0)
|
if (dateDiff != 0)
|
||||||
dateDiff = dateDiff / (60*60*24);
|
dateDiff = dateDiff / (60*60*24);
|
||||||
|
|
||||||
checkForUpdate = (dateDiff >= 1);
|
checkForUpdate = (dateDiff >= 1);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case HockeyUpdateCheckManually:
|
case HockeyUpdateCheckManually:
|
||||||
checkForUpdate = NO;
|
checkForUpdate = NO;
|
||||||
break;
|
break;
|
||||||
@ -731,7 +728,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
|
|
||||||
[parameter appendFormat:@"?format=json&authorize=yes&app_version=%@&udid=%@",
|
[parameter appendFormat:@"?format=json&authorize=yes&app_version=%@&udid=%@",
|
||||||
[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] bw_URLEncodedString],
|
[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] bw_URLEncodedString],
|
||||||
[[self deviceIdentifier] bw_URLEncodedString]
|
([self isAppStoreEnvironment] ? @"appstore" : [[self deviceIdentifier] bw_URLEncodedString])
|
||||||
];
|
];
|
||||||
|
|
||||||
// build request & send
|
// build request & send
|
||||||
@ -798,7 +795,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdate {
|
- (void)checkForUpdate {
|
||||||
if (isAppStoreEnvironment_) return;
|
|
||||||
if (self.requireAuthorization) return;
|
if (self.requireAuthorization) return;
|
||||||
if (self.isUpdateAvailable && [self.app.mandatory boolValue]) {
|
if (self.isUpdateAvailable && [self.app.mandatory boolValue]) {
|
||||||
[self showCheckForUpdateAlert_];
|
[self showCheckForUpdateAlert_];
|
||||||
@ -808,7 +804,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)checkForUpdateShowFeedback:(BOOL)feedback {
|
- (void)checkForUpdateShowFeedback:(BOOL)feedback {
|
||||||
if (isAppStoreEnvironment_) return;
|
|
||||||
if (self.isCheckInProgress) return;
|
if (self.isCheckInProgress) return;
|
||||||
|
|
||||||
showFeedback_ = feedback;
|
showFeedback_ = feedback;
|
||||||
@ -823,7 +818,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
|
|
||||||
NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@?format=json&udid=%@",
|
NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@?format=json&udid=%@",
|
||||||
[[self encodedAppIdentifier_] bw_URLEncodedString],
|
[[self encodedAppIdentifier_] bw_URLEncodedString],
|
||||||
[[self deviceIdentifier] bw_URLEncodedString]];
|
([self isAppStoreEnvironment] ? @"" : [[self deviceIdentifier] bw_URLEncodedString])];
|
||||||
|
|
||||||
// add additional statistics if user didn't disable flag
|
// add additional statistics if user didn't disable flag
|
||||||
if ([self canSendUserData]) {
|
if ([self canSendUserData]) {
|
||||||
@ -863,6 +858,8 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)initiateAppDownload {
|
- (BOOL)initiateAppDownload {
|
||||||
|
if ([self isAppStoreEnvironment]) return NO;
|
||||||
|
|
||||||
if (!self.isUpdateAvailable) {
|
if (!self.isUpdateAvailable) {
|
||||||
BWHockeyLog(@"Warning: No update available. Aborting.");
|
BWHockeyLog(@"Warning: No update available. Aborting.");
|
||||||
return NO;
|
return NO;
|
||||||
@ -925,8 +922,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
|
|
||||||
// begin the startup process
|
// begin the startup process
|
||||||
- (void)startManager {
|
- (void)startManager {
|
||||||
if (isAppStoreEnvironment_) return;
|
|
||||||
|
|
||||||
if (![self appVersionIsAuthorized]) {
|
if (![self appVersionIsAuthorized]) {
|
||||||
if ([self authorizationState] == HockeyAuthorizationPending) {
|
if ([self authorizationState] == HockeyAuthorizationPending) {
|
||||||
[self showAuthorizationScreen:BWHockeyLocalize(@"HockeyAuthorizationProgress") image:@"authorize_request.png"];
|
[self showAuthorizationScreen:BWHockeyLocalize(@"HockeyAuthorizationProgress") image:@"authorize_request.png"];
|
||||||
@ -993,9 +988,11 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
BWHockeyLog(@"Received API response: %@", responseString);
|
BWHockeyLog(@"Received API response: %@", responseString);
|
||||||
|
|
||||||
id json = [self parseJSONResultString:responseString];
|
id json = [self parseJSONResultString:responseString];
|
||||||
NSArray *feedArray = (NSArray *)([self checkForTracker] ? [json valueForKey:@"versions"] : json);
|
|
||||||
self.trackerConfig = ([self checkForTracker] ? [json valueForKey:@"tracker"] : nil);
|
self.trackerConfig = ([self checkForTracker] ? [json valueForKey:@"tracker"] : nil);
|
||||||
|
|
||||||
|
if (![self isAppStoreEnvironment]) {
|
||||||
|
NSArray *feedArray = (NSArray *)([self checkForTracker] ? [json valueForKey:@"versions"] : json);
|
||||||
|
|
||||||
self.receivedData = nil;
|
self.receivedData = nil;
|
||||||
self.urlConnection = nil;
|
self.urlConnection = nil;
|
||||||
|
|
||||||
@ -1054,6 +1051,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
showFeedback_ = NO;
|
showFeedback_ = NO;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
[self reportError_:[NSError errorWithDomain:kHockeyErrorDomain code:HockeyAPIServerReturnedEmptyResponse userInfo:
|
[self reportError_:[NSError errorWithDomain:kHockeyErrorDomain code:HockeyAPIServerReturnedEmptyResponse userInfo:
|
||||||
[NSDictionary dictionaryWithObjectsAndKeys:@"Server returned an empty response.", NSLocalizedDescriptionKey, nil]]];
|
[NSDictionary dictionaryWithObjectsAndKeys:@"Server returned an empty response.", NSLocalizedDescriptionKey, nil]]];
|
||||||
@ -1080,7 +1078,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
}
|
}
|
||||||
|
|
||||||
BW_IF_IOS4_OR_GREATER(
|
BW_IF_IOS4_OR_GREATER(
|
||||||
if (!isAppStoreEnvironment_) {
|
|
||||||
// register/deregister logic
|
// register/deregister logic
|
||||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||||
if (!updateURL_ && anUpdateURL) {
|
if (!updateURL_ && anUpdateURL) {
|
||||||
@ -1090,7 +1087,6 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
[dnc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
[dnc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||||
[dnc removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
[dnc removeObserver:self name:UIApplicationWillResignActiveNotification object:nil];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
if (updateURL_ != anUpdateURL) {
|
if (updateURL_ != anUpdateURL) {
|
||||||
@ -1098,10 +1094,8 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
updateURL_ = [anUpdateURL copy];
|
updateURL_ = [anUpdateURL copy];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isAppStoreEnvironment_) {
|
|
||||||
[self performSelector:@selector(startManager) withObject:nil afterDelay:0.0f];
|
[self performSelector:@selector(startManager) withObject:nil afterDelay:0.0f];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setAppIdentifier:(NSString *)anAppIdentifier {
|
- (void)setAppIdentifier:(NSString *)anAppIdentifier {
|
||||||
if (appIdentifier_ != anAppIdentifier) {
|
if (appIdentifier_ != anAppIdentifier) {
|
||||||
@ -1116,14 +1110,12 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
|||||||
if (checkForUpdateOnLaunch_ != flag) {
|
if (checkForUpdateOnLaunch_ != flag) {
|
||||||
checkForUpdateOnLaunch_ = flag;
|
checkForUpdateOnLaunch_ = flag;
|
||||||
BW_IF_IOS4_OR_GREATER(
|
BW_IF_IOS4_OR_GREATER(
|
||||||
if (!isAppStoreEnvironment_) {
|
|
||||||
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter];
|
||||||
if (flag) {
|
if (flag) {
|
||||||
[dnc addObserver:self selector:@selector(checkForUpdate) name:UIApplicationDidBecomeActiveNotification object:nil];
|
[dnc addObserver:self selector:@selector(checkForUpdate) name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||||
} else {
|
} else {
|
||||||
[dnc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
[dnc removeObserver:self name:UIApplicationDidBecomeActiveNotification object:nil];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,12 +136,12 @@
|
|||||||
|
|
||||||
if ([self shouldUseLiveIdenfitier]) {
|
if ([self shouldUseLiveIdenfitier]) {
|
||||||
appIdentifier = [liveIdentifier copy];
|
appIdentifier = [liveIdentifier copy];
|
||||||
|
|
||||||
[self configureQuincyManager];
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
appIdentifier = [betaIdentifier copy];
|
appIdentifier = [betaIdentifier copy];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (appIdentifier) {
|
||||||
[self configureQuincyManager];
|
[self configureQuincyManager];
|
||||||
[self configureHockeyManager];
|
[self configureHockeyManager];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user