navigation: Add is available (#1847)
Navigation app now needs 2 images to be loaded from the resources on the external filesystem. This PR adds an 'enabled' field to the Applications struct. This field is true for all applications expect for Navigation which calls Navigation::IsAvailable(). This methods returns true if the 2 files are available in the resources. The application list disables the application (draws it in grey, disables the touch callback) if the enable flag is not set.
This commit is contained in:
@@ -265,3 +265,19 @@ void Navigation::Refresh() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Navigation::IsAvailable(Pinetime::Controllers::FS& filesystem) {
|
||||
lfs_file file = {};
|
||||
|
||||
if (filesystem.FileOpen(&file, "/images/navigation0.bin", LFS_O_RDONLY) < 0) {
|
||||
return false;
|
||||
}
|
||||
filesystem.FileClose(&file);
|
||||
|
||||
if (filesystem.FileOpen(&file, "/images/navigation1.bin", LFS_O_RDONLY) < 0) {
|
||||
return false;
|
||||
}
|
||||
filesystem.FileClose(&file);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user