From 3fd3c083bfda9b256e4e433ef738d3ff37eb3cae Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Sun, 22 Jul 2012 02:36:55 +0200 Subject: [PATCH] Simplify privacy settings - Remove update settings UI - Only one property that defines if user and usage data is send (only if the app is not running in the app store) - Update documentation --- Classes/BITUpdateManager.h | 238 ++++++++++++---- Classes/BITUpdateManager.m | 95 +------ Classes/BITUpdateSettingsViewController.h | 42 --- Classes/BITUpdateSettingsViewController.m | 292 -------------------- Classes/BITUpdateViewController.m | 35 +-- Classes/HockeySDK.h | 1 - Classes/HockeySDKPrivate.h | 4 - Resources/gear.png | Bin 521 -> 0 bytes Resources/gear@2x.png | Bin 911 -> 0 bytes Support/HockeySDK.xcodeproj/project.pbxproj | 26 -- 10 files changed, 194 insertions(+), 539 deletions(-) delete mode 100644 Classes/BITUpdateSettingsViewController.h delete mode 100644 Classes/BITUpdateSettingsViewController.m delete mode 100644 Resources/gear.png delete mode 100644 Resources/gear@2x.png diff --git a/Classes/BITUpdateManager.h b/Classes/BITUpdateManager.h index 2ee55ce0b9..451eb56694 100644 --- a/Classes/BITUpdateManager.h +++ b/Classes/BITUpdateManager.h @@ -73,76 +73,204 @@ typedef enum { } -/////////////////////////////////////////////////////////////////////////////////////////////////// -// Setting Properties +///----------------------------------------------------------------------------- +/// @name Delegate +///----------------------------------------------------------------------------- -// delegate is optional +/** + Sets the `BITUpdateManagerDelegate` delegate. + + When using `BITUpdateManager` to distribute updates of your beta or enterprise + application, it is required to set this delegate and implement the + `customDeviceIdentifierForUpdateManager:` delegate! + */ @property (nonatomic, assign) id delegate; -// hockey secret is required if authentication is used -@property (nonatomic, retain) NSString *authenticationSecret; -// if YES, the current user data is send: device type, iOS version, app version, UDID (default) -// if NO, no such data is send to the server -@property (nonatomic, assign, getter=shouldSendUserData) BOOL sendUserData; +///----------------------------------------------------------------------------- +/// @name Configuration +///----------------------------------------------------------------------------- -// if YES, the the users usage time of the app to the service, only in 1 minute granularity! (default) -// if NO, no such data is send to the server -@property (nonatomic, assign, getter=shouldSendUsageTime) BOOL sendUsageTime; - -// if YES, the user agrees to send the usage data, user can change it if the developer shows the settings (default) -// if NO, the user overwrites the developer setting and no such data is sent -@property (nonatomic, assign, getter=isAllowUserToDisableSendData) BOOL allowUserToDisableSendData; - -// if YES, the user allowed to send user data (default) -// if NO, the user denied to send user data -@property (nonatomic, assign, getter=doesUserAllowsSendUserData) BOOL userAllowsSendUserData; - -// if YES, the user allowed to send usage data (default) -// if NO, the user denied to send usage data -@property (nonatomic, assign, getter=doesUserAllowsSendUsageTime) BOOL userAllowsSendUsageTime; - -// if YES, the new version alert will be displayed always if the current version is outdated (default) -// if NO, the alert will be displayed only once for each new update -@property (nonatomic, assign) BOOL alwaysShowUpdateReminder; - -// if YES, the user can change the HockeyUpdateSetting value (default) -// if NO, the user can not change it, and the default or developer defined value will be used -@property (nonatomic, assign, getter=shouldShowUserSettings) BOOL showUserSettings; - -// set bar style of navigation controller -@property (nonatomic, assign) UIBarStyle barStyle; - -// set modal presentation style of update view -@property (nonatomic, assign) UIModalPresentationStyle modalPresentationStyle; - -// if YES, then an update check will be performed after the application becomes active (default) -// if NO, then the update check will not happen unless invoked explicitly -@property (nonatomic, assign, getter=isCheckForUpdateOnLaunch) BOOL checkForUpdateOnLaunch; - -// if YES, the alert notifying about an new update also shows a button to install the update directly -// if NO, the alert notifying about an new update only shows ignore and show update button -@property (nonatomic, assign, getter=isShowingDirectInstallOption) BOOL showDirectInstallOption; - -// if YES, each app version needs to be authorized by the server to run on this device -// if NO, each app version does not need to be authorized (default) -@property (nonatomic, assign, getter=isRequireAuthorization) BOOL requireAuthorization; - -// HockeyComparisonResultDifferent: alerts if the version on the server is different (default) -// HockeyComparisonResultGreater: alerts if the version on the server is greater +/** + The type of version comparisson. + + Defines when a version is defined as being newer than the currently installed + version. This must be assigned one of the following: + + - `BITUpdateComparisonResultDifferent`: Version is different + - `BITUpdateComparisonResultGreater`: Version is greater + + **Default**: BITUpdateComparisonResultGreater + */ @property (nonatomic, assign) BITUpdateComparisonResult compareVersionType; + +///----------------------------------------------------------------------------- +/// @name Update Checking +///----------------------------------------------------------------------------- + // see HockeyUpdateSetting-enum. Will be saved in user defaults. // default value: HockeyUpdateCheckStartup +/** + When to check for new updates. + + Defines when a the SDK should check if there is a new update available on the + server. This must be assigned one of the following: + + - `BITUpdateCheckStartup`: On every startup or or when the app comes to the foreground + - `BITUpdateCheckDaily`: Once a day + - `BITUpdateCheckManually`: Manually + + **Default**: BITUpdateCheckStartup + + @warning **WARNING**: When setting this to `BITUpdateCheckManually` you need to either + invoke the update checking process yourself with `checkForUpdate` somehow, e.g. by + proving an update check button for the user or integrating the Update View into your + user interface. + @see checkForUpdateOnLaunch + @see checkForUpdate + */ @property (nonatomic, assign) BITUpdateSetting updateSetting; -// open update info view -- (void)showUpdateView; + +/** + Flag that determines whether the automatic update checks should be done. + + If this is enabled the update checks will be performed automatically depending on the + `updateSetting` property. If this is disabled the `updateSetting` property will have + no effect, and checking for updates is totally up to be done by yourself. + + *Default*: _YES_ + + @warning **WARNING**: When setting this to `NO` you need to invoke update checks yourself! + @see updateSetting + @see checkForUpdate + */ +@property (nonatomic, assign, getter=isCheckForUpdateOnLaunch) BOOL checkForUpdateOnLaunch; + // manually start an update check +/** + Check for an update + + Call this to trigger a check if there is a new update available on the HockeyApp servers. + + @see updateSetting + @see checkForUpdateOnLaunch + */ - (void)checkForUpdate; -// convenience methode to create hockey view controller + +///----------------------------------------------------------------------------- +/// @name Privacy +///----------------------------------------------------------------------------- + +/** + Flag that determines usage data will be send + + If this is enabled then the following data will be submitted to the server + - App Version + - iOS Version + - Device type + - Language + - Installation timestamp + - Usage time + + *Default*: _YES_ + + @warning **WARNING**: When setting this to `NO`, you will know if this user is actually testing! + */ +@property (nonatomic, assign, getter=shouldSendUsageData) BOOL sendUsageData; + + +///----------------------------------------------------------------------------- +/// @name Update Notification +///----------------------------------------------------------------------------- + +/** + Flag that determines if updates alert should be repeatedly shown + + If enabled the update alert shows on every startup and whenever the app becomes active, + until the update is installed. + If disabled the update alert is only shown once ever and it is up to you to provide an + alternate way for the user to navigate to the update UI or update in another way. + + *Default*: _YES_ + */ +@property (nonatomic, assign) BOOL alwaysShowUpdateReminder; + + +/** + Flag that determines if the update alert should show an direct install option + + If enabled the update alert shows an additional option which allows to invoke the update + installation process directly, instead of viewing the update UI first. + By default the alert only shows a `Show` and `Ignore` option. + + *Default*: _NO_ + */ +@property (nonatomic, assign, getter=isShowingDirectInstallOption) BOOL showDirectInstallOption; + + +///----------------------------------------------------------------------------- +/// @name Authorization +///----------------------------------------------------------------------------- + +/** + Flag that determines if each update should be authenticated + + If enabled each update will be authenticated on startup against the HockeyApp servers. + The process will basically validate if the current device is part of the provisioning + profile on the server. If not, it will present a blocking view on top of the apps UI + so that no interaction is possible. + + *Default*: _NO_ + @see authenticationSecret + */ +@property (nonatomic, assign, getter=isRequireAuthorization) BOOL requireAuthorization; + + +/** + The authentication token from HockeyApp. + + Set the token to the `Secret ID` which HockeyApp provides for every app. + + @see requireAuthorization + */ +@property (nonatomic, retain) NSString *authenticationSecret; + + +///----------------------------------------------------------------------------- +/// @name User Interface +///----------------------------------------------------------------------------- + +/** + The UIBarStyle of the update user interface navigation bar. + */ +@property (nonatomic, assign) UIBarStyle barStyle; + + +/** + The UIModalPresentationStyle for showing the update user interface when invoked + with the update alert. + */ +@property (nonatomic, assign) UIModalPresentationStyle modalPresentationStyle; + + +/** + Present the modal update user interface. + */ +- (void)showUpdateView; + + +/** + Create an update view + + @param modal Return a view ready for modal presentation with integrated navigation bar + @return BITUpdateViewController The update user interface view controller, + e.g. to push it onto a navigation stack. + */ - (BITUpdateViewController *)hockeyViewController:(BOOL)modal; + @end diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index 2415c8aee1..325d7aaa9f 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -59,16 +59,11 @@ @synthesize urlConnection = _urlConnection; @synthesize checkInProgress = _checkInProgress; @synthesize receivedData = _receivedData; -@synthesize sendUserData = _sendUserData; -@synthesize sendUsageTime = _sendUsageTime; -@synthesize allowUserToDisableSendData = _allowUserToDisableSendData; -@synthesize userAllowsSendUserData = _userAllowsSendUserData; -@synthesize userAllowsSendUsageTime = _userAllowsSendUsageTime; +@synthesize sendUsageData = _sendUsageData; @synthesize alwaysShowUpdateReminder = _showUpdateReminder; @synthesize checkForUpdateOnLaunch = _checkForUpdateOnLaunch; @synthesize compareVersionType = _compareVersionType; @synthesize lastCheck = _lastCheck; -@synthesize showUserSettings = _showUserSettings; @synthesize updateSetting = _updateSetting; @synthesize appVersions = _appVersions; @synthesize updateAvailable = _updateAvailable; @@ -274,30 +269,6 @@ return visibleWindow; } -- (BOOL)canSendUserData { - if (self.shouldSendUserData) { - if (self.allowUserToDisableSendData) { - return self.userAllowsSendUserData; - } - - return YES; - } - - return NO; -} - -- (BOOL)canSendUsageTime { - if (self.shouldSendUsageTime) { - if (self.allowUserToDisableSendData) { - return self.userAllowsSendUsageTime; - } - - return YES; - } - - return NO; -} - #pragma mark - Init @@ -322,22 +293,13 @@ // set defaults self.showDirectInstallOption = NO; self.requireAuthorization = NO; - self.sendUserData = YES; - self.sendUsageTime = YES; - self.allowUserToDisableSendData = YES; + self.sendUsageData = YES; self.alwaysShowUpdateReminder = YES; self.checkForUpdateOnLaunch = YES; - self.showUserSettings = NO; self.compareVersionType = BITUpdateComparisonResultGreater; self.barStyle = UIBarStyleDefault; self.modalPresentationStyle = UIModalPresentationFormSheet; - - // load update setting from user defaults and check value - if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITUpdateAutoUpdateSetting]) { - self.updateSetting = (BITUpdateSetting)[[NSUserDefaults standardUserDefaults] integerForKey:kBITUpdateAutoUpdateSetting]; - } else { - self.updateSetting = BITUpdateCheckStartup; - } + self.updateSetting = BITUpdateCheckStartup; if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITUpdateDateOfLastCheck]) { // we did write something else in the past, so for compatibility reasons do this @@ -350,18 +312,6 @@ self.lastCheck = [NSDate distantPast]; } - if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITUpdateAllowUserSetting]) { - self.userAllowsSendUserData = [[NSUserDefaults standardUserDefaults] boolForKey:kBITUpdateAllowUserSetting]; - } else { - self.userAllowsSendUserData = YES; - } - - if ([[NSUserDefaults standardUserDefaults] objectForKey:kBITUpdateAllowUsageSetting]) { - self.userAllowsSendUsageTime = [[NSUserDefaults standardUserDefaults] boolForKey:kBITUpdateAllowUsageSetting]; - } else { - self.userAllowsSendUsageTime = YES; - } - if (!BITHockeyBundle()) { NSLog(@"WARNING: %@.bundle is missing, make sure it is added!", BITHOCKEYSDK_BUNDLE); } @@ -773,19 +723,15 @@ _uuid]; // add additional statistics if user didn't disable flag - if ([self canSendUserData]) { - [parameter appendFormat:@"&app_version=%@&os=iOS&os_version=%@&device=%@&lang=%@&first_start_at=%@", + if (self.shouldSendUsageData) { + [parameter appendFormat:@"&app_version=%@&os=iOS&os_version=%@&device=%@&lang=%@&first_start_at=%@&usage_time=%@", [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"] bit_URLEncodedString], [[[UIDevice currentDevice] systemVersion] bit_URLEncodedString], [[self getDevicePlatform] bit_URLEncodedString], [[[[NSBundle mainBundle] preferredLocalizations] objectAtIndex:0] bit_URLEncodedString], - [[self installationDateString] bit_URLEncodedString] + [[self installationDateString] bit_URLEncodedString], + [[self currentUsageString] bit_URLEncodedString] ]; - if ([self canSendUsageTime]) { - [parameter appendFormat:@"&usage_time=%@", - [[self currentUsageString] bit_URLEncodedString] - ]; - } } if ([self checkForTracker]) { @@ -825,7 +771,7 @@ #endif NSString *extraParameter = [NSString string]; - if ([self canSendUserData]) { + if (self.shouldSendUsageData) { extraParameter = [NSString stringWithFormat:@"&udid=%@", [self deviceIdentifier]]; } @@ -1045,35 +991,10 @@ } } -- (void)setUserAllowsSendUserData:(BOOL)flag { - _userAllowsSendUserData = flag; - - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:_userAllowsSendUserData] forKey:kBITUpdateAllowUserSetting]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - -- (void)setUserAllowsSendUsageTime:(BOOL)flag { - _userAllowsSendUsageTime = flag; - - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:_userAllowsSendUsageTime] forKey:kBITUpdateAllowUsageSetting]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - - (NSString *)currentAppVersion { return _currentAppVersion; } - -- (void)setUpdateSetting:(BITUpdateSetting)anUpdateSetting { - if (anUpdateSetting > BITUpdateCheckManually) { - _updateSetting = BITUpdateCheckStartup; - } - - _updateSetting = anUpdateSetting; - [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithInteger:_updateSetting] forKey:kBITUpdateAutoUpdateSetting]; - [[NSUserDefaults standardUserDefaults] synchronize]; -} - - (void)setLastCheck:(NSDate *)aLastCheck { if (_lastCheck != aLastCheck) { [_lastCheck release]; diff --git a/Classes/BITUpdateSettingsViewController.h b/Classes/BITUpdateSettingsViewController.h deleted file mode 100644 index 396eec5c11..0000000000 --- a/Classes/BITUpdateSettingsViewController.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Author: Andreas Linde - * - * Copyright (c) 2012 HockeyApp, Bit Stadium GmbH. - * Copyright (c) 2011 Andreas Linde. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#import - -@class BITUpdateManager; - -@interface BITUpdateSettingsViewController : UIViewController { -} - -@property (nonatomic, retain) BITUpdateManager *updateManager; - -- (id)init:(BITUpdateManager *)newUpdateManager; -- (id)init; - -@end diff --git a/Classes/BITUpdateSettingsViewController.m b/Classes/BITUpdateSettingsViewController.m deleted file mode 100644 index 76eb4fae90..0000000000 --- a/Classes/BITUpdateSettingsViewController.m +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Author: Andreas Linde - * - * Copyright (c) 2012 HockeyApp, Bit Stadium GmbH. - * Copyright (c) 2011 Andreas Linde. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -#import "BITUpdateSettingsViewController.h" - -#import "HockeySDK.h" -#import "HockeySDKPrivate.h" - - -#define BW_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] - -@implementation BITUpdateSettingsViewController - -@synthesize updateManager = _updateManager; - -- (void)dismissSettings { - [self.navigationController dismissModalViewControllerAnimated:YES]; -} - -#pragma mark - Initialization - -- (id)init:(BITUpdateManager *)newUpdateManager { - if ((self = [super init])) { - self.updateManager = newUpdateManager; - self.title = BITHockeyLocalizedString(@"UpdateSettingsTitle"); - - CGRect frame = self.view.frame; - frame.origin = CGPointZero; - - UITableView *tableView_ = [[[UITableView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - 260, self.view.frame.size.width, 260) style:UITableViewStyleGrouped] autorelease]; - tableView_.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleWidth; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - self.view.backgroundColor = BW_RGBCOLOR(200, 202, 204); - tableView_.backgroundColor = BW_RGBCOLOR(200, 202, 204); - } else { - tableView_.frame = frame; - tableView_.autoresizingMask = tableView_.autoresizingMask | UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin; - } - - tableView_.delegate = self; - tableView_.dataSource = self; - tableView_.clipsToBounds = NO; - - [self.view addSubview:tableView_]; - - } - return self; -} - -- (id)init { - return [self init:[BITHockeyManager sharedHockeyManager].updateManager]; -} - - -#pragma mark - Table view data source - -- (int)numberOfSections { - int numberOfSections = 1; - - if ([_updateManager isAllowUserToDisableSendData]) { - if ([_updateManager shouldSendUserData]) numberOfSections++; - if ([_updateManager shouldSendUsageTime]) numberOfSections++; - } - - return numberOfSections; -} - - -- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section { - if (section == [self numberOfSections] - 1) { - return BITHockeyLocalizedString(@"UpdateSectionCheckTitle"); - } else { - return nil; - } -} - - -- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { - if (section < [self numberOfSections] - 1) { - return 66; - } else return 0; -} - - -- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { - if ([self numberOfSections] > 1 && section < [self numberOfSections] - 1) { - UILabel *footer = [[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 285, 66)] autorelease]; - footer.backgroundColor = [UIColor clearColor]; - footer.numberOfLines = 3; - footer.textAlignment = UITextAlignmentCenter; - footer.adjustsFontSizeToFitWidth = YES; - footer.textColor = [UIColor grayColor]; - footer.font = [UIFont systemFontOfSize:13]; - - if (section == 0 && [_updateManager isAllowUserToDisableSendData] && [_updateManager shouldSendUserData]) { - footer.text = BITHockeyLocalizedString(@"UpdateSettingsUserDataDescription"); - } else if ([_updateManager isAllowUserToDisableSendData] && section < [self numberOfSections]) { - footer.text = BITHockeyLocalizedString(@"UpdateSettingsUsageDataDescription"); - } - - UIView* view = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 285, footer.frame.size.height + 6 + 11)] autorelease]; - [view setBackgroundColor:[UIColor clearColor]]; - - CGRect frame = footer.frame; - frame.origin.y = 8; - frame.origin.x = 16; - frame.size.width = 285; - footer.frame = frame; - - [view addSubview:footer]; - [view sizeToFit]; - - return view; - } - - return nil; -} - - -- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - // Return the number of sections. - return [self numberOfSections]; -} - - -- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - // Return the number of rows in the section. - if (section == [self numberOfSections] - 1) - return 3; - else - return 1; -} - - -- (void)sendUserData:(UISwitch *)switcher { - [_updateManager setUserAllowsSendUserData:switcher.on]; -} - -- (void)sendUsageData:(UISwitch *)switcher { - [_updateManager setUserAllowsSendUsageTime:switcher.on]; -} - - -// Customize the appearance of table view cells. -- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { - - static NSString *CheckmarkCellIdentifier = @"CheckmarkCell"; - static NSString *SwitchCellIdentifier = @"SwitchCell"; - - NSString *requiredIdentifier = nil; - UITableViewCellStyle cellStyle = UITableViewCellStyleSubtitle; - - if ((NSInteger)indexPath.section == [self numberOfSections] - 1) { - cellStyle = UITableViewCellStyleDefault; - requiredIdentifier = CheckmarkCellIdentifier; - } else { - cellStyle = UITableViewCellStyleValue1; - requiredIdentifier = SwitchCellIdentifier; - } - - UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:requiredIdentifier]; - if (cell == nil) { - cell = [[[UITableViewCell alloc] initWithStyle:cellStyle reuseIdentifier:requiredIdentifier] autorelease]; - } - - cell.accessoryType = UITableViewCellAccessoryNone; - cell.selectionStyle = UITableViewCellSelectionStyleNone; - - // Configure the cell... - if ((NSInteger)indexPath.section == [self numberOfSections] - 1) { - cell.selectionStyle = UITableViewCellSelectionStyleBlue; - - // update check selection - BITUpdateSetting hockeyAutoUpdateSetting = [_updateManager updateSetting]; - if (indexPath.row == 0) { - // on startup - cell.textLabel.text = BITHockeyLocalizedString(@"UpdateSectionCheckStartup"); - if (hockeyAutoUpdateSetting == BITUpdateCheckStartup) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - } - } else if (indexPath.row == 1) { - // daily - cell.textLabel.text = BITHockeyLocalizedString(@"UpdateSectionCheckDaily"); - if (hockeyAutoUpdateSetting == BITUpdateCheckDaily) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - } - } else { - // manually - cell.textLabel.text = BITHockeyLocalizedString(@"UpdateSectionCheckManually"); - if (hockeyAutoUpdateSetting == BITUpdateCheckManually) { - cell.accessoryType = UITableViewCellAccessoryCheckmark; - } - } - } else { - UISwitch *toggleSwitch = [[[UISwitch alloc] initWithFrame:CGRectZero] autorelease]; - - if (indexPath.section == 0 && [_updateManager shouldSendUserData] && [_updateManager isAllowUserToDisableSendData]) { - // send user data - cell.textLabel.text = BITHockeyLocalizedString(@"UpdateSettingsUserData"); - [toggleSwitch addTarget:self action:@selector(sendUserData:) - forControlEvents:UIControlEventValueChanged]; - [toggleSwitch setOn:[_updateManager doesUserAllowsSendUserData]]; - - } else if ([_updateManager shouldSendUsageTime] && [_updateManager isAllowUserToDisableSendData]) { - // send usage time - cell.textLabel.text = BITHockeyLocalizedString(@"UpdateSettingsUsageData"); - [toggleSwitch addTarget:self action:@selector(sendUsageData:) - forControlEvents:UIControlEventValueChanged]; - [toggleSwitch setOn:[_updateManager doesUserAllowsSendUsageTime]]; - } - - cell.accessoryView = toggleSwitch; - - } - - return cell; -} - - -#pragma mark - Table view delegate - -- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { - [tableView deselectRowAtIndexPath:indexPath animated:YES]; - - // update check interval selection - if (indexPath.row == 0) { - // on startup - _updateManager.updateSetting = BITUpdateCheckStartup; - } else if (indexPath.row == 1) { - // daily - _updateManager.updateSetting = BITUpdateCheckDaily; - } else { - // manually - _updateManager.updateSetting = BITUpdateCheckManually; - } - - [tableView reloadData]; -} - - -#pragma mark - Memory management - -- (void)dealloc { - [_updateManager release]; - - [super dealloc]; -} - - -#pragma mark - Rotation - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - BOOL shouldAutorotate; - - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { - shouldAutorotate = (interfaceOrientation == UIInterfaceOrientationPortrait); - } else { - shouldAutorotate = YES; - } - - return shouldAutorotate; -} - -@end - diff --git a/Classes/BITUpdateViewController.m b/Classes/BITUpdateViewController.m index 62ab8a0a63..71ee7578ef 100644 --- a/Classes/BITUpdateViewController.m +++ b/Classes/BITUpdateViewController.m @@ -34,7 +34,6 @@ #import "UIImage+BITHockeyAdditions.h" #import "PSAppStoreHeader.h" #import "PSWebTableViewCell.h" -#import "BITUpdateSettingsViewController.h" #import "PSStoreButton.h" #import "HockeySDK.h" @@ -94,7 +93,7 @@ _appStoreHeader.subHeaderLabel = subHeaderString; } -- (void)appDidBecomeActive_ { +- (void)appDidBecomeActive { if (self.appStoreButtonState == AppStoreButtonStateInstalling) { [self setAppStoreButtonState:AppStoreButtonStateUpdate animated:YES]; } else if (![_updateManager isCheckInProgress]) { @@ -102,27 +101,6 @@ } } -- (void)openSettings:(id)sender { - BITUpdateSettingsViewController *settings = [[[BITUpdateSettingsViewController alloc] init] autorelease]; - - Class popoverControllerClass = NSClassFromString(@"UIPopoverController"); - if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad && popoverControllerClass) { - if (_popOverController == nil) { - _popOverController = [[popoverControllerClass alloc] initWithContentViewController:settings]; - } - if ([_popOverController contentViewController].view.window) { - [_popOverController dismissPopoverAnimated:YES]; - }else { - [_popOverController setPopoverContentSize: CGSizeMake(320, 440)]; - [_popOverController presentPopoverFromBarButtonItem:self.navigationItem.rightBarButtonItem - permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES]; - } - } else { - settings.modalTransitionStyle = UIModalTransitionStylePartialCurl; - [self presentModalViewController:settings animated:YES]; - } -} - - (UIImage *)addGlossToImage:(UIImage *)image { UIGraphicsBeginImageContextWithOptions(image.size, NO, 0.0); @@ -236,14 +214,7 @@ self.title = BITHockeyLocalizedString(@"UpdateScreenTitle"); _isAppStoreEnvironment = [BITHockeyManager sharedHockeyManager].isAppStoreEnvironment; - - if ([_updateManager shouldShowUserSettings]) { - self.navigationItem.rightBarButtonItem = [[[UIBarButtonItem alloc] initWithImage:[UIImage bit_imageNamed:@"gear.png" bundle:BITHOCKEYSDK_BUNDLE] - style:UIBarButtonItemStyleBordered - target:self - action:@selector(openSettings:)] autorelease]; - } - + _cells = [[NSMutableArray alloc] initWithCapacity:5]; _popOverController = nil; } @@ -321,7 +292,7 @@ // add notifications only to loaded view NSNotificationCenter *dnc = [NSNotificationCenter defaultCenter]; - [dnc addObserver:self selector:@selector(appDidBecomeActive_) name:UIApplicationDidBecomeActiveNotification object:nil]; + [dnc addObserver:self selector:@selector(appDidBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil]; // hook into manager with kvo! [_updateManager addObserver:self forKeyPath:@"checkInProgress" options:0 context:nil]; diff --git a/Classes/HockeySDK.h b/Classes/HockeySDK.h index 7561370919..2c8c5919a1 100644 --- a/Classes/HockeySDK.h +++ b/Classes/HockeySDK.h @@ -39,7 +39,6 @@ #import "BITUpdateManager.h" #import "BITUpdateManagerDelegate.h" #import "BITUpdateViewController.h" -#import "BITUpdateSettingsViewController.h" // Notification message which HockeyManager is listening to, to retry requesting updated from the server diff --git a/Classes/HockeySDKPrivate.h b/Classes/HockeySDKPrivate.h index b5d8b5a2cf..da45df2169 100644 --- a/Classes/HockeySDKPrivate.h +++ b/Classes/HockeySDKPrivate.h @@ -42,10 +42,6 @@ #define kBITUpdateDateOfVersionInstallation @"BITUpdateDateOfVersionInstallation" #define kBITUpdateUsageTimeOfCurrentVersion @"BITUpdateUsageTimeOfCurrentVersion" #define kBITUpdateUsageTimeForVersionString @"BITUpdateUsageTimeForVersionString" -#define kBITUpdateAutoUpdateSetting @"BITUpdateAutoUpdateSetting" -#define kBITUpdateAllowUserSetting @"BITUpdateAllowUserSetting" -#define kBITUpdateAllowUsageSetting @"BITUpdateAllowUsageSetting" -#define kBITUpdateAutoUpdateSetting @"BITUpdateAutoUpdateSetting" #define kBITUpdateAuthorizedVersion @"BITUpdateAuthorizedVersion" #define kBITUpdateAuthorizedToken @"BITUpdateAuthorizedToken" diff --git a/Resources/gear.png b/Resources/gear.png deleted file mode 100644 index 55629bbf800a64a4ebc82985f7705415cfdd4bfa..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 521 zcmV+k0`~ohP)bmA_5`K@f-M2n{AuX$ut;`V2-Is0fVIq@k?sj(OyUG4`=ORG1VY#hPMMMC}sv2kl zQytATPBMZO1G~mm5s`w9N=9tBVxR`x1Lr^$I0gDFt*^c+aG|j^Tk$V2Py~7& zuk|!{?N&@h-RYwS>STOshwh%;FS_23heGYg65vOor! z6OqWce;7WvEh1+kGSc}zaGb(E5|KT9A8Bse|FRXYqk<&j?F6dbTs$wStVbxZ8=&s3 z*ZJ#l1M)1c>D-9&u0lQNyKi&N$)|zsm3{>rtLA_gZ@zM+)0)r~a0r|L0}nD_(S#0w zOEzgj9=vGgT@Tz1#aeJabdI7ZdNZ!EESto=P< zXYIWmpk~vpe+|%x{zLyQH6^rwy61}X%>fnQyFC?Pu1Lm0p@BAFhkES*ZAC#BT^^m1 zT0P^fW-COwpn)D>BH+>~sogW)t^hPJ0rcbni7F49cmp^A<~{a4U=6tNl*fhH`aE&- zHs?m#f;3dqz&Nm11F{G_0H%SLz_ACmR>$T$ZLy0r_B~+y%Fw_dP)dRL1e7CSYgM*b zpGv@B2s);w?@Ag8*g7KSs8xr>`ZN--Ns9X;ZcAE_beWH2f&fmQkj ztN{0cu0&jyjjfnZnofbKl-!NAabPu&@FOsjv62F2%r{M|g+T+oR2x9r3eRQ%C+3TE4XAQi;r8a?X|WLR(BJ(!GwQDUVxe(6OhCu|~^7 z(paQ>9gFXjAxSSJJ+pvzNy90Ak0cFA+KmMGr6G$=(}AQjRZHVloz?e8wDIP8<$01c zM|1H6HdhTt(8lq#vrT?wNgFH(N1z lLN$C{b)$}3*IG>p{S%J0EmHOKC@BB{002ovPDHLkV1j>