Opeining app via download notification breaks back navigation
- Dominant language
- Kotlin
- Stars
- 5.6k
- Forks
- 2k
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 92
Description
### ⚠️ Before posting ⚠️
- [x] This is a **bug**, not a question or an enhancement.
- [x] I've [searched for similar issues](https://github.com/nextcloud/android/issues) and didn't find a duplicate.
- [x] I've written a clear and descriptive title for this issue, not just "Bug" or "Crash".
- [x] I agree to follow Nextcloud's [Code of Conduct](https://nextcloud.com/contribute/code-of-conduct/).
### Steps to reproduce
### Initial Setup
1. Set up fresh install of Nextcloud app
2. Open any folder which contains at least one, preferentially large, file (e.g. `/A/1G.bin`)
3. Download one file via the overflow menu
4. Close the app
5. Re-open the app via the download notification
### Actual Issue
1. Return to *All files*
2. Open any file from the root directory
3. Return by pressing back
### Expected behaviour
App returns to *All files*/root directory.
### Actual behaviour
App opens folder (`/A`) of previously uploaded file.
### Android version
14.0 (AOSP image)
### Device brand and model
Google Pixel 2 (Android Studio Emulator)
### Stock or custom OS?
Stock
### Nextcloud android app version
586a9b8
### Nextcloud server version
29.0.6
### Using a reverse proxy?
No
### Android logs
_No response_
### Server error logs
```bash
```
### Additional information
When the `FileDisplayActivity` is opened via the download notification, the folder containing the file is displayed. This is done by sending an intent with `ACTION_VIEW` and `EXTRA_FILE` set to the appropriate directory.
Internally this is handled by `onNewIntent()`, which calls `setIntent()` with the intent.
When the user returns from another activity, such as the `PreviewImageActivity`, `onResume()` is called. After some time, `getIntent()` is called to retrieve the supposed calling intent. After resolving the filename from the intent, `ocFileListFragment.listDirectory()` is called, which erroneously displays the folder.
This was originally introduced to allow users to open files from the *Activities* tab. Therefore, removing this call will break the aforementioned functionality.
We plan to address this issue once the navigation system has been overhauled.
Contributor guide
Assessment
This issue has not been assessed yet.