我可以调用单个 Cordova 命令来要求用户拍照或从照片库中挑选照片吗?

Can I call a single Cordova command to ask the user to either take a photo or pick from photo library?

当我使用普通 HTML 相机输入时:

<input type="file" accept="image/*;capture=camera" />

它让用户可以选择拍照,或者从他们的图库中挑选:

但是当我使用 Cordova camera plugin 时,它似乎无法促进这样的弹出窗口,而是让我作为开发人员从相机或照片库中选择。

这是正确的吗?有没有办法轻松地将选项呈现给用户,这样我就不必为每个选项创建额外的 UI?

我们是用 JS 来做的,虽然它不完全是一行!尝试

// route to dialog for choice of "choose from library or take a picture"
navigator.notification.confirm(
    "Get a photo from…",  // message
    choosePhotoSourceCallback,                  // callback to invoke
    "A title for the dialog box",            // title
    ["Photo Library", "Camera"]             // buttonLabels
);

choosePhotoSourceCallback 看起来像这样

function choosePhotoSourceCallback(choice) {
if (choice == 1) {
    console.log("i.choosePhotoSourceCallback:" + choice + " - pick from photo album");
    var source = navigator.camera.PictureSourceType.PHOTOLIBRARY; // camera roll
    getExistingPhoto(source);
} else if (choice != 0) {
    console.log("i.choosePhotoSourceCallback:" + choice + " - take picture with camera");
    //takePictureAsData();
    takePictureAsFileURI();
}

(从 https://cordova.apache.org/docs/en/3.0.0/cordova_camera_camera.md.html 中逐字抄写)