From 2257950c99e082bc834a33446d1f4ee573220b49 Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Sun, 22 Jul 2012 02:49:30 +0200 Subject: [PATCH] Clean up private properties and methods in BITUpdateViewController --- Classes/BITUpdateManager.m | 1 + Classes/BITUpdateViewController.h | 16 +----- Classes/BITUpdateViewController.m | 15 ++---- Classes/BITUpdateViewControllerPrivate.h | 58 +++++++++++++++++++++ Support/HockeySDK.xcodeproj/project.pbxproj | 4 ++ 5 files changed, 68 insertions(+), 26 deletions(-) create mode 100644 Classes/BITUpdateViewControllerPrivate.h diff --git a/Classes/BITUpdateManager.m b/Classes/BITUpdateManager.m index 325d7aaa9f..7df011dc0a 100644 --- a/Classes/BITUpdateManager.m +++ b/Classes/BITUpdateManager.m @@ -35,6 +35,7 @@ #import "HockeySDKPrivate.h" #import "BITUpdateManagerPrivate.h" +#import "BITUpdateViewControllerPrivate.h" #import "BITAppVersionMetaInfo.h" #import "NSString+BITHockeyAdditions.h" diff --git a/Classes/BITUpdateViewController.h b/Classes/BITUpdateViewController.h index 8d7e77e95f..4ca81f11af 100644 --- a/Classes/BITUpdateViewController.h +++ b/Classes/BITUpdateViewController.h @@ -32,17 +32,10 @@ @class PSStoreButton; @class PSAppStoreHeader; -@class BITUpdateManager; -typedef enum { - AppStoreButtonStateOffline, - AppStoreButtonStateCheck, - AppStoreButtonStateSearching, - AppStoreButtonStateUpdate, - AppStoreButtonStateInstalling -} AppStoreButtonState; @interface BITUpdateViewController : UITableViewController { +@private BOOL _kvoRegistered; BOOL _showAllVersions; UIStatusBarStyle _statusBarStyle; @@ -56,11 +49,4 @@ typedef enum { BOOL _isAppStoreEnvironment; } -@property (nonatomic, retain) BITUpdateManager *updateManager; -@property (nonatomic, readwrite) BOOL modal; -@property (nonatomic, readwrite) BOOL modalAnimated; - -- (id)init:(BITUpdateManager *)newUpdateManager modal:(BOOL)newModal; -- (id)init; - @end diff --git a/Classes/BITUpdateViewController.m b/Classes/BITUpdateViewController.m index 71ee7578ef..a9c3f9a7af 100644 --- a/Classes/BITUpdateViewController.m +++ b/Classes/BITUpdateViewController.m @@ -40,24 +40,17 @@ #import "HockeySDKPrivate.h" #import "BITUpdateManagerPrivate.h" +#import "BITUpdateViewControllerPrivate.h" #define BIT_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] #define kWebCellIdentifier @"PSWebTableViewCell" #define kAppStoreViewHeight 90 -@interface BITUpdateViewController() -// updates the whole view -- (void)showPreviousVersionAction; -- (void)redrawTableView; -@property (nonatomic, assign) AppStoreButtonState appStoreButtonState; -- (void)setAppStoreButtonState:(AppStoreButtonState)anAppStoreButtonState animated:(BOOL)animated; -@end - @implementation BITUpdateViewController -@synthesize appStoreButtonState = appStoreButtonState_; +@synthesize appStoreButtonState = _appStoreButtonState; @synthesize modal = _modal; @synthesize modalAnimated = _modalAnimated; @@ -570,7 +563,7 @@ } - (void)setAppStoreButtonState:(AppStoreButtonState)anAppStoreButtonState animated:(BOOL)animated { - appStoreButtonState_ = anAppStoreButtonState; + _appStoreButtonState = anAppStoreButtonState; switch (anAppStoreButtonState) { case AppStoreButtonStateOffline: @@ -594,7 +587,7 @@ } - (void)storeButtonFired:(PSStoreButton *)button { - switch (appStoreButtonState_) { + switch (_appStoreButtonState) { case AppStoreButtonStateCheck: [_updateManager checkForUpdateShowFeedback:YES]; break; diff --git a/Classes/BITUpdateViewControllerPrivate.h b/Classes/BITUpdateViewControllerPrivate.h new file mode 100644 index 0000000000..54aa07952c --- /dev/null +++ b/Classes/BITUpdateViewControllerPrivate.h @@ -0,0 +1,58 @@ +/* + * Author: Andreas Linde + * Peter Steinberger + * + * Copyright (c) 2012 HockeyApp, Bit Stadium GmbH. + * Copyright (c) 2011 Andreas Linde, Peter Steinberger. + * 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 + +typedef enum { + AppStoreButtonStateOffline, + AppStoreButtonStateCheck, + AppStoreButtonStateSearching, + AppStoreButtonStateUpdate, + AppStoreButtonStateInstalling +} AppStoreButtonState; + + +@class BITUpdateManager; + +@protocol PSStoreButtonDelegate; + +@interface BITUpdateViewController() { +} + +@property (nonatomic, retain) BITUpdateManager *updateManager; +@property (nonatomic, readwrite) BOOL modal; +@property (nonatomic, readwrite) BOOL modalAnimated; + +@property (nonatomic, assign) AppStoreButtonState appStoreButtonState; + +- (id)init:(BITUpdateManager *)newUpdateManager modal:(BOOL)newModal; +- (id)init; + +@end diff --git a/Support/HockeySDK.xcodeproj/project.pbxproj b/Support/HockeySDK.xcodeproj/project.pbxproj index ec9bfcd13c..388bfb06d6 100644 --- a/Support/HockeySDK.xcodeproj/project.pbxproj +++ b/Support/HockeySDK.xcodeproj/project.pbxproj @@ -9,6 +9,7 @@ /* Begin PBXBuildFile section */ 1E01118115BB6311007002AC /* BITUpdateManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E01118015BB62FE007002AC /* BITUpdateManagerPrivate.h */; }; 1E01118215BB6314007002AC /* BITCrashManagerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E01117E15BB6228007002AC /* BITCrashManagerPrivate.h */; }; + 1E01118D15BB83FB007002AC /* BITUpdateViewControllerPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E01118C15BB83F6007002AC /* BITUpdateViewControllerPrivate.h */; }; 1E27EF2515BB5033000AE995 /* HockeySDK.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1E59555F15B6F80E00A03429 /* HockeySDK.strings */; }; 1E40BCB515A3487500BD64D9 /* BITCrashManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */; settings = {ATTRIBUTES = (); }; }; 1E40BCB915A3494400BD64D9 /* BITCrashReportTextFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */; }; @@ -163,6 +164,7 @@ /* Begin PBXFileReference section */ 1E01117E15BB6228007002AC /* BITCrashManagerPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerPrivate.h; sourceTree = ""; }; 1E01118015BB62FE007002AC /* BITUpdateManagerPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BITUpdateManagerPrivate.h; sourceTree = ""; }; + 1E01118C15BB83F6007002AC /* BITUpdateViewControllerPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BITUpdateViewControllerPrivate.h; sourceTree = ""; }; 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerDelegate.h; sourceTree = ""; }; 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatter.h; sourceTree = ""; }; 1E40BCB815A3494400BD64D9 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = ""; }; @@ -347,6 +349,7 @@ 1E5955D515B72ED500A03429 /* BITUpdateManager.m */, 1E5955EE15B7752200A03429 /* BITUpdateManagerDelegate.h */, 1E5955E215B751ED00A03429 /* BITUpdateViewController.h */, + 1E01118C15BB83F6007002AC /* BITUpdateViewControllerPrivate.h */, 1E5955E615B751FB00A03429 /* BITUpdateViewController.m */, 1E5955D115B72E5300A03429 /* BITCrashManager.h */, 1E01117E15BB6228007002AC /* BITCrashManagerPrivate.h */, @@ -407,6 +410,7 @@ 1E01118115BB6311007002AC /* BITUpdateManagerPrivate.h in Headers */, 1E01118215BB6314007002AC /* BITCrashManagerPrivate.h in Headers */, 1E5955F215B77F5100A03429 /* NSString+BITHockeyAdditions.h in Headers */, + 1E01118D15BB83FB007002AC /* BITUpdateViewControllerPrivate.h in Headers */, 1E5955F315B77F5600A03429 /* PSAppStoreHeader.h in Headers */, 1E5954B615B6E17700A03429 /* PSStoreButton.h in Headers */, 1E5955F415B77F5E00A03429 /* PSWebTableViewCell.h in Headers */,