Skip to content
This repository has been archived by the owner on Dec 14, 2023. It is now read-only.

Duplicate files after using camera #105

Open
vladikKBR85 opened this issue Mar 12, 2020 · 3 comments
Open

Duplicate files after using camera #105

vladikKBR85 opened this issue Mar 12, 2020 · 3 comments

Comments

@vladikKBR85
Copy link

Describe the bug
After making a photo, the number of selected files increases by 2 instead of one.

To Reproduce

  1. Call openImagePicker({isNeedCamera: true, ....}), a list of files appear.

image

  1. Make a photo and accept it

image

  1. The number of files is increased by two.

image

  1. Check dump of getResults method.

image

Expected behavior
A single file should be returned.

NativeScript Info(please run tns info):
‼ Update available for component nativescript. Your current version is 6.1.0 and the latest available version is 6.4.1. ‼ Update available for component tns-core-modules. Your current version is 6.2.0-next-2019-09-25-140422-01 and the latest available version is 6.4.2. ‼ Update available for component tns-android. Your current version is 6.1.2 and the latest available version is 6.4.1. ‼ Update available for component tns-ios. Your current version is 6.1.0 and the latest available version is 6.4.2.

Sample Code(please provide minimum code to reproduce problem):
`

            let options = {
                android: {
                    isCaptureMood: false, // if true then camera will open directly.
                    isNeedCamera: true,
                    maxNumberFiles: 10,
                    isNeedFolderList: true,
                },
                ios: {
                    isCaptureMood: false, // if true then camera will open directly.
                    videoMaximumDuration: 10,
                }
            };

           let mediafilepicker = new Mediafilepicker();
            mediafilepicker.openImagePicker(options);

            mediafilepicker.on("getFiles", function (res) {
                let results = res.object.get('results');
                console.log(results);
                ...

`

Additional context
I've tried to reproduce this on the mobile phone and the number was increased by 3!

@felipeva
Copy link

I have the same issue, it duplicates every file.

@Kelson425
Copy link

I have the same issue, it duplicates every file.

The duplicated files have the same filename. Just solve it with own codes.

 let results = await new Promise<any[]>((resolve, reject) => {
                this.mediafilepicker.on("getFiles", function (res) {
                    let results = res.object.get('results');
                    resolve(results);
            })

results = _.map(_.groupBy(results, r => r.file), v => v[0]);

@vladikKBR85
Copy link
Author

Will this code fix the files count? By the way- this bug was the last straw for me. After that I've migrated to Xamarin. There are much less cryptic bugs in there

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants