animation_manager.c 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. #include <gui/view_stack.h>
  2. #include <stdint.h>
  3. #include <furi.h>
  4. #include <m-string.h>
  5. #include <portmacro.h>
  6. #include <dolphin/dolphin.h>
  7. #include <power/power_service/power.h>
  8. #include <storage/storage.h>
  9. #include <assets_icons.h>
  10. #include "views/bubble_animation_view.h"
  11. #include "views/one_shot_animation_view.h"
  12. #include "animation_storage.h"
  13. #include "animation_manager.h"
  14. #define TAG "AnimationManager"
  15. #define HARDCODED_ANIMATION_NAME "L1_Tv_128x47"
  16. #define NO_SD_ANIMATION_NAME "L1_NoSd_128x49"
  17. #define BAD_BATTERY_ANIMATION_NAME "L1_BadBattery_128x47"
  18. #define NO_DB_ANIMATION_NAME "L0_NoDb_128x51"
  19. #define BAD_SD_ANIMATION_NAME "L0_SdBad_128x51"
  20. #define SD_OK_ANIMATION_NAME "L0_SdOk_128x51"
  21. #define URL_ANIMATION_NAME "L0_Url_128x51"
  22. #define NEW_MAIL_ANIMATION_NAME "L0_NewMail_128x51"
  23. typedef enum {
  24. AnimationManagerStateIdle,
  25. AnimationManagerStateBlocked,
  26. AnimationManagerStateFreezedIdle,
  27. AnimationManagerStateFreezedBlocked,
  28. } AnimationManagerState;
  29. struct AnimationManager {
  30. bool sd_show_url;
  31. bool sd_shown_no_db;
  32. bool sd_shown_sd_ok;
  33. bool levelup_pending;
  34. bool levelup_active;
  35. AnimationManagerState state;
  36. FuriPubSubSubscription* pubsub_subscription_storage;
  37. FuriPubSubSubscription* pubsub_subscription_dolphin;
  38. BubbleAnimationView* animation_view;
  39. OneShotView* one_shot_view;
  40. osTimerId_t idle_animation_timer;
  41. StorageAnimation* current_animation;
  42. AnimationManagerInteractCallback interact_callback;
  43. AnimationManagerSetNewIdleAnimationCallback new_idle_callback;
  44. AnimationManagerSetNewIdleAnimationCallback check_blocking_callback;
  45. void* context;
  46. string_t freezed_animation_name;
  47. int32_t freezed_animation_time_left;
  48. ViewStack* view_stack;
  49. };
  50. static StorageAnimation*
  51. animation_manager_select_idle_animation(AnimationManager* animation_manager);
  52. static void animation_manager_replace_current_animation(
  53. AnimationManager* animation_manager,
  54. StorageAnimation* storage_animation);
  55. static void animation_manager_start_new_idle(AnimationManager* animation_manager);
  56. static bool animation_manager_check_blocking(AnimationManager* animation_manager);
  57. static bool animation_manager_is_valid_idle_animation(
  58. const StorageAnimationManifestInfo* info,
  59. const DolphinStats* stats);
  60. static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager);
  61. static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager);
  62. void animation_manager_set_context(AnimationManager* animation_manager, void* context) {
  63. furi_assert(animation_manager);
  64. animation_manager->context = context;
  65. }
  66. void animation_manager_set_new_idle_callback(
  67. AnimationManager* animation_manager,
  68. AnimationManagerSetNewIdleAnimationCallback callback) {
  69. furi_assert(animation_manager);
  70. animation_manager->new_idle_callback = callback;
  71. }
  72. void animation_manager_set_check_callback(
  73. AnimationManager* animation_manager,
  74. AnimationManagerCheckBlockingCallback callback) {
  75. furi_assert(animation_manager);
  76. animation_manager->check_blocking_callback = callback;
  77. }
  78. void animation_manager_set_interact_callback(
  79. AnimationManager* animation_manager,
  80. AnimationManagerInteractCallback callback) {
  81. furi_assert(animation_manager);
  82. animation_manager->interact_callback = callback;
  83. }
  84. static void animation_manager_check_blocking_callback(const void* message, void* context) {
  85. const StorageEvent* storage_event = message;
  86. switch(storage_event->type) {
  87. case StorageEventTypeCardMount:
  88. case StorageEventTypeCardUnmount:
  89. case StorageEventTypeCardMountError:
  90. furi_assert(context);
  91. AnimationManager* animation_manager = context;
  92. if(animation_manager->check_blocking_callback) {
  93. animation_manager->check_blocking_callback(animation_manager->context);
  94. }
  95. break;
  96. default:
  97. break;
  98. }
  99. }
  100. static void animation_manager_timer_callback(void* context) {
  101. furi_assert(context);
  102. AnimationManager* animation_manager = context;
  103. if(animation_manager->new_idle_callback) {
  104. animation_manager->new_idle_callback(animation_manager->context);
  105. }
  106. }
  107. static void animation_manager_interact_callback(void* context) {
  108. furi_assert(context);
  109. AnimationManager* animation_manager = context;
  110. if(animation_manager->interact_callback) {
  111. animation_manager->interact_callback(animation_manager->context);
  112. }
  113. }
  114. /* reaction to animation_manager->check_blocking_callback() */
  115. void animation_manager_check_blocking_process(AnimationManager* animation_manager) {
  116. furi_assert(animation_manager);
  117. if(animation_manager->state == AnimationManagerStateIdle) {
  118. bool blocked = animation_manager_check_blocking(animation_manager);
  119. if(!blocked) {
  120. Dolphin* dolphin = furi_record_open("dolphin");
  121. DolphinStats stats = dolphin_stats(dolphin);
  122. furi_record_close("dolphin");
  123. const StorageAnimationManifestInfo* manifest_info =
  124. animation_storage_get_meta(animation_manager->current_animation);
  125. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  126. if(!valid) {
  127. animation_manager_start_new_idle(animation_manager);
  128. }
  129. }
  130. }
  131. }
  132. /* reaction to animation_manager->new_idle_callback() */
  133. void animation_manager_new_idle_process(AnimationManager* animation_manager) {
  134. furi_assert(animation_manager);
  135. if(animation_manager->state == AnimationManagerStateIdle) {
  136. animation_manager_start_new_idle(animation_manager);
  137. }
  138. }
  139. /* reaction to animation_manager->interact_callback() */
  140. void animation_manager_interact_process(AnimationManager* animation_manager) {
  141. furi_assert(animation_manager);
  142. if(animation_manager->levelup_pending) {
  143. animation_manager->levelup_pending = false;
  144. animation_manager->levelup_active = true;
  145. animation_manager_switch_to_one_shot_view(animation_manager);
  146. Dolphin* dolphin = furi_record_open("dolphin");
  147. dolphin_upgrade_level(dolphin);
  148. furi_record_close("dolphin");
  149. } else if(animation_manager->levelup_active) {
  150. animation_manager->levelup_active = false;
  151. animation_manager_start_new_idle(animation_manager);
  152. animation_manager_switch_to_animation_view(animation_manager);
  153. } else if(animation_manager->state == AnimationManagerStateBlocked) {
  154. bool blocked = animation_manager_check_blocking(animation_manager);
  155. if(!blocked) {
  156. animation_manager_start_new_idle(animation_manager);
  157. }
  158. }
  159. }
  160. static void animation_manager_start_new_idle(AnimationManager* animation_manager) {
  161. furi_assert(animation_manager);
  162. StorageAnimation* new_animation = animation_manager_select_idle_animation(animation_manager);
  163. animation_manager_replace_current_animation(animation_manager, new_animation);
  164. const BubbleAnimation* bubble_animation =
  165. animation_storage_get_bubble_animation(animation_manager->current_animation);
  166. animation_manager->state = AnimationManagerStateIdle;
  167. osTimerStart(animation_manager->idle_animation_timer, bubble_animation->duration * 1000);
  168. }
  169. static bool animation_manager_check_blocking(AnimationManager* animation_manager) {
  170. furi_assert(animation_manager);
  171. StorageAnimation* blocking_animation = NULL;
  172. Storage* storage = furi_record_open("storage");
  173. FS_Error sd_status = storage_sd_status(storage);
  174. if(sd_status == FSE_INTERNAL) {
  175. blocking_animation = animation_storage_find_animation(BAD_SD_ANIMATION_NAME);
  176. furi_assert(blocking_animation);
  177. } else if(sd_status == FSE_NOT_READY) {
  178. animation_manager->sd_shown_sd_ok = false;
  179. animation_manager->sd_shown_no_db = false;
  180. } else if(sd_status == FSE_OK) {
  181. if(!animation_manager->sd_shown_sd_ok) {
  182. blocking_animation = animation_storage_find_animation(SD_OK_ANIMATION_NAME);
  183. furi_assert(blocking_animation);
  184. animation_manager->sd_shown_sd_ok = true;
  185. } else if(!animation_manager->sd_shown_no_db) {
  186. bool db_exists = storage_common_stat(storage, "/ext/Manifest", NULL) == FSE_OK;
  187. if(!db_exists) {
  188. blocking_animation = animation_storage_find_animation(NO_DB_ANIMATION_NAME);
  189. furi_assert(blocking_animation);
  190. animation_manager->sd_shown_no_db = true;
  191. animation_manager->sd_show_url = true;
  192. }
  193. } else if(animation_manager->sd_show_url) {
  194. blocking_animation = animation_storage_find_animation(URL_ANIMATION_NAME);
  195. furi_assert(blocking_animation);
  196. animation_manager->sd_show_url = false;
  197. }
  198. }
  199. Dolphin* dolphin = furi_record_open("dolphin");
  200. DolphinStats stats = dolphin_stats(dolphin);
  201. furi_record_close("dolphin");
  202. if(!blocking_animation && stats.level_up_is_pending) {
  203. blocking_animation = animation_storage_find_animation(NEW_MAIL_ANIMATION_NAME);
  204. furi_assert(blocking_animation);
  205. if(blocking_animation) {
  206. animation_manager->levelup_pending = true;
  207. }
  208. }
  209. if(blocking_animation) {
  210. osTimerStop(animation_manager->idle_animation_timer);
  211. animation_manager_replace_current_animation(animation_manager, blocking_animation);
  212. /* no timer starting because this is blocking animation */
  213. animation_manager->state = AnimationManagerStateBlocked;
  214. }
  215. furi_record_close("storage");
  216. return !!blocking_animation;
  217. }
  218. static void animation_manager_replace_current_animation(
  219. AnimationManager* animation_manager,
  220. StorageAnimation* storage_animation) {
  221. furi_assert(storage_animation);
  222. StorageAnimation* previous_animation = animation_manager->current_animation;
  223. const BubbleAnimation* animation = animation_storage_get_bubble_animation(storage_animation);
  224. bubble_animation_view_set_animation(animation_manager->animation_view, animation);
  225. const char* new_name = animation_storage_get_meta(storage_animation)->name;
  226. FURI_LOG_I(TAG, "Select \'%s\' animation", new_name);
  227. animation_manager->current_animation = storage_animation;
  228. if(previous_animation) {
  229. animation_storage_free_storage_animation(&previous_animation);
  230. }
  231. }
  232. AnimationManager* animation_manager_alloc(void) {
  233. AnimationManager* animation_manager = malloc(sizeof(AnimationManager));
  234. animation_manager->animation_view = bubble_animation_view_alloc();
  235. animation_manager->view_stack = view_stack_alloc();
  236. View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
  237. view_stack_add_view(animation_manager->view_stack, animation_view);
  238. string_init(animation_manager->freezed_animation_name);
  239. animation_manager->idle_animation_timer =
  240. osTimerNew(animation_manager_timer_callback, osTimerOnce, animation_manager, NULL);
  241. bubble_animation_view_set_interact_callback(
  242. animation_manager->animation_view, animation_manager_interact_callback, animation_manager);
  243. Storage* storage = furi_record_open("storage");
  244. animation_manager->pubsub_subscription_storage = furi_pubsub_subscribe(
  245. storage_get_pubsub(storage), animation_manager_check_blocking_callback, animation_manager);
  246. furi_record_close("storage");
  247. Dolphin* dolphin = furi_record_open("dolphin");
  248. animation_manager->pubsub_subscription_dolphin = furi_pubsub_subscribe(
  249. dolphin_get_pubsub(dolphin), animation_manager_check_blocking_callback, animation_manager);
  250. furi_record_close("dolphin");
  251. animation_manager->sd_shown_sd_ok = true;
  252. if(!animation_manager_check_blocking(animation_manager)) {
  253. animation_manager_start_new_idle(animation_manager);
  254. }
  255. return animation_manager;
  256. }
  257. void animation_manager_free(AnimationManager* animation_manager) {
  258. furi_assert(animation_manager);
  259. Dolphin* dolphin = furi_record_open("dolphin");
  260. furi_pubsub_unsubscribe(
  261. dolphin_get_pubsub(dolphin), animation_manager->pubsub_subscription_dolphin);
  262. furi_record_close("dolphin");
  263. Storage* storage = furi_record_open("storage");
  264. furi_pubsub_unsubscribe(
  265. storage_get_pubsub(storage), animation_manager->pubsub_subscription_storage);
  266. furi_record_close("storage");
  267. string_clear(animation_manager->freezed_animation_name);
  268. View* animation_view = bubble_animation_get_view(animation_manager->animation_view);
  269. view_stack_remove_view(animation_manager->view_stack, animation_view);
  270. bubble_animation_view_free(animation_manager->animation_view);
  271. osTimerDelete(animation_manager->idle_animation_timer);
  272. }
  273. View* animation_manager_get_animation_view(AnimationManager* animation_manager) {
  274. furi_assert(animation_manager);
  275. return view_stack_get_view(animation_manager->view_stack);
  276. }
  277. static bool animation_manager_is_valid_idle_animation(
  278. const StorageAnimationManifestInfo* info,
  279. const DolphinStats* stats) {
  280. furi_assert(info);
  281. furi_assert(info->name);
  282. bool result = true;
  283. if(!strcmp(info->name, BAD_BATTERY_ANIMATION_NAME)) {
  284. Power* power = furi_record_open("power");
  285. bool battery_is_well = power_is_battery_healthy(power);
  286. furi_record_close("power");
  287. result = !battery_is_well;
  288. }
  289. if(!strcmp(info->name, NO_SD_ANIMATION_NAME)) {
  290. Storage* storage = furi_record_open("storage");
  291. FS_Error sd_status = storage_sd_status(storage);
  292. furi_record_close("storage");
  293. result = (sd_status == FSE_NOT_READY);
  294. }
  295. if((stats->butthurt < info->min_butthurt) || (stats->butthurt > info->max_butthurt)) {
  296. result = false;
  297. }
  298. if((stats->level < info->min_level) || (stats->level > info->max_level)) {
  299. result = false;
  300. }
  301. return result;
  302. }
  303. static StorageAnimation*
  304. animation_manager_select_idle_animation(AnimationManager* animation_manager) {
  305. StorageAnimationList_t animation_list;
  306. StorageAnimationList_init(animation_list);
  307. animation_storage_fill_animation_list(&animation_list);
  308. Dolphin* dolphin = furi_record_open("dolphin");
  309. DolphinStats stats = dolphin_stats(dolphin);
  310. furi_record_close("dolphin");
  311. uint32_t whole_weight = 0;
  312. StorageAnimationList_it_t it;
  313. for(StorageAnimationList_it(it, animation_list); !StorageAnimationList_end_p(it);) {
  314. StorageAnimation* storage_animation = *StorageAnimationList_ref(it);
  315. const StorageAnimationManifestInfo* manifest_info =
  316. animation_storage_get_meta(storage_animation);
  317. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  318. if(valid) {
  319. whole_weight += manifest_info->weight;
  320. StorageAnimationList_next(it);
  321. } else {
  322. animation_storage_free_storage_animation(&storage_animation);
  323. /* remove and increase iterator */
  324. StorageAnimationList_remove(animation_list, it);
  325. }
  326. }
  327. uint32_t lucky_number = random() % whole_weight;
  328. uint32_t weight = 0;
  329. StorageAnimation* selected = NULL;
  330. for
  331. M_EACH(item, animation_list, StorageAnimationList_t) {
  332. if(lucky_number < weight) {
  333. break;
  334. }
  335. weight += animation_storage_get_meta(*item)->weight;
  336. selected = *item;
  337. }
  338. for
  339. M_EACH(item, animation_list, StorageAnimationList_t) {
  340. if(*item != selected) {
  341. animation_storage_free_storage_animation(item);
  342. }
  343. }
  344. StorageAnimationList_clear(animation_list);
  345. /* cache animation, if failed - choose reliable animation */
  346. if(!animation_storage_get_bubble_animation(selected)) {
  347. const char* name = animation_storage_get_meta(selected)->name;
  348. FURI_LOG_E(TAG, "Can't upload animation described in manifest: \'%s\'", name);
  349. animation_storage_free_storage_animation(&selected);
  350. selected = animation_storage_find_animation(HARDCODED_ANIMATION_NAME);
  351. }
  352. furi_assert(selected);
  353. return selected;
  354. }
  355. bool animation_manager_is_animation_loaded(AnimationManager* animation_manager) {
  356. furi_assert(animation_manager);
  357. return animation_manager->current_animation;
  358. }
  359. void animation_manager_unload_and_stall_animation(AnimationManager* animation_manager) {
  360. furi_assert(animation_manager);
  361. furi_assert(animation_manager->current_animation);
  362. furi_assert(!string_size(animation_manager->freezed_animation_name));
  363. furi_assert(
  364. (animation_manager->state == AnimationManagerStateIdle) ||
  365. (animation_manager->state == AnimationManagerStateBlocked));
  366. if(animation_manager->state == AnimationManagerStateBlocked) {
  367. animation_manager->state = AnimationManagerStateFreezedBlocked;
  368. } else if(animation_manager->state == AnimationManagerStateIdle) {
  369. animation_manager->state = AnimationManagerStateFreezedIdle;
  370. animation_manager->freezed_animation_time_left =
  371. xTimerGetExpiryTime(animation_manager->idle_animation_timer) - xTaskGetTickCount();
  372. if(animation_manager->freezed_animation_time_left < 0) {
  373. animation_manager->freezed_animation_time_left = 0;
  374. }
  375. osTimerStop(animation_manager->idle_animation_timer);
  376. } else {
  377. furi_assert(0);
  378. }
  379. FURI_LOG_I(
  380. TAG,
  381. "Unload animation \'%s\'",
  382. animation_storage_get_meta(animation_manager->current_animation)->name);
  383. StorageAnimationManifestInfo* meta =
  384. animation_storage_get_meta(animation_manager->current_animation);
  385. /* copy str, not move, because it can be internal animation */
  386. string_set_str(animation_manager->freezed_animation_name, meta->name);
  387. bubble_animation_freeze(animation_manager->animation_view);
  388. animation_storage_free_storage_animation(&animation_manager->current_animation);
  389. }
  390. void animation_manager_load_and_continue_animation(AnimationManager* animation_manager) {
  391. furi_assert(animation_manager);
  392. furi_assert(!animation_manager->current_animation);
  393. furi_assert(string_size(animation_manager->freezed_animation_name));
  394. furi_assert(
  395. (animation_manager->state == AnimationManagerStateFreezedIdle) ||
  396. (animation_manager->state == AnimationManagerStateFreezedBlocked));
  397. if(animation_manager->state == AnimationManagerStateFreezedBlocked) {
  398. StorageAnimation* restore_animation = animation_storage_find_animation(
  399. string_get_cstr(animation_manager->freezed_animation_name));
  400. /* all blocked animations must be in flipper -> we can
  401. * always find blocking animation */
  402. furi_assert(restore_animation);
  403. animation_manager_replace_current_animation(animation_manager, restore_animation);
  404. animation_manager->state = AnimationManagerStateBlocked;
  405. } else if(animation_manager->state == AnimationManagerStateFreezedIdle) {
  406. /* check if we missed some system notifications, and set current_animation */
  407. bool blocked = animation_manager_check_blocking(animation_manager);
  408. if(!blocked) {
  409. /* if no blocking - try restore last one idle */
  410. StorageAnimation* restore_animation = animation_storage_find_animation(
  411. string_get_cstr(animation_manager->freezed_animation_name));
  412. if(restore_animation) {
  413. Dolphin* dolphin = furi_record_open("dolphin");
  414. DolphinStats stats = dolphin_stats(dolphin);
  415. furi_record_close("dolphin");
  416. const StorageAnimationManifestInfo* manifest_info =
  417. animation_storage_get_meta(restore_animation);
  418. bool valid = animation_manager_is_valid_idle_animation(manifest_info, &stats);
  419. if(valid) {
  420. animation_manager_replace_current_animation(
  421. animation_manager, restore_animation);
  422. animation_manager->state = AnimationManagerStateIdle;
  423. if(animation_manager->freezed_animation_time_left) {
  424. osTimerStart(
  425. animation_manager->idle_animation_timer,
  426. animation_manager->freezed_animation_time_left);
  427. } else {
  428. const BubbleAnimation* animation = animation_storage_get_bubble_animation(
  429. animation_manager->current_animation);
  430. osTimerStart(
  431. animation_manager->idle_animation_timer, animation->duration * 1000);
  432. }
  433. }
  434. } else {
  435. FURI_LOG_E(
  436. TAG,
  437. "Failed to restore \'%s\'",
  438. string_get_cstr(animation_manager->freezed_animation_name));
  439. }
  440. }
  441. } else {
  442. /* Unknown state is an error. But not in release version.*/
  443. furi_assert(0);
  444. }
  445. /* if can't restore previous animation - select new */
  446. if(!animation_manager->current_animation) {
  447. animation_manager_start_new_idle(animation_manager);
  448. }
  449. FURI_LOG_I(
  450. TAG,
  451. "Load animation \'%s\'",
  452. animation_storage_get_meta(animation_manager->current_animation)->name);
  453. bubble_animation_unfreeze(animation_manager->animation_view);
  454. string_reset(animation_manager->freezed_animation_name);
  455. furi_assert(animation_manager->current_animation);
  456. }
  457. static void animation_manager_switch_to_one_shot_view(AnimationManager* animation_manager) {
  458. furi_assert(animation_manager);
  459. furi_assert(!animation_manager->one_shot_view);
  460. Dolphin* dolphin = furi_record_open("dolphin");
  461. DolphinStats stats = dolphin_stats(dolphin);
  462. furi_record_close("dolphin");
  463. animation_manager->one_shot_view = one_shot_view_alloc();
  464. one_shot_view_set_interact_callback(
  465. animation_manager->one_shot_view, animation_manager_interact_callback, animation_manager);
  466. View* prev_view = bubble_animation_get_view(animation_manager->animation_view);
  467. View* next_view = one_shot_view_get_view(animation_manager->one_shot_view);
  468. view_stack_remove_view(animation_manager->view_stack, prev_view);
  469. view_stack_add_view(animation_manager->view_stack, next_view);
  470. if(stats.level == 1) {
  471. one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup1_128x64);
  472. } else if(stats.level == 2) {
  473. one_shot_view_start_animation(animation_manager->one_shot_view, &A_Levelup2_128x64);
  474. } else {
  475. furi_assert(0);
  476. }
  477. }
  478. static void animation_manager_switch_to_animation_view(AnimationManager* animation_manager) {
  479. furi_assert(animation_manager);
  480. furi_assert(animation_manager->one_shot_view);
  481. View* prev_view = one_shot_view_get_view(animation_manager->one_shot_view);
  482. View* next_view = bubble_animation_get_view(animation_manager->animation_view);
  483. view_stack_remove_view(animation_manager->view_stack, prev_view);
  484. view_stack_add_view(animation_manager->view_stack, next_view);
  485. one_shot_view_free(animation_manager->one_shot_view);
  486. animation_manager->one_shot_view = NULL;
  487. }