Open pehala opened 3 years ago
Shall we use java.util.prefs.Preferences
as it seems to manage the OS-dependent stuff?
Is there anything else except the launcher options which should be saved in a persistent way as well? (f.e. last username,...)
Username, port, ip, maybe even settings for the new lobby. But that all can be done iteratively, for now I would do only IP, port and username.
At a later point we could also add a dropdown to choose the language in the launcher. But as a prerequisite we might have to scan which language actually do exist or hardcode them anywhere.
Agree, we have them hardcoded in one Enum and we have ability to choose it with CLI options so actually only thing missing is adding it a a dropdown to the menu.
I am not sure if the languages are actually used in the UI but I guess thats entirely different issue
Shall we use
java.util.prefs.Preferences
as it seems to manage the OS-dependent stuff?
We could use it but preferences are backend neutral (at least thats what I have learn from a quick google) so we will probably have to write the file saving/loading code at least partially ourselves
Shall we use
java.util.prefs.Preferences
as it seems to manage the OS-dependent stuff?We could use it but preferences are backend neutral (at least thats what I have learn from a quick google) so we will probably have to write the file saving/loading code at least partially ourselves
I found this post about the Preferences API and it looks that it would be very easy to implement like in the example:
https://www.vogella.com/tutorials/JavaPreferences/article.html
We could definitely try doing PoC
Should only the last used ip+port in the launcher window be remembered or the --server
or --port
input of the command line as well?
Ideally the command line as well
Saving the currently chosen preferences can happen just after submitting the dialog? Alternatively we could only save the setting if the following server connection was successful but this would be a bit harder.
After submitting dialog is fine
@pehala I have a quick question regarding your ManifestVersionProvider
:
If I run new ManifestVersionProvider().getVersion()
it returns: ${COMMAND-FULL-NAME} 2.1.0.0-BETA
Is that intended? If yes, how can I get just the 2.1.0.0-BETA
part?
Yes, it is intended, it is used by the picocli library in CLI. I fetch the version (2.1.0.0-BETA) in that class with this <yourclass>.class.getPackage().getImplementationVersion();
(for this to works it requires building through Maven so it might not work in development environment but should work with generated jars).
Thank you very much for clarification, I will try it out later.
I want to save the client version together with the preferences to have the ability to perform migrations when the preferences-concept somehow changes.
Do you have an idea on how to integrate the preferences management into the tests?
Thank you very much for clarification, I will try it out later.
I want to save the client version together with the preferences to have the ability to perform migrations when the preferences-concept somehow changes.
Good idea!
Do you have an idea on how to integrate the preferences management into the tests?
You should design the implementation in a way that would allow you to use mocked preferences in test, so you could check the methods and stuff.
Okay. I never used Mockito before and am currently not able to complete the tests. (Mostly the handling of dismissing/accepting the ServerSettings-Dialog is missing at the moment)
Would you mind if I just push my current state so that you can help me getting the tests to work?
Of course, go for it
@pehala I am out of ideas. It seems like my replacement for the showSettingDialog
never gets called...
Just create PR and I will look at it
We should save somewhere the last IP that the client connected to to show instead of placeholder
127.0.0.1
.