Fix alpha updates

This commit is contained in:
Peter 2019-09-09 01:05:40 +04:00
parent 2cd97a448d
commit e27556c332
6 changed files with 27 additions and 27 deletions

View File

@ -32,6 +32,8 @@ static_library(
"Classes/BITCrashDetails.h",
"Classes/BITCrashMetaData.h",
"Classes/BITAuthenticator.h",
"Classes/BITUpdateManager.h",
"Classes/BITUpdateManagerDelegate.h",
"Classes/BITUpdateViewController.h",
@ -45,7 +47,7 @@ static_library(
"-DHOCKEYSDK_FEATURE_CRASH_REPORTER=1",
"-DHOCKEYSDK_FEATURE_UPDATES=1",
"-DHOCKEYSDK_FEATURE_FEEDBACK=0",
"-DHOCKEYSDK_FEATURE_AUTHENTICATOR=0",
"-DHOCKEYSDK_FEATURE_AUTHENTICATOR=1",
"-DHOCKEYSDK_FEATURE_METRICS=0",
],
deps = [

View File

@ -166,7 +166,7 @@
- (NSString *)versionString {
NSString *shortString = ([self.shortVersion respondsToSelector:@selector(length)] && [self.shortVersion length]) ? [NSString stringWithFormat:@"%@", self.shortVersion] : @"";
NSString *versionString = [shortString length] ? [NSString stringWithFormat:@" (%@)", self.version] : self.version;
return [NSString stringWithFormat:@"%@ %@%@", BITHockeyLocalizedString(@"UpdateVersion"), shortString, versionString];
return [NSString stringWithFormat:@"%@ %@%@", BITHockeyLocalizedString(@"Version"), shortString, versionString];
}
- (NSString *)dateString {

View File

@ -435,27 +435,27 @@
- (void)showUpdateAlert {
dispatch_async(dispatch_get_main_queue(), ^{
if (!self.updateAlertShowing) {
NSString *versionString = [NSString stringWithFormat:@"%@ %@", BITHockeyLocalizedString(@"UpdateVersion"), self.latestStoreVersion];
NSString *versionString = [NSString stringWithFormat:@"%@ %@", BITHockeyLocalizedString(@"Version"), self.latestStoreVersion];
__weak typeof(self) weakSelf = self;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateAvailable")
message:[NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), versionString]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ignoreAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
UIAlertAction *ignoreAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Ignore")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
[strongSelf ignoreAction];
}];
[alertController addAction:ignoreAction];
UIAlertAction *remindAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateRemindMe")
UIAlertAction *remindAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Remind Me")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
[strongSelf remindAction];
}];
[alertController addAction:remindAction];
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Show")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;

View File

@ -88,10 +88,10 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
// only show error if we enable that
if (self.showFeedback) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateError")
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"An Error Occurred")
message:[error localizedDescription]
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {}];
[alertController addAction:okAction];
@ -223,9 +223,9 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
}
if (shouldShowDefaultAlert) {
NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyAppNamePlaceholder"));
NSString *appName = bit_appName(BITHockeyLocalizedString(@"Telegram"));
if (!self.blockingScreenMessage)
self.blockingScreenMessage = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateExpired"), appName];
self.blockingScreenMessage = [NSString stringWithFormat:BITHockeyLocalizedString(@"Update expired"), appName];
[self showBlockingScreen:self.blockingScreenMessage image:@"authorize_denied.png"];
if ([strongDelegate respondsToSelector:@selector(didDisplayExpiryAlertForUpdateManager:)]) {
@ -530,14 +530,14 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
}
if (!self.updateAlertShowing) {
NSString *title = BITHockeyLocalizedString(@"UpdateAvailable");
NSString *title = BITHockeyLocalizedString(@"Update Available");
NSString *message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertMandatoryTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]];
if ([self hasNewerMandatoryVersion]) {
__weak typeof(self) weakSelf = self;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Show")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -548,7 +548,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
[strongSelf showUpdateView];
}];
[alertController addAction:showAction];
UIAlertAction *installAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
UIAlertAction *installAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Install")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -559,13 +559,13 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
[self showAlertController:alertController];
self.updateAlertShowing = YES;
} else {
message = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateAlertTextWithAppVersion"), [self.newestAppVersion nameAndVersionString]];
message = [NSString stringWithFormat:BITHockeyLocalizedString(@"An update is available"), [self.newestAppVersion nameAndVersionString]];
__weak typeof(self) weakSelf = self;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:title
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *ignoreAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateIgnore")
UIAlertAction *ignoreAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Ignore")
style:UIAlertActionStyleCancel
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -575,7 +575,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
}
}];
[alertController addAction:ignoreAction];
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateShow")
UIAlertAction *showAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Show")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -587,7 +587,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
}];
[alertController addAction:showAction];
if (self.isShowingDirectInstallOption) {
UIAlertAction *installAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateInstall")
UIAlertAction *installAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Install")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -631,7 +631,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
if (!self.disableUpdateCheckOptionWhenExpired) {
UIButton *checkForUpdateButton = [UIButton buttonWithType:kBITButtonTypeSystem];
checkForUpdateButton.frame = CGRectMake((frame.size.width - 140) / (CGFloat)2.0, frame.size.height - 100, 140, 25);
[checkForUpdateButton setTitle:BITHockeyLocalizedString(@"UpdateButtonCheck") forState:UIControlStateNormal];
[checkForUpdateButton setTitle:BITHockeyLocalizedString(@"Check") forState:UIControlStateNormal];
[checkForUpdateButton addTarget:self
action:@selector(checkForUpdateForExpiredVersion)
forControlEvents:UIControlEventTouchUpInside];
@ -674,7 +674,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:message
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -682,7 +682,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
}];
[alertController addAction:okAction];
if (!self.disableUpdateCheckOptionWhenExpired && [message isEqualToString:self.blockingScreenMessage]) {
UIAlertAction *checkAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"UpdateButtonCheck")
UIAlertAction *checkAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"Check")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {
typeof(self) strongSelf = weakSelf;
@ -814,10 +814,10 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
#if TARGET_OS_SIMULATOR
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateWarning")
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"Warning")
message:BITHockeyLocalizedString(@"UpdateSimulatorMessage")
preferredStyle:UIAlertControllerStyleAlert];
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"HockeyOK")
UIAlertAction *okAction = [BITAlertAction actionWithTitle:BITHockeyLocalizedString(@"OK")
style:UIAlertActionStyleDefault
handler:^(UIAlertAction __unused *action) {}];
[alertController addAction:okAction];
@ -966,7 +966,7 @@ typedef NS_ENUM(NSInteger, BITUpdateAlertViewTag) {
NSString *shortVersionString = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
shortVersionString = shortVersionString ? [NSString stringWithFormat:@"%@ ", shortVersionString] : @"";
versionString = [shortVersionString length] ? [NSString stringWithFormat:@"(%@)", versionString] : versionString;
NSString *currentVersionString = [NSString stringWithFormat:@"%@ %@ %@%@", self.newestAppVersion.name, BITHockeyLocalizedString(@"UpdateVersion"), shortVersionString, versionString];
NSString *currentVersionString = [NSString stringWithFormat:@"%@ %@ %@%@", self.newestAppVersion.name, BITHockeyLocalizedString(@"Version"), shortVersionString, versionString];
NSString *alertMsg = [NSString stringWithFormat:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableMessage"), currentVersionString];
__weak typeof(self) weakSelf = self;
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:BITHockeyLocalizedString(@"UpdateNoUpdateAvailableTitle")

View File

@ -509,10 +509,10 @@
[self.appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonSearching") enabled:NO] animated:animated];
break;
case AppStoreButtonStateUpdate:
[self.appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonUpdate") enabled:YES] animated:animated];
[self.appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"Update") enabled:YES] animated:animated];
break;
case AppStoreButtonStateInstalling:
[self.appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"UpdateButtonInstalling") enabled:NO] animated:animated];
[self.appStoreButton setButtonData:[BITStoreButtonData dataWithLabel:BITHockeyLocalizedString(@"Installing") enabled:NO] animated:animated];
break;
default:
break;

View File

@ -1185,9 +1185,7 @@ final class SharedApplicationContext {
BITHockeyManager.shared().configure(withIdentifier: hockeyAppId, delegate: self)
BITHockeyManager.shared().crashManager.crashManagerStatus = .alwaysAsk
BITHockeyManager.shared().start()
#if !BUCK
BITHockeyManager.shared().authenticator.authenticateInstallation()
#endif
}
NotificationCenter.default.addObserver(forName: UIWindow.didBecomeHiddenNotification, object: nil, queue: nil, using: { notification in