Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PhotoManager.editor.deleteWithIds not working on android api 29 and above #69

Closed
ibragunduz opened this issue Nov 3, 2020 · 2 comments
Labels
i: lack of information Further information is requested. s: invalid This doesn't seem right.

Comments

@ibragunduz
Copy link

ibragunduz commented Nov 3, 2020

PhotoManager.editor.deleteWithIds working properly on ios and up to android api 28. But not working on android 29.

  1. Clone the example flutter_wechat_assets_picker project.
  2. Go to single_assets_page.dart file.
  3. Add this (PhotoManager.editor.deleteWithIds([assets.first.id]);) line in _selectedAssetDeleteButton method's gesture detector onTap callback to delete media.
  4. Run app on emulator have api 29 and pick one photo from "Single" tab and see the selected assets panel.
  5. Touch the selected photo the delete(X) button will be available.
  6. Touch to delete button and you will continue to see your selected photo on gallery.
  7. If you run app on emulator with api 28 or below the selected photos will be deleted.

[Test on api 27]
We want to delete selected image from the gallery. And it works fine on api 28 or below.
https://streamable.com/iof195

[Test on api 29]
Please notice! After deleting the image it is not showing on gallery so its works fine on api 28 or below.
But on api 29 the deleted images showing again on gallery. Probably its not deleting anytime.
https://streamable.com/tg429z

@ibragunduz ibragunduz added await investigate The issue is waiting for further investigation. s: bug Something isn't working. labels Nov 3, 2020
@AlexV525
Copy link
Member

AlexV525 commented Nov 3, 2020

Please update your description according to #28 .

@AlexV525 AlexV525 closed this as completed Nov 3, 2020
@AlexV525 AlexV525 added s: invalid This doesn't seem right. i: lack of information Further information is requested. and removed await investigate The issue is waiting for further investigation. s: bug Something isn't working. labels Nov 3, 2020
@joshua750
Copy link

i am facing same issue please tell me solution deleting in android 29 here is my code

late List <AssetEntity?> selectedAssets;

Future pickImageAndDelete() async {
List? result = await AssetPicker.pickAssets(
context,
pickerConfig: const AssetPickerConfig(
requestType: RequestType.image,
maxAssets: 20,
),
);

if (result != null && result.isNotEmpty) {
  setState(() {
    selectedAssets = result; // Store selected assets in a list
  });
  deleteSelectedImages(); // Call the method to delete selected images
}

}

Future deleteSelectedImages() async {
if (selectedAssets != null && selectedAssets.isNotEmpty) {
List ids = selectedAssets.map((asset) => asset!.id).toList();

  await PhotoManager.editor.deleteWithIds(ids);

  setState(() {
    print('delete photos');
    selectedAssets =[];
  });
}

}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i: lack of information Further information is requested. s: invalid This doesn't seem right.
Projects
None yet
Development

No branches or pull requests

3 participants