mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-31 07:30:40 +00:00
add feedbackManager delegate that is informed about incoming feedback
fixes #30
This commit is contained in:
parent
949613d7e5
commit
c816f4dc19
@ -49,7 +49,7 @@ typedef enum {
|
||||
|
||||
|
||||
@class BITFeedbackMessage;
|
||||
|
||||
@class BITFeedbackManagerDelegate;
|
||||
|
||||
/**
|
||||
The feedback module.
|
||||
@ -96,6 +96,18 @@ typedef enum {
|
||||
|
||||
@interface BITFeedbackManager : BITHockeyBaseManager
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name Delegate
|
||||
///-----------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
Sets the `BITFeedbackManagerDelegate` delegate.
|
||||
|
||||
Can be set to be notified when new feedback is received from the server.
|
||||
*/
|
||||
@property (nonatomic, weak) id<BITFeedbackManagerDelegate> delegate;
|
||||
|
||||
|
||||
///-----------------------------------------------------------------------------
|
||||
/// @name General settings
|
||||
///-----------------------------------------------------------------------------
|
||||
|
@ -670,17 +670,23 @@
|
||||
BITFeedbackMessage *latestMessage = [self lastMessageHavingID];
|
||||
if (self.userEmail && latestMessage.email && [self.userEmail compare:latestMessage.email] == NSOrderedSame)
|
||||
latestMessageFromUser = YES;
|
||||
|
||||
if (!latestMessageFromUser && self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) {
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageText")
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackIgnore")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackShow"), nil
|
||||
];
|
||||
[alertView setTag:0];
|
||||
[alertView show];
|
||||
_incomingMessagesAlertShowing = YES;
|
||||
|
||||
if (!latestMessageFromUser) {
|
||||
if([self.delegate respondsToSelector:@selector(feedbackManagerDidReceiveNewFeedback:)]) {
|
||||
[self.delegate feedbackManagerDidReceiveNewFeedback:self];
|
||||
}
|
||||
|
||||
if(self.showAlertOnIncomingMessages && !self.currentFeedbackListViewController && !self.currentFeedbackComposeViewController) {
|
||||
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageTitle")
|
||||
message:BITHockeyLocalizedString(@"HockeyFeedbackNewMessageText")
|
||||
delegate:self
|
||||
cancelButtonTitle:BITHockeyLocalizedString(@"HockeyFeedbackIgnore")
|
||||
otherButtonTitles:BITHockeyLocalizedString(@"HockeyFeedbackShow"), nil
|
||||
];
|
||||
[alertView setTag:0];
|
||||
[alertView show];
|
||||
_incomingMessagesAlertShowing = YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
29
Classes/BITFeedbackManagerDelegate.h
Normal file
29
Classes/BITFeedbackManagerDelegate.h
Normal file
@ -0,0 +1,29 @@
|
||||
//
|
||||
// BITFeedbackManagerDelegate.h
|
||||
// HockeySDK
|
||||
//
|
||||
// Created by Stephan Diederich on 26.07.13.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@class BITFeedbackManager;
|
||||
|
||||
/**
|
||||
* Delegate protocol which is notified about changes in the feedbackManager
|
||||
* @TODO
|
||||
* * move shouldShowUpdateAlert from feedbackManager here
|
||||
*/
|
||||
@protocol BITFeedbackManagerDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/**
|
||||
* can be implemented to know when new feedback from the server arrived
|
||||
*
|
||||
* @param feedbackManager The feedbackManager which did detect the new messages
|
||||
*/
|
||||
- (void) feedbackManagerDidReceiveNewFeedback:(BITFeedbackManager*) feedbackManager;
|
||||
|
||||
@end
|
@ -250,6 +250,7 @@
|
||||
|
||||
BITHockeyLog(@"INFO: Setup FeedbackManager");
|
||||
_feedbackManager = [[BITFeedbackManager alloc] initWithAppIdentifier:_appIdentifier isAppStoreEnvironemt:_appStoreEnvironment];
|
||||
_feedbackManager.delegate = _delegate;
|
||||
|
||||
#if JIRA_MOBILE_CONNECT_SUPPORT_ENABLED
|
||||
// Only if JMC is part of the project
|
||||
|
@ -112,6 +112,7 @@
|
||||
1EF95CA6162CB037000AE3AD /* BITFeedbackActivity.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EF95CA4162CB036000AE3AD /* BITFeedbackActivity.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
1EF95CA7162CB037000AE3AD /* BITFeedbackActivity.m in Sources */ = {isa = PBXBuildFile; fileRef = 1EF95CA5162CB036000AE3AD /* BITFeedbackActivity.m */; };
|
||||
1EF95CAA162CB314000AE3AD /* BITFeedbackComposeViewControllerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = 1EF95CA9162CB313000AE3AD /* BITFeedbackComposeViewControllerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
E405266217A2AD300096359C /* BITFeedbackManagerDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E405266117A2AD300096359C /* BITFeedbackManagerDelegate.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@ -226,6 +227,7 @@
|
||||
1EF95CA9162CB313000AE3AD /* BITFeedbackComposeViewControllerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITFeedbackComposeViewControllerDelegate.h; sourceTree = "<group>"; };
|
||||
BEE0207C16C5107E004426EA /* hu */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hu; path = hu.lproj/HockeySDK.strings; sourceTree = "<group>"; };
|
||||
E400561D148D79B500EB22B9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
E405266117A2AD300096359C /* BITFeedbackManagerDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITFeedbackManagerDelegate.h; sourceTree = "<group>"; };
|
||||
E41EB465148D7BF50015DEDC /* BITHockeyManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BITHockeyManager.h; sourceTree = "<group>"; };
|
||||
E41EB466148D7BF50015DEDC /* BITHockeyManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = BITHockeyManager.m; sourceTree = "<group>"; };
|
||||
E41EB48B148D7C4E0015DEDC /* CrashReporter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CrashReporter.framework; path = ../Vendor/CrashReporter.framework; sourceTree = "<group>"; };
|
||||
@ -332,6 +334,7 @@
|
||||
1EF95CA5162CB036000AE3AD /* BITFeedbackActivity.m */,
|
||||
1E49A4331612223B00463151 /* BITFeedbackManager.h */,
|
||||
1E49A4341612223B00463151 /* BITFeedbackManager.m */,
|
||||
E405266117A2AD300096359C /* BITFeedbackManagerDelegate.h */,
|
||||
1E49A4351612223B00463151 /* BITFeedbackManagerPrivate.h */,
|
||||
);
|
||||
name = Feedback;
|
||||
@ -464,6 +467,7 @@
|
||||
1E49A4BE161222B900463151 /* BITHockeyHelper.h in Headers */,
|
||||
1E49A4C4161222B900463151 /* BITAppStoreHeader.h in Headers */,
|
||||
1E49A4CA161222B900463151 /* BITStoreButton.h in Headers */,
|
||||
E405266217A2AD300096359C /* BITFeedbackManagerDelegate.h in Headers */,
|
||||
1E49A4D0161222B900463151 /* BITWebTableViewCell.h in Headers */,
|
||||
1E49A4D8161222D400463151 /* HockeySDKPrivate.h in Headers */,
|
||||
1EC69F601615001500808FD9 /* BITHockeyManagerPrivate.h in Headers */,
|
||||
|
Loading…
x
Reference in New Issue
Block a user