support icon indicating copy to clipboard operation
support copied to clipboard

[Feature] System flag to indicate first execution of program

Open gyenesvi opened this issue 1 year ago • 1 comments

As discussed in another topic (#1476), a program is not really able to tell if the contents of the persistent storage are valid for the given program or not, because new programs are possible to install without clearing the storage, which makes it hard to use it safely (the only workable solution we came to was using program-specific magic ids written into the beginning of the storage, which is cumbersome to maintain across programs).

I'd propose a system flag to indicate whether the current program being run is the first run of the program. I imagine this flag could always be set when a program is downloaded to the hub, and cleared automatically upon program termination. (I'm not sure if any hub can store more than one programs, then this would have to be a separate flag per program.)

This could be a better alternative to clearing the persistent storage itself, which may not always be desirable, and would require a new UI component. This solution would not effect existing programs as the flag could simply be omitted. However, programs that wish to observe the flag may choose to clear or initialize the storage with valid contents themselves (or even do any other one-time actions, such as showing usage tips on a hub with display).

I imagine it could be accessed like hub.system.is_first_execution (if only one program is ever possible on a hub).

Is this technically possible (setting and clearing such a flag automatically as proposed)?

gyenesvi avatar Feb 29 '24 09:02 gyenesvi

This could be useful indeed.

When we are adding this, we could also add a way to test being connected to the computer or not. This has been requested a few times as well.

laurensvalk avatar Feb 29 '24 10:02 laurensvalk