Skip to content

Commit

Permalink
v14.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
boehlerlukas committed Oct 23, 2024
1 parent 3db65da commit f040a4e
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 47 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion Example/Example/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, GleapDelegate {

//Gleap.setApiUrl("http://0.0.0.0:9000")
//Gleap.setFrameUrl("http://0.0.0.0:3001/appnew.html")
Gleap.initialize(withToken: "ogWhNhuiZcGWrva5nlDS8l7a78OfaLlV")
Gleap.initialize(withToken: "gbMLfLgtayFd2PeNJrjbxl6eB2OboAfn")

Gleap.sharedInstance().delegate = self

Expand Down
2 changes: 1 addition & 1 deletion Gleap.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

Pod::Spec.new do |s|
s.name = "Gleap"
s.version = "14.0.2"
s.version = "14.0.3"
s.summary = "In-App Bug Reporting and Testing for Apps. Learn more at https://gleap.io"
s.homepage = "https://gleap.io"
s.license = { :type => 'Commercial', :file => 'LICENSE.md' }
Expand Down
9 changes: 9 additions & 0 deletions Sources/ObjCSources/GleapCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,14 @@ typedef enum surveyFormat { SURVEY, SURVEY_FULL } GleapSurveyFormat;
+ (void)openNews;
+ (void)openNews:(Boolean)showBackButton;

/**
* Sets an y offset for the notification view when the feedback button is set to hidden (either through the config or code overwrite).
* @author Gleap
*
* @param offsetY The Y offset of the notification view.
*/
+ (void)setNotificationViewOffsetY: (int)offsetY;

/**
* Open the checklists overview.
* @author Gleap
Expand Down Expand Up @@ -543,6 +551,7 @@ typedef enum surveyFormat { SURVEY, SURVEY_FULL } GleapSurveyFormat;
@property (nonatomic, retain) NSArray* blacklist;
@property (nonatomic, retain) NSArray *networkLogPropsToIgnore;
@property (nonatomic, assign) int initialized;
@property (nonatomic, assign) int notificationViewOffsetY;
@property (nonatomic, assign) GleapApplicationType applicationType;
@property (nonatomic, weak) id <GleapDelegate> delegate;

Expand Down
5 changes: 5 additions & 0 deletions Sources/ObjCSources/GleapCore.m
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ - (void)initHelper {
self.blacklist = [[NSArray alloc] init];
self.networkLogPropsToIgnore = [[NSArray alloc] init];
self.initialized = NO;
self.notificationViewOffsetY = 20;
self.applicationType = NATIVE;

[[GleapMetaDataHelper sharedInstance] startSession];
Expand All @@ -88,6 +89,10 @@ + (void)setAutoActivationMethodsDisabled {
[GleapActivationMethodHelper setAutoActivationMethodsDisabled];
}

+ (void)setNotificationViewOffsetY: (int)offsetY {
[Gleap sharedInstance].notificationViewOffsetY = offsetY;
}

+ (void)setLanguage: (NSString *)language {
[GleapTranslationHelper setLanguage: language];
}
Expand Down
1 change: 0 additions & 1 deletion Sources/ObjCSources/GleapFeedbackButton.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ NS_ASSUME_NONNULL_BEGIN
@property (strong, nonatomic) NSLayoutConstraint *safeAreaConstraint;
@property (strong, nonatomic) NSLayoutConstraint *edgeConstraint;


@end

NS_ASSUME_NONNULL_END
58 changes: 19 additions & 39 deletions Sources/ObjCSources/GleapFeedbackButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ - (void)setupClassicButton {

if (@available(iOS 11, *)) {
UILayoutGuide *guide = window.safeAreaLayoutGuide;
_safeAreaConstraint = [NSLayoutConstraint constraintWithItem:self attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem:guide attribute:NSLayoutAttributeLeading multiplier:1 constant: -(buttonHeight - 6)];
_safeAreaConstraint = [NSLayoutConstraint constraintWithItem: self attribute:NSLayoutAttributeLeading relatedBy:NSLayoutRelationEqual toItem: guide attribute:NSLayoutAttributeLeading multiplier:1 constant: -(buttonHeight - 6)];
}
} else if ([feedbackButtonPosition isEqualToString: @"BUTTON_CLASSIC_BOTTOM"]) {
rotation = 0;
Expand Down Expand Up @@ -388,15 +388,15 @@ - (void)updateConstraintsForOrientation {
NSMutableArray *toDeactivate = [NSMutableArray array];

if (shouldActivateSafeAreaConstraint) {
[toActivate addObject:self.safeAreaConstraint];
[toActivate addObject: self.safeAreaConstraint];
} else {
[toDeactivate addObject:self.safeAreaConstraint];
[toDeactivate addObject: self.safeAreaConstraint];
}

if (shouldActivateEdgeConstraint) {
[toActivate addObject:self.edgeConstraint];
[toActivate addObject: self.edgeConstraint];
} else {
[toDeactivate addObject:self.edgeConstraint];
[toDeactivate addObject: self.edgeConstraint];
}

// Deactivate constraints safely
Expand All @@ -406,45 +406,13 @@ - (void)updateConstraintsForOrientation {

// Activate constraints safely
if (toActivate.count > 0) {
[NSLayoutConstraint activateConstraints:toActivate];
[NSLayoutConstraint activateConstraints: toActivate];
}
} @catch (NSException *exception) {
// Handle exceptions if necessary
}
}

- (void)safelyActivateConstraints:(NSArray<NSLayoutConstraint *> *)constraints {
for (NSLayoutConstraint *constraint in constraints) {
if (constraint == nil) {
NSLog(@"Gleap: Attempted to activate a nil constraint.");
continue;
}

if (constraint.firstItem == nil || constraint.secondItem == nil) {
NSLog(@"Gleap: Constraint has nil items: %@", constraint);
continue;
}

UIView *firstView = [constraint.firstItem isKindOfClass:[UIView class]] ? (UIView *)constraint.firstItem : nil;
if (firstView && ![firstView isDescendantOfView: self]) {
NSLog(@"Gleap: First item of constraint is not in the view hierarchy: %@", constraint);
continue;
}

UIView *secondView = [constraint.secondItem isKindOfClass:[UIView class]] ? (UIView *)constraint.secondItem : nil;
if (secondView && ![secondView isDescendantOfView: self]) {
NSLog(@"Gleap: Second item of constraint is not in the view hierarchy: %@", constraint);
continue;
}

@try {
[NSLayoutConstraint activateConstraints:@[constraint]];
} @catch (NSException *exception) {
NSLog(@"Gleap: Exception activating constraint: %@, Exception: %@", constraint, exception);
}
}
}

- (void)setupModernButton {
@try {
NSDictionary *config = GleapConfigHelper.sharedInstance.config;
Expand Down Expand Up @@ -518,8 +486,20 @@ - (void)setupModernButton {
}
}

- (void)willMoveToSuperview:(UIView *)newSuperview {
if (!newSuperview) {
@try {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
} @catch (NSException *exception) {}
}

[super willMoveToSuperview:newSuperview];
}

- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
@try {
[[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil];
} @catch (NSException *exception) {}
}

@end
2 changes: 1 addition & 1 deletion Sources/ObjCSources/GleapMetaDataHelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>

#define SDK_VERSION @"14.0.2"
#define SDK_VERSION @"14.0.3"

NS_ASSUME_NONNULL_BEGIN

Expand Down
12 changes: 11 additions & 1 deletion Sources/ObjCSources/GleapScreenCaptureHelper.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,17 @@ + (UIImage *)captureScreen {
return nil;
}

UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
UIWindow *keyWindow = nil;
if (@available(iOS 13.0, *)) {
for (UIWindowScene *windowScene in [UIApplication sharedApplication].connectedScenes) {
if (windowScene.activationState == UISceneActivationStateForegroundActive) {
keyWindow = windowScene.windows.firstObject;
break;
}
}
} else {
keyWindow = [UIApplication sharedApplication].keyWindow;
}
if (!keyWindow) {
NSLog(@"Error: keyWindow is nil");
return nil;
Expand Down
9 changes: 6 additions & 3 deletions Sources/ObjCSources/GleapUIOverlayViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ - (void)renderNotifications {
[_notificationsContainerView.widthAnchor constraintEqualToConstant: width].active = YES;
[_notificationsContainerView.heightAnchor constraintEqualToConstant: containerHeight].active = YES;

int notificationViewOffsetY = [Gleap sharedInstance].notificationViewOffsetY;

NSString *feedbackButtonPosition = [config objectForKey: @"feedbackButtonPosition"];
if ([feedbackButtonPosition isEqualToString: @"BUTTON_CLASSIC_LEFT"]) {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -20].active = YES;
Expand All @@ -329,23 +331,24 @@ - (void)renderNotifications {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: self.feedbackButton.topAnchor constant: -10].active = YES;
[_notificationsContainerView.leadingAnchor constraintEqualToAnchor: self.feedbackButton.leadingAnchor constant: 0].active = YES;
} else {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -20].active = YES;
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -notificationViewOffsetY].active = YES;
[_notificationsContainerView.leadingAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.leadingAnchor constant: 20].active = YES;
}
} else if ([feedbackButtonPosition isEqualToString: @"BOTTOM_RIGHT"]) {
if (self.feedbackButton != nil && self.feedbackButton.isHidden == NO) {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: self.feedbackButton.topAnchor constant: -10].active = YES;
[_notificationsContainerView.trailingAnchor constraintEqualToAnchor: self.feedbackButton.trailingAnchor constant: 0].active = YES;
} else {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -20].active = YES;
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -notificationViewOffsetY].active = YES;
[_notificationsContainerView.trailingAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.trailingAnchor constant: -20].active = YES;
}
} else if ([feedbackButtonPosition isEqualToString: @"BUTTON_NONE"]) {
if (self.feedbackButton != nil && self.feedbackButton.isHidden == NO) {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: self.feedbackButton.topAnchor constant: -10].active = YES;
[_notificationsContainerView.trailingAnchor constraintEqualToAnchor: self.feedbackButton.trailingAnchor constant: 0].active = YES;
} else {
[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -20].active = YES;

[_notificationsContainerView.bottomAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.bottomAnchor constant: -notificationViewOffsetY].active = YES;
[_notificationsContainerView.trailingAnchor constraintEqualToAnchor: window.safeAreaLayoutGuide.trailingAnchor constant: -20].active = YES;
}
}
Expand Down

0 comments on commit f040a4e

Please sign in to comment.