From ca49de1830c3e8d41b3324b8381b64a49fa953a7 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Sat, 4 Jan 2020 23:59:14 +0400 Subject: [PATCH] Store feedback generator --- .../LegacyComponents/TGVideoMessageCaptureController.m | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/submodules/LegacyComponents/LegacyComponents/TGVideoMessageCaptureController.m b/submodules/LegacyComponents/LegacyComponents/TGVideoMessageCaptureController.m index 4e7f5c54e2..045fbca31d 100644 --- a/submodules/LegacyComponents/LegacyComponents/TGVideoMessageCaptureController.m +++ b/submodules/LegacyComponents/LegacyComponents/TGVideoMessageCaptureController.m @@ -136,6 +136,8 @@ typedef enum bool _canSendSilently; bool _canSchedule; bool _reminder; + + UIImpactFeedbackGenerator *_generator; } @property (nonatomic, copy) bool(^isAlreadyLocked)(void); @@ -707,8 +709,10 @@ typedef enum - (void)sendLongPressed { if (iosMajorVersion() >= 10) { - UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]; - [generator impactOccurred]; + if (_generator == nil) { + _generator = [[UIImpactFeedbackGenerator alloc] initWithStyle:UIImpactFeedbackStyleMedium]; + } + [_generator impactOccurred]; } bool effectiveHasSchedule = true;