Skip to content

feat: Implement ActivityResultContract#1033

Open
stefan-niedermann wants to merge 1 commit into
mainfrom
448-activity-result-contract
Open

feat: Implement ActivityResultContract#1033
stefan-niedermann wants to merge 1 commit into
mainfrom
448-activity-result-contract

Conversation

@stefan-niedermann

Copy link
Copy Markdown
Member

Motivation:

  • Provide state-of-the-art access to Nextcloud Single Sign On
  • Hide complete permission granting and account importing process behind a clear API surface
  • Deprecate methods that rely on deprecated Android framework methods like onActivityResult
  • Enhance maintainability and make refactoring easier in the future when the deprecated methods have eventually been removed or marked as private

Refs: #448

Co-authored-by: Gemini

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

Motivation:
- Provide state-of-the-art access to Nextcloud Single Sign On
- Hide complete permission granting and account importing process behind a clear API surface
- Deprecate methods that rely on deprecated Android framework methods like onActivityResult
- Enhance maintainability and make refactoring easier in the future when the deprecated methods have eventually been removed or marked as private

Refs: #448

Co-authored-by: Gemini
Signed-off-by: Stefan Niedermann <info@niedermann.it>
@codacy-production

Copy link
Copy Markdown

Not up to standards ⛔

🔴 Issues 2 high · 1 minor

Alerts:
⚠ 3 issues (≤ 0 issues of at least minor severity)

Results:
3 new issues

Category Results
ErrorProne 2 high
CodeStyle 1 minor

View in Codacy

🟢 Metrics 16 complexity

Metric Results
Complexity 16

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@stefan-niedermann stefan-niedermann linked an issue Jul 15, 2026 that may be closed by this pull request
@stefan-niedermann

Copy link
Copy Markdown
Member Author

Additional information

Exception Handling

A third party app can start the import process and gets either a SingleSignOnAccount instance or null. Displaying errors to the users is handled intentionally completely within the SSO lib.

This aligns with other ActivityResultContracts and gives the SSO lib the full control over exception handling for a uniform user experience across various 3rd party apps.

Theming

There are multiple sources of dialogs that may look different within the flow:

  • Native android dialogs like the account chooser
  • Permission dialogs from the files app
  • Exception dialogs from the SSO lib

Given this does not affect the (now) deprecated way of importing accounts, this can be enhanced progressively in my opinion, so this should not be a show stopper.
Maybe @AndyScherzinger has some ideas how to unify the styling in the complete flow?

Testing

Tested successfully manually on AVD API level 24 without Google Play Services and API Level 36.1 with Google Play Services.

@github-actions

Copy link
Copy Markdown

SpotBugs

CategoryBaseNew
Bad practice99
Correctness2424
Dodgy code1316
Internationalization22
Malicious code vulnerability1111
Multithreaded correctness44
Performance44
Security77
Total7477

SpotBugs increased!

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.

Support Activity Result API

1 participant