diff --git a/core/bind/core_bind.cpp b/core/bind/core_bind.cpp index d07ba447883..1d451b2982f 100644 --- a/core/bind/core_bind.cpp +++ b/core/bind/core_bind.cpp @@ -1136,6 +1136,16 @@ bool _OS::request_permission(const String &p_name) { return OS::get_singleton()->request_permission(p_name); } +bool _OS::request_permissions() { + + return OS::get_singleton()->request_permissions(); +} + +Vector _OS::get_granted_permissions() const { + + return OS::get_singleton()->get_granted_permissions(); +} + _OS *_OS::singleton = NULL; void _OS::_bind_methods() { @@ -1319,6 +1329,8 @@ void _OS::_bind_methods() { ClassDB::bind_method(D_METHOD("get_power_percent_left"), &_OS::get_power_percent_left); ClassDB::bind_method(D_METHOD("request_permission", "name"), &_OS::request_permission); + ClassDB::bind_method(D_METHOD("request_permissions"), &_OS::request_permissions); + ClassDB::bind_method(D_METHOD("get_granted_permissions"), &_OS::get_granted_permissions); ADD_PROPERTY(PropertyInfo(Variant::STRING, "clipboard"), "set_clipboard", "get_clipboard"); ADD_PROPERTY(PropertyInfo(Variant::INT, "current_screen"), "set_current_screen", "get_current_screen"); diff --git a/core/bind/core_bind.h b/core/bind/core_bind.h index 693b85710a7..1a4fd1d5cb0 100644 --- a/core/bind/core_bind.h +++ b/core/bind/core_bind.h @@ -349,6 +349,8 @@ public: bool has_feature(const String &p_feature) const; bool request_permission(const String &p_name); + bool request_permissions(); + Vector get_granted_permissions() const; static _OS *get_singleton() { return singleton; } diff --git a/core/os/main_loop.cpp b/core/os/main_loop.cpp index 5587e827baa..146a3019950 100644 --- a/core/os/main_loop.cpp +++ b/core/os/main_loop.cpp @@ -65,6 +65,8 @@ void MainLoop::_bind_methods() { BIND_CONSTANT(NOTIFICATION_OS_IME_UPDATE); BIND_CONSTANT(NOTIFICATION_APP_RESUMED); BIND_CONSTANT(NOTIFICATION_APP_PAUSED); + + ADD_SIGNAL(MethodInfo("on_request_permissions_result", PropertyInfo(Variant::STRING, "permission"), PropertyInfo(Variant::BOOL, "granted"))); }; void MainLoop::set_init_script(const Ref