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 ActivityNotFoundExceptions [WPB-9794] #3163

Merged
merged 9 commits into from
Jul 5, 2024

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Jul 5, 2024

BugWPB-9794 [Android] App crashes when I try to share Photo or Video


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

Issues

There are ActivityNotFoundExceptions when executing actions that need to be handled by another apps, like taking a photo, capturing a video, choosing or saving file.

Solutions

Handle these issues in a unified way by showing a snackbar with proper info (like "No camera app found to complete this action.").
It looks bigger than it actually is because multiple things were moved around as I took the possibility and simplified the code responsible for permissions and intents on this occasion, because all requests look basically the same, the difference is only type of permission or ActivityResultContract so it can be unified without any duplicated code. Also, there were already multiple classes inside that package so they got grouped into basically two categories and combined in dedicated files: "permission requests" (only to get given permissions) and "intent permission requests" (to make action and ask for permission if needed).

Testing

How to Test

Make any action that requires permission or is executed outside the app (take a picture, record a video, make a backup, choose image from gallery or asset from file manager).


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@saleniuk saleniuk requested review from a team, typfel, borichellow, vitorhugods, Garzas and ohassine and removed request for a team July 5, 2024 09:29
Copy link
Contributor

github-actions bot commented Jul 5, 2024

Built wire-android-staging-compat-pr-3163.apk is available for download

Copy link
Contributor

github-actions bot commented Jul 5, 2024

Built wire-android-dev-debug-pr-3163.apk is available for download

…andle-activitynotfoundexceptions

# Conflicts:
#	app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/AdditionalOptions.kt
#	app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/AttachmentOptions.kt
#	app/src/main/kotlin/com/wire/android/ui/home/settings/backup/dialog/restore/RestoreBackupDialogs.kt
Copy link

sonarqubecloud bot commented Jul 5, 2024

Copy link
Contributor

github-actions bot commented Jul 5, 2024

Built wire-android-staging-compat-pr-3163.apk is available for download

Copy link
Contributor

github-actions bot commented Jul 5, 2024

Built wire-android-dev-debug-pr-3163.apk is available for download

Copy link
Contributor

@Garzas Garzas left a comment

Choose a reason for hiding this comment

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

🧑‍🏭 🏅

@saleniuk saleniuk added this pull request to the merge queue Jul 5, 2024
Merged via the queue into develop with commit 7d32939 Jul 5, 2024
10 of 11 checks passed
@saleniuk saleniuk deleted the fix/handle-activitynotfoundexceptions branch July 5, 2024 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants