Skip to content

Added support of Database Domain extensions #264

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

Merged
merged 8 commits into from
Dec 9, 2015
Merged

Added support of Database Domain extensions #264

merged 8 commits into from
Dec 9, 2015

Conversation

sromku
Copy link
Contributor

@sromku sromku commented Aug 26, 2015

Based on ticket #258

mContext = context;
}

protected abstract void onRegistered(JsonRpcPeer peer);
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 not sure it's required to make this abstraction work at the peer manager level. Probably good enough to just have an onFirstPeerConnected and onLastPeerDisconnected method, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Please check the latest commit. As you suggested, implementor shouldn't implement this class anymore.

@sromku
Copy link
Contributor Author

sromku commented Sep 1, 2015

@jasta Thanks for your review! :). So for the round 2 of reviews these are the changes that I made based on your comments. I hope, it is the way you intended, if not, please correct me.

  1. Now, there is only two drivers: SqliteDatabaseDriver and ContentProviderDatabaseDriver
  2. User will create as many as he/she wants of ContentProviderSchemas and register them to ContentProviderDatabaseDriver. It means, that user shouldn't implement some low level logic anymore.

In the sample project, the CalendarContentProvide.. class was deleted and SampleDebugApplication was updated.

.build())
.build();

Database database = new Database();
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry for the late review, I was working on getting stetho-1.2.0 out with a much improved API to support this kind of customization. I think we can now approach this with a new, much stronger API:

new DefaultInspectorModulesProvider()
  .provideDatabaseDriver(new ContentProviderDatabaseDriver(...))
  .finish();

This implies that the default provider is install installed. If the default is to be configured, they can use the existing (as of 1.2.0) method .databaseFiles(...) and just provide a no-op files lister.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jasta
Copy link
Contributor

jasta commented Sep 29, 2015

This is looking really great. I think with a couple of refinements we'd be ready to go. Sorry again for the delay :(

@sromku
Copy link
Contributor Author

sromku commented Oct 4, 2015

Thanks for your comment @jasta. Sorry for long response to your response :) Just couldn't leave this beach https://www.facebook.com/pages/Paralia-Stefanou-Seitan-limania-Chania/163349380464470 on my vacation. Now, back to work :) I will take 1.2.0 and make the necessary updates based on latest lib changes and your comments. Will update you soon. Thanks.

sromku added 3 commits October 5, 2015 15:03
Conflicts:
	stetho/src/main/java/com/facebook/stetho/Stetho.java
…ization. Refined DatabaseDriver and removed duplicated registration code.
@sromku
Copy link
Contributor Author

sromku commented Oct 5, 2015

@jasta Please check latest changes. The changes are based on your last comments.

  • DefaultInspectorModulesBuilder class has new method provideDatabaseDriver(DatabaseDriver) to support more cleaner API.
  • DatabaseDriver is responsible for invoking DevTools peer event for database registration instead of duplicated code in each of subclasses.
  • mChromePeerManager.setListener(mPeerListener); is used as you suggested. The anonymous listener class was changed to inner static one.
  • Sample app SampleDebugApplication updated accordingly to the new changes.

@sromku
Copy link
Contributor Author

sromku commented Nov 10, 2015

@jasta do you want me to make any changes?

@@ -42,7 +49,56 @@ private void initializeStetho(final Context context) {
.finish();
}
})
.enableWebKitInspector(Stetho.defaultInspectorModulesProvider(context))
.enableWebKitInspector(new ExtInspectorModulesProvider(context))
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure why we need a separate class here. It should be possible to write:

.enableWebKitInspector(
  new DefaultInspectorModulesBuilder()
    .databaseDriver(createBlaBla())
    .finish());

This was the original intention of the new builder API at least.

return tableName;
}
}
return "";
Copy link
Contributor

Choose a reason for hiding this comment

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

Prefer null and to mark this method @Nullable. Using magic string constants like "" can end up very hard to track down when bugs occur.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Right, agree.

@jasta
Copy link
Contributor

jasta commented Dec 9, 2015

This is very well done, thank you. I again apologize for such a long delay in review.

After getting through the full diff series I really only have nit-pick comments and I'm happy to just take those as notes to follow-up myself to do some tidy work or if you want you can follow-up after the fact. I otherwise am comfortable merging as-is.

jasta added a commit that referenced this pull request Dec 9, 2015
Added support of Database Domain extensions
@jasta jasta merged commit d5ff44c into facebook:master Dec 9, 2015
@sromku
Copy link
Contributor Author

sromku commented Dec 10, 2015

@jasta Thanks for your comments and review. Glad that this PR made it's way to the master :) We are using stetho in debug build types and this is one of the helpful and time saving tools!

@jasta
Copy link
Contributor

jasta commented Dec 10, 2015

@sromku of course, totally my fault making you wait so long. We're looking at a 1.3.0 release this month so it will be nice to finally get this turned around for you in an official release :)

@sromku
Copy link
Contributor Author

sromku commented Dec 11, 2015

Much thanks! :)

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.

3 participants