Dont repeat same animation twice (when possible)

This commit is contained in:
Willy-JL
2023-03-22 11:57:43 +00:00
parent 775b360391
commit 84a51de03d

View File

@@ -372,10 +372,10 @@ static bool animation_manager_is_valid_idle_animation(
static StorageAnimation*
animation_manager_select_idle_animation(AnimationManager* animation_manager) {
// const char* avoid_animation = NULL;
// if(animation_manager->current_animation) {
// avoid_animation = animation_storage_get_meta(animation_manager->current_animation)->name;
// }
const char* avoid_animation = NULL;
if(animation_manager->current_animation) {
avoid_animation = animation_storage_get_meta(animation_manager->current_animation)->name;
}
UNUSED(animation_manager);
StorageAnimationList_t animation_list;
@@ -385,7 +385,6 @@ static StorageAnimation*
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
DolphinStats stats = dolphin_stats(dolphin);
furi_record_close(RECORD_DOLPHIN);
// avoid_animation = StorageAnimationList_size(animation_list) > 1 ? avoid_animation : NULL;
uint32_t whole_weight = 0;
StorageAnimationList_it_t it;
@@ -396,14 +395,10 @@ static StorageAnimation*
animation_storage_get_meta(storage_animation);
bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats, unlock);
// Avoid repeating animation
// Bad / empty manifests can crash flipper and (very rarely) require DFU
// Need better solution, disabled for now
// if(avoid_animation != NULL) {
// if(strcmp(manifest_info->name, avoid_animation) == 0) {
// valid = false;
// }
// }
if(avoid_animation != NULL && strcmp(manifest_info->name, avoid_animation) == 0) {
// Avoid repeating same animation twice
valid = false;
}
if(valid) {
whole_weight += manifest_info->weight;