Swiftgram/Classes/BITUpdateManager.h
Andreas Linde 3fd3c083bf 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
2012-07-22 02:36:55 +02:00

277 lines
8.5 KiB
Objective-C

/*
* 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>
typedef enum {
BITUpdateComparisonResultDifferent,
BITUpdateComparisonResultGreater
} BITUpdateComparisonResult;
typedef enum {
BITUpdateAuthorizationDenied,
BITUpdateAuthorizationAllowed,
BITUpdateAuthorizationPending
} BITUpdateAuthorizationState;
typedef enum {
BITUpdateCheckStartup = 0,
BITUpdateCheckDaily = 1,
BITUpdateCheckManually = 2
} BITUpdateSetting;
@protocol BITUpdateManagerDelegate;
@class BITAppVersionMetaInfo;
@class BITUpdateViewController;
@interface BITUpdateManager : NSObject <UIAlertViewDelegate> {
@private
NSString *_appIdentifier;
NSString *_currentAppVersion;
UINavigationController *_navController;
BITUpdateViewController *_currentHockeyViewController;
BOOL _dataFound;
BOOL _showFeedback;
BOOL _updateAlertShowing;
BOOL _lastCheckFailed;
BOOL _isAppStoreEnvironment;
NSString *_uuid;
}
///-----------------------------------------------------------------------------
/// @name Delegate
///-----------------------------------------------------------------------------
/**
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 <BITUpdateManagerDelegate> delegate;
///-----------------------------------------------------------------------------
/// @name Configuration
///-----------------------------------------------------------------------------
/**
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;
/**
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;
///-----------------------------------------------------------------------------
/// @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