Add microphone privilege settings support back into export and add privilege exist check to camera server for iOS
This commit is contained in:
parent
d897131ac5
commit
776dc93571
3 changed files with 24 additions and 2 deletions
|
@ -36,6 +36,8 @@
|
||||||
<string>$camera_usage_description</string>
|
<string>$camera_usage_description</string>
|
||||||
<key>NSPhotoLibraryUsageDescription</key>
|
<key>NSPhotoLibraryUsageDescription</key>
|
||||||
<string>$photolibrary_usage_description</string>
|
<string>$photolibrary_usage_description</string>
|
||||||
|
<key>NSMicrophoneUsageDescription</key>
|
||||||
|
<string>$microphone_usage_description</string>
|
||||||
<key>UIRequiresFullScreen</key>
|
<key>UIRequiresFullScreen</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>UIStatusBarHidden</key>
|
<key>UIStatusBarHidden</key>
|
||||||
|
|
|
@ -397,6 +397,22 @@ void CameraIOS::update_feeds() {
|
||||||
};
|
};
|
||||||
|
|
||||||
CameraIOS::CameraIOS() {
|
CameraIOS::CameraIOS() {
|
||||||
|
// check if we have our usage description
|
||||||
|
NSString *usage_desc = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"NSCameraUsageDescription"];
|
||||||
|
if (usage_desc == NULL) {
|
||||||
|
// don't initialise if we don't get anything
|
||||||
|
print_line("No NSCameraUsageDescription key in pList, no access to cameras.");
|
||||||
|
return;
|
||||||
|
} else if (usage_desc.length == 0) {
|
||||||
|
// don't initialise if we don't get anything
|
||||||
|
print_line("Empty NSCameraUsageDescription key in pList, no access to cameras.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// now we'll request access.
|
||||||
|
// If this is the first time the user will be prompted with the string (iOS will read it).
|
||||||
|
// Once a decision is made it is returned. If the user wants to change it later on they
|
||||||
|
// need to go into setting.
|
||||||
print_line("Requesting Camera permissions");
|
print_line("Requesting Camera permissions");
|
||||||
|
|
||||||
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo
|
[AVCaptureDevice requestAccessForMediaType:AVMediaTypeVideo
|
||||||
|
|
|
@ -268,8 +268,9 @@ void EditorExportPlatformIOS::get_export_options(List<ExportOption> *r_options)
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/in_app_purchases"), false));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/in_app_purchases"), false));
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/push_notifications"), false));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "capabilities/push_notifications"), false));
|
||||||
|
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/camera_usage_description"), "Godot would like to use your camera"));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/camera_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need to use the camera"), ""));
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/photolibrary_usage_description"), "Godot would like to use your photos"));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/microphone_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need to use the microphone"), ""));
|
||||||
|
r_options->push_back(ExportOption(PropertyInfo(Variant::STRING, "privacy/photolibrary_usage_description", PROPERTY_HINT_PLACEHOLDER_TEXT, "Provide a message if you need access to the photo library"), ""));
|
||||||
|
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "orientation/portrait"), true));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "orientation/portrait"), true));
|
||||||
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "orientation/landscape_left"), true));
|
r_options->push_back(ExportOption(PropertyInfo(Variant::BOOL, "orientation/landscape_left"), true));
|
||||||
|
@ -398,6 +399,9 @@ void EditorExportPlatformIOS::_fix_config_file(const Ref<EditorExportPreset> &p_
|
||||||
} else if (lines[i].find("$camera_usage_description") != -1) {
|
} else if (lines[i].find("$camera_usage_description") != -1) {
|
||||||
String description = p_preset->get("privacy/camera_usage_description");
|
String description = p_preset->get("privacy/camera_usage_description");
|
||||||
strnew += lines[i].replace("$camera_usage_description", description) + "\n";
|
strnew += lines[i].replace("$camera_usage_description", description) + "\n";
|
||||||
|
} else if (lines[i].find("$microphone_usage_description") != -1) {
|
||||||
|
String description = p_preset->get("privacy/microphone_usage_description");
|
||||||
|
strnew += lines[i].replace("$microphone_usage_description", description) + "\n";
|
||||||
} else if (lines[i].find("$photolibrary_usage_description") != -1) {
|
} else if (lines[i].find("$photolibrary_usage_description") != -1) {
|
||||||
String description = p_preset->get("privacy/photolibrary_usage_description");
|
String description = p_preset->get("privacy/photolibrary_usage_description");
|
||||||
strnew += lines[i].replace("$photolibrary_usage_description", description) + "\n";
|
strnew += lines[i].replace("$photolibrary_usage_description", description) + "\n";
|
||||||
|
|
Loading…
Reference in a new issue