mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-03 05:03:45 +00:00
Add option to include satusbar in screenshots
All mehotds in BITFeedbackManager that are screenshot releated are changed to include an option that defines wether the screenshot should include the statusbar (if present) or not: - `- (UIImage *)screenshot` has been changed to `- (UIImage *)screenshotWithStatusBar:(BOOL)includeStatusBar)` - `- (void)showFeedbackComposeViewWithGeneratedScreenshot` has been changed to `- (void)showFeedbackComposeViewWithGeneratedScreenshotWithStatusBar:(BOOL)includeStatusBar`
This commit is contained in:
parent
4226ac0f20
commit
423915cb0c
@ -270,10 +270,12 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
|
||||
|
||||
/**
|
||||
Return a screenshot UIImage intance from the current visiable screen
|
||||
|
||||
@param includeStatusBar BOOL if the screenshot should include the satusbar (if present) or not
|
||||
|
||||
@return UIImage instance containing a screenshot of the current screen
|
||||
*/
|
||||
- (UIImage *)screenshot;
|
||||
- (UIImage *)screenshotWithStatusBar:(BOOL)includeStatusBar;
|
||||
|
||||
|
||||
/**
|
||||
@ -315,8 +317,10 @@ typedef NS_ENUM(NSInteger, BITFeedbackObservationMode) {
|
||||
[[BITHockeyManager sharedHockeyManager].feedbackManager showFeedbackComposeViewWithGeneratedScreenshot];
|
||||
|
||||
@see feedbackObservationMode
|
||||
|
||||
@param includeStatusBar BOOL if the screenshot should include the satusbar (if present) or not
|
||||
*/
|
||||
- (void)showFeedbackComposeViewWithGeneratedScreenshot;
|
||||
- (void)showFeedbackComposeViewWithGeneratedScreenshotWithStatusBar:(BOOL)includeStatusBar;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@ -198,8 +198,8 @@
|
||||
|
||||
#pragma mark - Feedback Modal UI
|
||||
|
||||
- (UIImage *)screenshot {
|
||||
return bit_screenshot();
|
||||
- (UIImage *)screenshotWithStatusBar:(BOOL)includeStatusBar {
|
||||
return bit_screenshot(includeStatusBar);
|
||||
}
|
||||
|
||||
- (BITFeedbackListViewController *)feedbackListViewController:(BOOL)modal {
|
||||
@ -243,8 +243,8 @@
|
||||
|
||||
}
|
||||
|
||||
- (void)showFeedbackComposeViewWithGeneratedScreenshot {
|
||||
UIImage *screenshot = bit_screenshot();
|
||||
- (void)showFeedbackComposeViewWithGeneratedScreenshotWithStatusBar:(BOOL)includeStatusBar {
|
||||
UIImage *screenshot = bit_screenshot(includeStatusBar);
|
||||
[self showFeedbackComposeViewWithPreparedItems:@[screenshot]];
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@
|
||||
|
||||
- (void)screenshotTripleTap:(UITapGestureRecognizer *)tapRecognizer {
|
||||
if (tapRecognizer.state == UIGestureRecognizerStateRecognized){
|
||||
[self showFeedbackComposeViewWithGeneratedScreenshot];
|
||||
[self showFeedbackComposeViewWithGeneratedScreenshotWithStatusBar:NO];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -59,5 +59,5 @@ UIImage *bit_reflectedImageWithHeight(UIImage *inputImage, NSUInteger height, fl
|
||||
UIImage *bit_newWithContentsOfResolutionIndependentFile(NSString * path);
|
||||
UIImage *bit_imageWithContentsOfResolutionIndependentFile(NSString * path);
|
||||
UIImage *bit_imageNamed(NSString *imageName, NSString *bundleName);
|
||||
UIImage *bit_screenshot(void);
|
||||
UIImage *bit_screenshot(BOOL includeStatusBar);
|
||||
UIImage *bit_appIcon(void);
|
||||
|
||||
@ -690,7 +690,7 @@ UIImage *bit_appIcon() {
|
||||
}
|
||||
}
|
||||
|
||||
UIImage *bit_screenshot() {
|
||||
UIImage *bit_screenshot(BOOL includeStatusBar) {
|
||||
// Create a graphics context with the target size
|
||||
CGSize imageSize = [[UIScreen mainScreen] bounds].size;
|
||||
BOOL isLandscapeLeft = [UIApplication sharedApplication].statusBarOrientation == UIInterfaceOrientationLandscapeLeft;
|
||||
@ -722,7 +722,10 @@ UIImage *bit_screenshot() {
|
||||
CGContextConcatCTM(context, [window transform]);
|
||||
|
||||
// Y-offset for the status bar (if it's showing)
|
||||
NSInteger yOffset = [UIApplication sharedApplication].statusBarHidden ? 0 : -20;
|
||||
NSInteger yOffset = 0;
|
||||
if (!includeStatusBar) {
|
||||
yOffset = [UIApplication sharedApplication].statusBarHidden ? 0 : -20;
|
||||
}
|
||||
|
||||
// Offset by the portion of the bounds left of and above the anchor point
|
||||
CGContextTranslateCTM(context,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user