-
Notifications
You must be signed in to change notification settings - Fork 15
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
Initial Login Infrastructure #78
Conversation
This PR adds one core dependency and a bunch of infrastrucutre to support login and login-based actions. Because HN doesn't have official API support for Login, Upvotes, Commenting, etc, the only way that clients can perform those actions is by requesting various web routes and scraping the HTML for data. Added `jsoup` as a dependency to make working with HTML a lot nicer, as it also allows you to query HTML documents using CSS selectors. Also created a `WebClient` which is reponsible for all things that require scraping the Hacker News website. Lastly I `CookieJar` to our OkHttp client so that it can store the "auth cookie" when we successfully login. We need this cooking on all subsequent web client requests in order to get access to actions.
2 builds increased size
Hacker News 1.0 (1)
|
Item | Install Size Change | Download Size Change |
---|---|---|
📝 androidx.datastore.preferences.protobuf.MessageSchema | ⬆️ 67.3 kB | ⬆️ 23.8 kB |
🗑 com.google.accompanist | ⬇️ -33.0 kB | ⬇️ -11.5 kB |
📝 androidx.datastore.preferences.protobuf.BinaryReader$SafeHeapRead... | ⬆️ 14.5 kB | ⬆️ 5.1 kB |
📝 org.jsoup.nodes.Element | ⬆️ 14.0 kB | ⬆️ 4.9 kB |
📝 org.jsoup.parser.HtmlTreeBuilder | ⬆️ 12.9 kB | ⬆️ 4.6 kB |
Hacker News 1.0 (1)
com.emergetools.hackernews
⚖️ Compare build
⏱️ Analyze build performance
Total install size change: ⬆️ 640.1 kB (18.98%)
Total download size change: ⬆️ 291.6 kB (18.74%)
Largest size changes
Item | Install Size Change | Download Size Change |
---|---|---|
📝 androidx.datastore.preferences.protobuf.MessageSchema | ⬆️ 27.3 kB | ⬆️ 12.4 kB |
kotlin.text.CharsKt | ⬇️ -18.8 kB | ⬇️ -8.5 kB |
📝 org.jsoup.Jsoup | ⬆️ 18.2 kB | ⬆️ 8.3 kB |
📝 androidx.compose.foundation.text.BasicTextKt | ⬆️ 14.4 kB | ⬆️ 6.5 kB |
📝 androidx.core.os.BundleKt | ⬆️ 14.0 kB | ⬆️ 6.4 kB |
🛸 Powered by Emerge Tools
Comment trigger: Size diff threshold of 100.00kB exceeded
📸 Snapshot Test5 modified, 2 added, 17 unchanged
🛸 Powered by Emerge Tools |
⏱ Performance AnalysisHacker News
🛸 Powered by Emerge Tools |
class HackerNewsWebClient( | ||
private val httpClient: OkHttpClient, | ||
) { | ||
suspend fun login(username: String, password: String): LoginResponse { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this is a lot cleaner than I was imagining it being!
@@ -19,21 +19,20 @@ emergePlugin = "3.1.1" | |||
emergeSnapshots = "1.1.2" | |||
composeCompilerExtension = "1.5.3" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No current action needed here (or soon), but was playing around with https://developer.android.com/develop/ui/compose/compiler the other day, would be good to move to that at some point in the near future, but again, no rush.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh snap, good mention. I'll put up a diff to move over soon.
This PR adds one core dependency and a bunch of infrastrucutre to support login and login-based actions.
Because HN doesn't have official API support for Login, Upvotes, Commenting, etc, the only way that clients can perform those actions is by requesting various web routes and scraping the HTML for data.
Added
jsoup
as a dependency to make working with HTML a lot nicer, as it also allows you to query HTML documents using CSS selectors.Also created a
WebClient
which is reponsible for all things that require scraping the Hacker News website.Lastly I
CookieJar
to our OkHttp client so that it can store the "auth cookie" when we successfully login. We need this cooking on all subsequent web client requests in order to get access to actions.