Move BITFeedbackActivity customization out from BITFeedbackManager

Also add first documentation parts
This commit is contained in:
Andreas Linde 2012-10-19 21:11:22 +02:00
parent 8120d9b2e4
commit 0fe87cf8c0
4 changed files with 50 additions and 35 deletions

View File

@ -10,6 +10,46 @@
#import "BITFeedbackComposeViewControllerDelegate.h"
/**
UIActivity subclass allowing to use the feedback interface to share content with the developer
This activity can be added into an UIActivityViewController and it will use the activity data
objects to prefill the content of `BITFeedbackComposeViewController`.
This can be useful if you present some data that users can not only share but also
report back to the developer because they have some problems, e.g. webcams not working
any more.
The activity provide a default title and image that can be further customized
via `customActivityImage` and `customActivityTitle`.
*/
@interface BITFeedbackActivity : UIActivity <BITFeedbackComposeViewControllerDelegate>
///-----------------------------------------------------------------------------
/// @name BITFeedbackActivity customisation
///-----------------------------------------------------------------------------
/**
Define the image shown when using `BITFeedbackActivity`
If not set a default icon is being used.
@see customActivityTitle
*/
@property (nonatomic, retain) UIImage *customActivityImage;
/**
Define the title shown when using `BITFeedbackActivity`
If not set, a default string is shown by using the apps name
and adding the localized string "Feedback" to it.
@see customActivityImage
*/
@property (nonatomic, retain) NSString *customActivityTitle;
@end

View File

@ -27,6 +27,9 @@
- (id)init {
if ((self = [super init])) {
_customActivityImage = nil;
_customActivityTitle = nil;
self.items = [NSMutableArray array];;
}
@ -36,6 +39,9 @@
- (void)dealloc {
[_items release]; _items = nil;
[_customActivityImage release];
[_customActivityTitle release];
[super dealloc];
}
@ -47,8 +53,8 @@
}
- (NSString *)activityTitle {
if ([BITHockeyManager sharedHockeyManager].feedbackManager.activityTitle)
return [BITHockeyManager sharedHockeyManager].feedbackManager.activityTitle;
if (self.customActivityTitle)
return self.customActivityTitle;
NSString *appName = bit_appName(BITHockeyLocalizedString(@"HockeyFeedbackActivityAppPlaceholder"));
@ -56,8 +62,8 @@
}
- (UIImage *)activityImage {
if ([BITHockeyManager sharedHockeyManager].feedbackManager.activityImage)
return [BITHockeyManager sharedHockeyManager].feedbackManager.activityImage;
if (self.customActivityImage)
return self.customActivityImage;
return bit_imageNamed(@"feedbackActiviy.png", BITHOCKEYSDK_BUNDLE);
}

View File

@ -130,29 +130,4 @@ typedef enum {
- (BITFeedbackComposeViewController *)feedbackComposeViewController;
///-----------------------------------------------------------------------------
/// @name BITFeedbackActivity settings
///-----------------------------------------------------------------------------
/**
Define the image shown when using `BITFeedbackActivity`
If not set a default icon is being used.
@see activityTitle
*/
@property (nonatomic, retain) UIImage *activityImage;
/**
Define the title shown when using `BITFeedbackActivity`
If not set, a default string is shown by using the apps name
and adding the localized string "Feedback" to it.
@see activityImage
*/
@property (nonatomic, retain) NSString *activityTitle;
@end

View File

@ -79,9 +79,6 @@
_token = nil;
_lastMessageID = nil;
_activityImage = nil;
_activityTitle = nil;
self.feedbackList = [NSMutableArray array];
_fileManager = [[NSFileManager alloc] init];
@ -127,9 +124,6 @@
[_feedbackDir release], _feedbackDir = nil;
[_settingsFile release], _settingsFile = nil;
[_activityImage release];
[_activityTitle release];
[super dealloc];
}