Skip to content

Commit

Permalink
expose SentryRedactViewHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
brustolin committed Oct 2, 2024
1 parent 6a3fee8 commit 2cad7ef
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 18 deletions.
14 changes: 0 additions & 14 deletions Sources/SentrySwiftUI/SentryInternal/SentryInternal.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,18 +57,4 @@ typedef NS_ENUM(NSUInteger, SentrySpanStatus);

@end

// Exposing SentryRedactViewHelper for our SentrySwiftUI external module
@interface SentryRedactViewHelper : NSObject
- (nonnull instancetype)init;
+ (nonnull instancetype)new;
+ (void)maskView:(UIView *_Nonnull)view;
+ (BOOL)shouldMaskView:(UIView *_Nonnull)view;
+ (BOOL)shouldUnmask:(UIView *_Nonnull)view;
+ (void)unmaskView:(UIView *_Nonnull)view;
+ (BOOL)shouldClipOut:(UIView *_Nonnull)view;
+ (void)clipOutView:(UIView *_Nonnull)view;
+ (BOOL)shouldRedactSwiftUI:(UIView *_Nonnull)view;
+ (void)maskSwiftUI:(UIView *_Nonnull)view;
@end

NS_ASSUME_NONNULL_END
7 changes: 3 additions & 4 deletions Sources/Swift/Tools/UIRedactBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,8 @@ class UIRedactBuilder {
}
}

@objc(SentryRedactViewHelper)
@objcMembers
class SentryRedactViewHelper: NSObject {
public class SentryRedactViewHelper: NSObject {
private static var associatedRedactObjectHandle: UInt8 = 0
private static var associatedIgnoreObjectHandle: UInt8 = 0
private static var associatedClipOutObjectHandle: UInt8 = 0
Expand Down Expand Up @@ -298,15 +297,15 @@ class SentryRedactViewHelper: NSObject {
(objc_getAssociatedObject(view, &associatedClipOutObjectHandle) as? NSNumber)?.boolValue ?? false
}

static func clipOutView(_ view: UIView) {
static public func clipOutView(_ view: UIView) {
objc_setAssociatedObject(view, &associatedClipOutObjectHandle, true, .OBJC_ASSOCIATION_ASSIGN)

Check warning on line 301 in Sources/Swift/Tools/UIRedactBuilder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Tools/UIRedactBuilder.swift#L301

Added line #L301 was not covered by tests
}

static func shouldRedactSwiftUI(_ view: UIView) -> Bool {
(objc_getAssociatedObject(view, &associatedSwiftUIRedactObjectHandle) as? NSNumber)?.boolValue ?? false
}

static func maskSwiftUI(_ view: UIView) {
static public func maskSwiftUI(_ view: UIView) {
objc_setAssociatedObject(view, &associatedSwiftUIRedactObjectHandle, true, .OBJC_ASSOCIATION_ASSIGN)

Check warning on line 309 in Sources/Swift/Tools/UIRedactBuilder.swift

View check run for this annotation

Codecov / codecov/patch

Sources/Swift/Tools/UIRedactBuilder.swift#L309

Added line #L309 was not covered by tests
}
}
Expand Down

0 comments on commit 2cad7ef

Please sign in to comment.