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

Fix handling of deleted photos on iOS #1556

Merged
merged 3 commits into from
Nov 13, 2023

Conversation

brsaylor2
Copy link
Contributor

See commit messages for details.

Fixes #1251

Fixes a crash on iOS when a displayed image is deleted in the
background:

    NSInternalInconsistencyException
    reason: 'attempt to delete and reload the same index path <snip>'

According to
https://developer.apple.com/documentation/photokit/phfetchresultchangedetails?language=objc

    ...changedIndexes can't be used safely inside
    performBatchUpdates:completion: Instead, use changedIndexes after and
    outside the performBatchUpdates:completion: call...
If a selected photo is deleted from the photo library, it needs to be
removed from `selectedAssets` or the UI will hang when the user taps
"Done". Also, the UI needs to be updated to reflect the new selection.
When the number of photos or videos in the collection changes, update
the footer to reflect the new counts.
@ku8ar
Copy link

ku8ar commented Oct 25, 2021

Hey @ivpusic , do you have any objections about this fix?

@brsaylor2
Copy link
Contributor Author

FWIW, I've tested these changes against v0.37.2 and they still work correctly.

@ariiyu
Copy link

ariiyu commented Nov 10, 2022

@ivpusic @brsaylor2
This fix with react-native-image-crop-picker v0.38.0 works well. With this fix the crash is not reproduced on iOS 15.5.
(I also tested on iOS 14.5 and iOS 16.0 but the issue itself could not be reproduced in my environment.)
I tested it with RN v0.70.5, in my project.

@tomgreco
Copy link

@ivpusic I've tested this as well.
Works, please merge.

@charlyBerthet
Copy link

charlyBerthet commented Nov 13, 2023

@ivpusic tested against v0.40.1 & RNv0.72.4. It works well, I will patch my local lib for release with this patch. Fingers crossed this will fix the crash [QBAssetsViewController photoLibraryDidChange:]_block_invoke

@ivpusic ivpusic merged commit e776878 into ivpusic:master Nov 13, 2023
renovate bot added a commit to valora-inc/wallet that referenced this pull request Nov 21, 2023
#4513)

[![Mend Renovate logo
banner](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-image-crop-picker](https://togithub.com/ivpusic/react-native-image-crop-picker)
| [`^0.35.1` ->
`^0.40.2`](https://renovatebot.com/diffs/npm/react-native-image-crop-picker/0.35.2/0.40.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-image-crop-picker/0.40.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-image-crop-picker/0.40.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-image-crop-picker/0.35.2/0.40.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-image-crop-picker/0.35.2/0.40.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>ivpusic/react-native-image-crop-picker
(react-native-image-crop-picker)</summary>

###
[`v0.40.2`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.40.2)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.40.1...v0.40.2)

#### What's Changed

- Update README about Android SDK version by
[@&#8203;pnthach95](https://togithub.com/pnthach95) in
[ivpusic/react-native-image-crop-picker#1887
- Fix handling of deleted photos on iOS by
[@&#8203;brsaylor2](https://togithub.com/brsaylor2) in
[ivpusic/react-native-image-crop-picker#1556

#### New Contributors

- [@&#8203;brsaylor2](https://togithub.com/brsaylor2) made their first
contribution in
[ivpusic/react-native-image-crop-picker#1556

**Full Changelog**:
ivpusic/react-native-image-crop-picker@v0.40.1...v0.40.2

###
[`v0.40.1`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.40.1)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.40.0...v0.40.1)

#### What's Changed

- fix spelling error in readme.md by
[@&#8203;therealrinku](https://togithub.com/therealrinku) in
[ivpusic/react-native-image-crop-picker#1953
- Property 'Latitude' does not exist on type 'object' in exif by
[@&#8203;dipanjanpanja6](https://togithub.com/dipanjanpanja6) in
[ivpusic/react-native-image-crop-picker#1964
- docs: readme typo fix by
[@&#8203;therealrinku](https://togithub.com/therealrinku) in
[ivpusic/react-native-image-crop-picker#1979
- \[revert] Fix for openPicker not working when app targets Android 13
by [@&#8203;RodolfoGS](https://togithub.com/RodolfoGS) in
[ivpusic/react-native-image-crop-picker#1973

#### New Contributors

- [@&#8203;therealrinku](https://togithub.com/therealrinku) made their
first contribution in
[ivpusic/react-native-image-crop-picker#1953
- [@&#8203;dipanjanpanja6](https://togithub.com/dipanjanpanja6) made
their first contribution in
[ivpusic/react-native-image-crop-picker#1964
- [@&#8203;RodolfoGS](https://togithub.com/RodolfoGS) made their first
contribution in
[ivpusic/react-native-image-crop-picker#1973

**Full Changelog**:
ivpusic/react-native-image-crop-picker@v0.40.0...v0.40.1

###
[`v0.40.0`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.40.0)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.39.0...v0.40.0)

##### ios

- Fix iPad crash
([ivpusic/react-native-image-crop-picker#1753)
- Add the way to customize iOS cropper toolbar
([ivpusic/react-native-image-crop-picker#1923)

###
[`v0.39.0`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.39.0)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.38.1...v0.39.0)

### ios

- Add Finish Language
([ivpusic/react-native-image-crop-picker#1872)
- Add Danish Language
([ivpusic/react-native-image-crop-picker#1871)

### android

- Fix for openPicker not working when app targets Android 13
[#&#8203;1852](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1852)

###
[`v0.38.1`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.38.1)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.38.0...v0.38.1)

### ios

- Add Vietnamese language
([ivpusic/react-native-image-crop-picker#1835)
- fix: added PhotosUi That requeired for iOS
([ivpusic/react-native-image-crop-picker#1853)

###
[`v0.38.0`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.38.0)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.37.3...v0.38.0)

#### ios

- Add Norwegian strings
ivpusic/react-native-image-crop-picker@a857dcb

### android

- Add custom FileProvider implementation to avoid merging collision
ivpusic/react-native-image-crop-picker@1870e4d
- Fix android "Invalid image selected" issue
ivpusic/react-native-image-crop-picker@248331c

###
[`v0.37.3`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.37.3)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.37.2...v0.37.3)

#### ios

- fix view blinks on ios15 if enable cropping flag
([ivpusic/react-native-image-crop-picker#1739)
ivpusic/react-native-image-crop-picker@356985a

###
[`v0.37.2`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.37.2)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.37.1...v0.37.2)

### ios

- Adding support for dark mode in limited permission help
([#&#8203;1680](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1680))
ivpusic/react-native-image-crop-picker@4a1bdbc

###
[`v0.37.1`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.37.1)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.4...v0.37.1)

#### ios

- Adding messenger inspired iOS 14 limited permission info help in album
controller
ivpusic/react-native-image-crop-picker@cd26484

###
[`v0.36.4`](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.3...v0.36.4)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.3...v0.36.4)

###
[`v0.36.3`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.36.3)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.2...v0.36.3)

#### ios

- Added romanian language (ios)
([#&#8203;1597](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1597))
ivpusic/react-native-image-crop-picker@cbe7f87
- fix(export): export named functions to match definitions
([#&#8203;1646](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1646))
ivpusic/react-native-image-crop-picker@540ecea

#### android

- started android 11 support
ivpusic/react-native-image-crop-picker@2437d99
- remove write external storage permission only on android 11
ivpusic/react-native-image-crop-picker@f63a954
- Sometimes the length of the video cannot be retrieved.
ivpusic/react-native-image-crop-picker@bbd8730
- Fix image compression OOM exception
([#&#8203;1627](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1627))
ivpusic/react-native-image-crop-picker@5333954

###
[`v0.36.2`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.36.2)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.1...v0.36.2)

- (android) safer exif parsing
ivpusic/react-native-image-crop-picker@16eb5e8

###
[`v0.36.1`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.36.1)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.36.0...v0.36.1)

- (ios) Add heic format for determining MIME type
ivpusic/react-native-image-crop-picker@a24af4c
- (ios) turkish language strings added
ivpusic/react-native-image-crop-picker@e311caa
- (android) float variant of latitude/longitude exif data
ivpusic/react-native-image-crop-picker@9d86ade

###
[`v0.36.0`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.36.0)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.35.3...v0.36.0)

#### Breaking changes

- (ios/android) Make sure to return precise + platform-consistent
permission error code
[ivpusic/react-native-image-crop-picker#1506

###
[`v0.35.3`](https://togithub.com/ivpusic/react-native-image-crop-picker/releases/tag/v0.35.3)

[Compare
Source](https://togithub.com/ivpusic/react-native-image-crop-picker/compare/v0.35.2...v0.35.3)

- ios Fix video not loading from iCloud
([#&#8203;1515](https://togithub.com/ivpusic/react-native-image-crop-picker/issues/1515))
ivpusic/react-native-image-crop-picker@e3b12e9

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy41OS44IiwidXBkYXRlZEluVmVyIjoiMzcuNTkuOCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
Co-authored-by: Satish Ravi <satish.ravi@valoraapp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NSInternalInconsistencyException attempt to delete and reload the same index path
6 participants