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

Setup Flipper #6300

Merged
merged 4 commits into from
Jun 16, 2022
Merged

Setup Flipper #6300

merged 4 commits into from
Jun 16, 2022

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Jun 14, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Setup flipper on the project, for debug builds only (https://fbflipper.com/)
  • Move getLastSession() to the SessionManager
  • Create DebugService on the SDK to get access to the Realmconfigurations
  • Move logDbUsageInfo() to DebugService

What will be done later:

  • write documentation (the file is here, but quite empty). This PR is created to unblock others dev faster.

Motivation and context

Help developer to develop the app, especially by inspecting the databases content.

Closes #6305

Screenshots / GIFs

Network

image

Database

image

LayoutInspector

image

On phone Diagnostic Activity

image

Tests

  • Run the app in debug and use Flipper app
  • Build the app in release mode, to ensure that it compiles.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested review from ouchadam and ganfra June 14, 2022 08:42
docs/flipper.md Outdated Show resolved Hide resolved
vector/build.gradle Outdated Show resolved Hide resolved
@bmarty bmarty force-pushed the feature/bma/flipper branch 2 times, most recently from 5264a4f to 7877d7c Compare June 14, 2022 10:09
/**
* Prints out info on DB size to logcat.
*/
fun logDbUsageInfo()
Copy link
Member Author

Choose a reason for hiding this comment

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

Note: it should probably return a String rather than printing things on logcat, but this is out of scope of this PR.

@bmarty
Copy link
Member Author

bmarty commented Jun 14, 2022

exodus is not happy.
https://etip.exodus-privacy.eu.org/trackers/90cd60c3-d0ac-42b6-91ae-9709dd6b13d7/

We should run exodus on the release version. Will see what we can do.

Copy link
Member

@ganfra ganfra left a comment

Choose a reason for hiding this comment

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

Two remarks/questions. Otherwise the plugin has been really helpful to debug timeline, so thats a good test :)

/**
* List of network interceptors, they will be added when building an OkHttp client.
*/
val networkInterceptors: List<Interceptor> = emptyList(),
Copy link
Member

Choose a reason for hiding this comment

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

I'd instead allow to provide an okhttp client. We'll be able to use okhttpClient.newBuilder().
If the app is using his own okhttp it'll allow to share resources.

Copy link
Member Author

@bmarty bmarty Jun 15, 2022

Choose a reason for hiding this comment

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

See my latest commit 5c84fdc, the interceptors provided by the configuration have to be added at the end, to ensure to see all the request headers.
Providing on OkHttp client make sense though, maybe for another dedicated PR?

/**
* Get all the available Realm Configuration.
*/
fun getAllRealmConfigurations(): List<RealmConfiguration>
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we could instead returns a list of flipper plugin?

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 Matrix SDK does not know what a Flipper plugin is, only the debug version of module vector knows it. Also there is only one Plugin to set up for all the RealmDatabase inspection.

bmarty and others added 4 commits June 15, 2022 16:14
Move getLastSession() to the SessionManager
Create `DebugService`
Move `logDbUsageInfo()` to `DebugService`
…ensure to view all the network request headers in Flipper.
@bmarty
Copy link
Member Author

bmarty commented Jun 15, 2022

Rebased, exodus from GH action should be fine, exodus from Buildkite is still supposed to fail.

@sonarcloud
Copy link

sonarcloud bot commented Jun 15, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

25.5% 25.5% Coverage
0.0% 0.0% Duplication

import javax.inject.Singleton

@Singleton
class FlipperProxy @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.

💯 for only including in the debug sourceset

@bmarty bmarty merged commit fe75157 into develop Jun 16, 2022
@bmarty bmarty deleted the feature/bma/flipper branch June 16, 2022 14:44
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.

Setup Flipper
3 participants