-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
32 lines (32 loc) · 1.16 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import proc from 'xxtouch-proc';
const UIAlertController = ObjC.classes.UIAlertController;
const UIAlertAction = ObjC.classes.UIAlertAction;
const UIApplication = ObjC.classes.UIApplication;
const alert = (message) => {
if (typeof message !== 'string') {
throw new TypeError('message must be a string');
}
ObjC.schedule(ObjC.mainQueue, function () {
const pool = ObjC.classes.NSAutoreleasePool.alloc().init();
const alert = UIAlertController
.alertControllerWithTitle_message_preferredStyle_(
'Frida Runtime', message, 1);
const alertHandler = new ObjC.Block({
retType: 'void',
argTypes: ['object'],
implementation: function () {
proc.send(0);
}
});
var defaultAction = UIAlertAction
.actionWithTitle_style_handler_('OK', 0, alertHandler);
alert.addAction_(defaultAction);
UIApplication
.sharedApplication()
.keyWindow()
.rootViewController()
.presentViewController_animated_completion_(alert, true, NULL);
pool.release();
});
};
export default alert;