BuIlDaLiBlE / BetterHI3Launcher

A much better Honkai Impact 3rd launcher.
The Unlicense
105 stars 19 forks source link

Hi3Helper.Http Submodule Update (Dec 2022) #61

Closed neon-nyan closed 1 year ago

neon-nyan commented 1 year ago

Pull Request Overview

As a continuation of the previous PR #54 and due to many changes have been happening within the submodule, I'm deciding to re-create this "Submodule Update" PR to adjust the latest usage of submodule with this launcher. Some of the changes are including:

Related Issue:

Additional Note

An additional that need to be discussed later is an addition of the ability to use a custom User-Agent. This was previously broken since the Inner HttpClient was inconsistently initialized per session instead of using an existing HttpClient from the parent class.

Since the usage of the custom User-Agent seems to be used widely in this launcher, could we use the user-agent for the usage of this submodule as well?

Also, some examples as the result of this changes will be updated later in this PR.

BuIlDaLiBlE commented 1 year ago

Much needed improvements! Really happy to see this PR. Does Hi3Mirror.Http use the user agent at all? If not, it would certainly be nice for it to do that.

neon-nyan commented 1 year ago

Hi3Helper.Http doesn't use User-Agent by default. Yes, It would be nice to set the User-Agent. I will update the code one I get home.

neon-nyan commented 1 year ago

Hi @BuIlDaLiBlE.

I've just updated this PR with some commits and it should be ready to get merged. As per note that the user-agent format might be changed since it replaces [] with () and HttpClient will fail to parse the user-agent string because it can't accept square-braces.

The last commit also provides some fixes to another possibility of disposing issue due to race condition while another session is (in-fact) still getting initialized or even uncompleted. Here I'm also including the result of the "Aggressive Pause/Resume Click" test and now the Hi3Helper.Http handles it much better and faster than the last refactoring changes.

https://user-images.githubusercontent.com/30566970/209880786-b7246350-1707-4adf-9d62-93a39ed49dc4.mp4

BuIlDaLiBlE commented 1 year ago

LGTM! Regarding the User Agent, I will change it so it conforms to the industry standard, was meaning to do it anyway.