Skip to content

Common network stack - #2161

Open
tobiasKaminsky wants to merge 4 commits into
masterfrom
commonNetworkStack
Open

tobiasKaminsky wants to merge 4 commits into
masterfrom
commonNetworkStack

Conversation

@tobiasKaminsky

@tobiasKaminsky tobiasKaminsky commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Goal:

  • api 'com.squareup.okhttp3:okhttp:5.5.0'
  • api 'com.github.bitfireAT:dav4jvm:2.2.1'
  • api 'com.squareup.retrofit2:retrofit:3.0.0'
    • Is only served via library.
    • Files, Talk, Notes (indirectly via SSO) use this.
  • Retrofit api is extracted to library, so that also other 3rd party apps can use it (showcase with new api interface)

To discuss:

  • general approach
  • structure
  • …

PRs:
Files: nextcloud/android#17760
Talk: nextcloud/talk-android#6802
Notes: nextcloud/notes-android#3372

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>

@alperozturk96 alperozturk96 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think before continuing we should agree on things I mentioned.

Package order:

/users
/users/model/UserInfoResponse
/users/repository/UserRemoteRepository
/users/UserApi


Also we should add this to the skills.

interface UserApi {
@Headers(OCS_API_REQUEST_HEADER)
@GET(ENDPOINT_USER)
fun getUser(

@alperozturk96 alperozturk96 Oct 2, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Since we are starting something new.

Prefixes like get, set should be used for internal data class, POJO object change like setName, getName or getting data from internal db.

and fetch should be used for remote operation thus we can have clear distinction between them.

interface UserApi {
@Headers(OCS_API_REQUEST_HEADER)
@GET(ENDPOINT_USER)
fun getUser(

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why we are exposing non-suspended version of the same function. Library should enforce the consumer to use suspending version of it. Thus we don't create more technical debts, ANRs.

Also library should never expose the suspend function calls without correct threading. This needs to be forced as well.

e.g.

interface UserApi -> this will be internal in the library

class UserRemoteRepository( -> this will be public
    private val api: UserApi
) {
    suspend fun fetchUser(): OcsKotlinResponse<UserInfoResponse> =
        withContext(Dispatchers.IO) {
            api.fetchUser("json")
        }
}

Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

SpotBugs

CategoryBaseNew
Bad practice3131
Correctness2828
Dodgy code1313
Internationalization66
Malicious code vulnerability2626
Multithreaded correctness77
Performance33
Security33
Total117117

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

SpotBugs

CategoryBaseNew
Bad practice3131
Correctness2828
Dodgy code1313
Internationalization66
Malicious code vulnerability2626
Multithreaded correctness77
Performance33
Security33
Total117117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants