From 22233ded4a9934c6eaddd8f8fc04afdb20d4876e Mon Sep 17 00:00:00 2001 From: George Marques Date: Fri, 30 Nov 2018 11:13:50 -0200 Subject: Change custom permissions in Android export to an array Don't limit the amount of permissions and makes it simpler to understand. --- platform/android/export/export.cpp | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'platform') diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index 3766f732e4..a3b5b6dd58 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -672,10 +672,13 @@ class EditorExportAndroid : public EditorExportPlatform { aperms++; } - for (int i = 0; i < MAX_USER_PERMISSIONS; i++) { - String user_perm = p_preset->get("user_permissions/" + itos(i)); - if (user_perm.strip_edges() != "" && user_perm.strip_edges() != "False") - perms.push_back(user_perm.strip_edges()); + PoolStringArray user_perms = p_preset->get("permissions/custom_permissions"); + + for (int i = 0; i < user_perms.size(); i++) { + String user_perm = user_perms[i].strip_edges(); + if (!user_perm.empty()) { + perms.push_back(user_perm); + } } if (p_give_internet) { @@ -1104,10 +1107,6 @@ class EditorExportAndroid : public EditorExportPlatform { } public: - enum { - MAX_USER_PERMISSIONS = 20 - }; - typedef Error (*EditorExportSaveFunction)(void *p_userdata, const String &p_path, const Vector &p_data, int p_file, int p_total); public: @@ -1169,17 +1168,14 @@ public: r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "architectures/" + abi), is_default)); } + r_options->push_back(ExportOption(PropertyInfo(Variant::POOL_STRING_ARRAY, "permissions/custom_permissions"), PoolStringArray())); + const char **perms = android_perms; while (*perms) { r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "permissions/" + String(*perms).to_lower()), false)); perms++; } - - for (int i = 0; i < MAX_USER_PERMISSIONS; i++) { - - r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "user_permissions/" + itos(i)), false)); - } } virtual String get_name() const { -- cgit v1.2.3