Clean up some private ivars and methods and move them into their own header files

This commit is contained in:
Andreas Linde 2012-07-22 00:32:42 +02:00
parent 3687f95f36
commit 0586a69bc0
9 changed files with 156 additions and 86 deletions

View File

@ -55,7 +55,6 @@ typedef enum BITCrashStatus {
NSString *_feedbackRequestID; NSString *_feedbackRequestID;
float _feedbackDelayInterval; float _feedbackDelayInterval;
NSMutableString *_contentOfProperty;
BITCrashStatus _serverResult; BITCrashStatus _serverResult;
int _analyzerStarted; int _analyzerStarted;
@ -109,8 +108,4 @@ typedef enum BITCrashStatus {
// will return the timeinterval from startup to the crash in seconds, default is -1 // will return the timeinterval from startup to the crash in seconds, default is -1
@property (nonatomic, readonly) NSTimeInterval timeintervalCrashInLastSessionOccured; @property (nonatomic, readonly) NSTimeInterval timeintervalCrashInLastSessionOccured;
- (id)initWithAppIdentifier:(NSString *)appIdentifier;
- (void)startManager;
@end @end

View File

@ -34,6 +34,7 @@
#import "HockeySDK.h" #import "HockeySDK.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
#import "BITCrashManagerPrivate.h"
#import "BITCrashReportTextFormatter.h" #import "BITCrashReportTextFormatter.h"
#include <sys/sysctl.h> #include <sys/sysctl.h>

View File

@ -0,0 +1,41 @@
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Kent Sutherland
*
* Copyright (c) 2012 HockeyApp, Bit Stadium GmbH.
* Copyright (c) 2011 Andreas Linde & Kent Sutherland.
* 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 <Foundation/Foundation.h>
@interface BITCrashManager () {
}
- (id)initWithAppIdentifier:(NSString *)appIdentifier;
- (void)startManager;
@end

View File

@ -29,7 +29,9 @@
#import "HockeySDK.h" #import "HockeySDK.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
#import "BITUpdateManager.h"
#import "BITCrashManagerPrivate.h"
#import "BITUpdateManagerPrivate.h"
@interface BITHockeyManager () @interface BITHockeyManager ()

View File

@ -55,6 +55,7 @@ typedef enum {
@class BITUpdateViewController; @class BITUpdateViewController;
@interface BITUpdateManager : NSObject <UIAlertViewDelegate> { @interface BITUpdateManager : NSObject <UIAlertViewDelegate> {
@private
NSString *_appIdentifier; NSString *_appIdentifier;
NSString *_currentAppVersion; NSString *_currentAppVersion;
@ -63,7 +64,6 @@ typedef enum {
BOOL _dataFound; BOOL _dataFound;
BOOL _showFeedback; BOOL _showFeedback;
BOOL _updateURLOffline;
BOOL _updateAlertShowing; BOOL _updateAlertShowing;
BOOL _lastCheckFailed; BOOL _lastCheckFailed;
@ -136,61 +136,7 @@ typedef enum {
// default value: HockeyUpdateCheckStartup // default value: HockeyUpdateCheckStartup
@property (nonatomic, assign) BITUpdateSetting updateSetting; @property (nonatomic, assign) BITUpdateSetting updateSetting;
///////////////////////////////////////////////////////////////////////////////////////////////////
// Private Properties
// if YES, the API will return an existing JMC config
// if NO, the API will return only version information
@property (nonatomic, assign) BOOL checkForTracker;
// Contains the tracker config if received from server
@property (nonatomic, retain, readonly) NSDictionary *trackerConfig;
- (id)initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironemt:(BOOL)isAppStoreEnvironment;
- (void)startManager;
// is an update available?
- (BOOL)isUpdateAvailable;
// are we currently checking for updates?
- (BOOL)isCheckInProgress;
// open update info view
- (void)showUpdateView;
// manually start an update check
- (void)checkForUpdate;
// checks for update, informs the user (error, no update found, etc)
- (void)checkForUpdateShowFeedback:(BOOL)feedback;
// initiates app-download call. displays an system UIAlertView
- (BOOL)initiateAppDownload;
// checks wether this app version is authorized
- (BOOL)appVersionIsAuthorized;
// start checking for an authorization key
- (void)checkForAuthorization;
// convenience methode to create hockey view controller // convenience methode to create hockey view controller
- (BITUpdateViewController *)hockeyViewController:(BOOL)modal; - (BITUpdateViewController *)hockeyViewController:(BOOL)modal;
// get/set current active hockey view controller
@property (nonatomic, retain) BITUpdateViewController *currentHockeyViewController;
// convenience method to get current running version string
- (NSString *)currentAppVersion;
// get newest app version
- (BITAppVersionMetaInfo *)newestAppVersion;
// get array of all available versions
- (NSArray *)appVersions;
// check if there is any newer version mandatory
- (BOOL)hasNewerMandatoryVersion;
@end @end

View File

@ -34,7 +34,7 @@
#import "HockeySDK.h" #import "HockeySDK.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
#import "BITUpdateManager.h" #import "BITUpdateManagerPrivate.h"
#import "BITAppVersionMetaInfo.h" #import "BITAppVersionMetaInfo.h"
#import "NSString+BITHockeyAdditions.h" #import "NSString+BITHockeyAdditions.h"
@ -51,30 +51,6 @@
#define BETA_UPDATE_TIMESTAMP @"timestamp" #define BETA_UPDATE_TIMESTAMP @"timestamp"
#define BETA_UPDATE_APPSIZE @"appsize" #define BETA_UPDATE_APPSIZE @"appsize"
@interface BITUpdateManager ()
- (id)parseJSONResultString:(NSString *)jsonString;
- (BOOL)shouldCheckForUpdates;
- (void)startUsage;
- (void)stopUsage;
- (void)showAuthorizationScreen:(NSString *)message image:(NSString *)image;
- (BOOL)canSendUserData;
- (BOOL)canSendUsageTime;
- (NSString *)currentUsageString;
- (NSString *)installationDateString;
- (NSString *)authenticationToken;
- (BITUpdateAuthorizationState)authorizationState;
@property (nonatomic, assign, getter=isUpdateAvailable) BOOL updateAvailable;
@property (nonatomic, assign, getter=isCheckInProgress) BOOL checkInProgress;
@property (nonatomic, retain) NSMutableData *receivedData;
@property (nonatomic, copy) NSDate *lastCheck;
@property (nonatomic, copy) NSArray *appVersions;
@property (nonatomic, retain) NSURLConnection *urlConnection;
@property (nonatomic, copy) NSDate *usageStartTimestamp;
@property (nonatomic, retain) UIView *authorizeView;
@property (nonatomic, retain) NSDictionary *trackerConfig;
@end
@implementation BITUpdateManager @implementation BITUpdateManager

View File

@ -0,0 +1,99 @@
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Peter Steinberger
*
* 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 <UIKit/UIKit.h>
@interface BITUpdateManager () {
}
// is an update available?
@property (nonatomic, assign, getter=isUpdateAvailable) BOOL updateAvailable;
// are we currently checking for updates?
@property (nonatomic, assign, getter=isCheckInProgress) BOOL checkInProgress;
@property (nonatomic, retain) NSMutableData *receivedData;
@property (nonatomic, copy) NSDate *lastCheck;
// get array of all available versions
@property (nonatomic, copy) NSArray *appVersions;
@property (nonatomic, retain) NSURLConnection *urlConnection;
@property (nonatomic, copy) NSDate *usageStartTimestamp;
@property (nonatomic, retain) UIView *authorizeView;
// if YES, the API will return an existing JMC config
// if NO, the API will return only version information
@property (nonatomic, assign) BOOL checkForTracker;
// Contains the tracker config if received from server
@property (nonatomic, retain) NSDictionary *trackerConfig;
- (id)initWithAppIdentifier:(NSString *)appIdentifier isAppStoreEnvironemt:(BOOL)isAppStoreEnvironment;
- (void)startManager;
// open update info view
- (void)showUpdateView;
// manually start an update check
- (void)checkForUpdate;
// checks for update, informs the user (error, no update found, etc)
- (void)checkForUpdateShowFeedback:(BOOL)feedback;
// initiates app-download call. displays an system UIAlertView
- (BOOL)initiateAppDownload;
// checks wether this app version is authorized
- (BOOL)appVersionIsAuthorized;
// start checking for an authorization key
- (void)checkForAuthorization;
// get/set current active hockey view controller
@property (nonatomic, retain) BITUpdateViewController *currentHockeyViewController;
// convenience method to get current running version string
- (NSString *)currentAppVersion;
// get newest app version
- (BITAppVersionMetaInfo *)newestAppVersion;
// check if there is any newer version mandatory
- (BOOL)hasNewerMandatoryVersion;
@end

View File

@ -40,6 +40,8 @@
#import "HockeySDK.h" #import "HockeySDK.h"
#import "HockeySDKPrivate.h" #import "HockeySDKPrivate.h"
#import "BITUpdateManagerPrivate.h"
#define BIT_RGBCOLOR(r,g,b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] #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 kWebCellIdentifier @"PSWebTableViewCell"

View File

@ -7,6 +7,8 @@
objects = { objects = {
/* Begin PBXBuildFile section */ /* 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 */; };
1E27EF2515BB5033000AE995 /* HockeySDK.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1E59555F15B6F80E00A03429 /* HockeySDK.strings */; }; 1E27EF2515BB5033000AE995 /* HockeySDK.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1E59555F15B6F80E00A03429 /* HockeySDK.strings */; };
1E40BCB515A3487500BD64D9 /* BITCrashManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */; settings = {ATTRIBUTES = (); }; }; 1E40BCB515A3487500BD64D9 /* BITCrashManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */; settings = {ATTRIBUTES = (); }; };
1E40BCB915A3494400BD64D9 /* BITCrashReportTextFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */; }; 1E40BCB915A3494400BD64D9 /* BITCrashReportTextFormatter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */; };
@ -168,6 +170,8 @@
/* End PBXContainerItemProxy section */ /* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
1E01117E15BB6228007002AC /* BITCrashManagerPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerPrivate.h; sourceTree = "<group>"; };
1E01118015BB62FE007002AC /* BITUpdateManagerPrivate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BITUpdateManagerPrivate.h; sourceTree = "<group>"; };
1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerDelegate.h; sourceTree = "<group>"; }; 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashManagerDelegate.h; sourceTree = "<group>"; };
1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatter.h; sourceTree = "<group>"; }; 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITCrashReportTextFormatter.h; sourceTree = "<group>"; };
1E40BCB815A3494400BD64D9 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; }; 1E40BCB815A3494400BD64D9 /* BITCrashReportTextFormatter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITCrashReportTextFormatter.m; sourceTree = "<group>"; };
@ -354,6 +358,7 @@
E41EB459148D7BF50015DEDC /* BITAppVersionMetaInfo.h */, E41EB459148D7BF50015DEDC /* BITAppVersionMetaInfo.h */,
E41EB45A148D7BF50015DEDC /* BITAppVersionMetaInfo.m */, E41EB45A148D7BF50015DEDC /* BITAppVersionMetaInfo.m */,
E41EB45D148D7BF50015DEDC /* BITUpdateManager.h */, E41EB45D148D7BF50015DEDC /* BITUpdateManager.h */,
1E01118015BB62FE007002AC /* BITUpdateManagerPrivate.h */,
1E5955D515B72ED500A03429 /* BITUpdateManager.m */, 1E5955D515B72ED500A03429 /* BITUpdateManager.m */,
1E5955EE15B7752200A03429 /* BITUpdateManagerDelegate.h */, 1E5955EE15B7752200A03429 /* BITUpdateManagerDelegate.h */,
1E5955E215B751ED00A03429 /* BITUpdateViewController.h */, 1E5955E215B751ED00A03429 /* BITUpdateViewController.h */,
@ -361,6 +366,7 @@
E41EB45F148D7BF50015DEDC /* BITUpdateSettingsViewController.h */, E41EB45F148D7BF50015DEDC /* BITUpdateSettingsViewController.h */,
E41EB460148D7BF50015DEDC /* BITUpdateSettingsViewController.m */, E41EB460148D7BF50015DEDC /* BITUpdateSettingsViewController.m */,
1E5955D115B72E5300A03429 /* BITCrashManager.h */, 1E5955D115B72E5300A03429 /* BITCrashManager.h */,
1E01117E15BB6228007002AC /* BITCrashManagerPrivate.h */,
E41EB464148D7BF50015DEDC /* BITCrashManager.m */, E41EB464148D7BF50015DEDC /* BITCrashManager.m */,
1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */, 1E40BCB415A3487500BD64D9 /* BITCrashManagerDelegate.h */,
1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */, 1E40BCB715A3494400BD64D9 /* BITCrashReportTextFormatter.h */,
@ -416,6 +422,8 @@
1E5955F815B77F7C00A03429 /* BITUpdateViewController.h in Headers */, 1E5955F815B77F7C00A03429 /* BITUpdateViewController.h in Headers */,
1E5954B515B6E16300A03429 /* BITUpdateSettingsViewController.h in Headers */, 1E5954B515B6E16300A03429 /* BITUpdateSettingsViewController.h in Headers */,
1E5955F615B77F6500A03429 /* HockeySDKPrivate.h in Headers */, 1E5955F615B77F6500A03429 /* HockeySDKPrivate.h in Headers */,
1E01118115BB6311007002AC /* BITUpdateManagerPrivate.h in Headers */,
1E01118215BB6314007002AC /* BITCrashManagerPrivate.h in Headers */,
1E5955F215B77F5100A03429 /* NSString+BITHockeyAdditions.h in Headers */, 1E5955F215B77F5100A03429 /* NSString+BITHockeyAdditions.h in Headers */,
1E5955F315B77F5600A03429 /* PSAppStoreHeader.h in Headers */, 1E5955F315B77F5600A03429 /* PSAppStoreHeader.h in Headers */,
1E5954B615B6E17700A03429 /* PSStoreButton.h in Headers */, 1E5954B615B6E17700A03429 /* PSStoreButton.h in Headers */,