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

Set up dokka to generate SDK documentation and cleanup the API #5744

Merged
merged 81 commits into from Apr 13, 2022

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Apr 12, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Cleanup SDK api package
  • Some classes has been moved from internal package to api package
  • Some classes are now explicitly declared internal
  • Some code and classes have been deleted because they were not used: see 567f298
  • The CI will now check that the app does not import classes from the internal package 🙈
  • Changelog: WIP

Motivation and context

#5726 (this PR does not close it)

Screenshots / GIFs

Tests

  • Run the app: OK
  • Run the sanity test: OK

image

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

bmarty and others added 30 commits April 12, 2022 15:38
Run `./gradlew matrix-sdk-android:dokkaHtml` to generate the Html documentation of the Matrix Android SDK
Classes marked with `internal` will be excluded from Kdoc.
It is used by the app. Make the extensions internal
@bmarty bmarty marked this pull request as ready for review April 12, 2022 14:43
@bmarty bmarty requested review from a team and ariskotsomitopoulos and removed request for a team April 12, 2022 14:43
@@ -73,6 +75,10 @@ android {

kotlinOptions {
jvmTarget = "11"
freeCompilerArgs += [
// Disabled for now, there are too many errors. Could be handled in another dedicated PR
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@github-actions
Copy link

github-actions bot commented Apr 12, 2022

Unit Test Results

114 files  ±0  114 suites  ±0   1m 18s ⏱️ -3s
201 tests ±0  201 ✔️ ±0  0 💤 ±0  0 ±0 
674 runs  ±0  674 ✔️ ±0  0 💤 ±0  0 ±0 

Results for commit e30c68f. ± Comparison against base commit 047a45d.

♻️ This comment has been updated with latest results.


/**
* Data model for response to [KeysBackup.getKeysBackupTrust()].
* TODO Members should be only val
Copy link
Contributor

Choose a reason for hiding this comment

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

could be handy to track these todos as github issues (if they aren't already)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you are right. Moar issues!

@@ -65,10 +63,8 @@ internal class SyncResponseHandler @Inject constructor(
private val aggregatorHandler: SyncResponsePostTreatmentAggregatorHandler,
private val cryptoService: DefaultCryptoService,
private val tokenStore: SyncTokenStore,
private val lightweightSettingsStorage: LightweightSettingsStorage,
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess these are unused?

Copy link
Member Author

Choose a reason for hiding this comment

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

yep

context: Context,
private val matrixConfiguration: MatrixConfiguration
) {
) : LightweightSettingsStorage {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

@@ -28,21 +29,20 @@ import javax.inject.Inject
* on the sdk without using the database. This should be used just for sdk/user preferences and
* not for large data sets
*/

class LightweightSettingsStorage @Inject constructor(
internal class DefaultLightweightSettingsStorage @Inject constructor(
Copy link
Contributor

Choose a reason for hiding this comment

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

not for this PR but I wonder if these settings should be client side rather than in the SDK

Copy link
Contributor

Choose a reason for hiding this comment

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

They are meant to be SDK side, client side we have vectorPreferences. You can't read vectorPreferences from SDK side. It's mainly for dynamic settings changes, MatrixConfiguration cannot be changed dynamically.

Copy link
Member Author

Choose a reason for hiding this comment

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

The main problem to me, is that those settings are SDK scope and should be session scope.

#

### You should not use code from internal SDK package. Either move them to the API package, or add a proper API to access this code, and add internal keyword SDK side.
import org.matrix.android.sdk.internal
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

@@ -265,6 +264,8 @@ class DebugMenuActivity : VectorBaseActivity<ActivityDebugMenuBinding>() {
}
}
}
// Ensure developer will see that this cannot work anymore
error("toQrCodeData() is now internal")
Copy link
Contributor

Choose a reason for hiding this comment

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

is the qrscanning debug option still helpful if we can't log the toQrCodeData result?

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably not, hence not used a lot nowadays. I guess if we want to test it we can uncomment the code and remove the internal keyword. Not sure what was the best approach to avoid to do that for that specific case.

))
}
})
keysBackupService.computePrivateKey(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm assuming deriveKey and keysBackupService.computePrivateKey are equivalent

Copy link
Member Author

Choose a reason for hiding this comment

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

True, new API added for this specific purpose: 3735ac3

Copy link
Contributor

@ouchadam ouchadam left a comment

Choose a reason for hiding this comment

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

great clean up! 💯
some minor comments/questions but they could be handled in another PR to help get this through faster

Copy link
Contributor

@ariskotsomitopoulos ariskotsomitopoulos left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, I only have one comment. There are a lot of changes here but most of the changes are straight forward. I also run the app & generated the dokka file I didn't observe any issue

@@ -22,6 +22,7 @@ buildscript {
classpath 'com.google.android.gms:oss-licenses-plugin:0.10.5'
classpath "com.likethesalad.android:stem-plugin:2.0.0"
classpath 'org.owasp:dependency-check-gradle:7.0.4.1'
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.6.10"
Copy link
Contributor

Choose a reason for hiding this comment

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

We do not need this while it is already defined in the matrix-sdk-android/build.gradle. I also tested it and works fine without it

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, you are right. I will keep this one and remove the line in the matrix sdk build.gradle file, if ever we need to generate documentation for another module (such as matrix-sdk-android-flow for instance)

@bmarty bmarty merged commit 5075775 into develop Apr 13, 2022
@bmarty bmarty deleted the feature/bma/dokka branch April 13, 2022 12:49
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.

None yet

3 participants