Skip to content

Fix file access permission if opened for the first time via "share" #85#271

Merged
naveensingh merged 19 commits intoFossifyOrg:mainfrom
jguegel:main
Sep 27, 2025
Merged

Fix file access permission if opened for the first time via "share" #85#271
naveensingh merged 19 commits intoFossifyOrg:mainfrom
jguegel:main

Conversation

@jguegel
Copy link
Copy Markdown
Contributor

@jguegel jguegel commented Sep 26, 2025

Type of change(s)

  • Bug fix
  • Feature / enhancement
  • Infrastructure / tooling (CI, build, deps, tests)
  • Documentation

What changed and why

  • Fixed file access permission if opened for the first time via "share"

Before & after preview

reuses the file permission view from mainactivity

Closes the following issue(s)

Checklist

  • I read the contribution guidelines.
  • I manually tested my changes on device/emulator (if applicable).
  • I updated the "Unreleased" section in CHANGELOG.md (if applicable).
  • All checks are passing.

Jan Guegel and others added 10 commits September 25, 2025 21:43
update changelog
…ctivity.kt

Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Signed-off-by: Jan Guegel <jan@guegel.eu>
Signed-off-by: Jan Guegel <jan@guegel.eu>
Copy link
Copy Markdown
Member

@naveensingh naveensingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be better and simpler to move handleStoragePermission() (and friends) from MainActivity to SimpleActivity and then reuse it in both places. Currently, we have duplicated code and no checks for pre-R devices.

Also, raise pull requests from a new branch every time instead of your main branch, and keep your main in sync before branching. That way, you'll avoid repushing the same commits in every pull request.

(Comments below are just bonus feedback)

Comment thread app/src/main/kotlin/org/fossify/filemanager/activities/SaveAsActivity.kt Outdated
@naveensingh naveensingh added the waiting for author If the author does not respond, the issue will be closed. Otherwise, the label will be removed. label Sep 26, 2025
Jan Guegel added 3 commits September 26, 2025 15:18
Signed-off-by: Jan Guegel <jan@guegel.eu>
Signed-off-by: Jan Guegel <jan@guegel.eu>
@jguegel
Copy link
Copy Markdown
Contributor Author

jguegel commented Sep 26, 2025

yeah next PR will be from own branch then, still just playing around a bit
moved the method to simpleActivity like you suggested to avoid duplicated code

Copy link
Copy Markdown
Member

@naveensingh naveensingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you misunderstood my comment. Even after your changes:

  • The handleStoragePermission() method and related constants are still in MainActivity. They should be in SimpleActivity.
  • There's still duplicated code because handleStoragePermission() is not being reused in SaveAsActivity.
  • There's still no permission request for Android 10 and below versions in SaveAsActivity. Reusing the handleStoragePermission() method will also solve this.

Also, are you not testing your changes?

…ty.kt

introduced tryInitFileManager() to SaveAsActivity.kt
removed const MANAGE_STORAGE_RC from MainActivity.kt

Signed-off-by: Jan Guegel <jan@guegel.eu>
@jguegel
Copy link
Copy Markdown
Contributor Author

jguegel commented Sep 26, 2025

i am testing, just with android 16 and there it did work.
didnt know that older version behave differently there..
hopefully the latest commit should fix the issues

Jan Guegel added 2 commits September 26, 2025 16:37
Signed-off-by: Jan Guegel <jan@guegel.eu>
Signed-off-by: Jan Guegel <jan@guegel.eu>
@jguegel
Copy link
Copy Markdown
Contributor Author

jguegel commented Sep 26, 2025

so i think i could fix it (and the linter is happy too)
sorry for the inconvenience... was struggling a bit more than i thought

@jguegel jguegel requested a review from naveensingh September 26, 2025 17:20
@naveensingh naveensingh removed the waiting for author If the author does not respond, the issue will be closed. Otherwise, the label will be removed. label Sep 27, 2025
Comment thread app/src/main/kotlin/org/fossify/filemanager/activities/SimpleActivity.kt Outdated
Comment thread app/src/main/kotlin/org/fossify/filemanager/activities/SaveAsActivity.kt Outdated
Comment thread app/src/main/kotlin/org/fossify/filemanager/activities/SaveAsActivity.kt Outdated
thanks for the feedback!

Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
@jguegel jguegel requested a review from naveensingh September 27, 2025 05:51
Signed-off-by: Jan Guegel <jan@guegel.eu>
Comment thread CHANGELOG.md Outdated
Co-authored-by: Naveen Singh <36371707+naveensingh@users.noreply.github.com>
Copy link
Copy Markdown
Member

@naveensingh naveensingh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks.

@naveensingh naveensingh merged commit 223e644 into FossifyOrg:main Sep 27, 2025
5 checks passed
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.

File manager does not ask for file access permission if opened for the first time via "share" dialog

2 participants