Closed jochembroekhoff closed 6 years ago
Thank you for your detailed report, I appreciate it a lot 👍
In response to your issue, this is actually an intentional design to use ==
. The correct method to open an application is by first retrieving the AppInfo
instance from ApplicationManager#getApplication()
then calling System#openApplication()
. Currently it's an issue that AppInfo
is public and will soon be restricted. The idea of AppInfo is that that there will only be one instance for each application and that any instance of AppInfo WILL be valid application that can be opened.
You will notice that if you create an AppInfo
like you did in the example above, methods like getAuthor()
will be null.
I've tried to use the new 'Open application outside of the Laptop class' feature, but it does not work.
Example code
What happens Nothing. (Note Stash was installed using the Application Market.)
What should happen The application 'Note Stash' should open.
Problem When the AppInfo gets filtered, the
==
operator is used. Because a new instance of AppInfo is passed, the comparison always fails.How to fix Use
app.getInfo().equals(info)
instead. The method AppIinfo#equals is a method specifically for cases like this. I've tested it personnaly, and this works.Even better would be to make
System#openApplication(AppInfo info, NBTTagCompound intent)
for internal use only and create a new method that is intended for external use. Passing an instance of AppInfo is in my opinion not the best solution, because AppInfo is only used for internal purposes. I'd suggest something likeSystem#openApplication(ResourceLocation resLoc [, NBTTagCompound intent])
orSystem#openApplication(String domain, String path [, NBTTagCompound intent])
.