frida-screenshot 5.0.0 → 5.0.2
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 +22 -6
- package/package.json +1 -1
package/dist/lib/ios.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const CGFloat = (Process.pointerSize === 4) ? 'float' : 'double';
|
|
2
2
|
const CGSize = [CGFloat, CGFloat];
|
|
3
|
+
const blocks = new Set();
|
|
3
4
|
export function ios(view) {
|
|
4
5
|
return performOnMainThread(() => {
|
|
5
6
|
const api = getApi();
|
|
@@ -31,13 +32,27 @@ function performOnMainThread(action) {
|
|
|
31
32
|
ObjC.schedule(ObjC.mainQueue, performAction);
|
|
32
33
|
}
|
|
33
34
|
function performAction() {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
catch (e) {
|
|
39
|
-
reject(e);
|
|
35
|
+
const application = api.UIApplication.sharedApplication();
|
|
36
|
+
if (application === null) {
|
|
37
|
+
reject(new Error("App not ready"));
|
|
38
|
+
return;
|
|
40
39
|
}
|
|
40
|
+
const block = new ObjC.Block({
|
|
41
|
+
retType: 'void',
|
|
42
|
+
argTypes: [],
|
|
43
|
+
implementation() {
|
|
44
|
+
try {
|
|
45
|
+
const result = action();
|
|
46
|
+
resolve(result);
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
reject(e);
|
|
50
|
+
}
|
|
51
|
+
setTimeout(() => blocks.delete(block), 0);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
blocks.add(block);
|
|
55
|
+
application["- _performBlockAfterCATransactionCommits:"](block);
|
|
41
56
|
}
|
|
42
57
|
});
|
|
43
58
|
}
|
|
@@ -46,6 +61,7 @@ let cachedApi = null;
|
|
|
46
61
|
function getApi() {
|
|
47
62
|
if (cachedApi === null) {
|
|
48
63
|
cachedApi = {
|
|
64
|
+
UIApplication: ObjC.classes.UIApplication,
|
|
49
65
|
UIWindow: ObjC.classes.UIWindow,
|
|
50
66
|
NSThread: ObjC.classes.NSThread,
|
|
51
67
|
UIGraphicsBeginImageContextWithOptions: new NativeFunction(Module.getExportByName('UIKit', 'UIGraphicsBeginImageContextWithOptions'), 'void', [CGSize, 'bool', CGFloat]),
|