EmergeTools / hackernews

A simple Hackernews client for Android. iOS coming soon.
https://www.emergetools.com/blog/posts/open-sourcing-emerge-tools-hackernews-app
MIT License
75 stars 10 forks source link

Initial Login Infrastructure #78

Closed Rahkeen closed 3 months ago

Rahkeen commented 3 months ago

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.

emerge-tools[bot] commented 3 months ago

2 builds increased size

Name Version Download Change Install Change Approval
:warning: Hacker News
com.emergetools.hackernews.debug
1.0 (1) 10.1 MB ⬆️ 547.4 kB (5.71%) 29.4 MB ⬆️ 1.5 MB (5.2%) N/A
:warning: Hacker News
com.emergetools.hackernews
1.0 (1) 1.8 MB ⬆️ 291.6 kB (18.74%) 4.0 MB ⬆️ 640.1 kB (18.98%) N/A

Hacker News 1.0 (1)
com.emergetools.hackernews.debug

⚖️ Compare build ⏱️ Analyze build performance

Total install size change: ⬆️ 1.5 MB (5.2%) Total download size change: ⬆️ 547.4 kB (5.71%)

Largest size changes

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
View Treemap [![Image of diff](https://diff-treemap-images.s3.us-west-1.amazonaws.com/emerge-demo/329861bb-c052-4544-a08f-2fc0b7647b1c.1a5578f8-841a-4c1e-849b-32ed66c05768.png)](https://www.emergetools.com/compare?head=1a5578f8-841a-4c1e-849b-32ed66c05768&base=329861bb-c052-4544-a08f-2fc0b7647b1c&sizeOpen=true&utm_source=github&utm_medium=vcs)

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
View Treemap [![Image of diff](https://diff-treemap-images.s3.us-west-1.amazonaws.com/emerge-demo/2ef4e60b-f1b6-4bf3-ba07-e59949cdf0bb.7951296a-f206-4853-a803-e959747528a5.png)](https://www.emergetools.com/compare?head=7951296a-f206-4853-a803-e959747528a5&base=2ef4e60b-f1b6-4bf3-ba07-e59949cdf0bb&sizeOpen=true&utm_source=github&utm_medium=vcs)

:flying_saucer: Powered by Emerge Tools

Comment trigger: Size diff threshold of 100.00kB exceeded

emerge-tools[bot] commented 3 months ago

📸 Snapshot Test

5 modified, 2 added, 17 unchanged

Name Version Added Removed Modified Unchanged Errored Approval
Hacker News
com.emergetools.hackernews.debug
1.0 (1) 2 0 5 17 0 ✅ Approved

:flying_saucer: Powered by Emerge Tools

emerge-tools[bot] commented 3 months ago

⏱ Performance Analysis

Hacker News

Head build: Hacker News 1.0 (1) Base build: Hacker News 1.0 (1)

Name Change Comparison
⚠️ Startup (com.emerge.universaltests.EmergeUniversalStartupTest) ⬆️ 10.52% 🛸 View

:flying_saucer: Powered by Emerge Tools