Skip to content
Snippets Groups Projects
Commit bce8790f authored by wieseoli's avatar wieseoli
Browse files

Merge branch 'HockeyApp_Integration' into 'master'

Hockey app integration

See merge request enzevalos/enzevalos_iphone_workspace!2
parents a7edd537 6230e2d8
No related branches found
No related tags found
No related merge requests found
Showing
with 3085 additions and 30 deletions
# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore
## Build generated
build/
DerivedData/
## Various settings
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata/
*.generated*
## Other
*.xccheckout
*.moved-aside
*.xcuserstate
*.xcscmblueprint
## Obj-C/Swift specific
*.hmap
*.ipa
*.dSYM.zip
*.dSYM
*.DS_Store
## Playgrounds
timeline.xctimeline
playground.xcworkspace
# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
# Pods/
...@@ -3,35 +3,41 @@ platform :ios, '9.3' ...@@ -3,35 +3,41 @@ platform :ios, '9.3'
project '../enzevalos_iphone/enzevalos_iphone.xcodeproj' project '../enzevalos_iphone/enzevalos_iphone.xcodeproj'
inhibit_all_warnings!
use_frameworks!
def pods
# VENTokenField is modified
pod 'VENTokenField', '~> 2.0'
pod 'mailcore2-ios', :git => 'https://github.com/MailCore/mailcore2.git', :branch => 'master'
#pod 'ObjectivePGP'
pod 'OpenSSL-Universal'
pod 'BZipCompression'
pod 'KeychainAccess'#, '~> 2.4'
pod 'Onboard'
#pod 'deltachat-core', :git => 'https://github.com/r10s/deltachat-core.git', :branch => 'master'
# pod 'OpenSSL'
# pod 'UNNetPGP', :git => 'https://github.com/oliverFU/unnetpgp.git', :branch => 'master'
pod 'HockeySDK', '5.0.0'
end
target 'enzevalos_iphone' do target 'enzevalos_iphone' do
# Comment this line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
# Pods for enzevalos_iphone
# VENTokenField is modified
pod 'VENTokenField', '~> 2.0'
pod 'mailcore2-ios', :git => 'https://github.com/MailCore/mailcore2.git', :branch => 'master'
#pod 'ObjectivePGP'
pod 'OpenSSL-Universal'
pod 'BZipCompression'
pod 'KeychainAccess'#, '~> 2.4'
pod 'Onboard'
#pod 'deltachat-core', :git => 'https://github.com/r10s/deltachat-core.git', :branch => 'master'
# pod 'OpenSSL'
# pod 'UNNetPGP', :git => 'https://github.com/oliverFU/unnetpgp.git', :branch => 'master'
target 'enzevalos_iphoneTests' do
inherit! :search_paths
# Pods for testing
end
target 'enzevalos_iphoneUITests' do
inherit! :search_paths
# Pods for testing
end
pods
target 'enzevalos_iphoneTests' do
inherit! :search_paths
# Pods for testing
end
target 'enzevalos_iphoneUITests' do
inherit! :search_paths
# Pods for testing
end
end
target 'enzevalos_iphone-AdHoc' do
pods
end end
PODS: PODS:
- BZipCompression (1.0.2) - BZipCompression (1.0.2)
- FrameAccessor (1.3.2) - FrameAccessor (1.3.2)
- HockeySDK (5.0.0):
- HockeySDK/DefaultLib (= 5.0.0)
- HockeySDK/DefaultLib (5.0.0)
- KeychainAccess (3.1.0) - KeychainAccess (3.1.0)
- mailcore2-ios (0.6.4) - mailcore2-ios (0.6.4)
- Onboard (2.3.1) - Onboard (2.3.1)
...@@ -10,6 +13,7 @@ PODS: ...@@ -10,6 +13,7 @@ PODS:
DEPENDENCIES: DEPENDENCIES:
- BZipCompression - BZipCompression
- HockeySDK (= 5.0.0)
- KeychainAccess - KeychainAccess
- mailcore2-ios (from `https://github.com/MailCore/mailcore2.git`, branch `master`) - mailcore2-ios (from `https://github.com/MailCore/mailcore2.git`, branch `master`)
- Onboard - Onboard
...@@ -29,12 +33,13 @@ CHECKOUT OPTIONS: ...@@ -29,12 +33,13 @@ CHECKOUT OPTIONS:
SPEC CHECKSUMS: SPEC CHECKSUMS:
BZipCompression: e0f96508e60eb93b5f5d4c7de1eb3dd0ac4f9ae9 BZipCompression: e0f96508e60eb93b5f5d4c7de1eb3dd0ac4f9ae9
FrameAccessor: 0f7ba6ce37be9a5d0302a27c731dca70af8d438b FrameAccessor: 0f7ba6ce37be9a5d0302a27c731dca70af8d438b
HockeySDK: 82bf8dcbe1af3c87c24dc98924fcf2e2ba5be8c4
KeychainAccess: 94c5540b32eabf7bc32bfb976a268e8ea05fd6da KeychainAccess: 94c5540b32eabf7bc32bfb976a268e8ea05fd6da
mailcore2-ios: 603bf559a9e50327a0f85a7fab7861ab1c042656 mailcore2-ios: 603bf559a9e50327a0f85a7fab7861ab1c042656
Onboard: b6871f25ac753175b2ab9a362fb2feb26a81a311 Onboard: b6871f25ac753175b2ab9a362fb2feb26a81a311
OpenSSL-Universal: bcea8d73aec478029029164f9f0695b57cb94309 OpenSSL-Universal: bcea8d73aec478029029164f9f0695b57cb94309
VENTokenField: 5a19b838fb97f040e3d4c93f584b4adeaf3fc1ee VENTokenField: 5a19b838fb97f040e3d4c93f584b4adeaf3fc1ee
PODFILE CHECKSUM: 0467f9885b137d8b03e85207642d9affce0b7706 PODFILE CHECKSUM: 41c64cca12310b767d4c8f2b43bfd1cf74ea7cb5
COCOAPODS: 1.3.1 COCOAPODS: 1.3.1
/*
* Author: Stephan Diederich, Andreas Linde
*
* Copyright (c) 2013-2014 HockeyApp, Bit Stadium GmbH.
* 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>
#import "BITHockeyBaseManager.h"
/**
* Identification Types
*/
typedef NS_ENUM(NSUInteger, BITAuthenticatorIdentificationType) {
/**
* Assigns this app an anonymous user id.
* <br/><br/>
* The user will not be asked anything and an anonymous ID will be generated.
* This helps identifying this installation being unique but HockeyApp won't be able
* to identify who actually is running this installation and on which device
* the app is installed.
*/
BITAuthenticatorIdentificationTypeAnonymous,
/**
* Ask for the HockeyApp account email
* <br/><br/>
* This will present a user interface requesting the user to provide their
* HockeyApp user email address.
* <br/><br/>
* The provided email address has to match an email address of a registered
* HockeyApp user who is a member or tester of the app
*/
BITAuthenticatorIdentificationTypeHockeyAppEmail,
/**
* Ask for the HockeyApp account by email and password
* <br/><br/>
* This will present a user interface requesting the user to provide their
* HockeyApp user credentials.
* <br/><br/>
* The provided user account has to match a registered HockeyApp user who is
* a member or tester of the app
*/
BITAuthenticatorIdentificationTypeHockeyAppUser,
/**
* Identifies the current device
* <br/><br/>
* This will open the HockeyApp web page on the device in Safari and request the user
* to submit the device's unique identifier to the app. If the web page session is not aware
* of the current devices UDID, it will request the user to install the HockeyApp web clip
* which will provide the UDID to users session in the browser.
* <br/><br/>
* This requires the app to register an URL scheme. See the linked property and methods
* for further documentation on this.
*/
BITAuthenticatorIdentificationTypeDevice,
/**
* Ask for the HockeyApp account email.
* <br/><br/>
* This will present a user interface requesting the user to start a Safari based
* flow to login to HockeyApp (if not already logged in) and to share the hockeyapp
* account's email.
* <br/><br/>
* If restrictApplicationUsage is enabled, the provided user account has to match a
* registered HockeyApp user who is a member or tester of the app.
* For identification purpose any HockeyApp user is allowed.
*/
BITAuthenticatorIdentificationTypeWebAuth,
};
/**
* Restriction enforcement styles
*
* Specifies how often the Authenticator checks if the user is allowed to use
* this app.
*/
typedef NS_ENUM(NSUInteger, BITAuthenticatorAppRestrictionEnforcementFrequency) {
/**
* Checks if the user is allowed to use the app at the first time a version is started
*/
BITAuthenticatorAppRestrictionEnforcementOnFirstLaunch,
/**
* Checks if the user is allowed to use the app every time the app becomes active
*/
BITAuthenticatorAppRestrictionEnforcementOnAppActive,
};
@protocol BITAuthenticatorDelegate;
/**
* Identify and authenticate users of Ad-Hoc or Enterprise builds
*
* `BITAuthenticator` serves 2 purposes:
*
* 1. Identifying who is running your Ad-Hoc or Enterprise builds
* `BITAuthenticator` provides an identifier for the rest of the HockeySDK
* to work with, e.g. in-app update checks and crash reports.
*
* 2. Optional regular checking if an identified user is still allowed
* to run this application. The `BITAuthenticator` can be used to make
* sure only users who are testers of your app are allowed to run it.
*
* This module automatically disables itself when running in an App Store build by default!
*
* @warning It is mandatory to call `authenticateInstallation` somewhen after calling
* `[[BITHockeyManager sharedHockeyManager] startManager]` or fully customize the identification
* and validation workflow yourself.
* If your app shows a modal view on startup, make sure to call `authenticateInstallation`
* either once your modal view is fully presented (e.g. its `viewDidLoad:` method is processed)
* or once your modal view is dismissed.
*/
@interface BITAuthenticator : BITHockeyBaseManager
#pragma mark - Configuration
///-----------------------------------------------------------------------------
/// @name Configuration
///-----------------------------------------------------------------------------
/**
* Defines the identification mechanism to be used
*
* _Default_: `BITAuthenticatorIdentificationTypeAnonymous`
*
* @see BITAuthenticatorIdentificationType
*/
@property (nonatomic, assign) BITAuthenticatorIdentificationType identificationType;
/**
* Enables or disables checking if the user is allowed to run this app
*
* If disabled, the Authenticator never validates, besides initial identification,
* if the user is allowed to run this application.
*
* If enabled, the Authenticator checks depending on `restrictionEnforcementFrequency`
* if the user is allowed to use this application.
*
* Enabling this property and setting `identificationType` to `BITAuthenticatorIdentificationTypeHockeyAppEmail`,
* `BITAuthenticatorIdentificationTypeHockeyAppUser` or `BITAuthenticatorIdentificationTypeWebAuth` also allows
* to remove access for users by removing them from the app's users list on HockeyApp.
*
* _Default_: `NO`
*
* @warning if `identificationType` is set to `BITAuthenticatorIdentificationTypeAnonymous`,
* this property has no effect.
*
* @see BITAuthenticatorIdentificationType
* @see restrictionEnforcementFrequency
*/
@property (nonatomic, assign) BOOL restrictApplicationUsage;
/**
* Defines how often the BITAuthenticator checks if the user is allowed
* to run this application
*
* This requires `restrictApplicationUsage` to be enabled.
*
* _Default_: `BITAuthenticatorAppRestrictionEnforcementOnFirstLaunch`
*
* @see BITAuthenticatorAppRestrictionEnforcementFrequency
* @see restrictApplicationUsage
*/
@property (nonatomic, assign) BITAuthenticatorAppRestrictionEnforcementFrequency restrictionEnforcementFrequency;
/**
* The authentication secret from HockeyApp. To find the right secret,
* click on your app on the HockeyApp dashboard, then on Show next to
* "Secret:".
*
* This is only needed if `identificationType` is set to `BITAuthenticatorIdentificationTypeHockeyAppEmail`
*
* @see identificationType
*/
@property (nonatomic, copy) NSString *authenticationSecret;
#pragma mark - Device based identification
///-----------------------------------------------------------------------------
/// @name Device based identification
///-----------------------------------------------------------------------------
/**
* The baseURL of the webpage the user is redirected to if `identificationType` is
* set to `BITAuthenticatorIdentificationTypeDevice`; defaults to https://rink.hockeyapp.net.
*
* @see identificationType
*/
@property (nonatomic, strong) NSURL *webpageURL;
/**
* URL to query the device's id via external webpage
* Built with the baseURL set in `webpageURL`.
*/
- (NSURL*) deviceAuthenticationURL;
/**
* The url-scheme used to identify via `BITAuthenticatorIdentificationTypeDevice`
*
* Please make sure that the URL scheme is unique and not shared with other apps.
*
* If set to nil, the default scheme is used which is `ha<APP_ID>`.
*
* @see identificationType
* @see handleOpenURL:sourceApplication:annotation:
*/
@property (nonatomic, copy) NSString *urlScheme;
/**
Should be used by the app-delegate to forward handle application:openURL:sourceApplication:annotation: calls.
This is required if `identificationType` is set to `BITAuthenticatorIdentificationTypeDevice`.
Your app needs to implement the default `ha<APP_ID>` URL scheme or register its own scheme
via `urlScheme`.
BITAuthenticator checks if the given URL is actually meant to be parsed by it and will
return NO if it doesn't think so. It does this by checking the 'host'-part of the URL to be 'authorize', as well
as checking the protocol part.
Please make sure that if you're using a custom URL scheme, it does _not_ conflict with BITAuthenticator's.
If BITAuthenticator thinks the URL was meant to be an authorization URL, but could not find a valid token, it will
reset the stored identification token and state.
Sample usage (in AppDelegate):
- (BOOL)application:(UIApplication *)application
openURL:(NSURL *)url
sourceApplication:(NSString *)sourceApplication annotation:(id)annotation {
if ([[BITHockeyManager sharedHockeyManager].authenticator handleOpenURL:url
sourceApplication:sourceApplication
annotation:annotation]) {
return YES;
} else {
//do your own URL handling, return appropriate value
}
return NO;
}
@param url Param `url` that was passed to the app
@param sourceApplication Param `sourceApplication` that was passed to the app
@param annotation Param `annotation` that was passed to the app
@return YES if the URL request was handled, NO if the URL could not be handled/identified.
@see identificationType
@see urlScheme
*/
- (BOOL) handleOpenURL:(NSURL *) url
sourceApplication:(NSString *) sourceApplication
annotation:(id) annotation;
#pragma mark - Authentication
///-----------------------------------------------------------------------------
/// @name Authentication
///-----------------------------------------------------------------------------
/**
* Invoked automatic identification and validation
*
* If the `BITAuthenticator` is in automatic mode this will initiate identifying
* the current user according to the type specified in `identificationType` and
* validate if the identified user is allowed to run this application.
*
* If the user is not yet identified it will present a modal view asking the user to
* provide the required information.
*
* If your app provides it's own startup modal screen, e.g. a guide or a login, then
* you might either call this method once that UI is fully presented or once
* the user e.g. did actually login already.
*
* @warning You need to call this method in your code even if automatic mode is enabled!
*
* @see identificationType
*/
- (void) authenticateInstallation;
/**
* Identifies the user according to the type specified in `identificationType`.
*
* If the `BITAuthenticator` is in manual mode, it's your responsibility to call
* this method. Depending on the `identificationType`, this method
* might present a viewController to let the user enter his/her credentials.
*
* If the Authenticator is in auto-mode, this is called by the authenticator itself
* once needed.
*
* @see identificationType
* @see authenticateInstallation
* @see validateWithCompletion:
*
* @param completion Block being executed once identification completed. Be sure to properly dispatch code to the main queue if necessary.
*/
- (void) identifyWithCompletion:(void(^)(BOOL identified, NSError *error)) completion;
/**
* Returns YES if this app is identified according to the setting in `identificationType`.
*
* Since the identification process is done asynchronously (contacting the server),
* you need to observe the value change via KVO.
*
* @see identificationType
*/
@property (nonatomic, assign, readonly, getter = isIdentified) BOOL identified;
/**
* Validates if the identified user is allowed to run this application. This checks
* with the HockeyApp backend and calls the completion-block once completed.
*
* If the `BITAuthenticator` is in manual mode, it's your responsibility to call
* this method. If the application is not yet identified, validation is not possible
* and the completion-block is called with an error set.
*
* If the `BITAuthenticator` is in auto-mode, this is called by the authenticator itself
* once needed.
*
* @see identificationType
* @see authenticateInstallation
* @see identifyWithCompletion:
*
* @param completion Block being executed once validation completed. Be sure to properly dispatch code to the main queue if necessary.
*/
- (void) validateWithCompletion:(void(^)(BOOL validated, NSError *error)) completion;
/**
* Indicates if this installation is validated.
*/
@property (nonatomic, assign, readonly, getter = isValidated) BOOL validated;
/**
* Removes all previously stored authentication tokens, UDIDs, etc.
*/
- (void) cleanupInternalStorage;
/**
* Returns different values depending on `identificationType`. This can be used
* by the application to identify the user.
*
* @see identificationType
*/
- (NSString*) publicInstallationIdentifier;
@end
#pragma mark - Protocol
/**
* `BITAuthenticator` protocol
*/
@protocol BITAuthenticatorDelegate <NSObject>
@optional
/**
* If the authentication (or validation) needs to identify the user,
* this delegate method is called with the viewController that we'll present.
*
* @param authenticator `BITAuthenticator` object
* @param viewController `UIViewController` used to identify the user
*
*/
- (void) authenticator:(BITAuthenticator *)authenticator willShowAuthenticationController:(UIViewController*) viewController;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2014 HockeyApp, Bit Stadium GmbH.
* 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 "BITHockeyAttachment.h"
/**
Deprecated: Provides support to add binary attachments to crash reports
This class is not needed any longer and exists for compatibility purposes with
HockeySDK-iOS 3.5.5.
It is a subclass of `BITHockeyAttachment` which only provides an initializer
that is compatible with the one of HockeySDK-iOS 3.5.5.
This is used by `[BITCrashManagerDelegate attachmentForCrashManager:]`
@see BITHockeyAttachment
*/
@interface BITCrashAttachment : BITHockeyAttachment
/**
Create an BITCrashAttachment instance with a given filename and NSData object
@param filename The filename the attachment should get
@param crashAttachmentData The attachment data as NSData
@param contentType The content type of your data as MIME type
@return An instance of BITCrashAttachment
*/
- (instancetype)initWithFilename:(NSString *)filename
crashAttachmentData:(NSData *)crashAttachmentData
contentType:(NSString *)contentType;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
/**
* Provides details about the crash that occurred in the previous app session
*/
@interface BITCrashDetails : NSObject
/**
* UUID for the crash report
*/
@property (nonatomic, readonly, copy) NSString *incidentIdentifier;
/**
* UUID for the app installation on the device
*/
@property (nonatomic, readonly, copy) NSString *reporterKey;
/**
* Signal that caused the crash
*/
@property (nonatomic, readonly, copy) NSString *signal;
/**
* Exception name that triggered the crash, nil if the crash was not caused by an exception
*/
@property (nonatomic, readonly, copy) NSString *exceptionName;
/**
* Exception reason, nil if the crash was not caused by an exception
*/
@property (nonatomic, readonly, copy) NSString *exceptionReason;
/**
* Date and time the app started, nil if unknown
*/
@property (nonatomic, readonly, strong) NSDate *appStartTime;
/**
* Date and time the crash occurred, nil if unknown
*/
@property (nonatomic, readonly, strong) NSDate *crashTime;
/**
* Operation System version string the app was running on when it crashed.
*/
@property (nonatomic, readonly, copy) NSString *osVersion;
/**
* Operation System build string the app was running on when it crashed
*
* This may be unavailable.
*/
@property (nonatomic, readonly, copy) NSString *osBuild;
/**
* CFBundleShortVersionString value of the app that crashed
*
* Can be `nil` if the crash was captured with an older version of the SDK
* or if the app doesn't set the value.
*/
@property (nonatomic, readonly, copy) NSString *appVersion;
/**
* CFBundleVersion value of the app that crashed
*/
@property (nonatomic, readonly, copy) NSString *appBuild;
/**
* Identifier of the app process that crashed
*/
@property (nonatomic, readonly, assign) NSUInteger appProcessIdentifier;
/**
Indicates if the app was killed while being in foreground from the iOS
If `[BITCrashManager enableAppNotTerminatingCleanlyDetection]` is enabled, use this on startup
to check if the app starts the first time after it was killed by iOS in the previous session.
This can happen if it consumed too much memory or the watchdog killed the app because it
took too long to startup or blocks the main thread for too long, or other reasons. See Apple
documentation: https://developer.apple.com/library/ios/qa/qa1693/_index.html
See `[BITCrashManager enableAppNotTerminatingCleanlyDetection]` for more details about which kind of kills can be detected.
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked! In addition, it is automatically disabled while a debugger session is active!
@see `[BITCrashManager enableAppNotTerminatingCleanlyDetection]`
@see `[BITCrashManager didReceiveMemoryWarningInLastSession]`
@return YES if the details represent an app kill instead of a crash
*/
- (BOOL)isAppKill;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Kent Sutherland
*
* Copyright (c) 2012-2014 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>
#import "BITHockeyBaseManager.h"
@class BITCrashDetails;
@class BITCrashMetaData;
/**
* Custom block that handles the alert that prompts the user whether they want to send crash reports
*/
typedef void(^BITCustomAlertViewHandler)(void);
/**
* Crash Manager status
*/
typedef NS_ENUM(NSUInteger, BITCrashManagerStatus) {
/**
* Crash reporting is disabled
*/
BITCrashManagerStatusDisabled = 0,
/**
* User is asked each time before sending
*/
BITCrashManagerStatusAlwaysAsk = 1,
/**
* Each crash report is send automatically
*/
BITCrashManagerStatusAutoSend = 2
};
/**
* Prototype of a callback function used to execute additional user code. Called upon completion of crash
* handling, after the crash report has been written to disk.
*
* @param context The API client's supplied context value.
*
* @see `BITCrashManagerCallbacks`
* @see `[BITCrashManager setCrashCallbacks:]`
*/
typedef void (*BITCrashManagerPostCrashSignalCallback)(void *context);
/**
* This structure contains callbacks supported by `BITCrashManager` to allow the host application to perform
* additional tasks prior to program termination after a crash has occurred.
*
* @see `BITCrashManagerPostCrashSignalCallback`
* @see `[BITCrashManager setCrashCallbacks:]`
*/
typedef struct BITCrashManagerCallbacks {
/** An arbitrary user-supplied context value. This value may be NULL. */
void *context;
/**
* The callback used to report caught signal information.
*/
BITCrashManagerPostCrashSignalCallback handleSignal;
} BITCrashManagerCallbacks;
/**
* Crash Manager alert user input
*/
typedef NS_ENUM(NSUInteger, BITCrashManagerUserInput) {
/**
* User chose not to send the crash report
*/
BITCrashManagerUserInputDontSend = 0,
/**
* User wants the crash report to be sent
*/
BITCrashManagerUserInputSend = 1,
/**
* User chose to always send crash reports
*/
BITCrashManagerUserInputAlwaysSend = 2
};
@protocol BITCrashManagerDelegate;
/**
The crash reporting module.
This is the HockeySDK module for handling crash reports, including when distributed via the App Store.
As a foundation it is using the open source, reliable and async-safe crash reporting framework
[PLCrashReporter](https://code.google.com/p/plcrashreporter/).
This module works as a wrapper around the underlying crash reporting framework and provides functionality to
detect new crashes, queues them if networking is not available, present a user interface to approve sending
the reports to the HockeyApp servers and more.
It also provides options to add additional meta information to each crash report, like `userName`, `userEmail`
via `BITHockeyManagerDelegate` protocol, and additional textual log information via `BITCrashManagerDelegate`
protocol and a way to detect startup crashes so you can adjust your startup process to get these crash reports
too and delay your app initialization.
Crashes are send the next time the app starts. If `crashManagerStatus` is set to `BITCrashManagerStatusAutoSend`,
crashes will be send without any user interaction, otherwise an alert will appear allowing the users to decide
whether they want to send the report or not. This module is not sending the reports right when the crash happens
deliberately, because if is not safe to implement such a mechanism while being async-safe (any Objective-C code
is _NOT_ async-safe!) and not causing more danger like a deadlock of the device, than helping. We found that users
do start the app again because most don't know what happened, and you will get by far most of the reports.
Sending the reports on startup is done asynchronously (non-blocking). This is the only safe way to ensure
that the app won't be possibly killed by the iOS watchdog process, because startup could take too long
and the app could not react to any user input when network conditions are bad or connectivity might be
very slow.
It is possible to check upon startup if the app crashed before using `didCrashInLastSession` and also how much
time passed between the app launch and the crash using `timeIntervalCrashInLastSessionOccurred`. This allows you
to add additional code to your app delaying the app start until the crash has been successfully send if the crash
occurred within a critical startup timeframe, e.g. after 10 seconds. The `BITCrashManagerDelegate` protocol provides
various delegates to inform the app about it's current status so you can continue the remaining app startup setup
after sending has been completed. The documentation contains a guide
[How to handle Crashes on startup](HowTo-Handle-Crashes-On-Startup) with an example on how to do that.
More background information on this topic can be found in the following blog post by Landon Fuller, the
developer of [PLCrashReporter](https://www.plcrashreporter.org), about writing reliable and
safe crash reporting: [Reliable Crash Reporting](http://goo.gl/WvTBR)
@warning If you start the app with the Xcode debugger attached, detecting crashes will _NOT_ be enabled!
*/
@interface BITCrashManager : BITHockeyBaseManager
///-----------------------------------------------------------------------------
/// @name Configuration
///-----------------------------------------------------------------------------
/** Set the default status of the Crash Manager
Defines if the crash reporting feature should be disabled, ask the user before
sending each crash report or send crash reports automatically without
asking.
The default value is `BITCrashManagerStatusAlwaysAsk`. The user can switch to
`BITCrashManagerStatusAutoSend` by choosing "Always" in the dialog (since
`showAlwaysButton` default is _YES_).
The current value is always stored in User Defaults with the key
`BITCrashManagerStatus`.
If you intend to implement a user setting to let them enable or disable
crash reporting, this delegate should be used to return that value. You also
have to make sure the new value is stored in the UserDefaults with the key
`BITCrashManagerStatus`.
@see BITCrashManagerStatus
@see showAlwaysButton
*/
@property (nonatomic, assign) BITCrashManagerStatus crashManagerStatus;
/**
* Trap fatal signals via a Mach exception server.
*
* By default the SDK is using the safe and proven in-process BSD Signals for catching crashes.
* This option provides an option to enable catching fatal signals via a Mach exception server
* instead.
*
* We strongly advice _NOT_ to enable Mach exception handler in release versions of your apps!
*
* Default: _NO_
*
* @warning The Mach exception handler executes in-process, and will interfere with debuggers when
* they attempt to suspend all active threads (which will include the Mach exception handler).
* Mach-based handling should _NOT_ be used when a debugger is attached. The SDK will not
* enabled catching exceptions if the app is started with the debugger running. If you attach
* the debugger during runtime, this may cause issues the Mach exception handler is enabled!
* @see isDebuggerAttached
*/
@property (nonatomic, assign, getter=isMachExceptionHandlerEnabled) BOOL enableMachExceptionHandler;
/**
* Enable on device symbolication for system symbols
*
* By default, the SDK does not symbolicate on the device, since this can
* take a few seconds at each crash. Also note that symbolication on the
* device might not be able to retrieve all symbols.
*
* Enable if you want to analyze crashes on unreleased OS versions.
*
* Default: _NO_
*/
@property (nonatomic, assign, getter=isOnDeviceSymbolicationEnabled) BOOL enableOnDeviceSymbolication;
/**
* EXPERIMENTAL: Enable heuristics to detect the app not terminating cleanly
*
* This allows it to get a crash report if the app got killed while being in the foreground
* because of one of the following reasons:
*
* - The main thread was blocked for too long
* - The app took too long to start up
* - The app tried to allocate too much memory. If iOS did send a memory warning before killing the app because of this reason, `didReceiveMemoryWarningInLastSession` returns `YES`.
* - Permitted background duration if main thread is running in an endless loop
* - App failed to resume in time if main thread is running in an endless loop
* - If `enableMachExceptionHandler` is not activated, crashed due to stack overflow will also be reported
*
* The following kills can _NOT_ be detected:
*
* - Terminating the app takes too long
* - Permitted background duration too long for all other cases
* - App failed to resume in time for all other cases
* - possibly more cases
*
* Crash reports triggered by this mechanisms do _NOT_ contain any stack traces since the time of the kill
* cannot be intercepted and hence no stack trace of the time of the kill event can't be gathered.
*
* The heuristic is implemented as follows:
* If the app never gets a `UIApplicationDidEnterBackgroundNotification` or `UIApplicationWillTerminateNotification`
* notification, PLCrashReporter doesn't detect a crash itself, and the app starts up again, it is assumed that
* the app got either killed by iOS while being in foreground or a crash occurred that couldn't be detected.
*
* Default: _NO_
*
* @warning This is a heuristic and it _MAY_ report false positives! It has been tested with iOS 6.1 and iOS 7.
* Depending on Apple changing notification events, new iOS version may cause more false positives!
*
* @see lastSessionCrashDetails
* @see didReceiveMemoryWarningInLastSession
* @see `BITCrashManagerDelegate considerAppNotTerminatedCleanlyReportForCrashManager:`
* @see [Apple Technical Note TN2151](https://developer.apple.com/library/ios/technotes/tn2151/_index.html)
* @see [Apple Technical Q&A QA1693](https://developer.apple.com/library/ios/qa/qa1693/_index.html)
*/
@property (nonatomic, assign, getter = isAppNotTerminatingCleanlyDetectionEnabled) BOOL enableAppNotTerminatingCleanlyDetection;
/**
* Set the callbacks that will be executed prior to program termination after a crash has occurred
*
* PLCrashReporter provides support for executing an application specified function in the context
* of the crash reporter's signal handler, after the crash report has been written to disk.
*
* Writing code intended for execution inside of a signal handler is exceptionally difficult, and is _NOT_ recommended!
*
* _Program Flow and Signal Handlers_
*
* When the signal handler is called the normal flow of the program is interrupted, and your program is an unknown state. Locks may be held, the heap may be corrupt (or in the process of being updated), and your signal handler may invoke a function that was being executed at the time of the signal. This may result in deadlocks, data corruption, and program termination.
*
* _Async-Safe Functions_
*
* A subset of functions are defined to be async-safe by the OS, and are safely callable from within a signal handler. If you do implement a custom post-crash handler, it must be async-safe. A table of POSIX-defined async-safe functions and additional information is available from the [CERT programming guide - SIG30-C](https://www.securecoding.cert.org/confluence/display/seccode/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers).
*
* Most notably, the Objective-C runtime itself is not async-safe, and Objective-C may not be used within a signal handler.
*
* Documentation taken from PLCrashReporter: https://www.plcrashreporter.org/documentation/api/v1.2-rc2/async_safety.html
*
* @see BITCrashManagerPostCrashSignalCallback
* @see BITCrashManagerCallbacks
*
* @param callbacks A pointer to an initialized PLCrashReporterCallback structure, see https://www.plcrashreporter.org/documentation/api/v1.2-rc2/struct_p_l_crash_reporter_callbacks.html
*/
- (void)setCrashCallbacks: (BITCrashManagerCallbacks *) callbacks;
/**
Flag that determines if an "Always" option should be shown
If enabled the crash reporting alert will also present an "Always" option, so
the user doesn't have to approve every single crash over and over again.
If If `crashManagerStatus` is set to `BITCrashManagerStatusAutoSend`, this property
has no effect, since no alert will be presented.
Default: _YES_
@see crashManagerStatus
*/
@property (nonatomic, assign, getter=shouldShowAlwaysButton) BOOL showAlwaysButton;
///-----------------------------------------------------------------------------
/// @name Crash Meta Information
///-----------------------------------------------------------------------------
/**
Indicates if the app crash in the previous session
Use this on startup, to check if the app starts the first time after it crashed
previously. You can use this also to disable specific events, like asking
the user to rate your app.
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked!
@see lastSessionCrashDetails
*/
@property (nonatomic, readonly) BOOL didCrashInLastSession;
/**
Provides an interface to pass user input from a custom alert to a crash report
@param userInput Defines the users action wether to send, always send, or not to send the crash report.
@param userProvidedMetaData The content of this optional BITCrashMetaData instance will be attached to the crash report and allows to ask the user for e.g. additional comments or info.
@return Returns YES if the input is a valid option and successfully triggered further processing of the crash report
@see BITCrashManagerUserInput
@see BITCrashMetaData
*/
- (BOOL)handleUserInput:(BITCrashManagerUserInput)userInput withUserProvidedMetaData:(BITCrashMetaData *)userProvidedMetaData;
/**
Lets you set a custom block which handles showing a custom UI and asking the user
whether they want to send the crash report.
This replaces the default alert the SDK would show!
You can use this to present any kind of user interface which asks the user for additional information,
e.g. what they did in the app before the app crashed.
In addition to this you should always ask your users if they agree to send crash reports, send them
always or not and return the result when calling `handleUserInput:withUserProvidedCrashDescription`.
@param alertViewHandler A block that is responsible for loading, presenting and and dismissing your custom user interface which prompts the user if they want to send crash reports. The block is also responsible for triggering further processing of the crash reports.
@warning This is not available when compiled for Watch OS!
@warning Block needs to call the `[BITCrashManager handleUserInput:withUserProvidedMetaData:]` method!
@warning This needs to be set before calling `[BITHockeyManager startManager]`!
*/
- (void)setAlertViewHandler:(BITCustomAlertViewHandler)alertViewHandler;
/**
* Provides details about the crash that occurred in the last app session
*/
@property (nonatomic, readonly) BITCrashDetails *lastSessionCrashDetails;
/**
Indicates if the app did receive a low memory warning in the last session
It may happen that low memory warning where send but couldn't be logged, since iOS
killed the app before updating the flag in the filesystem did complete.
This property may be true in case of low memory kills, but it doesn't have to be! Apps
can also be killed without the app ever receiving a low memory warning.
Also the app could have received a low memory warning, but the reason for being killed was
actually different.
@warning This property only has a correct value, once `[BITHockeyManager startManager]` was
invoked!
@see enableAppNotTerminatingCleanlyDetection
@see lastSessionCrashDetails
*/
@property (nonatomic, readonly) BOOL didReceiveMemoryWarningInLastSession;
/**
Provides the time between startup and crash in seconds
Use this in together with `didCrashInLastSession` to detect if the app crashed very
early after startup. This can be used to delay app initialization until the crash
report has been sent to the server or if you want to do any other actions like
cleaning up some cache data etc.
Note that sending a crash reports starts as early as 1.5 seconds after the application
did finish launching!
The `BITCrashManagerDelegate` protocol provides some delegates to inform if sending
a crash report was finished successfully, ended in error or was cancelled by the user.
*Default*: _-1_
@see didCrashInLastSession
@see BITCrashManagerDelegate
*/
@property (nonatomic, readonly) NSTimeInterval timeIntervalCrashInLastSessionOccurred;
///-----------------------------------------------------------------------------
/// @name Helper
///-----------------------------------------------------------------------------
/**
* Detect if a debugger is attached to the app process
*
* This is only invoked once on app startup and can not detect if the debugger is being
* attached during runtime!
*
* @return BOOL if the debugger is attached on app startup
*/
- (BOOL)isDebuggerAttached;
/**
* Lets the app crash for easy testing of the SDK
*
* The best way to use this is to trigger the crash with a button action.
*
* Make sure not to let the app crash in `applicationDidFinishLaunching` or any other
* startup method! Since otherwise the app would crash before the SDK could process it.
*
* Note that our SDK provides support for handling crashes that happen early on startup.
* Check the documentation for more information on how to use this.
*
* If the SDK detects an App Store environment, it will _NOT_ cause the app to crash!
*/
- (void)generateTestCrash;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
@class BITCrashManager;
@class BITHockeyAttachment;
/**
The `BITCrashManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITCrashManager`.
*/
@protocol BITCrashManagerDelegate <NSObject>
@optional
///-----------------------------------------------------------------------------
/// @name Additional meta data
///-----------------------------------------------------------------------------
/** Return any log string based data the crash report being processed should contain
@param crashManager The `BITCrashManager` instance invoking this delegate
@see attachmentForCrashManager:
@see BITHockeyManagerDelegate userNameForHockeyManager:componentManager:
@see BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:
*/
-(NSString *)applicationLogForCrashManager:(BITCrashManager *)crashManager;
/** Return a BITHockeyAttachment object providing an NSData object the crash report
being processed should contain
Please limit your attachments to reasonable files to avoid high traffic costs for your users.
Example implementation:
- (BITHockeyAttachment *)attachmentForCrashManager:(BITCrashManager *)crashManager {
NSData *data = [NSData dataWithContentsOfURL:@"mydatafile"];
BITHockeyAttachment *attachment = [[BITHockeyAttachment alloc] initWithFilename:@"myfile.data"
hockeyAttachmentData:data
contentType:@"'application/octet-stream"];
return attachment;
}
@param crashManager The `BITCrashManager` instance invoking this delegate
@see BITHockeyAttachment
@see applicationLogForCrashManager:
@see BITHockeyManagerDelegate userNameForHockeyManager:componentManager:
@see BITHockeyManagerDelegate userEmailForHockeyManager:componentManager:
*/
-(BITHockeyAttachment *)attachmentForCrashManager:(BITCrashManager *)crashManager;
///-----------------------------------------------------------------------------
/// @name Alert
///-----------------------------------------------------------------------------
/** Invoked before the user is asked to send a crash report, so you can do additional actions.
E.g. to make sure not to ask the user for an app rating :)
@param crashManager The `BITCrashManager` instance invoking this delegate
*/
-(void)crashManagerWillShowSubmitCrashReportAlert:(BITCrashManager *)crashManager;
/** Invoked after the user did choose _NOT_ to send a crash in the alert
@param crashManager The `BITCrashManager` instance invoking this delegate
*/
-(void)crashManagerWillCancelSendingCrashReport:(BITCrashManager *)crashManager;
/** Invoked after the user did choose to send crashes always in the alert
@param crashManager The `BITCrashManager` instance invoking this delegate
*/
-(void)crashManagerWillSendCrashReportsAlways:(BITCrashManager *)crashManager;
///-----------------------------------------------------------------------------
/// @name Networking
///-----------------------------------------------------------------------------
/** Invoked right before sending crash reports will start
@param crashManager The `BITCrashManager` instance invoking this delegate
*/
- (void)crashManagerWillSendCrashReport:(BITCrashManager *)crashManager;
/** Invoked after sending crash reports failed
@param crashManager The `BITCrashManager` instance invoking this delegate
@param error The error returned from the NSURLSession call or `kBITCrashErrorDomain`
with reason of type `BITCrashErrorReason`.
*/
- (void)crashManager:(BITCrashManager *)crashManager didFailWithError:(NSError *)error;
/** Invoked after sending crash reports succeeded
@param crashManager The `BITCrashManager` instance invoking this delegate
*/
- (void)crashManagerDidFinishSendingCrashReport:(BITCrashManager *)crashManager;
///-----------------------------------------------------------------------------
/// @name Experimental
///-----------------------------------------------------------------------------
/** Define if a report should be considered as a crash report
Due to the risk, that these reports may be false positives, this delegates allows the
developer to influence which reports detected by the heuristic should actually be reported.
The developer can use the following property to get more information about the crash scenario:
- `[BITCrashManager didReceiveMemoryWarningInLastSession]`: Did the app receive a low memory warning
This allows only reports to be considered where at least one low memory warning notification was
received by the app to reduce to possibility of having false positives.
@param crashManager The `BITCrashManager` instance invoking this delegate
@return `YES` if the heuristic based detected report should be reported, otherwise `NO`
@see `[BITCrashManager didReceiveMemoryWarningInLastSession]`
*/
-(BOOL)considerAppNotTerminatedCleanlyReportForCrashManager:(BITCrashManager *)crashManager;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
/**
* This class provides properties that can be attached to a crash report via a custom alert view flow
*/
@interface BITCrashMetaData : NSObject
/**
* User provided description that should be attached to the crash report as plain text
*/
@property (nonatomic, copy) NSString *userProvidedDescription;
/**
* User name that should be attached to the crash report
*/
@property (nonatomic, copy) NSString *userName;
/**
* User email that should be attached to the crash report
*/
@property (nonatomic, copy) NSString *userEmail;
/**
* User ID that should be attached to the crash report
*/
@property (nonatomic, copy) NSString *userID;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2014 HockeyApp, Bit Stadium GmbH.
* 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>
/**
Provides support to add binary attachments to crash reports and feedback messages
This is used by `[BITCrashManagerDelegate attachmentForCrashManager:]`,
`[BITFeedbackComposeViewController prepareWithItems:]` and
`[BITFeedbackManager showFeedbackComposeViewWithPreparedItems:]`
*/
@interface BITHockeyAttachment : NSObject<NSCoding>
/**
The filename the attachment should get
*/
@property (nonatomic, readonly, copy) NSString *filename;
/**
The attachment data as NSData object
*/
@property (nonatomic, readonly, strong) NSData *hockeyAttachmentData;
/**
The content type of your data as MIME type
*/
@property (nonatomic, readonly, copy) NSString *contentType;
/**
Create an BITHockeyAttachment instance with a given filename and NSData object
@param filename The filename the attachment should get. If nil will get a automatically generated filename
@param hockeyAttachmentData The attachment data as NSData. The instance will be ignore if this is set to nil!
@param contentType The content type of your data as MIME type. If nil will be set to "application/octet-stream"
@return An instance of BITHockeyAttachment.
*/
- (instancetype)initWithFilename:(NSString *)filename
hockeyAttachmentData:(NSData *)hockeyAttachmentData
contentType:(NSString *)contentType;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
#import <UIKit/UIKit.h>
/**
The internal superclass for all component managers
*/
@interface BITHockeyBaseManager : NSObject
///-----------------------------------------------------------------------------
/// @name Modules
///-----------------------------------------------------------------------------
/**
Defines the server URL to send data to or request data from
By default this is set to the HockeyApp servers and there rarely should be a
need to modify that.
*/
@property (nonatomic, copy) NSString *serverURL;
///-----------------------------------------------------------------------------
/// @name User Interface
///-----------------------------------------------------------------------------
/**
The UIBarStyle of the update user interface navigation bar.
Default is UIBarStyleBlackOpaque
@see navigationBarTintColor
*/
@property (nonatomic, assign) UIBarStyle barStyle;
/**
The navigationbar tint color of the update user interface navigation bar.
The navigationBarTintColor is used by default, you can either overwrite it `navigationBarTintColor`
or define another `barStyle` instead.
Default is RGB(25, 25, 25)
@see barStyle
*/
@property (nonatomic, strong) UIColor *navigationBarTintColor;
/**
The UIModalPresentationStyle for showing the update user interface when invoked
with the update alert.
*/
@property (nonatomic, assign) UIModalPresentationStyle modalPresentationStyle;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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 BITHockeyBaseViewController : UITableViewController
@property (nonatomic, readwrite) BOOL modalAnimated;
- (instancetype)initWithModalStyle:(BOOL)modal;
- (instancetype)initWithStyle:(UITableViewStyle)style modal:(BOOL)modal;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
#import "HockeySDKFeatureConfig.h"
#if HOCKEYSDK_FEATURE_CRASH_REPORTER
#import "BITCrashManagerDelegate.h"
#endif
#if HOCKEYSDK_FEATURE_UPDATES
#import "BITUpdateManagerDelegate.h"
#endif
#if HOCKEYSDK_FEATURE_FEEDBACK
#import "BITFeedbackManagerDelegate.h"
#endif
#if HOCKEYSDK_FEATURE_AUTHENTICATOR
#import "BITAuthenticator.h"
#endif
@class BITHockeyManager;
@class BITHockeyBaseManager;
/**
The `BITHockeyManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITHockeyManager`, as well as the delegate of the modules it manages.
*/
@protocol BITHockeyManagerDelegate <NSObject
#if HOCKEYSDK_FEATURE_CRASH_REPORTER
, BITCrashManagerDelegate
#endif
#if HOCKEYSDK_FEATURE_UPDATES
, BITUpdateManagerDelegate
#endif
#if HOCKEYSDK_FEATURE_FEEDBACK
, BITFeedbackManagerDelegate
#endif
#if HOCKEYSDK_FEATURE_AUTHENTICATOR
, BITAuthenticatorDelegate
#endif
>
@optional
///-----------------------------------------------------------------------------
/// @name App Identifier usage
///-----------------------------------------------------------------------------
/**
Implement to force the usage of the live identifier
This is useful if you are e.g. distributing an enterprise app inside your company
and want to use the `liveIdentifier` for that even though it is not running from
the App Store.
Example:
- (BOOL)shouldUseLiveIdentifierForHockeyManager:(BITHockeyManager *)hockeyManager {
#ifdef (CONFIGURATION_AppStore)
return YES;
#endif
return NO;
}
@param hockeyManager BITHockeyManager instance
*/
- (BOOL)shouldUseLiveIdentifierForHockeyManager:(BITHockeyManager *)hockeyManager;
///-----------------------------------------------------------------------------
/// @name UI presentation
///-----------------------------------------------------------------------------
// optional parent view controller for the feedback screen when invoked via the alert view, default is the root UIWindow instance
/**
Return a custom parent view controller for presenting modal sheets
By default the SDK is using the root UIWindow instance to present any required
view controllers. Overwrite this if this doesn't result in a satisfying
behavior or if you want to define any other parent view controller.
@param hockeyManager The `BITHockeyManager` HockeyManager instance invoking this delegate
@param componentManager The `BITHockeyBaseManager` component instance invoking this delegate, can be `BITCrashManager` or `BITFeedbackManager`
*/
- (UIViewController *)viewControllerForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
///-----------------------------------------------------------------------------
/// @name Additional meta data
///-----------------------------------------------------------------------------
/** Return the userid that should used in the SDK components
Right now this is used by the `BITCrashManager` to attach to a crash report.
`BITFeedbackManager` uses it too for assigning the user to a discussion thread.
In addition, if this returns not nil for `BITFeedbackManager` the user will
not be asked for any user details by the component, including userName or userEmail.
You can find out the component requesting the userID like this:
- (NSString *)userIDForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager {
if (componentManager == hockeyManager.feedbackManager) {
return UserIDForFeedback;
} else if (componentManager == hockeyManager.crashManager) {
return UserIDForCrashReports;
} else {
return nil;
}
}
For crash reports, this delegate is invoked on the startup after the crash!
Alternatively you can also use `[BITHockeyManager userID]` which will cache the value in the keychain.
@warning When returning a non nil value for the `BITCrashManager` component, crash reports
are not anonymous any more and the crash alerts will not show the word "anonymous"!
@param hockeyManager The `BITHockeyManager` HockeyManager instance invoking this delegate
@param componentManager The `BITHockeyBaseManager` component instance invoking this delegate, can be `BITCrashManager` or `BITFeedbackManager`
@see userNameForHockeyManager:componentManager:
@see userEmailForHockeyManager:componentManager:
@see [BITHockeyManager userID]
*/
- (NSString *)userIDForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
/** Return the user name that should used in the SDK components
Right now this is used by the `BITCrashManager` to attach to a crash report.
`BITFeedbackManager` uses it too for assigning the user to a discussion thread.
In addition, if this returns not nil for `BITFeedbackManager` the user will
not be asked for any user details by the component, including userName or userEmail.
You can find out the component requesting the user name like this:
- (NSString *)userNameForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager {
if (componentManager == hockeyManager.feedbackManager) {
return UserNameForFeedback;
} else if (componentManager == hockeyManager.crashManager) {
return UserNameForCrashReports;
} else {
return nil;
}
}
For crash reports, this delegate is invoked on the startup after the crash!
Alternatively you can also use `[BITHockeyManager userName]` which will cache the value in the keychain.
@warning When returning a non nil value for the `BITCrashManager` component, crash reports
are not anonymous any more and the crash alerts will not show the word "anonymous"!
@param hockeyManager The `BITHockeyManager` HockeyManager instance invoking this delegate
@param componentManager The `BITHockeyBaseManager` component instance invoking this delegate, can be `BITCrashManager` or `BITFeedbackManager`
@see userIDForHockeyManager:componentManager:
@see userEmailForHockeyManager:componentManager:
@see [BITHockeyManager userName]
*/
- (NSString *)userNameForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
/** Return the users email address that should used in the SDK components
Right now this is used by the `BITCrashManager` to attach to a crash report.
`BITFeedbackManager` uses it too for assigning the user to a discussion thread.
In addition, if this returns not nil for `BITFeedbackManager` the user will
not be asked for any user details by the component, including userName or userEmail.
You can find out the component requesting the user email like this:
- (NSString *)userEmailForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager {
if (componentManager == hockeyManager.feedbackManager) {
return UserEmailForFeedback;
} else if (componentManager == hockeyManager.crashManager) {
return UserEmailForCrashReports;
} else {
return nil;
}
}
For crash reports, this delegate is invoked on the startup after the crash!
Alternatively you can also use `[BITHockeyManager userEmail]` which will cache the value in the keychain.
@warning When returning a non nil value for the `BITCrashManager` component, crash reports
are not anonymous any more and the crash alerts will not show the word "anonymous"!
@param hockeyManager The `BITHockeyManager` HockeyManager instance invoking this delegate
@param componentManager The `BITHockeyBaseManager` component instance invoking this delegate, can be `BITCrashManager` or `BITFeedbackManager`
@see userIDForHockeyManager:componentManager:
@see userNameForHockeyManager:componentManager:
@see [BITHockeyManager userEmail]
*/
- (NSString *)userEmailForHockeyManager:(BITHockeyManager *)hockeyManager componentManager:(BITHockeyBaseManager *)componentManager;
@end
#import "HockeySDKFeatureConfig.h"
#if HOCKEYSDK_FEATURE_METRICS
#import <Foundation/Foundation.h>
#import "BITHockeyBaseManager.h"
#import "HockeySDKNullability.h"
NS_ASSUME_NONNULL_BEGIN
/**
The metrics module.
This is the HockeySDK module that handles users, sessions and events tracking.
Unless disabled, this module automatically tracks users and session of your app to give you
better insights about how your app is being used.
Users are tracked in a completely anonymous way without collecting any personally identifiable
information.
Before starting to track events, ask yourself the questions that you want to get answers to.
For instance, you might be interested in business, performance/quality or user experience aspects.
Name your events in a meaningful way and keep in mind that you will use these names
when searching for events in the HockeyApp web portal.
It is your reponsibility to not collect personal information as part of the events tracking or get
prior consent from your users as necessary.
*/
@interface BITMetricsManager : BITHockeyBaseManager
/**
* A property indicating whether the BITMetricsManager instance is disabled.
*/
@property (nonatomic, assign) BOOL disabled;
/**
* This method allows to track an event that happened in your app.
* Remember to choose meaningful event names to have the best experience when diagnosing your app
* in the HockeyApp web portal.
*
* @param eventName The event's name as a string.
*/
- (void)trackEventWithName:(nonnull NSString *)eventName;
/**
* This method allows to track an event that happened in your app.
* Remember to choose meaningful event names to have the best experience when diagnosing your app
* in the web portal.
*
* @param eventName the name of the event, which should be tracked.
* @param properties key value pairs with additional info about the event.
* @param measurements key value pairs, which contain custom metrics.
*/
- (void)trackEventWithName:(nonnull NSString *)eventName properties:(nullable NSDictionary<NSString *, NSString *> *)properties measurements:(nullable NSDictionary<NSString *, NSNumber *> *)measurements;
@end
NS_ASSUME_NONNULL_END
#endif /* HOCKEYSDK_FEATURE_METRICS */
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2013-2014 HockeyApp, Bit Stadium GmbH.
* 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>
#import "BITHockeyBaseManager.h"
/**
* Defines the update check intervals
*/
typedef NS_ENUM(NSInteger, BITStoreUpdateSetting) {
/**
* Check every day
*/
BITStoreUpdateCheckDaily = 0,
/**
* Check every week
*/
BITStoreUpdateCheckWeekly = 1,
/**
* Check manually
*/
BITStoreUpdateCheckManually = 2
};
@protocol BITStoreUpdateManagerDelegate;
/**
The store update manager module.
This is the HockeySDK module for handling app updates when having your app released in the App Store.
By default the module uses the current users locale to define the app store to check for updates. You
can modify this using the `countryCode` property. See the property documentation for details on its usage.
When an update is detected, this module will show an alert asking the user if he/she wants to update or
ignore this version. If update was chosen, it will open the apps page in the app store app.
You need to enable this module using `[BITHockeyManager enableStoreUpdateManager]` if you want to use this
feature. By default this module is disabled!
When this module is enabled and **NOT** running in an App Store build/environment, it won't do any checks!
The `BITStoreUpdateManagerDelegate` protocol informs the app about new detected app versions.
@warning This module can **NOT** check if the current device and OS version match the minimum requirements of
the new app version!
*/
@interface BITStoreUpdateManager : BITHockeyBaseManager
///-----------------------------------------------------------------------------
/// @name Update Checking
///-----------------------------------------------------------------------------
/**
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, see `BITStoreUpdateSetting`:
- `BITStoreUpdateCheckDaily`: Once a day
- `BITStoreUpdateCheckWeekly`: Once a week
- `BITStoreUpdateCheckManually`: Manually
**Default**: BITStoreUpdateCheckWeekly
@warning When setting this to `BITStoreUpdateCheckManually` 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 BITStoreUpdateSetting
@see countryCode
@see checkForUpdateOnLaunch
@see checkForUpdate
*/
@property (nonatomic, assign) BITStoreUpdateSetting updateSetting;
/**
Defines the store country the app is always available in, otherwise uses the users locale
If this value is not defined, then it uses the device country if the current locale.
If you are pre-defining a country and are releasing a new version on a specific date,
it can happen that users get an alert but the update is not yet available in their country!
But if a user downloaded the app from another appstore than the locale is set and the app is not
available in the locales app store, then the user will never receive an update notification!
More information about possible country codes is available here: http://en.wikipedia.org/wiki/ISO_3166-1_alpha-2
@see updateSetting
@see checkForUpdateOnLaunch
@see checkForUpdate
*/
@property (nonatomic, copy) NSString *countryCode;
/**
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 When setting this to `NO` you need to invoke update checks yourself!
@see updateSetting
@see countryCode
@see checkForUpdate
*/
@property (nonatomic, assign, getter=isCheckingForUpdateOnLaunch) BOOL checkForUpdateOnLaunch;
///-----------------------------------------------------------------------------
/// @name User Interface
///-----------------------------------------------------------------------------
/**
Flag that determines if the integrated update alert should be used
If enabled, the integrated UIAlert based update notification will be used to inform
the user about a new update being available in the App Store.
If disabled, you need to implement the `BITStoreUpdateManagerDelegate` protocol with
the method `[BITStoreUpdateManagerDelegate detectedUpdateFromStoreUpdateManager:newVersion:storeURL:]`
to be notified about new version and proceed yourself.
The manager will consider this identical to an `Ignore` user action using the alert
and not inform about this particular version any more, unless the app is updated
and this very same version shows up at a later time again as a new version.
*Default*: _YES_
@warning If the HockeySDKResources bundle is missing in the application package, then the internal
update alert is also disabled and be treated identical to manually disabling this
property.
@see updateSetting
*/
@property (nonatomic, assign, getter=isUpdateUIEnabled) BOOL updateUIEnabled;
///-----------------------------------------------------------------------------
/// @name Manual update checking
///-----------------------------------------------------------------------------
/**
Check for an update
Call this to trigger a check if there is a new update available on the HockeyApp servers.
@see updateSetting
@see countryCode
@see checkForUpdateOnLaunch
*/
- (void)checkForUpdate;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2013-2014 HockeyApp, Bit Stadium GmbH.
* 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>
@class BITStoreUpdateManager;
/**
The `BITStoreUpdateManagerDelegate` formal protocol defines methods for
more interaction with `BITStoreUpdateManager`.
*/
@protocol BITStoreUpdateManagerDelegate <NSObject>
@optional
///-----------------------------------------------------------------------------
/// @name Update information
///-----------------------------------------------------------------------------
/** Informs which new version has been reported to be available
@warning If this is invoked with a simulated new version, the storeURL could be _NIL_ if the current builds
bundle identifier is different to the bundle identifier used in the app store build.
@param storeUpdateManager The `BITStoreUpdateManager` instance invoking this delegate
@param newVersion The new version string reported by the App Store
@param storeURL The App Store URL for this app that could be invoked to let them perform the update.
*/
-(void)detectedUpdateFromStoreUpdateManager:(BITStoreUpdateManager *)storeUpdateManager newVersion:(NSString *)newVersion storeURL:(NSURL *)storeURL;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Peter Steinberger
*
* Copyright (c) 2012-2014 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 "BITHockeyBaseManager.h"
/**
* Update check interval
*/
typedef NS_ENUM (NSUInteger, BITUpdateSetting) {
/**
* On every startup or or when the app comes to the foreground
*/
BITUpdateCheckStartup = 0,
/**
* Once a day
*/
BITUpdateCheckDaily = 1,
/**
* Manually
*/
BITUpdateCheckManually = 2
};
@protocol BITUpdateManagerDelegate;
@class BITAppVersionMetaInfo;
@class BITUpdateViewController;
/**
The update manager module.
This is the HockeySDK module for handling app updates when using Ad-Hoc or Enterprise provisioning profiles.
This module handles version updates, presents update and version information in an App Store like user interface,
collects usage information and provides additional authorization options when using Ad-Hoc provisioning profiles.
By default, this module automatically disables itself when running in an App Store build!
The protocol `BITUpdateManagerDelegate` provides delegates to inform about events and adjust a few behaviors.
To use the server side restriction feature, to provide updates only to specific users, you need to setup the
`BITAuthenticator` class. This allows the update request to tell the server which user is using the app on the
current device and then let the server decide which updates the device may see.
*/
@interface BITUpdateManager : BITHockeyBaseManager
///-----------------------------------------------------------------------------
/// @name Update Checking
///-----------------------------------------------------------------------------
// see HockeyUpdateSetting-enum. Will be saved in user defaults.
// default value: HockeyUpdateCheckStartup
/**
When to check for new updates.
Defines when the SDK should check if there is a new update available on the
server. This must be assigned one of the following, see `BITUpdateSetting`:
- `BITUpdateCheckStartup`: On every startup or or when the app comes to the foreground
- `BITUpdateCheckDaily`: Once a day
- `BITUpdateCheckManually`: Manually
When running the app from the App Store, this setting is ignored.
**Default**: BITUpdateCheckStartup
@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 BITUpdateSetting
@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.
When running the app from the App Store, this setting is ignored.
*Default*: _YES_
@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.
When running the app from the App Store, this method call is ignored.
@see updateSetting
@see checkForUpdateOnLaunch
*/
- (void)checkForUpdate;
///-----------------------------------------------------------------------------
/// @name Update Notification
///-----------------------------------------------------------------------------
/**
Flag that determines if update alerts 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.
When running the app from the App Store, this setting is ignored.
*Default*: _YES_
*/
@property (nonatomic, assign) BOOL alwaysShowUpdateReminder;
/**
Flag that determines if the update alert should show a 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.
When running the app from the App Store, this setting is ignored.
*Default*: _NO_
*/
@property (nonatomic, assign, getter=isShowingDirectInstallOption) BOOL showDirectInstallOption;
///-----------------------------------------------------------------------------
/// @name Expiry
///-----------------------------------------------------------------------------
/**
Expiry date of the current app version
If set, the app will get unusable at the given date by presenting a blocking view on
top of the apps UI so that no interaction is possible. To present a custom UI, check
the documentation of the
`[BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]` delegate.
Once the expiry date is reached, the app will no longer check for updates or
send any usage data to the server!
When running the app from the App Store, this setting is ignored.
*Default*: nil
@see disableUpdateCheckOptionWhenExpired
@see [BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]
@see [BITUpdateManagerDelegate didDisplayExpiryAlertForUpdateManager:]
@warning This only works when using Ad-Hoc provisioning profiles!
*/
@property (nonatomic, strong) NSDate *expiryDate;
/**
Disable the update check button from expiry screen or alerts
If do not want your users to be able to check for updates once a version is expired,
then enable this property.
If this is not enabled, the users will be able to check for updates and install them
if any is available for the current device.
*Default*: NO
@see expiryDate
@see [BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]
@see [BITUpdateManagerDelegate didDisplayExpiryAlertForUpdateManager:]
@warning This only works when using Ad-Hoc provisioning profiles!
*/
@property (nonatomic) BOOL disableUpdateCheckOptionWhenExpired;
///-----------------------------------------------------------------------------
/// @name User Interface
///-----------------------------------------------------------------------------
/**
Present the modal update user interface.
@warning Make sure to call this method from the main thread!
*/
- (void)showUpdateView;
/**
Create an update view
@param modal Return a view which is ready for modal presentation with an 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
/*
* Author: Andreas Linde <mail@andreaslinde.de>
*
* Copyright (c) 2012-2014 HockeyApp, Bit Stadium GmbH.
* 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>
@class BITUpdateManager;
/**
The `BITUpdateManagerDelegate` formal protocol defines methods further configuring
the behaviour of `BITUpdateManager`.
*/
@protocol BITUpdateManagerDelegate <NSObject>
@optional
///-----------------------------------------------------------------------------
/// @name Update
///-----------------------------------------------------------------------------
/**
Return if update alert should be shown
If you want to display your own user interface when there is an update available,
implement this method, present your user interface and return _NO_. In this case
it is your responsibility to call `BITUpdateManager showUpdateView`
Note: This delegate will be invoked on startup and every time the app becomes
active again!
When returning _YES_ the default blocking UI will be shown.
When running the app from the App Store, this delegate is ignored.
@param updateManager The `BITUpdateManager` instance invoking this delegate
@param shortVersion The latest available version
@param version The latest available version
*/
- (BOOL)shouldDisplayUpdateAlertForUpdateManager:(BITUpdateManager *)updateManager forShortVersion:(NSString *)shortVersion forVersion:(NSString *)version;
///-----------------------------------------------------------------------------
/// @name Expiry
///-----------------------------------------------------------------------------
/**
Return if expiry alert should be shown if date is reached
If you want to display your own user interface when the expiry date is reached,
implement this method, present your user interface and return _NO_. In this case
it is your responsibility to make the app unusable!
Note: This delegate will be invoked on startup and every time the app becomes
active again!
When returning _YES_ the default blocking UI will be shown.
When running the app from the App Store, this delegate is ignored.
@param updateManager The `BITUpdateManager` instance invoking this delegate
@see [BITUpdateManager expiryDate]
@see [BITUpdateManagerDelegate didDisplayExpiryAlertForUpdateManager:]
*/
- (BOOL)shouldDisplayExpiryAlertForUpdateManager:(BITUpdateManager *)updateManager;
/**
Invoked once a default expiry alert is shown
Once expiry date is reached and the default blocking UI is shown,
this delegate method is invoked to provide you the possibility to do any
desired additional processing.
@param updateManager The `BITUpdateManager` instance invoking this delegate
@see [BITUpdateManager expiryDate]
@see [BITUpdateManagerDelegate shouldDisplayExpiryAlertForUpdateManager:]
*/
- (void)didDisplayExpiryAlertForUpdateManager:(BITUpdateManager *)updateManager;
///-----------------------------------------------------------------------------
/// @name Privacy
///-----------------------------------------------------------------------------
/** Return NO if usage data should not be send
The update module send usage data by default, if the application is _NOT_
running in an App Store version. Implement this delegate and
return NO if you want to disable this.
If you intend to implement a user setting to let them enable or disable
sending usage data, this delegate should be used to return that value.
Usage data contains the following information:
- App Version
- iOS Version
- Device type
- Language
- Installation timestamp
- Usage time
@param updateManager The `BITUpdateManager` instance invoking this delegate
@warning When setting this to `NO`, you will _NOT_ know if this user is actually testing!
*/
- (BOOL)updateManagerShouldSendUsageData:(BITUpdateManager *)updateManager;
///-----------------------------------------------------------------------------
/// @name Privacy
///-----------------------------------------------------------------------------
/** Implement this method to be notified before an update starts.
The update manager will send this delegate message _just_ before the system
call to update the application is placed, but after the user has already chosen
to install the update.
There is no guarantee that the update will actually start after this delegate
message is sent.
@param updateManager The `BITUpdateManager` instance invoking this delegate
*/
- (BOOL)willStartDownloadAndUpdate:(BITUpdateManager *)updateManager;
/**
Invoked right before the app will exit to allow app update to start (>= iOS8 only)
The iOS installation mechanism only starts if the app the should be updated is currently
not running. On all iOS versions up to iOS 7, the system did automatically exit the app
in these cases. Since iOS 8 this isn't done any longer.
@param updateManager The `BITUpdateManager` instance invoking this delegate
*/
- (void)updateManagerWillExitApp:(BITUpdateManager *)updateManager;
@end
/*
* Author: Andreas Linde <mail@andreaslinde.de>
* Peter Steinberger
*
* Copyright (c) 2012-2014 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 <UIKit/UIKit.h>
#import "BITHockeyBaseViewController.h"
@interface BITUpdateViewController : BITHockeyBaseViewController
@end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment