-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96e128a
commit 38971ab
Showing
23 changed files
with
167 additions
and
544 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...lutter/android/src/main/java/com/instabug/flutter/util/privateViews/ScreenshotCaptor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.instabug.flutter.util.privateViews; | ||
|
||
import android.graphics.Bitmap; | ||
|
||
public interface ScreenshotCaptor { | ||
public void capture(CapturingCallback listener); | ||
|
||
public interface CapturingCallback { | ||
public void onCapturingFailure(Throwable throwable); | ||
|
||
public void onCapturingSuccess(Bitmap bitmap); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.0.1 | ||
# Changelog | ||
|
||
* TODO: Describe initial release. | ||
## [UnReleased](https://github.com/Instabug/) | ||
|
||
### Added | ||
|
||
- Add support for masking private views during screen capturing ([#527](https://github.com/Instabug/Instabug-Flutter/pull/527)). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
packages/instabug_private_views/example/ios/RunnerTests/PrivateViewHostApiTests.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#import <Foundation/Foundation.h> | ||
#import <XCTest/XCTest.h> | ||
#import <OCMock/OCMock.h> | ||
#import "PrivateViewApi.h" | ||
#import "instabug_flutter/InstabugApi.h" | ||
#import "PrivateViewHostApi.h" | ||
|
||
@interface PrivateViewHostApiTests : XCTestCase | ||
|
||
@property (nonatomic, strong) PrivateViewHostApi *api; | ||
@property (nonatomic, strong) id privateViewApiMock; | ||
|
||
@end | ||
|
||
@implementation PrivateViewHostApiTests | ||
|
||
- (void)setUp { | ||
[super setUp]; | ||
|
||
// Set up a mock for PrivateViewApi | ||
self.privateViewApiMock = OCMClassMock([PrivateViewApi class]); | ||
|
||
// Initialize the PrivateViewHostApi instance | ||
self.api = [[PrivateViewHostApi alloc] init]; | ||
self.api.privateViewApi = self.privateViewApiMock; | ||
} | ||
|
||
- (void)tearDown { | ||
self.api = nil; | ||
self.privateViewApiMock = nil; | ||
[super tearDown]; | ||
} | ||
|
||
- (void)testInitWithError_setsScreenshotMaskingHandler { | ||
// Define an expectation for the screenshot masking handler | ||
UIImage *mockScreenshot = [[UIImage alloc] init]; | ||
UIImage *mockMaskedImage = [[UIImage alloc] init]; | ||
FlutterError *error = nil; | ||
|
||
|
||
|
||
OCMStub([self.privateViewApiMock mask:mockScreenshot completion:([OCMArg invokeBlockWithArgs:mockMaskedImage, nil])]); | ||
|
||
|
||
// Call initWithError and set up the screenshot masking handler | ||
[self.api initWithError:&error]; | ||
|
||
// Invoke the screenshot masking handler | ||
void (^completionHandler)(UIImage * _Nullable) = ^(UIImage * _Nullable maskedImage) { | ||
XCTAssertEqual(maskedImage, mockMaskedImage, @"The masked image should be returned by the completion handler."); | ||
}; | ||
[InstabugApi setScreenshotMaskingHandler:^(UIImage * _Nonnull screenshot, void (^ _Nonnull completion)(UIImage * _Nullable)) { | ||
completionHandler(screenshot); | ||
}]; | ||
} | ||
|
||
@end |
Oops, something went wrong.