M*LIB: non-inlined strings, FuriString primitive (#1795)
* Quicksave 1 * Header stage complete * Source stage complete * Lint & merge fixes * Includes * Documentation step 1 * FBT: output free size considering BT STACK * Documentation step 2 * py lint * Fix music player plugin * unit test stage 1: string allocator, mem, getters, setters, appends, compare, search. * unit test: string equality * unit test: string replace * unit test: string start_with, end_with * unit test: string trim * unit test: utf-8 * Rename * Revert fw_size changes * Simplify CLI backspace handling * Simplify CLI character insert * Merge fixes * Furi: correct filenaming and spelling * Bt: remove furi string include Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
#include <stdint.h>
|
||||
#include <furi.h>
|
||||
#include <furi_hal.h>
|
||||
#include <m-string.h>
|
||||
#include <portmacro.h>
|
||||
#include <dolphin/dolphin.h>
|
||||
#include <power/power_service/power.h>
|
||||
@@ -50,7 +49,7 @@ struct AnimationManager {
|
||||
AnimationManagerSetNewIdleAnimationCallback new_idle_callback;
|
||||
AnimationManagerSetNewIdleAnimationCallback check_blocking_callback;
|
||||
void* context;
|
||||
string_t freezed_animation_name;
|
||||
FuriString* freezed_animation_name;
|
||||
int32_t freezed_animation_time_left;
|
||||
ViewStack* view_stack;
|
||||
};
|
||||
@@ -279,7 +278,7 @@ AnimationManager* animation_manager_alloc(void) {
|
||||
animation_manager->view_stack = view_stack_alloc();
|
||||
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
|
||||
view_stack_add_view(animation_manager->view_stack, animation_view);
|
||||
string_init(animation_manager->freezed_animation_name);
|
||||
animation_manager->freezed_animation_name = furi_string_alloc();
|
||||
|
||||
animation_manager->idle_animation_timer =
|
||||
furi_timer_alloc(animation_manager_timer_callback, FuriTimerTypeOnce, animation_manager);
|
||||
@@ -317,7 +316,7 @@ void animation_manager_free(AnimationManager* animation_manager) {
|
||||
storage_get_pubsub(storage), animation_manager->pubsub_subscription_storage);
|
||||
furi_record_close(RECORD_STORAGE);
|
||||
|
||||
string_clear(animation_manager->freezed_animation_name);
|
||||
furi_string_free(animation_manager->freezed_animation_name);
|
||||
View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
|
||||
view_stack_remove_view(animation_manager->view_stack, animation_view);
|
||||
bubble_animation_view_free(animation_manager->animation_view);
|
||||
@@ -433,7 +432,7 @@ bool animation_manager_is_animation_loaded(AnimationManager* animation_manager)
|
||||
void animation_manager_unload_and_stall_animation(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
furi_assert(animation_manager->current_animation);
|
||||
furi_assert(!string_size(animation_manager->freezed_animation_name));
|
||||
furi_assert(!furi_string_size(animation_manager->freezed_animation_name));
|
||||
furi_assert(
|
||||
(animation_manager->state == AnimationManagerStateIdle) ||
|
||||
(animation_manager->state == AnimationManagerStateBlocked));
|
||||
@@ -461,7 +460,7 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
|
||||
StorageAnimationManifestInfo* meta =
|
||||
animation_storage_get_meta(animation_manager->current_animation);
|
||||
/* copy str, not move, because it can be internal animation */
|
||||
string_set_str(animation_manager->freezed_animation_name, meta->name);
|
||||
furi_string_set(animation_manager->freezed_animation_name, meta->name);
|
||||
|
||||
bubble_animation_freeze(animation_manager->animation_view);
|
||||
animation_storage_free_storage_animation(&animation_manager->current_animation);
|
||||
@@ -470,14 +469,14 @@ void animation_manager_unload_and_stall_animation(AnimationManager* animation_ma
|
||||
void animation_manager_load_and_continue_animation(AnimationManager* animation_manager) {
|
||||
furi_assert(animation_manager);
|
||||
furi_assert(!animation_manager->current_animation);
|
||||
furi_assert(string_size(animation_manager->freezed_animation_name));
|
||||
furi_assert(furi_string_size(animation_manager->freezed_animation_name));
|
||||
furi_assert(
|
||||
(animation_manager->state == AnimationManagerStateFreezedIdle) ||
|
||||
(animation_manager->state == AnimationManagerStateFreezedBlocked));
|
||||
|
||||
if(animation_manager->state == AnimationManagerStateFreezedBlocked) {
|
||||
StorageAnimation* restore_animation = animation_storage_find_animation(
|
||||
string_get_cstr(animation_manager->freezed_animation_name));
|
||||
furi_string_get_cstr(animation_manager->freezed_animation_name));
|
||||
/* all blocked animations must be in flipper -> we can
|
||||
* always find blocking animation */
|
||||
furi_assert(restore_animation);
|
||||
@@ -489,7 +488,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
if(!blocked) {
|
||||
/* if no blocking - try restore last one idle */
|
||||
StorageAnimation* restore_animation = animation_storage_find_animation(
|
||||
string_get_cstr(animation_manager->freezed_animation_name));
|
||||
furi_string_get_cstr(animation_manager->freezed_animation_name));
|
||||
if(restore_animation) {
|
||||
Dolphin* dolphin = furi_record_open(RECORD_DOLPHIN);
|
||||
DolphinStats stats = dolphin_stats(dolphin);
|
||||
@@ -517,7 +516,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
FURI_LOG_E(
|
||||
TAG,
|
||||
"Failed to restore \'%s\'",
|
||||
string_get_cstr(animation_manager->freezed_animation_name));
|
||||
furi_string_get_cstr(animation_manager->freezed_animation_name));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -535,7 +534,7 @@ void animation_manager_load_and_continue_animation(AnimationManager* animation_m
|
||||
animation_storage_get_meta(animation_manager->current_animation)->name);
|
||||
|
||||
bubble_animation_unfreeze(animation_manager->animation_view);
|
||||
string_reset(animation_manager->freezed_animation_name);
|
||||
furi_string_reset(animation_manager->freezed_animation_name);
|
||||
furi_assert(animation_manager->current_animation);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user