Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/platforms/app-plus/service/api/media/choose-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function chooseImage ({
function successCallback (paths) {
const tempFiles = []
const tempFilePaths = []
let source = "album";
Promise.all(paths.map((path) => getFileInfo(path)))
.then((filesInfo) => {
filesInfo.forEach((file, index) => {
Expand All @@ -49,13 +50,15 @@ export function chooseImage ({
invoke(callbackId, {
errMsg: 'chooseImage:ok',
tempFilePaths,
tempFiles
tempFiles,
source
})
})
.catch(errorCallback)
}

function openCamera () {
source = "camera";
const camera = plus.camera.getCamera()
camera.captureImage(path => successCallback([path]),
errorCallback, {
Expand All @@ -67,6 +70,7 @@ export function chooseImage ({
}

function openAlbum () {
source = "album";
plus.gallery.pick(({ files }) => successCallback(files), errorCallback, {
maximum: count,
multiple: true,
Expand Down