Update appName handling

This commit is contained in:
Andreas Linde 2012-10-19 17:18:10 +02:00
parent e6d76ca364
commit 59a0319ea9
5 changed files with 8 additions and 12 deletions

View File

@ -33,6 +33,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#import "HockeySDK.h" #import "HockeySDK.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
#import "BITHockeyHelper.h"
#import "BITHockeyManagerPrivate.h" #import "BITHockeyManagerPrivate.h"
#import "BITHockeyBaseManagerPrivate.h" #import "BITHockeyBaseManagerPrivate.h"
@ -444,9 +445,7 @@
[self.delegate crashManagerWillShowSubmitCrashReportAlert:self]; [self.delegate crashManagerWillShowSubmitCrashReportAlert:self];
} }
NSString *appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"]; NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyAppNamePlaceholder"));
if (!appName)
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: BITHockeyLocalizedString(@"HockeyAppNamePlaceholder");
NSString *alertDescription = [NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundAnonymousDescription"), appName]; NSString *alertDescription = [NSString stringWithFormat:BITHockeyLocalizedString(@"CrashDataFoundAnonymousDescription"), appName];
// the crash report is not anynomous any more if username or useremail are not nil // the crash report is not anynomous any more if username or useremail are not nil

View File

@ -47,7 +47,7 @@
} }
- (NSString *)activityTitle { - (NSString *)activityTitle {
NSString *appName = bit_appName(); NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyFeedbackActivityAppPlaceholder"));
return [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackActivityButtonTitle"), appName]; return [NSString stringWithFormat:BITHockeyLocalizedString(@"HockeyFeedbackActivityButtonTitle"), appName];
} }

View File

@ -34,7 +34,7 @@ NSString *bit_URLEncodedString(NSString *inputString);
NSString *bit_URLDecodedString(NSString *inputString); NSString *bit_URLDecodedString(NSString *inputString);
NSComparisonResult bit_versionCompare(NSString *stringA, NSString *stringB); NSComparisonResult bit_versionCompare(NSString *stringA, NSString *stringB);
NSString *bit_encodeAppIdentifier(NSString *inputString); NSString *bit_encodeAppIdentifier(NSString *inputString);
NSString *bit_appName(void); NSString *bit_appName(NSString *placeHolderString);
/* UIImage helpers */ /* UIImage helpers */
UIImage *bit_roundedCornerImage(UIImage *inputImage, NSInteger cornerSize, NSInteger borderSize); UIImage *bit_roundedCornerImage(UIImage *inputImage, NSInteger cornerSize, NSInteger borderSize);

View File

@ -82,13 +82,10 @@ NSString *bit_encodeAppIdentifier(NSString *inputString) {
return (inputString ? bit_URLEncodedString(inputString) : bit_URLEncodedString([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"])); return (inputString ? bit_URLEncodedString(inputString) : bit_URLEncodedString([[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleIdentifier"]));
} }
NSString *bit_appName(void) { NSString *bit_appName(NSString *placeHolderString) {
NSString *appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"]; NSString *appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
if (!appName) if (!appName)
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: BITHockeyLocalizedString(@"HockeyFeedbackActivityAppPlaceholder"); appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleDisplayName"] ?: placeHolderString;
if (!appName)
appName = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleName"];
return appName; return appName;
} }

View File

@ -138,7 +138,7 @@
} }
if (shouldShowDefaultAlert) { if (shouldShowDefaultAlert) {
NSString *appName = bit_appName(); NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyAppNamePlaceholder"));
[self showBlockingScreen:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateExpired"), appName] image:@"authorize_denied.png"]; [self showBlockingScreen:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateExpired"), appName] image:@"authorize_denied.png"];
if (self.delegate != nil && [self.delegate respondsToSelector:@selector(didDisplayExpiryAlertForUpdateManager:)]) { if (self.delegate != nil && [self.delegate respondsToSelector:@selector(didDisplayExpiryAlertForUpdateManager:)]) {
@ -940,7 +940,7 @@
// populate with default values (if empty) // populate with default values (if empty)
if (![anAppVersions count]) { if (![anAppVersions count]) {
BITAppVersionMetaInfo *defaultApp = [[[BITAppVersionMetaInfo alloc] init] autorelease]; BITAppVersionMetaInfo *defaultApp = [[[BITAppVersionMetaInfo alloc] init] autorelease];
defaultApp.name = bit_appName(); defaultApp.name = bit_appName(BITHockeyLocalizedString(@"HockeyAppNamePlaceholder"));
defaultApp.version = _currentAppVersion; defaultApp.version = _currentAppVersion;
defaultApp.shortVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"]; defaultApp.shortVersion = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
_appVersions = [[NSArray arrayWithObject:defaultApp] retain]; _appVersions = [[NSArray arrayWithObject:defaultApp] retain];