vanBassum / Wakatime.Unity

A Wakatime plugin for Unity
MIT License
36 stars 7 forks source link

Make use of the wakatime-cli #7

Closed vanBassum closed 1 year ago

vanBassum commented 1 year ago

According to wakatime the preferred way of interfacing is by utilizing the wakatime-cli. https://wakatime.com/help/creating-plugin#sending-file-to-wakatime-cli

I'm not really sure if using the CLI gives me any advantages over the current solution. Right now things seem to work fine, and it's build in C# without dependencies. Personally, I prefer to use native C# instead of depending on external executables that might not run on some systems. C# obviously runs on all platforms that can run Unity, so I don't have to deal with support for other OSes. Besides, I don't know if the CLI tool has other dependencies like python etc. that may not be present on all systems. 

That being said, I do like the idea of the CLI collecting the information and sending it to the endpoint. Maybe when problems arise or features are missing, ill implement this.

Another dependencies I'm not really happy about is git. Although, it's safe to assume that git is present on all systems that make use of git.

vanBassum commented 1 year ago

I suspect #8 will also be a problem if this is implemented. It's possible to add a setting that lets the user choose what implementation to use.

alanhamlett commented 1 year ago

Using wakatime-cli is highly recommended, because you get things like:

To solve the window popup problem on Windows, #9 looks like it should fix it?

alanhamlett commented 1 year ago

Also, if you use wakatime-cli we'll make this plugin the first choice and hide the other plugins on the installation page.

vanBassum commented 1 year ago

Hello,

I already made a start with implementing the CLI, but it isn't ready yet. I would like to make this a setting, that by default uses the CLI. The reason is that #9 doesn't actually solve the popup problem. It uses file IO to determine the branch instead of the GIT CLI. By adding this as a setting, gives users that experience this problem an alternative.

The drawback of making this a setting is that users are less prone to mention any issues with the CLI integration and just change the setting to use the native C# implementation. I might add a deprecation warning to the native solution or something, or do something in UI that motivates users to use the CLI.

I hope to have this integration by the end of this month.

alanhamlett commented 1 year ago

The reason is that #9 doesn't actually solve the popup problem. It uses file IO to determine the branch instead of the GIT CLI. By adding this as a setting, gives users that experience this problem an alternative.

That's #10, but #9 might work too it just wasn't merged.

vanBassum commented 1 year ago

I think I now have a working implementation, see the branch Implement-wakatimeCLI. However, I'm a bit stuck with testing. Is there any way I can see:

If this works as intended, I might add support for auto downloading the cli from the GitHub releases page. For now the user has to manually point to the executable location.

BTW, I really appreciate that you take the time to support me with developing this plugin.

alanhamlett commented 1 year ago

Click the Try it out here to see the current day's heartbeats and their data: https://wakatime.com/developers/#heartbeats

vanBassum commented 1 year ago

The new implementation has been pushed to the main. So from now on the wakatime cli is used. The old implementation has been removed from the main. @alanhamlett Can you let me know what you think?