mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Merge branch 'release/2.2.4'
* release/2.2.4: Updated Hockey.bundle. Make sure if the installed version is newer, mandatory is ignored Add SDK info to update request too Increase podspec version number Add SDK version number to source and send it to the server, together with the SDK name Improve handling of mandatory flag Don't crash if no JSON serializer is found, show an error in the log instead Updated podspec. don't add a target selector for removed method removed PSLog to prevent conflicts with other SDKs Fix for using any method automatically triggering checkForUpdate via notification Fix potential crash if json string is nil Conflicts: HockeySDK.podspec
This commit is contained in:
commit
5f407647e0
@ -229,6 +229,9 @@ typedef enum {
|
||||
|
||||
- (NSArray *)apps;
|
||||
|
||||
// check if there is any newer version mandatory
|
||||
- (BOOL)hasNewerMandatoryVersion;
|
||||
|
||||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -40,6 +40,9 @@
|
||||
#define BETA_UPDATE_TIMESTAMP @"timestamp"
|
||||
#define BETA_UPDATE_APPSIZE @"appsize"
|
||||
|
||||
#define SDK_NAME @"HockeySDK"
|
||||
#define SDK_VERSION @"2.2.4"
|
||||
|
||||
@interface BWHockeyManager ()
|
||||
- (NSString *)getDevicePlatform_;
|
||||
- (id)parseJSONResultString:(NSString *)jsonString;
|
||||
@ -539,7 +542,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
if (isAppStoreEnvironment_) return;
|
||||
|
||||
if (!updateAlertShowing_) {
|
||||
if ([self.app.mandatory boolValue] ) {
|
||||
if ([self hasNewerMandatoryVersion]) {
|
||||
UIAlertView *alertView = [[[UIAlertView alloc] initWithTitle:BWHockeyLocalize(@"HockeyUpdateAvailable")
|
||||
message:[NSString stringWithFormat:BWHockeyLocalize(@"HockeyUpdateAlertMandatoryTextWithAppVersion"), [self.app nameAndVersionString]]
|
||||
delegate:self
|
||||
@ -634,6 +637,9 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
NSError *error = nil;
|
||||
id feedResult = nil;
|
||||
|
||||
if (!jsonString)
|
||||
return nil;
|
||||
|
||||
#if BW_NATIVE_JSON_AVAILABLE
|
||||
feedResult = [NSJSONSerialization JSONObjectWithData:[jsonString dataUsingEncoding:NSUTF8StringEncoding] options:kNilOptions error:&error];
|
||||
#else
|
||||
@ -648,6 +654,10 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
invocation.target = nsjsonClass;
|
||||
invocation.selector = nsjsonSelect;
|
||||
NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding];
|
||||
|
||||
if (!jsonData)
|
||||
return nil;
|
||||
|
||||
[invocation setArgument:&jsonData atIndex:2]; // arguments 0 and 1 are self and _cmd respectively, automatically set by NSInvocation
|
||||
NSUInteger readOptions = kNilOptions;
|
||||
[invocation setArgument:&readOptions atIndex:3];
|
||||
@ -683,13 +693,13 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
[invocation invoke];
|
||||
[invocation getReturnValue:&feedResult];
|
||||
} else {
|
||||
NSLog(@"Error: You need a JSON Framework in your runtime!");
|
||||
[self doesNotRecognizeSelector:_cmd];
|
||||
error = [NSError errorWithDomain:kHockeyErrorDomain
|
||||
code:HockeyAPIServerReturnedEmptyResponse
|
||||
userInfo:[NSDictionary dictionaryWithObjectsAndKeys:@"You need a JSON Framework in your runtime for iOS4!", NSLocalizedDescriptionKey, nil]];
|
||||
}
|
||||
#endif
|
||||
|
||||
if (error) {
|
||||
BWHockeyLog(@"Error while parsing response feed: %@", [error localizedDescription]);
|
||||
[self reportError_:error];
|
||||
return nil;
|
||||
}
|
||||
@ -727,9 +737,11 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
- (void)checkForAuthorization {
|
||||
NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@", [self encodedAppIdentifier_]];
|
||||
|
||||
[parameter appendFormat:@"?format=json&authorize=yes&app_version=%@&udid=%@",
|
||||
[parameter appendFormat:@"?format=json&authorize=yes&app_version=%@&udid=%@&sdk=%@&sdk_version=%@",
|
||||
[[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] bw_URLEncodedString],
|
||||
([self isAppStoreEnvironment] ? @"appstore" : [[self deviceIdentifier] bw_URLEncodedString])
|
||||
([self isAppStoreEnvironment] ? @"appstore" : [[self deviceIdentifier] bw_URLEncodedString]),
|
||||
SDK_NAME,
|
||||
SDK_VERSION
|
||||
];
|
||||
|
||||
// build request & send
|
||||
@ -796,10 +808,10 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
}
|
||||
|
||||
- (void)checkForUpdate {
|
||||
if (!updateURL_) return;
|
||||
if (self.requireAuthorization) return;
|
||||
if (self.isUpdateAvailable && [self.app.mandatory boolValue]) {
|
||||
if (self.isUpdateAvailable && [self hasNewerMandatoryVersion]) {
|
||||
[self showCheckForUpdateAlert_];
|
||||
return;
|
||||
}
|
||||
[self checkForUpdateShowFeedback:NO];
|
||||
}
|
||||
@ -817,9 +829,11 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
return;
|
||||
}
|
||||
|
||||
NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@?format=json&udid=%@",
|
||||
NSMutableString *parameter = [NSMutableString stringWithFormat:@"api/2/apps/%@?format=json&udid=%@&sdk=%@&sdk_version=%@",
|
||||
[[self encodedAppIdentifier_] bw_URLEncodedString],
|
||||
([self isAppStoreEnvironment] ? @"appstore" : [[self deviceIdentifier] bw_URLEncodedString])];
|
||||
([self isAppStoreEnvironment] ? @"appstore" : [[self deviceIdentifier] bw_URLEncodedString]),
|
||||
SDK_NAME,
|
||||
SDK_VERSION];
|
||||
|
||||
// add additional statistics if user didn't disable flag
|
||||
if ([self canSendUserData]) {
|
||||
@ -1046,7 +1060,7 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
[alert release];
|
||||
}
|
||||
|
||||
if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self.app.mandatory boolValue])) {
|
||||
if (self.isUpdateAvailable && (self.alwaysShowUpdateReminder || newVersionDiffersFromCachedVersion || [self hasNewerMandatoryVersion])) {
|
||||
if (updateAvailable_ && !currentHockeyViewController_) {
|
||||
[self showCheckForUpdateAlert_];
|
||||
}
|
||||
@ -1059,6 +1073,21 @@ static NSString *kHockeyErrorDomain = @"HockeyErrorDomain";
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)hasNewerMandatoryVersion {
|
||||
BOOL result = NO;
|
||||
|
||||
for (BWApp *app in self.apps) {
|
||||
if ([app.version isEqualToString:self.currentAppVersion] || [app.version versionCompare:self.currentAppVersion] == NSOrderedAscending) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ([app.mandatory boolValue]) {
|
||||
result = YES;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
|
@ -35,6 +35,9 @@
|
||||
#include <sys/sysctl.h>
|
||||
#include <inttypes.h> //needed for PRIx64 macro
|
||||
|
||||
#define SDK_NAME @"HockeySDK"
|
||||
#define SDK_VERSION @"2.2.4"
|
||||
|
||||
NSBundle *quincyBundle(void) {
|
||||
static NSBundle* bundle = nil;
|
||||
if (!bundle) {
|
||||
@ -606,11 +609,13 @@ NSString *BWQuincyLocalize(NSString *stringToken) {
|
||||
|
||||
if (self.appIdentifier) {
|
||||
request = [NSMutableURLRequest requestWithURL:
|
||||
[NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes",
|
||||
self.submissionURL,
|
||||
[self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
|
||||
]
|
||||
]];
|
||||
[NSURL URLWithString:[NSString stringWithFormat:@"%@api/2/apps/%@/crashes?sdk=%@&sdk_version=%@",
|
||||
self.submissionURL,
|
||||
[self.appIdentifier stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding],
|
||||
SDK_NAME,
|
||||
SDK_VERSION
|
||||
]
|
||||
]];
|
||||
} else {
|
||||
request = [NSMutableURLRequest requestWithURL:url];
|
||||
}
|
||||
|
@ -27,12 +27,6 @@
|
||||
|
||||
#import "PSStoreButton.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#define PSLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__);
|
||||
#else
|
||||
#define PSLog(...)
|
||||
#endif
|
||||
|
||||
#define PS_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1]
|
||||
#define PS_MIN_HEIGHT 25.0f
|
||||
#define PS_MAX_WIDTH 120.0f
|
||||
@ -87,12 +81,7 @@
|
||||
#pragma mark -
|
||||
#pragma mark private
|
||||
|
||||
- (void)touchedUpOutside:(id)sender {
|
||||
PSLog(@"touched outside...");
|
||||
}
|
||||
|
||||
- (void)buttonPressed:(id)sender {
|
||||
PSLog(@"calling delegate:storeButtonFired for %@", sender);
|
||||
[buttonDelegate_ storeButtonFired:self];
|
||||
}
|
||||
|
||||
@ -182,7 +171,6 @@
|
||||
[self.titleLabel setFont:[UIFont boldSystemFontOfSize:13.0]];
|
||||
|
||||
// register for touch events
|
||||
[self addTarget:self action:@selector(touchedUpOutside:) forControlEvents:UIControlEventTouchUpOutside];
|
||||
[self addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside];
|
||||
|
||||
// border layers for more sex!
|
||||
|
@ -1,6 +1,6 @@
|
||||
Pod::Spec.new do |s|
|
||||
s.name = 'HockeySDK'
|
||||
s.version = '2.2.3'
|
||||
s.version = '2.2.4'
|
||||
s.license = 'MIT'
|
||||
s.platform = :ios
|
||||
s.summary = 'Distribute beta apps and collect crash reports with HockeyApp.'
|
||||
|
@ -63,6 +63,7 @@
|
||||
"HockeyNoUpdateNeededTitle" = "Kein Update Verfügbar";
|
||||
"HockeyNoUpdateNeededMessage" = "%@ ist bereits die aktuellste Version.";
|
||||
"HockeyUpdateAlertTextWithAppVersion" = "%@ ist verfügbar.";
|
||||
"HockeyUpdateAlertMandatoryTextWithAppVersion" = "%@ ist verfügbar und muss installiert werden!";
|
||||
"HockeyIgnore" = "Ignorieren";
|
||||
"HockeyShowUpdate" = "Anzeigen";
|
||||
"HockeyInstallUpdate" = "Installieren";
|
||||
|
@ -63,6 +63,7 @@
|
||||
"HockeyNoUpdateNeededTitle" = "No Update Available";
|
||||
"HockeyNoUpdateNeededMessage" = "%@ is already the latest version.";
|
||||
"HockeyUpdateAlertTextWithAppVersion" = "%@ is available.";
|
||||
"HockeyUpdateAlertMandatoryTextWithAppVersion" = "%@ is available and is a mandatory update!";
|
||||
"HockeyIgnore" = "Ignore";
|
||||
"HockeyShowUpdate" = "Show";
|
||||
"HockeyInstallUpdate" = "Install";
|
||||
|
@ -63,6 +63,7 @@
|
||||
"HockeyNoUpdateNeededTitle" = "Nessun aggiornamento disponibile";
|
||||
"HockeyNoUpdateNeededMessage" = "%@ <20> aggiornata all'ultima versione.";
|
||||
"HockeyUpdateAlertTextWithAppVersion" = "%@ <20> disponibile.";
|
||||
"HockeyUpdateAlertMandatoryTextWithAppVersion" = "%@ is available and is a mandatory update!";
|
||||
"HockeyIgnore" = "Ignora";
|
||||
"HockeyShowUpdate" = "Mostra";
|
||||
"HockeyInstallUpdate" = "Installa";
|
||||
|
@ -64,6 +64,7 @@
|
||||
"HockeyNoUpdateNeededTitle" = "Ingen uppdatering tillgänglig";
|
||||
"HockeyNoUpdateNeededMessage" = "%@ är den senaste versionen.";
|
||||
"HockeyUpdateAlertTextWithAppVersion" = "%@ finns.";
|
||||
"HockeyUpdateAlertMandatoryTextWithAppVersion" = "%@ is available and is a mandatory update!";
|
||||
"HockeyIgnore" = "Ignorera";
|
||||
"HockeyShowUpdate" = "Visa";
|
||||
"HockeyInstallUpdate" = "Installera";
|
||||
|
Loading…
x
Reference in New Issue
Block a user