frida-screenshot 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/ios.js +10 -3
- package/package.json +1 -1
package/dist/lib/ios.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
import ObjC from "frida-objc-bridge";
|
|
2
2
|
const blocks = new Set();
|
|
3
3
|
export function ios(view, options) {
|
|
4
|
+
view?.retain();
|
|
5
|
+
let keyWindow = null;
|
|
4
6
|
return performOnMainThread(() => {
|
|
5
7
|
const api = getApi();
|
|
6
8
|
if (api === null) {
|
|
7
9
|
throw new Error("Cannot retrieve the API");
|
|
8
10
|
}
|
|
9
11
|
if (!view) {
|
|
10
|
-
|
|
12
|
+
keyWindow = api.UIWindow.keyWindow();
|
|
13
|
+
keyWindow?.retain();
|
|
11
14
|
}
|
|
12
|
-
const
|
|
15
|
+
const target = view ? view : keyWindow;
|
|
16
|
+
const bounds = target.bounds();
|
|
13
17
|
const size = bounds[1];
|
|
14
18
|
const format = api.UIGraphicsImageRendererFormat.preferredFormat();
|
|
15
19
|
const constrainSize = options?.constrainSize;
|
|
@@ -28,7 +32,7 @@ export function ios(view, options) {
|
|
|
28
32
|
argTypes: ["object"],
|
|
29
33
|
retType: "void",
|
|
30
34
|
implementation: () => {
|
|
31
|
-
|
|
35
|
+
target.drawViewHierarchyInRect_afterScreenUpdates_(bounds, true);
|
|
32
36
|
setTimeout(() => blocks.delete(actionBlock), 0);
|
|
33
37
|
}
|
|
34
38
|
});
|
|
@@ -37,6 +41,9 @@ export function ios(view, options) {
|
|
|
37
41
|
const png = new ObjC.Object(api.UIImagePNGRepresentation(image));
|
|
38
42
|
const data = png.bytes();
|
|
39
43
|
return data.readByteArray(png.length());
|
|
44
|
+
}).finally(() => {
|
|
45
|
+
view?.release();
|
|
46
|
+
keyWindow?.release();
|
|
40
47
|
});
|
|
41
48
|
}
|
|
42
49
|
;
|